Revision d1177cb5

View differences:

libavcodec/dca.c
341 341
                 tmode_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
342 342
    }
343 343

  
344
    for(i = 0; i < 10; i++)
345
        for(j = 0; j < 7; j++){
346
            if(!bitalloc_codes[i][j]) break;
344
    for (i = 0; i < 10; i++)
345
        for (j = 0; j < 7; j++){
346
            if (!bitalloc_codes[i][j]) break;
347 347
            dca_smpl_bitalloc[i+1].offset = bitalloc_offsets[i];
348 348
            dca_smpl_bitalloc[i+1].wrap = 1 + (j > 4);
349 349
            dca_smpl_bitalloc[i+1].vlc[j].table = &dca_table[dca_vlc_offs[c]];
......
491 491

  
492 492
    /* FIXME: channels mixing levels */
493 493
    s->output = s->amode;
494
    if(s->lfe) s->output |= DCA_LFE;
494
    if (s->lfe) s->output |= DCA_LFE;
495 495

  
496 496
#ifdef TRACE
497 497
    av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type);
......
543 543
   if (level < 5) {
544 544
       /* huffman encoded */
545 545
       value += get_bitalloc(gb, &dca_scalefactor, level);
546
   } else if(level < 8)
546
   } else if (level < 8)
547 547
       value = get_bits(gb, level + 1);
548 548
   return value;
549 549
}
......
672 672

  
673 673
    /* Stereo downmix coefficients */
674 674
    if (!base_channel && s->prim_channels > 2) {
675
        if(s->downmix) {
675
        if (s->downmix) {
676 676
            for (j = base_channel; j < s->prim_channels; j++) {
677 677
                s->downmix_coef[j][0] = get_bits(&s->gb, 7);
678 678
                s->downmix_coef[j][1] = get_bits(&s->gb, 7);
......
888 888
    samples[i+256] = t * coef[0][1] + samples[i+256] * coef[1][1] + samples[i+512] * coef[2][1];
889 889

  
890 890
#define DOWNMIX_TO_STEREO(op1, op2) \
891
    for(i = 0; i < 256; i++){ \
891
    for (i = 0; i < 256; i++){ \
892 892
        op1 \
893 893
        op2 \
894 894
    }
......
900 900
    float t;
901 901
    float coef[DCA_PRIM_CHANNELS_MAX][2];
902 902

  
903
    for(i=0; i<DCA_PRIM_CHANNELS_MAX; i++) {
903
    for (i=0; i<DCA_PRIM_CHANNELS_MAX; i++) {
904 904
        coef[i][0] = dca_downmix_coeffs[downmix_coef[i][0]];
905 905
        coef[i][1] = dca_downmix_coeffs[downmix_coef[i][1]];
906 906
    }
......
1000 1000
            /*
1001 1001
             * Extract bits from the bit stream
1002 1002
             */
1003
            if(!abits){
1003
            if (!abits){
1004 1004
                memset(subband_samples[k][l], 0, 8 * sizeof(subband_samples[0][0][0]));
1005 1005
            } else {
1006 1006
                /* Deal with transients */
1007 1007
                int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l];
1008 1008
                float rscale = quant_step_size * s->scale_factor[k][l][sfi] * s->scalefactor_adj[k][sel];
1009 1009

  
1010
                if(abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table){
1011
                    if(abits <= 7){
1010
                if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table){
1011
                    if (abits <= 7){
1012 1012
                        /* Block code */
1013 1013
                        int block_code1, block_code2, size, levels;
1014 1014

  
......
1139 1139

  
1140 1140
    /* presumably optional information only appears in the core? */
1141 1141
    if (!base_channel) {
1142
    if (s->timestamp)
1143
        get_bits(&s->gb, 32);
1142
        if (s->timestamp)
1143
            get_bits(&s->gb, 32);
1144 1144

  
1145
    if (s->aux_data)
1146
        aux_data_count = get_bits(&s->gb, 6);
1145
        if (s->aux_data)
1146
            aux_data_count = get_bits(&s->gb, 6);
1147 1147

  
1148
    for (i = 0; i < aux_data_count; i++)
1149
        get_bits(&s->gb, 8);
1148
        for (i = 0; i < aux_data_count; i++)
1149
            get_bits(&s->gb, 8);
1150 1150

  
1151
    if (s->crc_present && (s->downmix || s->dynrange))
1152
        get_bits(&s->gb, 16);
1151
        if (s->crc_present && (s->downmix || s->dynrange))
1152
            get_bits(&s->gb, 16);
1153 1153
    }
1154 1154

  
1155 1155
    return 0;
......
1217 1217
    uint16_t *sdst = (uint16_t *) dst;
1218 1218
    PutBitContext pb;
1219 1219

  
1220
    if((unsigned)src_size > (unsigned)max_size) {
1220
    if ((unsigned)src_size > (unsigned)max_size) {
1221 1221
//        av_log(NULL, AV_LOG_ERROR, "Input frame size larger then DCA_MAX_FRAME_SIZE!\n");
1222 1222
//        return -1;
1223 1223
        src_size = max_size;
......
1357 1357
            s->channel_order_tab[s->prim_channels - 1] < 0)
1358 1358
            return -1;
1359 1359

  
1360
        if(avctx->request_channels == 2 && s->prim_channels > 2) {
1360
        if (avctx->request_channels == 2 && s->prim_channels > 2) {
1361 1361
            channels = 2;
1362 1362
            s->output = DCA_STEREO;
1363 1363
            avctx->channel_layout = CH_LAYOUT_STEREO;
......
1376 1376
    if (!avctx->channels)
1377 1377
        avctx->channels = channels;
1378 1378

  
1379
    if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
1379
    if (*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
1380 1380
        return -1;
1381 1381
    *data_size = 256 / 8 * s->sample_blocks * sizeof(int16_t) * channels;
1382 1382

  
......
1421 1421
        s->samples_chanptr[i] = s->samples + i * 256;
1422 1422
    avctx->sample_fmt = SAMPLE_FMT_S16;
1423 1423

  
1424
    if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
1424
    if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
1425 1425
        s->add_bias = 385.0f;
1426 1426
        s->scale_bias = 1.0 / 32768.0;
1427 1427
    } else {

Also available in: Unified diff