Logo Search packages:      
Sourcecode: blender version File versions  Download package

int ff_mdct_init ( MDCTContext *  s,
int  nbits,
int  inverse 
)

init MDCT or IMDCT computation.

Definition at line 29 of file mdct.c.

References av_freep(), av_malloc(), and ff_fft_init().

Referenced by main().

{
    int n, n4, i;
    float alpha;

    memset(s, 0, sizeof(*s));
    n = 1 << nbits;
    s->nbits = nbits;
    s->n = n;
    n4 = n >> 2;
    s->tcos = av_malloc(n4 * sizeof(FFTSample));
    if (!s->tcos)
        goto fail;
    s->tsin = av_malloc(n4 * sizeof(FFTSample));
    if (!s->tsin)
        goto fail;

    for(i=0;i<n4;i++) {
        alpha = 2 * M_PI * (i + 1.0 / 8.0) / n;
        s->tcos[i] = -cos(alpha);
        s->tsin[i] = -sin(alpha);
    }
    if (ff_fft_init(&s->fft, s->nbits - 2, inverse) < 0)
        goto fail;
    return 0;
 fail:
    av_freep(&s->tcos);
    av_freep(&s->tsin);
    return -1;
}


Generated by  Doxygen 1.6.0   Back to index