[Ffmpeg-devel] [RFC] IMC decoder

Michael Niedermayer michaelni
Mon Oct 30 10:59:50 CET 2006


Hi

On Mon, Oct 30, 2006 at 10:13:05AM +0200, Kostya wrote:
[...]
> > > +
> > > +        r3 = (cntf * 4.0 + 1.0) / 2048.0 * M_PI * 2.0;
> > 
> > /2048 * 2 = /1024
> 
> Changed
[...]
> > 
> > > +        q->last_fft_im[i] = 0;
> > > +    }
> > > +    q->flcf1 = (float) (log2(10) * 0.05703125);
> > > +    q->flcf2 = (float) (log2(10) * 0.25);
> > > +
> > > +    /* Generate a square root table */
> > > +
> > > +    for(i = 0; i < 30; i++) {
> > > +        q->sqrt_tab[i] = sqrt((float)i);
> > > +    }
> > > +
> > > +    /* initialize the VLC tables */
> > > +    for(i = 0; i < 4 ; i++) {
> > > +        for(j = 0; j < 4; j++) {
> > > +            init_vlc (&q->huffman_vlc[i][j], 9, imc_huffman_sizes[i],
> > > +                     imc_huffman_lens[i][j], 1, 1,
> > > +                     imc_huffman_bits[i][j], 2, 2, 0);
> > > +        }
> > > +    }
> > > +    q->one_div_log2 = 1/log(2);
> > > +
> > > +    ff_fft_init(&q->fft, 7, 1);
> > > +    return 0;
> > > +}
> > 
> > this function always returns 0 so it could be changed to void
> 
> No, that's codec init function.

oops ;)


[...]
[...]
> +        r1 = sin((i * 4.0 + 1.0) / 2048.0 * M_PI * 2.0);
> +        r2 = cos((i * 4.0 + 1.0) / 2048.0 * M_PI * 2.0);

forgotten? /2048*2=/1024


[...]
> +            tmp = tmp * imc_exp_tab[15 + level];
> +            tmp2 = tmp2 + q->flcf2 * level;

*= and += could be used


[...]
> +            if (q->levlCoeffBuf[i] != 16) {
> +                q->bitsBandT[i] = 5;
> +                for(j = band_tab[i]; j < band_tab[i+1]; j++) {
> +                    bitscount += 5;
> +                    q->CWlengthT[j] = 5;
> +                }
> +            } else {
> +                q->bitsBandT[i] = 0;
> +                for(j = band_tab[i]; j < band_tab[i+1]; j++) {
> +                    q->CWlengthT[j] = 0;
> +                }
> +            }

int bits= q->levlCoeffBuf[i] == 16 ? 0 : 5;
q->bitsBandT[i] = bits;
for(j = band_tab[i]; j < band_tab[i+1]; j++) {
    bitscount += bits;
    q->CWlengthT[j] = bits;
}


excpet these minor things patch looks ok

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

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list