Revision 11bb2eb0 libavcodec/ra144.c

View differences:

libavcodec/ra144.c
174 174
    memcpy(statbuf, work + 40, 20);
175 175
}
176 176

  
177
static unsigned int rms(const int *data, int f)
177
static unsigned int rescale_rms(int rms, int energy)
178
{
179
    return (rms * energy) >> 10;
180
}
181

  
182
static unsigned int rms(const int *data)
178 183
{
179 184
    int x;
180 185
    unsigned int res = 0x10000;
......
197 202
        res = t_sqrt(res);
198 203

  
199 204
    res >>= (b + 10);
200
    res = (res * f) >> 10;
201 205
    return res;
202 206
}
203 207

  
......
314 318
        // coefficients
315 319
        if (copynew) {
316 320
            int_to_int16(decsp, ractx->lpc_coef);
317
            return rms(ractx->lpc_refl, energy);
321
            return rescale_rms(rms(ractx->lpc_refl), energy);
318 322
        } else {
319 323
            int_to_int16(decsp, ractx->lpc_coef_old);
320
            return rms(ractx->lpc_refl_old, energy);
324
            return rescale_rms(rms(ractx->lpc_refl_old), energy);
321 325
        }
322 326
    } else {
323
        return rms(work, energy);
327
        return rescale_rms(rms(work), energy);
324 328
    }
325 329
}
326 330

  
......
358 362
    refl_rms[1] = interp(ractx, block_coefs[1], 1, energy > ractx->old_energy,
359 363
                    t_sqrt(energy*ractx->old_energy) >> 12);
360 364
    refl_rms[2] = interp(ractx, block_coefs[2], 2, 1, energy);
361
    refl_rms[3] = rms(ractx->lpc_refl, energy);
365
    refl_rms[3] = rescale_rms(rms(ractx->lpc_refl), energy);
362 366

  
363 367
    int_to_int16(block_coefs[3], ractx->lpc_coef);
364 368

  

Also available in: Unified diff