Revision 57cc1ad3 libavcodec/aaccoder.c

View differences:

libavcodec/aaccoder.c
110 110
    const float IQ = ff_aac_pow2sf_tab[200 + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
111 111
    const float  Q = ff_aac_pow2sf_tab[200 - scale_idx + SCALE_ONE_POS - SCALE_DIV_512];
112 112
    const float CLIPPED_ESCAPE = 165140.0f*IQ;
113
    int i, j, k;
113
    int i, j;
114 114
    float cost = 0;
115 115
    const int dim = BT_PAIR ? 2 : 4;
116 116
    int resbits = 0;
......
149 149
        curbits =  ff_aac_spectral_bits[cb-1][curidx];
150 150
        vec     = &ff_aac_codebook_vectors[cb-1][curidx*dim];
151 151
        if (BT_UNSIGNED) {
152
            for (k = 0; k < dim; k++) {
153
                float t = fabsf(in[i+k]);
152
            for (j = 0; j < dim; j++) {
153
                float t = fabsf(in[i+j]);
154 154
                float di;
155
                if (BT_ESC && vec[k] == 64.0f) { //FIXME: slow
155
                if (BT_ESC && vec[j] == 64.0f) { //FIXME: slow
156 156
                    if (t >= CLIPPED_ESCAPE) {
157 157
                        di = t - CLIPPED_ESCAPE;
158 158
                        curbits += 21;
......
162 162
                        curbits += av_log2(c)*2 - 4 + 1;
163 163
                    }
164 164
                } else {
165
                    di = t - vec[k]*IQ;
165
                    di = t - vec[j]*IQ;
166 166
                }
167
                if (vec[k] != 0.0f)
167
                if (vec[j] != 0.0f)
168 168
                    curbits++;
169 169
                rd += di*di;
170 170
            }
171 171
        } else {
172
            for (k = 0; k < dim; k++) {
173
                float di = in[i+k] - vec[k]*IQ;
172
            for (j = 0; j < dim; j++) {
173
                float di = in[i+j] - vec[j]*IQ;
174 174
                rd += di*di;
175 175
            }
176 176
        }

Also available in: Unified diff