[FFmpeg-devel] [PATCH v2 1/2] avcodec: add Dolby E decoder
foo86
foobaz86 at gmail.com
Fri Jul 21 15:40:00 EEST 2017
On Wed, Jul 19, 2017 at 01:48:47PM +0200, Moritz Barsnick wrote:
> On Sat, Jul 01, 2017 at 17:03:46 +0300, foo86 wrote:
> > +static av_cold void init_tables(void)
> > +{
> > + int i, j;
> > +
> > + for (i = 1; i < 17; i++)
> > + mantissa_tab1[i][0] = 1.0 / (1 << i - 1);
> > +
> > + for (i = 2; i < 16; i++) {
> > + mantissa_tab1[i][1] = 1.0 / ((1 << i) - 1);
> > + mantissa_tab1[i][2] = 0.5 / ((1 << i) - 1);
> > + mantissa_tab1[i][3] = 0.25 / ((1 << i) - 1);
> > + }
> > +
> > + mantissa_tab1[i][1] = 0.5 / (1 << 15);
> > + mantissa_tab1[i][2] = 0.75 / (1 << 15);
> > + mantissa_tab1[i][3] = 0.875 / (1 << 15);
> > +
> > + for (i = 1; i < 17; i++) {
> > + mantissa_tab2[i][1] = mantissa_tab1[i][0] * 0.5;
> > + mantissa_tab2[i][2] = mantissa_tab1[i][0] * 0.75;
> > + mantissa_tab2[i][3] = mantissa_tab1[i][0] * 0.875;
> > + for (j = 1; j < 4; j++)
> > + mantissa_tab3[i][j] = 1.0 / (1 << i) + 1.0 / (1 << j) - 1.0 / (1 << i + j);
> > + }
> > +
> > + mantissa_tab3[1][3] = 0.6875;
> > +
> > + for (i = 0; i < 25; i++) {
> > + exponent_tab[i * 2 ] = 1.0 / (1 << i);
> > + exponent_tab[i * 2 + 1] = M_SQRT1_2 / (1 << i);
> > + }
>
> The literal numerical constants used in the quoted section should
> probably get 'f' suffixes, to force single precision operations. (Not
> that it matters much in the init code.)
I can send a patch to add 'f' suffixes if that's preferred.
More information about the ffmpeg-devel
mailing list