[FFmpeg-devel] [PATCH] RDFT for Bink and QDM2

Alex Converse alex.converse
Sun Jan 18 02:18:04 CET 2009


On Sat, Jan 17, 2009 at 7:52 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sat, Jan 17, 2009 at 01:29:13PM -0500, Alex Converse wrote:
>> Attached is my RDFT patch with all the feedback applied. Also attached
>> is a patch that makes use of it in QDM2 decoding. I thought I had
>> unwrapped the math perfectly but it looks like things changed for the
>> better.
>>
>> Also new is a flag for FFT sign convention. This is because the
>> inverse transform is not the same as the forward transform with the
>> opposite sign convention, scaled.
>>
>> The reference files are decoded with the binary coder from the qt63 dlls.
>>
>> $ tests/tiny_psnr ../qdm2/nadasurf_popular_dl.wav old.wav 2 0 44
>> stddev: 1305.89 PSNR: 34.00 bytes: 39632896/ 39632896
>> $ tests/tiny_psnr ../qdm2/nadasurf_popular_dl.wav new.wav 2 0 44
>> stddev: 1145.39 PSNR: 35.14 bytes: 39632896/ 39632896
>> $ tests/tiny_psnr ../qdm2/switzler084d_dl.wav old.wav 2 0 44
>> stddev:  377.46 PSNR: 44.78 bytes: 20660224/ 20660224
>> $ tests/tiny_psnr ../qdm2/switzler084d_dl.wav new.wav 2 0 44
>> stddev:  305.00 PSNR: 46.63 bytes: 20660224/ 20660224
> [...]
>> +/**
>> + * Sets up a real FFT.
>> + * @param nbits           Log2 of the length of the input array
>> + * @param inverse         If TRUE, perform the inverse of the transform
>> + * @param sign_convention The sign of j of the forward FFT.
>> + */
>> +int ff_rdft_init(RDFTContext *s, int nbits, int inverse, int sign_convention)
>> +{
>> +    int n = 1 << nbits;
>> +    int i;
>> +    const double theta = sign_convention*(1-2*inverse)*2*M_PI/n;
>> +
>> +    s->nbits           = nbits;
>> +    s->inverse         = inverse;
>> +    s->sign_convention = sign_convention;
>> +
>> +    if (ff_fft_init(&s->fft, nbits-1, (sign_convention==1) ^ inverse) < 0)
>> +        goto fail;
>> +
>
>> +    s->tsin = av_malloc((n>>2) * sizeof(FFTSample));
>
> i do prefer that no tables are duplicated
>

Where can I pull these from?

--Alex




More information about the ffmpeg-devel mailing list