[FFmpeg-devel] [PATCH] HE-AACv1 second revision

Vitor Sessak vitor1001
Tue Feb 2 06:04:34 CET 2010


Alex Converse wrote:
> On Sat, Jan 30, 2010 at 8:55 PM, Vitor Sessak <vitor1001 at gmail.com> wrote:
>> Alex Converse wrote:
> ...
>>> +/**
>>> + * Analysis QMF Bank (14496-3 sp04 p206)
>>> + *
>>> + * @param   x       pointer to the beginning of the first sample window
>>> + * @param   W       array of complex-valued samples split into subbands
>>> + */
>>> +static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *fft, const
>>> float *in, float *x,
>>> +                             FFTComplex u[64], float W[2][32][32][2])
>>> +{
>>> +    int i, k, l;
>>> +    const uint16_t *revtab = fft->revtab;
>>> +    memcpy(W[0], W[1], sizeof(W[0]));
>>> +    memcpy(x    , x+1024, (320-32)*sizeof(x[0]));
>>> +    memcpy(x+288, in    ,     1024*sizeof(x[0]));
>>> +    x += 319;
>>> +    for (l = 0; l < 32; l++) { // numTimeSlots*RATE = 16*2 as 960 sample
>>> frames
>>> +                               // are not supported
>>> +        float z[320];
>>> +        for (i = 0; i < 320; i++)
>>> +            z[i] = x[-i] * sbr_qmf_window_ds[i];
>>> +        for (i = 0; i < 64; i++) {
>>> +            float f = z[i] + z[i + 64] + z[i + 128] + z[i + 192] + z[i +
>>> 256];
>>> +            u[revtab[i]].re = f * analysis_cos_pre[i];
>>> +            u[revtab[i]].im = f * analysis_sin_pre[i];
>>> +        }
>>> +        ff_fft_calc(fft, u);
>> This looks like a RDFT translated in the frequency space. If you could use a
>> rdft you could make your temporary buffer half the size and also have half
>> of the data for the fft.
> 
> It's a half-sample translation. Is there a fast way to deal with that?
> A full sample would be trivial.

If this is what you mean with a half-sample translation:

F_k   = sum_n X_n exp(-2*pi*i*(k+1./2)*(n/N))
F_k-1 = sum_n X_n exp(-2*pi*i*(k-1./2)*(n/N))

you can do

F_k + F_k-1 = sum_n X_n*2*cos(pi*n/N)*exp(-2*pi*i*k*(n/N))

which if you multiply X_n by 2*cos(pi*n/N) and do a RDFT gives a 
recursive formula for F_k. For initial point we have

F_-1 = F_0*  (complex conjugate)

so

2*Re[F_0] = sum_n X_n*2*cos(pi*n/N)*exp(-2*pi*i*0*(n/N)) = first term of 
the RDFT

For Im[F_0], I see no obvious way but to do it other than doing the sum :(

-Vitor




More information about the ffmpeg-devel mailing list