Revision 9edae4ad

View differences:

libavcodec/aac.c
436 436
/**
437 437
 * Decode scalefactors; reference: table 4.47.
438 438
 *
439
 * @param   mix_gain            channel gain (Not used by AAC bitstream.)
440 439
 * @param   global_gain         first scalefactor value as scalefactors are differentially coded
441 440
 * @param   band_type           array of the used band type
442 441
 * @param   band_type_run_end   array of the last scalefactor band of a band type run
......
445 444
 * @return  Returns error status. 0 - OK, !0 - error
446 445
 */
447 446
static int decode_scalefactors(AACContext * ac, float sf[120], GetBitContext * gb,
448
        float mix_gain, unsigned int global_gain, IndividualChannelStream * ics,
447
        unsigned int global_gain, IndividualChannelStream * ics,
449 448
        enum BandType band_type[120], int band_type_run_end[120]) {
450 449
    const int sf_offset = ac->sf_offset + (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE ? 12 : 0);
451 450
    int g, i, idx = 0;
......
469 468
                        return -1;
470 469
                    }
471 470
                    sf[idx]  = ff_aac_pow2sf_tab[-offset[2] + 300];
472
                    sf[idx] *= mix_gain;
473 471
                }
474 472
            }else if(band_type[idx] == NOISE_BT) {
475 473
                for(; i < run_end; i++, idx++) {
......
483 481
                        return -1;
484 482
                    }
485 483
                    sf[idx]  = -ff_aac_pow2sf_tab[ offset[1] + sf_offset];
486
                    sf[idx] *= mix_gain;
487 484
                }
488 485
            }else {
489 486
                for(; i < run_end; i++, idx++) {
......
494 491
                        return -1;
495 492
                    }
496 493
                    sf[idx] = -ff_aac_pow2sf_tab[ offset[0] + sf_offset];
497
                    sf[idx] *= mix_gain;
498 494
                }
499 495
            }
500 496
        }
......
649 645
 */
650 646
static int decode_sbr_extension(AACContext * ac, GetBitContext * gb, int crc, int cnt) {
651 647
    // TODO : sbr_extension implementation
652
    av_log(ac->avccontext, AV_LOG_DEBUG, "aac: SBR not yet supported.\n");
648
    av_log_missing_feature(ac->avccontext, "SBR", 0);
653 649
    skip_bits_long(gb, 8*cnt - 4); // -4 due to reading extension type
654 650
    return cnt;
655 651
}
......
769 765
    for (g = 0; g < ics->num_window_groups; g++) {
770 766
        for (i = 0; i < ics->max_sfb; i++, idx++) {
771 767
            if (cc->ch[0].band_type[idx] != ZERO_BT) {
772
                float gain = cc->coup.gain[index][idx] * sce->mixing_gain;
773 768
                for (group = 0; group < ics->group_len[g]; group++) {
774 769
                    for (k = offsets[i]; k < offsets[i+1]; k++) {
775 770
                        // XXX dsputil-ize
776
                        dest[group*128+k] += gain * src[group*128+k];
771
                        dest[group*128+k] += cc->coup.gain[index][idx] * src[group*128+k];
777 772
                    }
778 773
                }
779 774
            }
......
790 785
 */
791 786
static void apply_independent_coupling(AACContext * ac, SingleChannelElement * sce, ChannelElement * cc, int index) {
792 787
    int i;
793
    float gain = cc->coup.gain[index][0] * sce->mixing_gain;
794 788
    for (i = 0; i < 1024; i++)
795
        sce->ret[i] += gain * (cc->ch[0].ret[i] - ac->add_bias);
789
        sce->ret[i] += cc->coup.gain[index][0] * (cc->ch[0].ret[i] - ac->add_bias);
796 790
}
797 791

  
798 792
    if (!ac->is_saved) {
......
817 811

  
818 812
static av_cold int aac_decode_close(AVCodecContext * avccontext) {
819 813
    AACContext * ac = avccontext->priv_data;
820
    int i, j;
814
    int i, type;
821 815

  
822 816
    for (i = 0; i < MAX_ELEM_ID; i++) {
823
        for(j = 0; j < 4; j++)
824
            av_freep(&ac->che[j][i]);
817
        for(type = 0; type < 4; type++)
818
            av_freep(&ac->che[type][i]);
825 819
    }
826 820

  
827 821
    ff_mdct_end(&ac->mdct);

Also available in: Unified diff