[FFmpeg-devel] [PATCH] RDFT for Bink audio

Alex Converse alex.converse
Thu Jan 15 17:08:22 CET 2009

```On Thu, Jan 15, 2009 at 4:25 AM, Benjamin Larsson <banan at ludd.ltu.se> wrote:
> Alex Converse wrote:
>> Hi,
>>
>> Attached is an implementation of the Real Discrete Fourier Transform as
>> required for Bink Audio.
>>
>> Regards,
>> Alex Converse
>>
>
> Hi, Bink audio has 2 modes:
>
> +        if (s->use_dct)
> +            ff_dct_calc (&s->trans.dct,  coeffs);
> +        else
> +            ff_rdft_calc(&s->trans.rdft, coeffs);
>
>
>
> Did you implement both modes in this patch ? To me it looks like we also
> need a dct function also.
>

Separate transform will be in a separate patch.

> +        ev.re =  k1*(data[i1  ]+data[i2  ]);
> +        od.im =  k2*(data[i1  ]-data[i2  ]);
> +        ev.im =  k1*(data[i1+1]-data[i2+1]);
> +        od.re = -k2*(data[i1+1]+data[i2+1]);
> +        /* Apply twiddle factors to the odd FFT and add to the even FFT */
> +        data[i1  ] =  ev.re + od.re*tcos[i] - od.im*tsin[i];
> +        data[i1+1] =  ev.im + od.im*tcos[i] + od.re*tsin[i];
> +        data[i2  ] =  ev.re - od.re*tcos[i] + od.im*tsin[i];
> +        data[i2+1] = -ev.im + od.im*tcos[i] + od.re*tsin[i];
>
>
> That part of the code looked like some code we have in the qdm2.c
> decoder ? Can you look and see if it matches? I have always wondered
> what kind of transform it was.
>

It is clearly a IRDFT with something weird going on with the 0 and N/2
points. Do you know anything about the genesis of that code that isn't
in your pdf? The n2 term is clearly not passed to the FFT at all.

> Code wise other then some strange indentation in the struct it looked ok.
>

Some tabs crept in, try this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rdft-fix.diff
Type: application/octet-stream
Size: 5823 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090115/67734b5f/attachment.obj>

```