[FFmpeg-devel] [PATCH] avcodec/on2avc: Fix stability issues with scale_tab generation

Ronald S. Bultje rsbultje at gmail.com
Sun Dec 27 13:40:53 CET 2015


Hi,

On Sun, Dec 27, 2015 at 6:02 AM, Michael Niedermayer <michaelni at gmx.at>
wrote:

> +    for (i = 0; i < 20; i++)
> +        c->scale_tab[i] = ceil(ff_exp10(i * 0.1) * 16 - 0.01) / 32;
>      for (; i < 128; i++)
> +        c->scale_tab[i] = ceil(ff_exp10(i * 0.1) * 0.5 - 0.01);
>

To innocent bystanders, this is hard to understand. Let's keep it a habit
to document things (what and why), where the "what" portion is probably
"this code emulates pow(10, x) with ff_pow10(x - 0.01)". As for why (most
specifically, why the 0.01?), I'm going to assume that here, you're trying
to get unit integers to not go to unit.0000000[..]001, so you subtract 0.01
before the ceil so it works fine again to get the exact unit integer output
number. If that's correct, please add a comment saying that, and then lgtm.

Ronald


More information about the ffmpeg-devel mailing list