Home | History | Annotate | Download | only in src
      1 /*
      2  ** Copyright 2003-2010, VisualOn, Inc.
      3  **
      4  ** Licensed under the Apache License, Version 2.0 (the "License");
      5  ** you may not use this file except in compliance with the License.
      6  ** You may obtain a copy of the License at
      7  **
      8  **     http://www.apache.org/licenses/LICENSE-2.0
      9  **
     10  ** Unless required by applicable law or agreed to in writing, software
     11  ** distributed under the License is distributed on an "AS IS" BASIS,
     12  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  ** See the License for the specific language governing permissions and
     14  ** limitations under the License.
     15  */
     16 
     17 /***********************************************************************
     18 *       File: updt_tar.c                                               *
     19 *                                                                      *
     20 *       Description: Update the target vector for codebook search      *
     21 *                                                                      *
     22 ************************************************************************/
     23 
     24 #include "typedef.h"
     25 #include "basic_op.h"
     26 
     27 void Updt_tar(
     28         Word16 * x,                           /* (i) Q0  : old target (for pitch search)     */
     29         Word16 * x2,                          /* (o) Q0  : new target (for codebook search)  */
     30         Word16 * y,                           /* (i) Q0  : filtered adaptive codebook vector */
     31         Word16 gain,                          /* (i) Q14 : adaptive codebook gain            */
     32         Word16 L                              /* (i)     : subframe size                     */
     33          )
     34 {
     35     Word32 i;
     36     Word32 L_tmp, L_tmp2;
     37 
     38     for (i = 0; i < L; i++)
     39     {
     40         L_tmp = x[i] << 15;
     41         L_tmp2 = L_mult(y[i], gain);
     42         L_tmp = L_sub(L_tmp, L_tmp2);
     43         x2[i] = extract_h(L_shl2(L_tmp, 1));
     44     }
     45 
     46     return;
     47 }
     48 
     49 
     50 
     51