Commit 5d2f52b9 authored by Michael Niedermayer's avatar Michael Niedermayer

simplify

Originally committed as revision 5576 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b2e30cb3
...@@ -649,7 +649,7 @@ static void quantize_lpc_coefs(double *lpc_in, int order, int precision, ...@@ -649,7 +649,7 @@ static void quantize_lpc_coefs(double *lpc_in, int order, int precision,
int32_t *lpc_out, int *shift) int32_t *lpc_out, int *shift)
{ {
int i; int i;
double d, cmax; double cmax;
int32_t qmax; int32_t qmax;
int sh; int sh;
...@@ -659,18 +659,13 @@ static void quantize_lpc_coefs(double *lpc_in, int order, int precision, ...@@ -659,18 +659,13 @@ static void quantize_lpc_coefs(double *lpc_in, int order, int precision,
/* find maximum coefficient value */ /* find maximum coefficient value */
cmax = 0.0; cmax = 0.0;
for(i=0; i<order; i++) { for(i=0; i<order; i++) {
d = lpc_in[i]; cmax= FFMAX(cmax, fabs(lpc_in[i]));
if(d < 0) d = -d;
if(d > cmax)
cmax = d;
} }
/* if maximum value quantizes to zero, return all zeros */ /* if maximum value quantizes to zero, return all zeros */
if(cmax * (1 << MAX_LPC_SHIFT) < 1.0) { if(cmax * (1 << MAX_LPC_SHIFT) < 1.0) {
*shift = 0; *shift = 0;
for(i=0; i<order; i++) { memset(lpc_out, 0, sizeof(int32_t) * order);
lpc_out[i] = 0;
}
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment