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

Benjamin Larsson banan
Sun Oct 14 15:40:07 CEST 2007


Michael Niedermayer wrote:
> Hi
> 
> On Sat, Oct 13, 2007 at 03:18:04PM +0200, Benjamin Larsson wrote:
>> Fixed I think.
> 
> [...]
> 
>> DECLARE_ALIGNED_16(float,sine_window[128]);

Yes. But I don't know of any other codec that uses a sine window this small.

>> DECLARE_ALIGNED_16(float,tcos[64]);

No.

>> DECLARE_ALIGNED_16(float,tsin[64]);

No.

>> DECLARE_ALIGNED_16(float,cos_tab[64]);

Don't know. But I don't think so.

> 
> are there any opertunities to share these with other codecs?
> 

Answers are from my memory of all the tables in lavc.

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

Fixed.


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

Fixed.

> 
>>     }
>> }
>>
> 
>> 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;
> ...
> ?
> 

Fixed, missed a *sizeof(float).

> 
> [...]
>> static int decode_end(AVCodecContext * avctx) {
>>
>>     ff_fft_end(&fftc);
>>     return 0;
>> }
> 
> this breaks with 2 decoders even in a single thread
> 

Fixed.

MvH
Benjamin Larsson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nellymoserdec.c
Type: text/x-csrc
Size: 15044 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071014/145b87e9/attachment.c>



More information about the ffmpeg-devel mailing list