Revision 72745cff libavcodec/ac3dec.c

View differences:

libavcodec/ac3dec.c
201 201
    av_init_random(0, &s->dith_state);
202 202

  
203 203
    /* set bias values for float to int16 conversion */
204
    if(s->dsp.float_to_int16 == ff_float_to_int16_c) {
204
    if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
205 205
        s->add_bias = 385.0f;
206 206
        s->mul_bias = 1.0f;
207 207
    } else {
......
604 604
            for(i=0; i<128; i++)
605 605
                x[i] = s->transform_coeffs[ch][2*i];
606 606
            ff_imdct_half(&s->imdct_256, s->tmp_output, x);
607
            s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 0, 128);
607
            s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, s->add_bias, 128);
608 608
            for(i=0; i<128; i++)
609 609
                x[i] = s->transform_coeffs[ch][2*i+1];
610 610
            ff_imdct_half(&s->imdct_256, s->delay[ch-1], x);
611 611
        } else {
612 612
            ff_imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]);
613
            s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 0, 128);
613
            s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, s->add_bias, 128);
614 614
            memcpy(s->delay[ch-1], s->tmp_output+128, 128*sizeof(float));
615 615
        }
616 616
    }
......
1018 1018
        do_imdct(s, s->out_channels);
1019 1019
    }
1020 1020

  
1021
    /* convert float to 16-bit integer */
1022
    for(ch=0; ch<s->out_channels; ch++) {
1023
        for(i=0; i<256; i++) {
1024
            s->output[ch][i] += s->add_bias;
1025
        }
1026
        s->dsp.float_to_int16(s->int_output[ch], s->output[ch], 256);
1027
    }
1028

  
1029 1021
    return 0;
1030 1022
}
1031 1023

  
......
1037 1029
{
1038 1030
    AC3DecodeContext *s = avctx->priv_data;
1039 1031
    int16_t *out_samples = (int16_t *)data;
1040
    int i, blk, ch, err;
1032
    int blk, ch, err;
1041 1033

  
1042 1034
    /* initialize the GetBitContext with the start of valid AC-3 Frame */
1043 1035
    if (s->input_buffer) {
......
1127 1119

  
1128 1120
    /* decode the audio blocks */
1129 1121
    for (blk = 0; blk < s->num_blocks; blk++) {
1122
        const float *output[s->out_channels];
1130 1123
        if (!err && decode_audio_block(s, blk)) {
1131 1124
            av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n");
1132 1125
        }
1133

  
1134
        /* interleave output samples */
1135
        for (i = 0; i < 256; i++)
1136
            for (ch = 0; ch < s->out_channels; ch++)
1137
                *(out_samples++) = s->int_output[ch][i];
1126
        for (ch = 0; ch < s->out_channels; ch++)
1127
            output[ch] = s->output[ch];
1128
        s->dsp.float_to_int16_interleave(out_samples, output, 256, s->out_channels);
1129
        out_samples += 256 * s->out_channels;
1138 1130
    }
1139 1131
    *data_size = s->num_blocks * 256 * avctx->channels * sizeof (int16_t);
1140 1132
    return s->frame_size;

Also available in: Unified diff