diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index 7044042c95ad94cf13aff7e00cd6e0aeb59496c8..c227607f1fd60bac43eed516cd22c883212445de 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -253,8 +253,12 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len return buf; }else{ - buf >>= 32 - limit - esc_len; - LAST_SKIP_BITS(re, gb, esc_len + limit); + LAST_SKIP_BITS(re, gb, limit); + UPDATE_CACHE(re, gb); + + buf = SHOW_UBITS(re, gb, esc_len); + + LAST_SKIP_BITS(re, gb, esc_len); CLOSE_READER(re, gb); return buf + limit - 1;