comparison ra144.c @ 6991:3a148660d0be libavcodec

Remove warning that could never be triggered. Thanks Mkhodor for pointing it out.
author vitor
date Mon, 02 Jun 2008 18:29:04 +0000
parents 7f7de664020f
children 5bad976fae7b
comparison
equal deleted inserted replaced
6990:f855f314fb62 6991:3a148660d0be
172 172
173 memcpy(out, work+10, len * 2); 173 memcpy(out, work+10, len * 2);
174 memcpy(statbuf, work + 40, 20); 174 memcpy(statbuf, work + 40, 20);
175 } 175 }
176 176
177 static unsigned int rms(const int *data, int f, RA144Context *ractx) 177 static unsigned int rms(const int *data, int f)
178 { 178 {
179 int x; 179 int x;
180 unsigned int res = 0x10000; 180 unsigned int res = 0x10000;
181 int b = 0; 181 int b = 0;
182 182
183 for (x=0; x<10; x++) { 183 for (x=0; x<10; x++) {
184 res = (((0x1000000 - (*data) * (*data)) >> 12) * res) >> 12; 184 res = (((0x1000000 - (*data) * (*data)) >> 12) * res) >> 12;
185 185
186 if (res == 0) 186 if (res == 0)
187 return 0; 187 return 0;
188
189 if (res > 0x10000) {
190 av_log(ractx, AV_LOG_ERROR, "Overflow. Broken sample?\n");
191 return 0;
192 }
193 188
194 while (res <= 0x3fff) { 189 while (res <= 0x3fff) {
195 b++; 190 b++;
196 res <<= 2; 191 res <<= 2;
197 } 192 }
317 if (eval_refl(decsp, work, ractx)) { 312 if (eval_refl(decsp, work, ractx)) {
318 // The interpolated coefficients are unstable, copy either new or old 313 // The interpolated coefficients are unstable, copy either new or old
319 // coefficients 314 // coefficients
320 if (copynew) { 315 if (copynew) {
321 int_to_int16(decsp, ractx->lpc_coef); 316 int_to_int16(decsp, ractx->lpc_coef);
322 return rms(ractx->lpc_refl, energy, ractx); 317 return rms(ractx->lpc_refl, energy);
323 } else { 318 } else {
324 int_to_int16(decsp, ractx->lpc_coef_old); 319 int_to_int16(decsp, ractx->lpc_coef_old);
325 return rms(ractx->lpc_refl_old, energy, ractx); 320 return rms(ractx->lpc_refl_old, energy);
326 } 321 }
327 } else { 322 } else {
328 return rms(work, energy, ractx); 323 return rms(work, energy);
329 } 324 }
330 } 325 }
331 326
332 /* Uncompress one block (20 bytes -> 160*2 bytes) */ 327 /* Uncompress one block (20 bytes -> 160*2 bytes) */
333 static int ra144_decode_frame(AVCodecContext * avctx, 328 static int ra144_decode_frame(AVCodecContext * avctx,
361 356
362 refl_rms[0] = interp(ractx, block_coefs[0], 0, 0, ractx->old_energy); 357 refl_rms[0] = interp(ractx, block_coefs[0], 0, 0, ractx->old_energy);
363 refl_rms[1] = interp(ractx, block_coefs[1], 1, energy > ractx->old_energy, 358 refl_rms[1] = interp(ractx, block_coefs[1], 1, energy > ractx->old_energy,
364 t_sqrt(energy*ractx->old_energy) >> 12); 359 t_sqrt(energy*ractx->old_energy) >> 12);
365 refl_rms[2] = interp(ractx, block_coefs[2], 2, 1, energy); 360 refl_rms[2] = interp(ractx, block_coefs[2], 2, 1, energy);
366 refl_rms[3] = rms(ractx->lpc_refl, energy, ractx); 361 refl_rms[3] = rms(ractx->lpc_refl, energy);
367 362
368 int_to_int16(block_coefs[3], ractx->lpc_coef); 363 int_to_int16(block_coefs[3], ractx->lpc_coef);
369 364
370 /* do output */ 365 /* do output */
371 for (c=0; c<4; c++) { 366 for (c=0; c<4; c++) {