g729ev_fec_tools.c

来自「最新的ITU-T的宽带语音编解码标准G.729.1,是对原先的G.729的最好的」· C语言 代码 · 共 100 行

C
100
字号
/* ITU-T G.729EV Optimization/Characterization Candidate                         *//* Version:       1.0.a                                                          *//* Revision Date: June 28, 2006                                                  *//*   ITU-T G.729EV Optimization/Characterization Candidate    ANSI-C Source Code   Copyright (c) 2006    France Telecom, Matsushita Electric, Mindspeed, Siemens AG, ETRI, VoiceAge Corp.   All rights reserved*//*-----------------------------------------------------------* * Tool library * ~~~~~~~~~~~~~~~~~~~                                              *-----------------------------------------------------------*//* Fixed-point definitions and prototypes */#include "G729EV_MAIN_defines.h"#include "G729EV_G729_defines.h"#include "G729EV_FEC_tools.h"#include "G729EV_FEC_fer.h"#include "stl.h"/*----------------------------------------------------------------------------------* * procedure   Emaximum:                                      *             ~~~~~~~~                                       *   Find index of a maximum energy in a vector               *----------------------------------------------------------------------------------*/Word16 G729EV_Emaximum2(                    /* o:   return index with energy value in vector  Q0 */                         const Word16 Qvec, /* i:   Q of input vector                         Q0 */                         const Word16 * vec,/* i:   input vector                              Qx */                         const Word16 lvec, /* i:   length of input vector                    Q0 */                         Word32 * ener_max  /* o:   maximum energy value                      Q0 */    ){  Word16    j, ind;  Word32    L_tmp;#if(WMOPS)  move16();  move32();#endif  *ener_max = (Word32) 0;  ind = (Word16) 0;  FOR(j = 0; j < lvec; j++)  {    L_tmp = L_mult(vec[j], vec[j]);    if (L_sub(L_tmp, *ener_max) > 0)    {      ind = j;      move16();      *ener_max = L_tmp;      move32();#if(WMOPS)      move16();      move32();#endif    }  }#if(WMOPS)  move32();#endif  *ener_max = L_shr(*ener_max, add(add(Qvec, Qvec), 1));  return ind;}/*----------------------------------------------------------------------------------* * Function Name : Dot_product()                            * Compute scalar product of <x[],y[]> using accumulator.    * Performs no normalization, as opposed to Dot_product12()   *----------------------------------------------------------------------------------*/Word32 G729EV_Dot_product(                    /* o:   Sum               */                           const Word16 x[],  /* i:   12bits: x vector  */                           const Word16 y[],  /* i:   12bits: y vector  */                           const Word16 lg    /* i:   vector length     */    ){  Word16    i;  Word32    L_sum;  L_sum = L_mac(1L, x[0], y[0]);  FOR(i = 1; i < lg; i++)  {    L_sum = L_mac(L_sum, x[i], y[i]);  }  return (L_sum);}/*----------------------------------------------------------------------------------* * Scale_sig                                                  *----------------------------------------------------------------------------------*/void G729EV_Scale_sig(Word16 x[],       /* i/o: signal to scale                 Qx        */                      const Word16 lg,  /* i:   size of x[]                     Q0        */                      const Word16 exp0 /* i:   exponent: x = round(x << exp)   Qx 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?