Revision 4e33ed36

View differences:

libavcodec/ra288.c
61 61

  
62 62
static void decode(RA288Context *ractx, float gain, int cb_coef)
63 63
{
64
    int x, y;
64
    int i, j;
65 65
    double sumsum;
66 66
    float sum, buffer[5];
67 67

  
68 68
    memmove(ractx->sp_block + 5, ractx->sp_block, 36*sizeof(*ractx->sp_block));
69 69

  
70
    for (x=4; x >= 0; x--)
71
        ractx->sp_block[x] = -scalar_product_float(ractx->sp_block + x + 1,
70
    for (i=4; i >= 0; i--)
71
        ractx->sp_block[i] = -scalar_product_float(ractx->sp_block + i + 1,
72 72
                                             ractx->sp_lpc, 36);
73 73

  
74 74
    /* block 46 of G.728 spec */
......
80 80
    /* block 48 of G.728 spec */
81 81
    sumsum = exp(sum * 0.1151292546497) * gain; /* pow(10.0,sum/20)*gain */
82 82

  
83
    for (x=0; x < 5; x++)
84
        buffer[x] = codetable[cb_coef][x] * sumsum;
83
    for (i=0; i < 5; i++)
84
        buffer[i] = codetable[cb_coef][i] * sumsum;
85 85

  
86 86
    sum = scalar_product_float(buffer, buffer, 5) / 5;
87 87

  
......
93 93

  
94 94
    *ractx->gain_block = 10 * log10(sum) - 32;
95 95

  
96
    for (x=1; x < 5; x++)
97
        for (y=x-1; y >= 0; y--)
98
            buffer[x] -= ractx->sp_lpc[x-y-1] * buffer[y];
96
    for (i=1; i < 5; i++)
97
        for (j=i-1; j >= 0; j--)
98
            buffer[i] -= ractx->sp_lpc[i-j-1] * buffer[j];
99 99

  
100 100
    /* output */
101
    for (x=0; x < 5; x++)
102
        ractx->sp_block[4-x] =
103
            av_clipf(ractx->sp_block[4-x] + buffer[x], -4095, 4095);
101
    for (i=0; i < 5; i++)
102
        ractx->sp_block[4-i] =
103
            av_clipf(ractx->sp_block[4-i] + buffer[i], -4095, 4095);
104 104
}
105 105

  
106 106
/**
......
111 111
 */
112 112
static int eval_lpc_coeffs(const float *in, float *tgt, int n)
113 113
{
114
    int x, y;
114
    int i, j;
115 115
    double f0, f1, f2;
116 116

  
117 117
    if (in[n] == 0)
......
122 122

  
123 123
    in--; // To avoid a -1 subtraction in the inner loop
124 124

  
125
    for (x=1; x <= n; x++) {
126
        f1 = in[x+1];
125
    for (i=1; i <= n; i++) {
126
        f1 = in[i+1];
127 127

  
128
        for (y=0; y < x - 1; y++)
129
            f1 += in[x-y]*tgt[y];
128
        for (j=0; j < i - 1; j++)
129
            f1 += in[i-j]*tgt[j];
130 130

  
131
        tgt[x-1] = f2 = -f1/f0;
132
        for (y=0; y < x >> 1; y++) {
133
            float temp = tgt[y] + tgt[x-y-2]*f2;
134
            tgt[x-y-2] += tgt[y]*f2;
135
            tgt[y] = temp;
131
        tgt[i-1] = f2 = -f1/f0;
132
        for (j=0; j < i >> 1; j++) {
133
            float temp = tgt[j] + tgt[i-j-2]*f2;
134
            tgt[i-j-2] += tgt[j]*f2;
135
            tgt[j] = temp;
136 136
        }
137 137
        if ((f0 += f1*f2) < 0)
138 138
            return -1;
......
171 171
                             float *out, float *hist, float *out2,
172 172
                             const float *window)
173 173
{
174
    unsigned int x;
174
    unsigned int i;
175 175
    float buffer1[order + 1];
176 176
    float buffer2[order + 1];
177 177
    float work[order + n + non_rec];
......
179 179
    /* update history */
180 180
    memmove(hist, hist + n, (order + non_rec)*sizeof(*hist));
181 181

  
182
    for (x=0; x < n; x++)
183
        hist[order + non_rec + x] = in[n-x-1];
182
    for (i=0; i < n; i++)
183
        hist[order + non_rec + i] = in[n-i-1];
184 184

  
185 185
    colmult(work, window, hist, order + n + non_rec);
186 186

  
187 187
    prodsum(buffer1, work + order    , n      , order);
188 188
    prodsum(buffer2, work + order + n, non_rec, order);
189 189

  
190
    for (x=0; x <= order; x++) {
191
        out2[x] = out2[x] * 0.5625 + buffer1[x];
192
        out [x] = out2[x]          + buffer2[x];
190
    for (i=0; i <= order; i++) {
191
        out2[i] = out2[i] * 0.5625 + buffer1[i];
192
        out [i] = out2[i]          + buffer2[i];
193 193
    }
194 194

  
195 195
    /* Multiply by the white noise correcting factor (WNCF) */
......
222 222
                              int buf_size)
223 223
{
224 224
    int16_t *out = data;
225
    int x, y;
225
    int i, j;
226 226
    RA288Context *ractx = avctx->priv_data;
227 227
    GetBitContext gb;
228 228

  
......
235 235

  
236 236
    init_get_bits(&gb, buf, avctx->block_align * 8);
237 237

  
238
    for (x=0; x < 32; x++) {
238
    for (i=0; i < 32; i++) {
239 239
        float gain = amptable[get_bits(&gb, 3)];
240
        int cb_coef = get_bits(&gb, 6 + (x&1));
240
        int cb_coef = get_bits(&gb, 6 + (i&1));
241 241

  
242 242
        decode(ractx, gain, cb_coef);
243 243

  
244
        for (y=0; y < 5; y++)
245
            *(out++) = 8 * ractx->sp_block[4 - y];
244
        for (j=0; j < 5; j++)
245
            *(out++) = 8 * ractx->sp_block[4 - j];
246 246

  
247
        if ((x & 7) == 3)
247
        if ((i & 7) == 3)
248 248
            backward_filter(ractx);
249 249
    }
250 250

  

Also available in: Unified diff