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

Alex Converse alex.converse
Tue Jan 20 22:58:07 CET 2009


On Tue, Jan 20, 2009 at 12:24 PM, Alex Converse <alex.converse at gmail.com> wrote:
> On Tue, Jan 20, 2009 at 11:52 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> On Mon, Jan 19, 2009 at 07:44:38PM -0500, Alex Converse wrote:
>>> On Sun, Jan 18, 2009 at 5:48 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>>> > On Sat, Jan 17, 2009 at 08:18:04PM -0500, Alex Converse wrote:
>>> >> 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?
>>> >
>>> > I dont know, its very possible there are no such global tables yet,
>>> > if so, just add new global/static tables ...
>>> >
>>> > [...]
>>>
>>> Like this?
>>
>> yes
>>
>>
>>>
>>> Also the addition to the Makefile in rdft-qdm.diff seemed unnecessary
>>> (as it was already covered by a dependency in configure) so I removed
>>> it and am resubmitting that patch as well.
>>
>> [...]
>>
>>> @@ -747,6 +749,23 @@ void ff_imdct_half_sse(MDCTContext *s, FFTSample *output, const FFTSample *input
>>>  void ff_mdct_calc(MDCTContext *s, FFTSample *out, const FFTSample *input);
>>>  void ff_mdct_end(MDCTContext *s);
>>>
>>> +/* Real Discrete Fourier Transform */
>>> +
>>> +typedef struct {
>>
>> not doxygen compatible
>
> fixed

On further inspection this separates the RDFT section of dsputil.h and
does not describe the struct. None of the other section separators in
dsputil.h are doxygen comments.
[...]

--Alex




More information about the ffmpeg-devel mailing list