util/rbsp: Fill bits again if reading more than 16 leading zeros

Same as 73d69ef1e6, this is also needed for vl_rbsp_ue.

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30672>
This commit is contained in:
David Rosca 2024-08-21 09:48:54 +02:00 committed by Marge Bot
parent 5bf6602d23
commit fc1ec3c5d4

View file

@ -151,8 +151,11 @@ static inline unsigned vl_rbsp_ue(struct vl_rbsp *rbsp)
unsigned bits = 0;
vl_rbsp_fillbits(rbsp);
while (!vl_vlc_get_uimsbf(&rbsp->nal, 1))
while (!vl_vlc_get_uimsbf(&rbsp->nal, 1)) {
++bits;
if (bits == 16)
vl_rbsp_fillbits(rbsp);
}
return (1 << bits) - 1 + vl_rbsp_u(rbsp, bits);
}