mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-14 19:25:01 +00:00
Do not try to read residue if ave_mean <= 1
Otherwise, we end up with with log(0) or log(1). av_ceil_log2 simply assumes the argument is non-zero and returns wrong result when it is. (Not that there is a proper way of returning an undefined value.)
This commit is contained in:
parent
59df25effd
commit
d1ea26f640
@ -715,9 +715,14 @@ static int decode_channel_residues(WmallDecodeCtx *s, int ch, int tile_size)
|
|||||||
quo += get_bits_long(&s->gb, get_bits(&s->gb, 5) + 1);
|
quo += get_bits_long(&s->gb, get_bits(&s->gb, 5) + 1);
|
||||||
|
|
||||||
ave_mean = (s->ave_sum[ch] + (1 << s->movave_scaling)) >> (s->movave_scaling + 1);
|
ave_mean = (s->ave_sum[ch] + (1 << s->movave_scaling)) >> (s->movave_scaling + 1);
|
||||||
rem_bits = av_ceil_log2(ave_mean);
|
if (ave_mean <= 1)
|
||||||
rem = rem_bits ? get_bits(&s->gb, rem_bits) : 0;
|
residue = quo;
|
||||||
residue = (quo << rem_bits) + rem;
|
else
|
||||||
|
{
|
||||||
|
rem_bits = av_ceil_log2(ave_mean);
|
||||||
|
rem = rem_bits ? get_bits(&s->gb, rem_bits) : 0;
|
||||||
|
residue = (quo << rem_bits) + rem;
|
||||||
|
}
|
||||||
|
|
||||||
s->ave_sum[ch] = residue + s->ave_sum[ch] - (s->ave_sum[ch] >> s->movave_scaling);
|
s->ave_sum[ch] = residue + s->ave_sum[ch] - (s->ave_sum[ch] >> s->movave_scaling);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user