comparison ac3dec.c @ 5414:9746c9a0384f libavcodec

change 2 fields from context to local variables
author jbr
date Sun, 29 Jul 2007 00:35:30 +0000
parents 28c20633db55
children 8bf7358978c8
comparison
equal deleted inserted replaced
5413:28c20633db55 5414:9746c9a0384f
87 int blksw[AC3_MAX_CHANNELS]; 87 int blksw[AC3_MAX_CHANNELS];
88 int dithflag[AC3_MAX_CHANNELS]; 88 int dithflag[AC3_MAX_CHANNELS];
89 int cplinu; 89 int cplinu;
90 int chincpl[AC3_MAX_CHANNELS]; 90 int chincpl[AC3_MAX_CHANNELS];
91 int phsflginu; 91 int phsflginu;
92 int cplbegf;
93 int cplendf;
94 int cplcoe; 92 int cplcoe;
95 uint32_t cplbndstrc; 93 uint32_t cplbndstrc;
96 int rematstr; 94 int rematstr;
97 int rematflg[AC3_MAX_CHANNELS]; 95 int rematflg[AC3_MAX_CHANNELS];
98 int cplexpstr; 96 int cplexpstr;
799 797
800 if (get_bits1(gb)) { /* coupling strategy */ 798 if (get_bits1(gb)) { /* coupling strategy */
801 ctx->cplinu = get_bits1(gb); 799 ctx->cplinu = get_bits1(gb);
802 ctx->cplbndstrc = 0; 800 ctx->cplbndstrc = 0;
803 if (ctx->cplinu) { /* coupling in use */ 801 if (ctx->cplinu) { /* coupling in use */
802 int cplbegf, cplendf;
803
804 for (i = 0; i < nfchans; i++) 804 for (i = 0; i < nfchans; i++)
805 ctx->chincpl[i] = get_bits1(gb); 805 ctx->chincpl[i] = get_bits1(gb);
806 806
807 if (acmod == AC3_ACMOD_STEREO) 807 if (acmod == AC3_ACMOD_STEREO)
808 ctx->phsflginu = get_bits1(gb); //phase flag in use 808 ctx->phsflginu = get_bits1(gb); //phase flag in use
809 809
810 ctx->cplbegf = get_bits(gb, 4); 810 cplbegf = get_bits(gb, 4);
811 ctx->cplendf = get_bits(gb, 4); 811 cplendf = get_bits(gb, 4);
812 812
813 if (3 + ctx->cplendf - ctx->cplbegf < 0) { 813 if (3 + cplendf - cplbegf < 0) {
814 av_log(NULL, AV_LOG_ERROR, "cplendf = %d < cplbegf = %d\n", ctx->cplendf, ctx->cplbegf); 814 av_log(NULL, AV_LOG_ERROR, "cplendf = %d < cplbegf = %d\n", cplendf, cplbegf);
815 return -1; 815 return -1;
816 } 816 }
817 817
818 ctx->ncplbnd = ctx->ncplsubnd = 3 + ctx->cplendf - ctx->cplbegf; 818 ctx->ncplbnd = ctx->ncplsubnd = 3 + cplendf - cplbegf;
819 ctx->cplstrtmant = ctx->cplbegf * 12 + 37; 819 ctx->cplstrtmant = cplbegf * 12 + 37;
820 ctx->cplendmant = ctx->cplendf * 12 + 73; 820 ctx->cplendmant = cplendf * 12 + 73;
821 for (i = 0; i < ctx->ncplsubnd - 1; i++) /* coupling band structure */ 821 for (i = 0; i < ctx->ncplsubnd - 1; i++) /* coupling band structure */
822 if (get_bits1(gb)) { 822 if (get_bits1(gb)) {
823 ctx->cplbndstrc |= 1 << i; 823 ctx->cplbndstrc |= 1 << i;
824 ctx->ncplbnd--; 824 ctx->ncplbnd--;
825 } 825 }
855 } 855 }
856 856
857 if (acmod == AC3_ACMOD_STEREO) {/* rematrixing */ 857 if (acmod == AC3_ACMOD_STEREO) {/* rematrixing */
858 ctx->rematstr = get_bits1(gb); 858 ctx->rematstr = get_bits1(gb);
859 if (ctx->rematstr) { 859 if (ctx->rematstr) {
860 if (!(ctx->cplinu) || ctx->cplbegf > 2) 860 if (!(ctx->cplinu) || ctx->cplstrtmant > 61)
861 for (rbnd = 0; rbnd < 4; rbnd++) 861 for (rbnd = 0; rbnd < 4; rbnd++)
862 ctx->rematflg[rbnd] = get_bits1(gb); 862 ctx->rematflg[rbnd] = get_bits1(gb);
863 if (ctx->cplbegf > 0 && ctx->cplbegf <= 2 && ctx->cplinu) 863 if (ctx->cplstrtmant > 37 && ctx->cplstrtmant <= 61 && ctx->cplinu)
864 for (rbnd = 0; rbnd < 3; rbnd++) 864 for (rbnd = 0; rbnd < 3; rbnd++)
865 ctx->rematflg[rbnd] = get_bits1(gb); 865 ctx->rematflg[rbnd] = get_bits1(gb);
866 if (ctx->cplbegf == 0 && ctx->cplinu) 866 if (ctx->cplstrtmant == 37 && ctx->cplinu)
867 for (rbnd = 0; rbnd < 2; rbnd++) 867 for (rbnd = 0; rbnd < 2; rbnd++)
868 ctx->rematflg[rbnd] = get_bits1(gb); 868 ctx->rematflg[rbnd] = get_bits1(gb);
869 } 869 }
870 } 870 }
871 871