comparison aac.c @ 7891:13ee9bb85721 libavcodec

Zero 'idx' for each iteration of the coupling gain loop and as it is only used within this loop, we can move its declaration there too. This fixes bitstream desync when decoding streams containing CCEs. Based on a patch by Alex Converse (alex converse gmail com)
author superdump
date Thu, 18 Sep 2008 16:02:51 +0000
parents 20dd4e5e5aa6
children 8fd8f23be794
comparison
equal deleted inserted replaced
7890:20dd4e5e5aa6 7891:13ee9bb85721
948 * 948 *
949 * @return Returns error status. 0 - OK, !0 - error 949 * @return Returns error status. 0 - OK, !0 - error
950 */ 950 */
951 static int decode_cce(AACContext * ac, GetBitContext * gb, ChannelElement * che) { 951 static int decode_cce(AACContext * ac, GetBitContext * gb, ChannelElement * che) {
952 int num_gain = 0; 952 int num_gain = 0;
953 int c, g, sfb, ret, idx = 0; 953 int c, g, sfb, ret;
954 int sign; 954 int sign;
955 float scale; 955 float scale;
956 SingleChannelElement * sce = &che->ch[0]; 956 SingleChannelElement * sce = &che->ch[0];
957 ChannelCoupling * coup = &che->coup; 957 ChannelCoupling * coup = &che->coup;
958 958
983 983
984 if ((ret = decode_ics(ac, sce, gb, 0, 0))) 984 if ((ret = decode_ics(ac, sce, gb, 0, 0)))
985 return ret; 985 return ret;
986 986
987 for (c = 0; c < num_gain; c++) { 987 for (c = 0; c < num_gain; c++) {
988 int idx = 0;
988 int cge = 1; 989 int cge = 1;
989 int gain = 0; 990 int gain = 0;
990 float gain_cache = 1.; 991 float gain_cache = 1.;
991 if (c) { 992 if (c) {
992 cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb); 993 cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);