Revision 6ee6d068

View differences:

libavcodec/ac3dec.c
802 802
            /* coupling frequency range */
803 803
            /* TODO: modify coupling end freq if spectral extension is used */
804 804
            cpl_start_subband = get_bits(gbc, 4);
805
            cpl_end_subband = get_bits(gbc, 4);
806
            if (3 + cpl_end_subband - cpl_start_subband < 0) {
807
                av_log(s->avctx, AV_LOG_ERROR, "3+cplendf = %d < cplbegf = %d\n", 3+cpl_end_subband, cpl_start_subband);
805
            cpl_end_subband   = get_bits(gbc, 4) + 3;
806
            s->num_cpl_subbands = cpl_end_subband - cpl_start_subband;
807
            if (s->num_cpl_subbands < 0) {
808
                av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d > %d)\n",
809
                       cpl_start_subband, cpl_end_subband);
808 810
                return -1;
809 811
            }
810
            s->num_cpl_bands = s->num_cpl_subbands = 3 + cpl_end_subband - cpl_start_subband;
811 812
            s->start_freq[CPL_CH] = cpl_start_subband * 12 + 37;
812
            s->end_freq[CPL_CH] = cpl_end_subband * 12 + 73;
813
            s->end_freq[CPL_CH]   = cpl_end_subband   * 12 + 37;
813 814

  
814 815
            /* coupling band structure */
816
            s->num_cpl_bands = s->num_cpl_subbands;
815 817
            if (!s->eac3 || get_bits1(gbc)) {
816 818
                for (bnd = 0; bnd < s->num_cpl_subbands - 1; bnd++) {
817 819
                    s->cpl_band_struct[bnd] = get_bits1(gbc);

Also available in: Unified diff