diff options
Diffstat (limited to 'media/libstagefright/codecs/amrwbenc/src/hp50.c')
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/src/hp50.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/media/libstagefright/codecs/amrwbenc/src/hp50.c b/media/libstagefright/codecs/amrwbenc/src/hp50.c index c1c7b83..807d672 100644 --- a/media/libstagefright/codecs/amrwbenc/src/hp50.c +++ b/media/libstagefright/codecs/amrwbenc/src/hp50.c @@ -17,7 +17,7 @@ /*********************************************************************** * File: hp50.c * * * -* Description: * +* Description: * * 2nd order high pass filter with cut off frequency at 31 Hz. * * Designed with cheby2 function in MATLAB. * * Optimized for fixed-point to get the following frequency response: * @@ -51,56 +51,56 @@ static Word16 a[3] = {8192, 16211, -8021}; /* Q12 (x2) */ void Init_HP50_12k8(Word16 mem[]) { - Set_zero(mem, 6); + Set_zero(mem, 6); } void HP50_12k8( - Word16 signal[], /* input/output signal */ - Word16 lg, /* lenght of signal */ - Word16 mem[] /* filter memory [6] */ - ) + Word16 signal[], /* input/output signal */ + Word16 lg, /* lenght of signal */ + Word16 mem[] /* filter memory [6] */ + ) { - Word16 x2; - Word16 y2_hi, y2_lo, y1_hi, y1_lo, x0, x1; - Word32 L_tmp; - Word32 num; + Word16 x2; + Word16 y2_hi, y2_lo, y1_hi, y1_lo, x0, x1; + Word32 L_tmp; + Word32 num; - y2_hi = *mem++; - y2_lo = *mem++; - y1_hi = *mem++; - y1_lo = *mem++; - x0 = *mem++; - x1 = *mem; - num = (Word32)lg; - do - { - x2 = x1; - x1 = x0; - x0 = *signal; - /* y[i] = b[0]*x[i] + b[1]*x[i-1] + b140[2]*x[i-2] */ - /* + a[1]*y[i-1] + a[2] * y[i-2]; */ - L_tmp = 8192 ; /* rounding to maximise precision */ - L_tmp += y1_lo * a[1]; - L_tmp += y2_lo * a[2]; - L_tmp = L_tmp >> 14; - L_tmp += (y1_hi * a[1] + y2_hi * a[2] + (x0 + x2) * b[0] + x1 * b[1]) << 1; - L_tmp <<= 2; /* coeff Q12 --> Q13 */ - y2_hi = y1_hi; - y2_lo = y1_lo; - y1_hi = (Word16)(L_tmp>>16); - y1_lo = (Word16)((L_tmp & 0xffff)>>1); - *signal++ = extract_h((L_add((L_tmp<<1), 0x8000))); - }while(--num !=0); + y2_hi = *mem++; + y2_lo = *mem++; + y1_hi = *mem++; + y1_lo = *mem++; + x0 = *mem++; + x1 = *mem; + num = (Word32)lg; + do + { + x2 = x1; + x1 = x0; + x0 = *signal; + /* y[i] = b[0]*x[i] + b[1]*x[i-1] + b140[2]*x[i-2] */ + /* + a[1]*y[i-1] + a[2] * y[i-2]; */ + L_tmp = 8192 ; /* rounding to maximise precision */ + L_tmp += y1_lo * a[1]; + L_tmp += y2_lo * a[2]; + L_tmp = L_tmp >> 14; + L_tmp += (y1_hi * a[1] + y2_hi * a[2] + (x0 + x2) * b[0] + x1 * b[1]) << 1; + L_tmp <<= 2; /* coeff Q12 --> Q13 */ + y2_hi = y1_hi; + y2_lo = y1_lo; + y1_hi = (Word16)(L_tmp>>16); + y1_lo = (Word16)((L_tmp & 0xffff)>>1); + *signal++ = extract_h((L_add((L_tmp<<1), 0x8000))); + }while(--num !=0); - *mem-- = x1; - *mem-- = x0; - *mem-- = y1_lo; - *mem-- = y1_hi; - *mem-- = y2_lo; - *mem-- = y2_hi; + *mem-- = x1; + *mem-- = x0; + *mem-- = y1_lo; + *mem-- = y1_hi; + *mem-- = y2_lo; + *mem-- = y2_hi; - return; + return; } |