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

Michael Niedermayer michaelni
Tue Jan 20 17:52:34 CET 2009


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

[...]

> +/**
> + * 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

i suggest if 0 perform the forward transform, if 1 perform the inverse


> + * @param sign_convention The sign of j of the forward FFT.

i do not understand this, j is a variable that has no clear relation to a FFT

also the doxy should be in the header IMHO


> + */
> +int ff_rdft_init(RDFTContext *s, int nbits, int inverse, int sign_convention)

should be av_cold


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

Democracy is the form of government in which you can choose your dictator
-------------- 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/20090120/b18bda20/attachment.pgp>



More information about the ffmpeg-devel mailing list