[FFmpeg-devel] [PATCH] NellyMoser audio decoder v2

Michael Niedermayer michaelni
Sat Oct 13 21:00:44 CEST 2007


Hi

On Sat, Oct 13, 2007 at 03:18:04PM +0200, Benjamin Larsson wrote:
> Fixed I think.

[...]

> DECLARE_ALIGNED_16(float,sine_window[128]);
> DECLARE_ALIGNED_16(float,tcos[64]);
> DECLARE_ALIGNED_16(float,tsin[64]);
> DECLARE_ALIGNED_16(float,cos_tab[64]);

are there any opertunities to share these with other codecs?


[...]
>         tmp -= bits[i-1];
>         bits[i-1] = NELLY_DETAIL_BITS-tmp;

bits[i-1] -= tmp - NELLY_DETAIL_BITS;


>         while (i < NELLY_FILL_LEN) {
>             bits[i] = 0;
>             i++;
>         }

for(; i < NELLY_FILL_LEN; i++)
    bits[i] = 0;


>     }
> }
> 

> void nelly_decode_block(NellyMoserDecodeContext *s, unsigned char block[NELLY_BLOCK_LEN], float audio[NELLY_SAMPLES])
> {
>     int i,j;
>     float buf[NELLY_BUF_LEN], pows[NELLY_BUF_LEN];
>     float *aptr, *bptr, *pptr, val, pval;
>     int bits[NELLY_BUF_LEN];
>     unsigned char v;
> 
>     init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8);
> 
>     bptr = buf;
>     pptr = pows;
>     val = nelly_init_table[get_bits(&s->gb, 6)];
>     for (i=0 ; i<NELLY_BANDS ; i++) {
>         if (i > 0)
>             val += nelly_delta_table[get_bits(&s->gb, 5)];
>         pval = pow(2, val/2048);
>         for (j = 0; j < nelly_band_sizes_table[i]; j++) {
>             *bptr++ = val;
>             *pptr++ = pval;
>         }
> 
>     }
> 
>     memset(&buf[NELLY_FILL_LEN],0,4);
>     memset(&pows[NELLY_FILL_LEN],0,4);

this is wrong, it assumes sizeof(float)==4
why dont you just:
buf[NELLY_FILL_LEN]=0;
...
?


[...]
> static int decode_end(AVCodecContext * avctx) {
> 
>     ff_fft_end(&fftc);
>     return 0;
> }

this breaks with 2 decoders even in a single thread

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071013/0f49e887/attachment.pgp>



More information about the ffmpeg-devel mailing list