[FFmpeg-devel] [PATCH] Move tables initialisation and handling into ac3enc_tables.c
Reimar Döffinger
Reimar.Doeffinger
Sat Jan 12 19:03:30 CET 2008
Hello,
On Sat, Jan 12, 2008 at 06:02:59PM +0100, Aurelien Jacobs wrote:
> Diego 'Flameeyes' Petten? wrote:
> > The attached patch moves the declaration and the initialisation of
> > tables, as well as the include of the hardcoded tables, on a separate
> > C file. The next patch will add tables generation code to that file.
> >
> > [...]
> >
> > +static inline int16_t fix15(float a)
> > +{
> > + int v;
> > + v = (int)(a * (float)(1 << 15));
> > + if (v < -32767)
> > + v = -32767;
> > + else if (v > 32767)
> > + v = 32767;
> > + return v;
> > +}
>
> Unrelated to this patch, but I wondered if clipping to -32767 was
> intentional. I guess yes, but just in case it could be clipped to
> -32768 instead, av_clip_int16() could be used.
I guess the idea was to avoid a bias, but the regression tests at least
remain unchanged when using av_clip_int16 instead.
Though I do wonder if not clipping at all and doing "* 0x7fff" instead
of "* (1 << 15)" wouldn't be even better here. Probably not though since
it breaks regression tests...
Who knows the details of this stuff? *g*
Greetings,
Reimar D?ffinger
More information about the ffmpeg-devel
mailing list