diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-10-22 12:02:11 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-10-26 07:16:10 +0100 |
commit | 3a836f38f609940d883b8d8ed5e8a526e803da3c (patch) | |
tree | f1bf8041f54afebb81b53d7df60e6124f3bb6d81 /libavcodec/rv34.c | |
parent | f033e6d2e635820ec3deb9b936ed3f27ac7ad0a7 (diff) | |
download | ffmpeg-3a836f38f609940d883b8d8ed5e8a526e803da3c.tar.gz |
avcodec/rv34: Simplify getting right VLC
For both RealVideo 3.0 as well as RealVideo 4.0 the VLC table to use
depends upon the slice's quantization parameter; these are coded on five
bits in the bitstream and are therefore in the range of 0..31; yet the
last element here is not valid and therefore the quantizer is clipped to
the range 0..30 to get the index. But this is unnecessary: One can just
add one element more to the relevant array to avoid the clipping.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/rv34.c')
-rw-r--r-- | libavcodec/rv34.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index d251c6817c..09fa962b2f 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -24,6 +24,7 @@ * RV30/40 decoder common data */ +#include "libavutil/avassert.h" #include "libavutil/imgutils.h" #include "libavutil/internal.h" @@ -339,8 +340,9 @@ static inline RV34VLC* choose_vlc_set(int quant, int mod, int type) { if(mod == 2 && quant < 19) quant += 10; else if(mod && quant < 26) quant += 5; - return type ? &inter_vlcs[rv34_quant_to_vlc_set[1][av_clip(quant, 0, 30)]] - : &intra_vlcs[rv34_quant_to_vlc_set[0][av_clip(quant, 0, 30)]]; + av_assert2(quant >= 0 && quant < 32); + return type ? &inter_vlcs[rv34_quant_to_vlc_set[1][quant]] + : &intra_vlcs[rv34_quant_to_vlc_set[0][quant]]; } /** |