diff options
author | Mans Rullgard <mans@mansr.com> | 2011-04-22 09:22:33 +0300 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-05-21 09:39:22 -0700 |
commit | e2e838afcf03e603a41a0455846eaf9614537c16 (patch) | |
tree | b6c2eedacc690a2c5514ac33dea7267cb38744bf /media/libstagefright/codecs/amrwbenc/src/g_pitch.c | |
parent | 8294aac281863e584027c3f2c7d2007c4140bf24 (diff) | |
download | frameworks_av-e2e838afcf03e603a41a0455846eaf9614537c16.zip frameworks_av-e2e838afcf03e603a41a0455846eaf9614537c16.tar.gz frameworks_av-e2e838afcf03e603a41a0455846eaf9614537c16.tar.bz2 |
Convert line breaks to Unix style
Change-Id: I6219725a9fbd72432bad71a176c14f26fabdbd5f
Diffstat (limited to 'media/libstagefright/codecs/amrwbenc/src/g_pitch.c')
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/src/g_pitch.c | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/media/libstagefright/codecs/amrwbenc/src/g_pitch.c b/media/libstagefright/codecs/amrwbenc/src/g_pitch.c index 570138e..f5112c5 100644 --- a/media/libstagefright/codecs/amrwbenc/src/g_pitch.c +++ b/media/libstagefright/codecs/amrwbenc/src/g_pitch.c @@ -1,79 +1,79 @@ -/*
- ** Copyright 2003-2010, VisualOn, Inc.
- **
- ** Licensed under the Apache License, Version 2.0 (the "License");
- ** you may not use this file except in compliance with the License.
- ** You may obtain a copy of the License at
- **
- ** http://www.apache.org/licenses/LICENSE-2.0
- **
- ** Unless required by applicable law or agreed to in writing, software
- ** distributed under the License is distributed on an "AS IS" BASIS,
- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ** See the License for the specific language governing permissions and
- ** limitations under the License.
- */
-
-/***********************************************************************
-* File: g_pitch.c *
-* *
-* Description:Compute the gain of pitch. Result in Q12 *
-* if(gain < 0) gain = 0 *
-* if(gain > 1.2) gain = 1.2 *
-************************************************************************/
-
-#include "typedef.h"
-#include "basic_op.h"
-#include "math_op.h"
-
-Word16 G_pitch( /* (o) Q14 : Gain of pitch lag saturated to 1.2 */
- Word16 xn[], /* (i) : Pitch target. */
- Word16 y1[], /* (i) : filtered adaptive codebook. */
- Word16 g_coeff[], /* : Correlations need for gain quantization. */
- Word16 L_subfr /* : Length of subframe. */
- )
-{
- Word32 i;
- Word16 xy, yy, exp_xy, exp_yy, gain;
- /* Compute scalar product <y1[],y1[]> */
-#ifdef ASM_OPT /* asm optimization branch */
- /* Compute scalar product <xn[],y1[]> */
- xy = extract_h(Dot_product12_asm(xn, y1, L_subfr, &exp_xy));
- yy = extract_h(Dot_product12_asm(y1, y1, L_subfr, &exp_yy));
-
-#else
- /* Compute scalar product <xn[],y1[]> */
- xy = extract_h(Dot_product12(xn, y1, L_subfr, &exp_xy));
- yy = extract_h(Dot_product12(y1, y1, L_subfr, &exp_yy));
-
-#endif
-
- g_coeff[0] = yy;
- g_coeff[1] = exp_yy;
- g_coeff[2] = xy;
- g_coeff[3] = exp_xy;
-
- /* If (xy < 0) gain = 0 */
- if (xy < 0)
- return ((Word16) 0);
-
- /* compute gain = xy/yy */
-
- xy >>= 1; /* Be sure xy < yy */
- gain = div_s(xy, yy);
-
- i = exp_xy;
- i -= exp_yy;
-
- gain = shl(gain, i);
-
- /* if (gain > 1.2) gain = 1.2 in Q14 */
- if(gain > 19661)
- {
- gain = 19661;
- }
- return (gain);
-}
-
-
-
+/* + ** Copyright 2003-2010, VisualOn, Inc. + ** + ** Licensed under the Apache License, Version 2.0 (the "License"); + ** you may not use this file except in compliance with the License. + ** You may obtain a copy of the License at + ** + ** http://www.apache.org/licenses/LICENSE-2.0 + ** + ** Unless required by applicable law or agreed to in writing, software + ** distributed under the License is distributed on an "AS IS" BASIS, + ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ** See the License for the specific language governing permissions and + ** limitations under the License. + */ + +/*********************************************************************** +* File: g_pitch.c * +* * +* Description:Compute the gain of pitch. Result in Q12 * +* if(gain < 0) gain = 0 * +* if(gain > 1.2) gain = 1.2 * +************************************************************************/ + +#include "typedef.h" +#include "basic_op.h" +#include "math_op.h" + +Word16 G_pitch( /* (o) Q14 : Gain of pitch lag saturated to 1.2 */ + Word16 xn[], /* (i) : Pitch target. */ + Word16 y1[], /* (i) : filtered adaptive codebook. */ + Word16 g_coeff[], /* : Correlations need for gain quantization. */ + Word16 L_subfr /* : Length of subframe. */ + ) +{ + Word32 i; + Word16 xy, yy, exp_xy, exp_yy, gain; + /* Compute scalar product <y1[],y1[]> */ +#ifdef ASM_OPT /* asm optimization branch */ + /* Compute scalar product <xn[],y1[]> */ + xy = extract_h(Dot_product12_asm(xn, y1, L_subfr, &exp_xy)); + yy = extract_h(Dot_product12_asm(y1, y1, L_subfr, &exp_yy)); + +#else + /* Compute scalar product <xn[],y1[]> */ + xy = extract_h(Dot_product12(xn, y1, L_subfr, &exp_xy)); + yy = extract_h(Dot_product12(y1, y1, L_subfr, &exp_yy)); + +#endif + + g_coeff[0] = yy; + g_coeff[1] = exp_yy; + g_coeff[2] = xy; + g_coeff[3] = exp_xy; + + /* If (xy < 0) gain = 0 */ + if (xy < 0) + return ((Word16) 0); + + /* compute gain = xy/yy */ + + xy >>= 1; /* Be sure xy < yy */ + gain = div_s(xy, yy); + + i = exp_xy; + i -= exp_yy; + + gain = shl(gain, i); + + /* if (gain > 1.2) gain = 1.2 in Q14 */ + if(gain > 19661) + { + gain = 19661; + } + return (gain); +} + + + |