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

Michael Niedermayer michael at niedermayer.cc
Sun Dec 27 16:44:01 CET 2015


On Sun, Dec 27, 2015 at 07:40:53AM -0500, Ronald S. Bultje wrote:
> 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.

yes
changed
applied
thx


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151227/5b4f66f2/attachment.sig>


More information about the ffmpeg-devel mailing list