radeonsi/video: Fix assert in radeon_bs_code_ns
It is valid for w to be 1, in that case nothing should be encoded in the bitstream. value must be lower than max, add that as an assert instead. Reviewed-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35648>
This commit is contained in:
@@ -156,6 +156,8 @@ void radeon_bs_code_ns(struct radeon_bitstream *bs, uint32_t value, uint32_t max
|
||||
uint32_t m;
|
||||
uint32_t max_num = max;
|
||||
|
||||
assert(value < max);
|
||||
|
||||
while ( max_num ) {
|
||||
max_num >>= 1;
|
||||
w++;
|
||||
@@ -163,8 +165,6 @@ void radeon_bs_code_ns(struct radeon_bitstream *bs, uint32_t value, uint32_t max
|
||||
|
||||
m = (1 << w) - max;
|
||||
|
||||
assert(w > 1);
|
||||
|
||||
if (value < m) {
|
||||
radeon_bs_code_fixed_bits(bs, value, (w - 1));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user