Exemplo n.º 1
0
dca_state_t * dca_init (uint32_t mm_accel)
{
    dca_state_t * state;
    int i;

    (void)mm_accel;
    state = (dca_state_t *) malloc (sizeof (dca_state_t));
    if (state == NULL)
        return NULL;

    memset (state, 0, sizeof(dca_state_t));

    state->samples = (sample_t *) memalign (16, 256 * 12 * sizeof (sample_t));
    if (state->samples == NULL) {
        free (state);
        return NULL;
    }

    for (i = 0; i < 256 * 12; i++)
        state->samples[i] = 0;

    /* Pre-calculate cosine modulation coefficients */
    pre_calc_cosmod( state );

    state->downmixed = 1;

    return state;
}
Exemplo n.º 2
0
static av_cold int dca_decode_init(AVCodecContext * avctx)
{
    DCAContext *s = avctx->priv_data;

    s->avctx = avctx;
    dca_init_vlcs();
    pre_calc_cosmod(s);

    dsputil_init(&s->dsp, avctx);

    /* allow downmixing to stereo */
    if (avctx->channels > 0 && avctx->request_channels < avctx->channels &&
            avctx->request_channels == 2) {
        avctx->channels = avctx->request_channels;
    }

    return 0;
}