Revision eaf84d97

View differences:

libavcodec/ac3dec.c
572 572
                got_cplchan = 1;
573 573
            }
574 574
            end = ctx->cplendmant;
575
        } else
575
        } else {
576 576
            end = ctx->endmant[i];
577
        }
577 578
        do
578 579
            ctx->transform_coeffs[i + 1][end] = 0;
579 580
        while(++end < 256);
......
673 674
                                     ctx->window, 256);
674 675
    }
675 676
    for (ch=1; ch<=ctx->nfchans; ch++) {
676
        if (ctx->blksw[ch-1])
677
        if (ctx->blksw[ch-1]) {
677 678
            do_imdct_256(ctx, ch);
678
        else
679
        } else {
679 680
            ctx->imdct_512.fft.imdct_calc(&ctx->imdct_512, ctx->tmp_output,
680 681
                                          ctx->transform_coeffs[ch],
681 682
                                          ctx->tmp_imdct);
682

  
683
        }
683 684
        ctx->dsp.vector_fmul_add_add(ctx->output[ch], ctx->tmp_output,
684 685
                                     ctx->window, ctx->delay[ch], 384, 256, 1);
685 686
        ctx->dsp.vector_fmul_reverse(ctx->delay[ch], ctx->tmp_output+256,
......
749 750
            ctx->ncplbnd = ctx->ncplsubnd = 3 + cplendf - cplbegf;
750 751
            ctx->cplstrtmant = cplbegf * 12 + 37;
751 752
            ctx->cplendmant = cplendf * 12 + 73;
752
            for (i = 0; i < ctx->ncplsubnd - 1; i++) /* coupling band structure */
753
            for (i = 0; i < ctx->ncplsubnd - 1; i++) { /* coupling band structure */
753 754
                if (get_bits1(gb)) {
754 755
                    ctx->cplbndstrc[i] = 1;
755 756
                    ctx->ncplbnd--;
756 757
                }
758
            }
757 759
        } else {
758 760
            for (i = 0; i < nfchans; i++)
759 761
                ctx->chincpl[i] = 0;
......
763 765
    if (ctx->cplinu) {
764 766
        int cplcoe = 0;
765 767

  
766
        for (i = 0; i < nfchans; i++)
767
            if (ctx->chincpl[i])
768
        for (i = 0; i < nfchans; i++) {
769
            if (ctx->chincpl[i]) {
768 770
                if (get_bits1(gb)) { /* coupling co-ordinates */
769 771
                    cplcoe = 1;
770 772
                    mstrcplco = 3 * get_bits(gb, 2);
......
778 780
                        ctx->cplco[i][bnd] *= scale_factors[cplcoexp + mstrcplco];
779 781
                    }
780 782
                }
783
            }
784
        }
781 785

  
782
        if (acmod == AC3_ACMOD_STEREO && ctx->phsflginu && cplcoe)
783
            for (bnd = 0; bnd < ctx->ncplbnd; bnd++)
786
        if (acmod == AC3_ACMOD_STEREO && ctx->phsflginu && cplcoe) {
787
            for (bnd = 0; bnd < ctx->ncplbnd; bnd++) {
784 788
                if (get_bits1(gb))
785 789
                    ctx->cplco[1][bnd] = -ctx->cplco[1][bnd];
790
            }
791
        }
786 792
    }
787 793

  
788 794
    if (acmod == AC3_ACMOD_STEREO) {/* rematrixing */
......
805 811
    if (ctx->lfeon)  /* lfe exponent strategy */
806 812
        ctx->lfeexpstr = get_bits1(gb);
807 813

  
808
    for (i = 0; i < nfchans; i++) /* channel bandwidth code */
814
    for (i = 0; i < nfchans; i++) { /* channel bandwidth code */
809 815
        if (ctx->chexpstr[i] != EXP_REUSE) {
810 816
            if (ctx->chincpl[i])
811 817
                ctx->endmant[i] = ctx->cplstrtmant;
......
818 824
                ctx->endmant[i] = chbwcod * 3 + 73;
819 825
            }
820 826
        }
827
    }
821 828

  
822 829
    if (ctx->cplexpstr != EXP_REUSE) {/* coupling exponents */
823 830
        bit_alloc_flags = 64;
......
826 833
        decode_exponents(gb, ctx->cplexpstr, ngrps, cplabsexp, ctx->dcplexps + ctx->cplstrtmant);
827 834
    }
828 835

  
829
    for (i = 0; i < nfchans; i++) /* fbw channel exponents */
836
    for (i = 0; i < nfchans; i++) { /* fbw channel exponents */
830 837
        if (ctx->chexpstr[i] != EXP_REUSE) {
831 838
            bit_alloc_flags |= 1 << i;
832 839
            grpsize = 3 << (ctx->chexpstr[i] - 1);
......
836 843
            decode_exponents(gb, ctx->chexpstr[i], ngrps, dexps[0], dexps + 1);
837 844
            skip_bits(gb, 2); /* skip gainrng */
838 845
        }
846
    }
839 847

  
840 848
    if (ctx->lfeexpstr != EXP_REUSE) { /* lfe exponents */
841 849
        bit_alloc_flags |= 32;
......
895 903
            }
896 904
        }
897 905

  
898
        if (ctx->cplinu)
906
        if (ctx->cplinu) {
899 907
            if (ctx->cpldeltbae == DBA_NEW) { /*coupling delta offset, len and bit allocation */
900 908
                ctx->cpldeltnseg = get_bits(gb, 3);
901 909
                for (seg = 0; seg <= ctx->cpldeltnseg; seg++) {
......
904 912
                    ctx->cpldeltba[seg] = get_bits(gb, 3);
905 913
                }
906 914
            }
915
        }
907 916

  
908
        for (i = 0; i < nfchans; i++)
917
        for (i = 0; i < nfchans; i++) {
909 918
            if (ctx->deltbae[i] == DBA_NEW) {/*channel delta offset, len and bit allocation */
910 919
                ctx->deltnseg[i] = get_bits(gb, 3);
911 920
                for (seg = 0; seg <= ctx->deltnseg[i]; seg++) {
......
914 923
                    ctx->deltba[i][seg] = get_bits(gb, 3);
915 924
                }
916 925
            }
926
        }
917 927
    } else if(blk == 0) {
918 928
        if(ctx->cplinu)
919 929
            ctx->cpldeltbae = DBA_NONE;
......
923 933
    }
924 934

  
925 935
    if (bit_alloc_flags) {
926
        if (ctx->cplinu && (bit_alloc_flags & 64))
936
        if (ctx->cplinu && (bit_alloc_flags & 64)) {
927 937
            ac3_parametric_bit_allocation(&ctx->bit_alloc_params, ctx->cplbap,
928 938
                                          ctx->dcplexps, ctx->cplstrtmant,
929 939
                                          ctx->cplendmant, ctx->cplsnroffst,
......
931 941
                                          ctx->cpldeltbae, ctx->cpldeltnseg,
932 942
                                          ctx->cpldeltoffst, ctx->cpldeltlen,
933 943
                                          ctx->cpldeltba);
934
        for (i = 0; i < nfchans; i++)
935
            if ((bit_alloc_flags >> i) & 1)
944
        }
945
        for (i = 0; i < nfchans; i++) {
946
            if ((bit_alloc_flags >> i) & 1) {
936 947
                ac3_parametric_bit_allocation(&ctx->bit_alloc_params,
937 948
                                              ctx->bap[i], ctx->dexps[i], 0,
938 949
                                              ctx->endmant[i], ctx->snroffst[i],
939 950
                                              ctx->fgain[i], 0, ctx->deltbae[i],
940 951
                                              ctx->deltnseg[i], ctx->deltoffst[i],
941 952
                                              ctx->deltlen[i], ctx->deltba[i]);
942
        if (ctx->lfeon && (bit_alloc_flags & 32))
953
            }
954
        }
955
        if (ctx->lfeon && (bit_alloc_flags & 32)) {
943 956
            ac3_parametric_bit_allocation(&ctx->bit_alloc_params, ctx->lfebap,
944 957
                                          ctx->dlfeexps, 0, 7, ctx->lfesnroffst,
945 958
                                          ctx->lfefgain, 1,
946 959
                                          DBA_NONE, 0, NULL, NULL, NULL);
960
        }
947 961
    }
948 962

  
949 963
    if (get_bits1(gb)) { /* unused dummy data */

Also available in: Unified diff