mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/mobiclip: Rewrite code to make it clearer
In order to know that the earlier code did not use uninitialized values one needs to know that the lowest four bits of each used value of pframe_block4x4_coefficients_tab do not vanish identically. E.g. Coverity did not get this and warned about it in ticket #1466632. Fix this by slightly rewriting the code. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
f5e74e8d48
commit
d6c16c5217
|
@ -491,7 +491,7 @@ static int add_pframe_coefficients(AVCodecContext *avctx, AVFrame *frame,
|
||||||
int ret, idx = get_ue_golomb_31(gb);
|
int ret, idx = get_ue_golomb_31(gb);
|
||||||
|
|
||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
ret = add_coefficients(avctx, frame, bx, by, size, plane);
|
return add_coefficients(avctx, frame, bx, by, size, plane);
|
||||||
} else if ((unsigned)idx < FF_ARRAY_ELEMS(pframe_block4x4_coefficients_tab)) {
|
} else if ((unsigned)idx < FF_ARRAY_ELEMS(pframe_block4x4_coefficients_tab)) {
|
||||||
int flags = pframe_block4x4_coefficients_tab[idx];
|
int flags = pframe_block4x4_coefficients_tab[idx];
|
||||||
|
|
||||||
|
@ -505,11 +505,10 @@ static int add_pframe_coefficients(AVCodecContext *avctx, AVFrame *frame,
|
||||||
flags >>= 1;
|
flags >>= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
ret = AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int adjust(int x, int size)
|
static int adjust(int x, int size)
|
||||||
|
|
Loading…
Reference in New Issue