mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-14 19:10:09 +01:00
avcodec/cfhd, cfhddata: Simplify check for escape
cfhd.c checked for level being equal to a certain codebook- dependent constant and to run being two. The first check is actually redundant, as all codebooks contain only one (real) entry with run == 2 (as is usual with VLCs, this one real entry has several corresponding entries in the table). But given that no entry has a run of zero (except incomplete entries which just signal that one needs to do another round of parsing), one can actually use that as sentinel. This patch does so. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -819,7 +819,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
|
|||||||
VLC_BITS, 3, 1);
|
VLC_BITS, 3, 1);
|
||||||
|
|
||||||
/* escape */
|
/* escape */
|
||||||
if (level == 64 && run == 2)
|
if (!run)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
count += run;
|
count += run;
|
||||||
@@ -850,7 +850,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
|
|||||||
VLC_BITS, 3, 1);
|
VLC_BITS, 3, 1);
|
||||||
|
|
||||||
/* escape */
|
/* escape */
|
||||||
if (level == 255 && run == 2)
|
if (!run)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
count += run;
|
count += run;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ static const uint16_t table_9_vlc_run[NB_VLC_TABLE_9] = {
|
|||||||
1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 2,
|
1, 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t table_9_vlc_level[NB_VLC_TABLE_9] = {
|
static const uint8_t table_9_vlc_level[NB_VLC_TABLE_9] = {
|
||||||
@@ -226,7 +226,7 @@ static const uint16_t table_18_vlc_run[NB_VLC_TABLE_18] = {
|
|||||||
1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 2,
|
1, 1, 1, 1, 1, 1, 1, 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t table_18_vlc_level[NB_VLC_TABLE_18] = {
|
static const uint8_t table_18_vlc_level[NB_VLC_TABLE_18] = {
|
||||||
|
|||||||
Reference in New Issue
Block a user