static void mdct512(int32_t *out, int16_t *in)
{
    int i, re, im, re1, im1;
    int16_t rot[N];
    IComplex x[N/4];
    for(i=0;i<N/4;i++)
        rot[i] = -in[i + 3*N/4];
    for(i=N/4;i<N;i++)
        rot[i] = in[i - N/4];
    for(i=0;i<N/4;i++) {
        re = ((int)rot[2*i] - (int)rot[N-1-2*i]) >> 1;
        im = -((int)rot[N/2+2*i] - (int)rot[N/2-1-2*i]) >> 1;
        CMUL(x[i].re, x[i].im, re, im, -xcos1[i], xsin1[i]);
    }
    fft(x, MDCT_NBITS - 2);
    for(i=0;i<N/4;i++) {
        re = x[i].re;
        im = x[i].im;
        CMUL(re1, im1, re, im, xsin1[i], xcos1[i]);
        out[2*i] = im1;
        out[N/2-1-2*i] = re1;
    }
}
['static int AC3_encode_frame(AVCodecContext *avctx,\n                            unsigned char *frame, int buf_size, void *data)\n{\n    AC3EncodeContext *s = avctx->priv_data;\n    int16_t *samples = data;\n    int i, j, k, v, ch;\n    int16_t input_samples[N];\n    int32_t mdct_coef[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];\n    uint8_t exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];\n    uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS];\n    uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];\n    uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];\n    int8_t exp_samples[NB_BLOCKS][AC3_MAX_CHANNELS];\n    int frame_bits;\n    frame_bits = 0;\n    for(ch=0;ch<s->nb_all_channels;ch++) {\n        for(i=0;i<NB_BLOCKS;i++) {\n            int16_t *sptr;\n            int sinc;\n            memcpy(input_samples, s->last_samples[ch], N/2 * sizeof(int16_t));\n            sinc = s->nb_all_channels;\n            sptr = samples + (sinc * (N/2) * i) + ch;\n            for(j=0;j<N/2;j++) {\n                v = *sptr;\n                input_samples[j + N/2] = v;\n                s->last_samples[ch][j] = v;\n                sptr += sinc;\n            }\n            for(j=0;j<N/2;j++) {\n                input_samples[j] = MUL16(input_samples[j],\n                                         ff_ac3_window[j]) >> 15;\n                input_samples[N-j-1] = MUL16(input_samples[N-j-1],\n                                             ff_ac3_window[j]) >> 15;\n            }\n            v = 14 - log2_tab(input_samples, N);\n            if (v < 0)\n                v = 0;\n            exp_samples[i][ch] = v - 9;\n            lshift_tab(input_samples, N, v);\n            mdct512(mdct_coef[i][ch], input_samples);\n            for(j=0;j<N/2;j++) {\n                int e;\n                v = abs(mdct_coef[i][ch][j]);\n                if (v == 0)\n                    e = 24;\n                else {\n                    e = 23 - av_log2(v) + exp_samples[i][ch];\n                    if (e >= 24) {\n                        e = 24;\n                        mdct_coef[i][ch][j] = 0;\n                    }\n                }\n                exp[i][ch][j] = e;\n            }\n        }\n        compute_exp_strategy(exp_strategy, exp, ch, ch == s->lfe_channel);\n        i = 0;\n        while (i < NB_BLOCKS) {\n            j = i + 1;\n            while (j < NB_BLOCKS && exp_strategy[j][ch] == EXP_REUSE) {\n                exponent_min(exp[i][ch], exp[j][ch], s->nb_coefs[ch]);\n                j++;\n            }\n            frame_bits += encode_exp(encoded_exp[i][ch],\n                                     exp[i][ch], s->nb_coefs[ch],\n                                     exp_strategy[i][ch]);\n            for(k=i+1;k<j;k++) {\n                memcpy(encoded_exp[k][ch], encoded_exp[i][ch],\n                       s->nb_coefs[ch] * sizeof(uint8_t));\n            }\n            i = j;\n        }\n    }\n    while(s->bits_written >= s->bit_rate && s->samples_written >= s->sample_rate) {\n        s->bits_written -= s->bit_rate;\n        s->samples_written -= s->sample_rate;\n    }\n    s->frame_size = s->frame_size_min + (s->bits_written * s->sample_rate < s->samples_written * s->bit_rate);\n    s->bits_written += s->frame_size * 16;\n    s->samples_written += AC3_FRAME_SIZE;\n    compute_bit_allocation(s, bap, encoded_exp, exp_strategy, frame_bits);\n    output_frame_header(s, frame);\n    for(i=0;i<NB_BLOCKS;i++) {\n        output_audio_block(s, exp_strategy[i], encoded_exp[i],\n                           bap[i], mdct_coef[i], exp_samples[i], i);\n    }\n    return output_frame_end(s);\n}', 'static void mdct512(int32_t *out, int16_t *in)\n{\n    int i, re, im, re1, im1;\n    int16_t rot[N];\n    IComplex x[N/4];\n    for(i=0;i<N/4;i++)\n        rot[i] = -in[i + 3*N/4];\n    for(i=N/4;i<N;i++)\n        rot[i] = in[i - N/4];\n    for(i=0;i<N/4;i++) {\n        re = ((int)rot[2*i] - (int)rot[N-1-2*i]) >> 1;\n        im = -((int)rot[N/2+2*i] - (int)rot[N/2-1-2*i]) >> 1;\n        CMUL(x[i].re, x[i].im, re, im, -xcos1[i], xsin1[i]);\n    }\n    fft(x, MDCT_NBITS - 2);\n    for(i=0;i<N/4;i++) {\n        re = x[i].re;\n        im = x[i].im;\n        CMUL(re1, im1, re, im, xsin1[i], xcos1[i]);\n        out[2*i] = im1;\n        out[N/2-1-2*i] = re1;\n    }\n}']