Home | History | Annotate | Download | only in inc
      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 /*--------------------------------------------------------------------------*
     19  *                         ACELP.H                                          *
     20  *--------------------------------------------------------------------------*
     21  *       Function			 			             *
     22  *--------------------------------------------------------------------------*/
     23 #ifndef __ACELP_H__
     24 #define __ACELP_H__
     25 
     26 #include "typedef.h"
     27 #include "cod_main.h"
     28 
     29 /*-----------------------------------------------------------------*
     30  *                        LPC prototypes                           *
     31  *-----------------------------------------------------------------*/
     32 
     33 Word16 median5(Word16 x[]);
     34 
     35 void Autocorr(
     36 		Word16 x[],                           /* (i)    : Input signal                      */
     37 		Word16 m,                             /* (i)    : LPC order                         */
     38 		Word16 r_h[],                         /* (o)    : Autocorrelations  (msb)           */
     39 		Word16 r_l[]                          /* (o)    : Autocorrelations  (lsb)           */
     40 	     );
     41 
     42 void Lag_window(
     43 		Word16 r_h[],                         /* (i/o)   : Autocorrelations  (msb)          */
     44 		Word16 r_l[]                          /* (i/o)   : Autocorrelations  (lsb)          */
     45 	       );
     46 
     47 void Init_Levinson(
     48 		Word16 * mem                          /* output  :static memory (18 words) */
     49 		);
     50 
     51 void Levinson(
     52 		Word16 Rh[],                          /* (i)     : Rh[M+1] Vector of autocorrelations (msb) */
     53 		Word16 Rl[],                          /* (i)     : Rl[M+1] Vector of autocorrelations (lsb) */
     54 		Word16 A[],                           /* (o) Q12 : A[M]    LPC coefficients  (m = 16)       */
     55 		Word16 rc[],                          /* (o) Q15 : rc[M]   Reflection coefficients.         */
     56 		Word16 * mem                          /* (i/o)   :static memory (18 words)                  */
     57 	     );
     58 
     59 void Az_isp(
     60 		Word16 a[],                           /* (i) Q12 : predictor coefficients                 */
     61 		Word16 isp[],                         /* (o) Q15 : Immittance spectral pairs              */
     62 		Word16 old_isp[]                      /* (i)     : old isp[] (in case not found M roots)  */
     63 	   );
     64 
     65 void Isp_Az(
     66 		Word16 isp[],                         /* (i) Q15 : Immittance spectral pairs            */
     67 		Word16 a[],                           /* (o) Q12 : predictor coefficients (order = M)   */
     68 		Word16 m,
     69 		Word16 adaptive_scaling               /* (i) 0   : adaptive scaling disabled */
     70 		/*     1   : adaptive scaling enabled  */
     71 	   );
     72 
     73 void Isp_isf(
     74 		Word16 isp[],                         /* (i) Q15 : isp[m] (range: -1<=val<1)                */
     75 		Word16 isf[],                         /* (o) Q15 : isf[m] normalized (range: 0.0<=val<=0.5) */
     76 		Word16 m                              /* (i)     : LPC order                                */
     77 	    );
     78 
     79 void Isf_isp(
     80 		Word16 isf[],                         /* (i) Q15 : isf[m] normalized (range: 0.0<=val<=0.5) */
     81 		Word16 isp[],                         /* (o) Q15 : isp[m] (range: -1<=val<1)                */
     82 		Word16 m                              /* (i)     : LPC order                                */
     83 	    );
     84 
     85 void Int_isp(
     86 		Word16 isp_old[],                     /* input : isps from past frame              */
     87 		Word16 isp_new[],                     /* input : isps from present frame           */
     88 		Word16 frac[],                        /* input : fraction for 3 first subfr (Q15)  */
     89 		Word16 Az[]                           /* output: LP coefficients in 4 subframes    */
     90 	    );
     91 
     92 void Weight_a(
     93 		Word16 a[],                           /* (i) Q12 : a[m+1]  LPC coefficients             */
     94 		Word16 ap[],                          /* (o) Q12 : Spectral expanded LPC coefficients   */
     95 		Word16 gamma,                         /* (i) Q15 : Spectral expansion factor.           */
     96 		Word16 m                              /* (i)     : LPC order.                           */
     97 	     );
     98 
     99 
    100 /*-----------------------------------------------------------------*
    101  *                        isf quantizers                           *
    102  *-----------------------------------------------------------------*/
    103 
    104 void Qpisf_2s_46b(
    105 		Word16 * isf1,                        /* (i) Q15 : ISF in the frequency domain (0..0.5) */
    106 		Word16 * isf_q,                       /* (o) Q15 : quantized ISF               (0..0.5) */
    107 		Word16 * past_isfq,                   /* (io)Q15 : past ISF quantizer                   */
    108 		Word16 * indice,                      /* (o)     : quantization indices                 */
    109 		Word16 nb_surv                        /* (i)     : number of survivor (1, 2, 3 or 4)    */
    110 		);
    111 
    112 void Qpisf_2s_36b(
    113 		Word16 * isf1,                        /* (i) Q15 : ISF in the frequency domain (0..0.5) */
    114 		Word16 * isf_q,                       /* (o) Q15 : quantized ISF               (0..0.5) */
    115 		Word16 * past_isfq,                   /* (io)Q15 : past ISF quantizer                   */
    116 		Word16 * indice,                      /* (o)     : quantization indices                 */
    117 		Word16 nb_surv                        /* (i)     : number of survivor (1, 2, 3 or 4)    */
    118 		);
    119 
    120 void Dpisf_2s_46b(
    121 		Word16 * indice,                      /* input:  quantization indices                       */
    122 		Word16 * isf_q,                       /* output: quantized ISF in frequency domain (0..0.5) */
    123 		Word16 * past_isfq,                   /* i/0   : past ISF quantizer                    */
    124 		Word16 * isfold,                      /* input : past quantized ISF                    */
    125 		Word16 * isf_buf,                     /* input : isf buffer                                                        */
    126 		Word16 bfi,                           /* input : Bad frame indicator                   */
    127 		Word16 enc_dec
    128 		);
    129 
    130 void Dpisf_2s_36b(
    131 		Word16 * indice,                      /* input:  quantization indices                       */
    132 		Word16 * isf_q,                       /* output: quantized ISF in frequency domain (0..0.5) */
    133 		Word16 * past_isfq,                   /* i/0   : past ISF quantizer                    */
    134 		Word16 * isfold,                      /* input : past quantized ISF                    */
    135 		Word16 * isf_buf,                     /* input : isf buffer                                                        */
    136 		Word16 bfi,                           /* input : Bad frame indicator                   */
    137 		Word16 enc_dec
    138 		);
    139 
    140 void Qisf_ns(
    141 		Word16 * isf1,                        /* input : ISF in the frequency domain (0..0.5) */
    142 		Word16 * isf_q,                       /* output: quantized ISF                        */
    143 		Word16 * indice                       /* output: quantization indices                 */
    144 	    );
    145 
    146 void Disf_ns(
    147 		Word16 * indice,                      /* input:  quantization indices                  */
    148 		Word16 * isf_q                        /* input : ISF in the frequency domain (0..0.5)  */
    149 	    );
    150 
    151 Word16 Sub_VQ(                             /* output: return quantization index     */
    152 		Word16 * x,                           /* input : ISF residual vector           */
    153 		Word16 * dico,                        /* input : quantization codebook         */
    154 		Word16 dim,                           /* input : dimention of vector           */
    155 		Word16 dico_size,                     /* input : size of quantization codebook */
    156 		Word32 * distance                     /* output: error of quantization         */
    157 	     );
    158 
    159 void Reorder_isf(
    160 		Word16 * isf,                         /* (i/o) Q15: ISF in the frequency domain (0..0.5) */
    161 		Word16 min_dist,                      /* (i) Q15  : minimum distance to keep             */
    162 		Word16 n                              /* (i)      : number of ISF                        */
    163 		);
    164 
    165 /*-----------------------------------------------------------------*
    166  *                       filter prototypes                         *
    167  *-----------------------------------------------------------------*/
    168 
    169 void Init_Decim_12k8(
    170 		Word16 mem[]                          /* output: memory (2*NB_COEF_DOWN) set to zeros */
    171 		);
    172 void Decim_12k8(
    173 		Word16 sig16k[],                      /* input:  signal to downsampling  */
    174 		Word16 lg,                            /* input:  length of input         */
    175 		Word16 sig12k8[],                     /* output: decimated signal        */
    176 		Word16 mem[]                          /* in/out: memory (2*NB_COEF_DOWN) */
    177 	       );
    178 
    179 void Init_HP50_12k8(Word16 mem[]);
    180 void HP50_12k8(
    181 		Word16 signal[],                      /* input/output signal */
    182 		Word16 lg,                            /* lenght of signal    */
    183 		Word16 mem[]                          /* filter memory [6]   */
    184 	      );
    185 void Init_HP400_12k8(Word16 mem[]);
    186 void HP400_12k8(
    187 		Word16 signal[],                      /* input/output signal */
    188 		Word16 lg,                            /* lenght of signal    */
    189 		Word16 mem[]                          /* filter memory [6]   */
    190 	       );
    191 
    192 void Init_Filt_6k_7k(Word16 mem[]);
    193 void Filt_6k_7k(
    194 		Word16 signal[],                      /* input:  signal                  */
    195 		Word16 lg,                            /* input:  length of input         */
    196 		Word16 mem[]                          /* in/out: memory (size=30)        */
    197 	       );
    198 void Filt_6k_7k_asm(
    199 		Word16 signal[],                      /* input:  signal                  */
    200 		Word16 lg,                            /* input:  length of input         */
    201 		Word16 mem[]                          /* in/out: memory (size=30)        */
    202 	       );
    203 
    204 void LP_Decim2(
    205 		Word16 x[],                           /* in/out: signal to process         */
    206 		Word16 l,                             /* input : size of filtering         */
    207 		Word16 mem[]                          /* in/out: memory (size=3)           */
    208 	      );
    209 
    210 void Preemph(
    211 		Word16 x[],                           /* (i/o)   : input signal overwritten by the output */
    212 		Word16 mu,                            /* (i) Q15 : preemphasis coefficient                */
    213 		Word16 lg,                            /* (i)     : lenght of filtering                    */
    214 		Word16 * mem                          /* (i/o)   : memory (x[-1])                         */
    215 	    );
    216 void Preemph2(
    217 		Word16 x[],                           /* (i/o)   : input signal overwritten by the output */
    218 		Word16 mu,                            /* (i) Q15 : preemphasis coefficient                */
    219 		Word16 lg,                            /* (i)     : lenght of filtering                    */
    220 		Word16 * mem                          /* (i/o)   : memory (x[-1])                         */
    221 	     );
    222 void Deemph(
    223 		Word16 x[],                           /* (i/o)   : input signal overwritten by the output */
    224 		Word16 mu,                            /* (i) Q15 : deemphasis factor                      */
    225 		Word16 L,                             /* (i)     : vector size                            */
    226 		Word16 * mem                          /* (i/o)   : memory (y[-1])                         */
    227 	   );
    228 void Deemph2(
    229 		Word16 x[],                           /* (i/o)   : input signal overwritten by the output */
    230 		Word16 mu,                            /* (i) Q15 : deemphasis factor                      */
    231 		Word16 L,                             /* (i)     : vector size                            */
    232 		Word16 * mem                          /* (i/o)   : memory (y[-1])                         */
    233 	    );
    234 void Deemph_32(
    235 		Word16 x_hi[],                        /* (i)     : input signal (bit31..16) */
    236 		Word16 x_lo[],                        /* (i)     : input signal (bit15..4)  */
    237 		Word16 y[],                           /* (o)     : output signal (x16)      */
    238 		Word16 mu,                            /* (i) Q15 : deemphasis factor        */
    239 		Word16 L,                             /* (i)     : vector size              */
    240 		Word16 * mem                          /* (i/o)   : memory (y[-1])           */
    241 	      );
    242 
    243 void Deemph_32_asm(
    244 		Word16 x_hi[],                        /* (i)     : input signal (bit31..16) */
    245 		Word16 x_lo[],                        /* (i)     : input signal (bit15..4)  */
    246 		Word16 y[],                           /* (o)     : output signal (x16)      */
    247 		Word16 * mem                          /* (i/o)   : memory (y[-1])           */
    248 	      );
    249 
    250 void Convolve(
    251 		Word16 x[],                           /* (i)     : input vector                              */
    252 		Word16 h[],                           /* (i) Q15    : impulse response                       */
    253 		Word16 y[],                           /* (o) 12 bits: output vector                          */
    254 		Word16 L                              /* (i)     : vector size                               */
    255 	     );
    256 
    257 void Convolve_asm(
    258 		Word16 x[],                           /* (i)     : input vector                              */
    259 		Word16 h[],                           /* (i) Q15    : impulse response                       */
    260 		Word16 y[],                           /* (o) 12 bits: output vector                          */
    261 		Word16 L                              /* (i)     : vector size                               */
    262 	     );
    263 
    264 void Residu(
    265 		Word16 a[],                           /* (i) Q12 : prediction coefficients                     */
    266 		Word16 x[],                           /* (i)     : speech (values x[-m..-1] are needed         */
    267 		Word16 y[],                           /* (o)     : residual signal                             */
    268 		Word16 lg                             /* (i)     : size of filtering                           */
    269 		);
    270 
    271 void Residu_opt(
    272 		Word16 a[],                           /* (i) Q12 : prediction coefficients                     */
    273 		Word16 x[],                           /* (i)     : speech (values x[-m..-1] are needed         */
    274 		Word16 y[],                           /* (o)     : residual signal                             */
    275 		Word16 lg                             /* (i)     : size of filtering                           */
    276 		);
    277 
    278 void Syn_filt(
    279 	Word16 a[],                           /* (i) Q12 : a[m+1] prediction coefficients           */
    280 	Word16 x[],                           /* (i)     : input signal                             */
    281 	Word16 y[],                           /* (o)     : output signal                            */
    282 	Word16 lg,                            /* (i)     : size of filtering                        */
    283 	Word16 mem[],                         /* (i/o)   : memory associated with this filtering.   */
    284 	Word16 update                         /* (i)     : 0=no update, 1=update of memory.         */
    285 	);
    286 
    287 void Syn_filt_asm(
    288 	Word16 a[],                           /* (i) Q12 : a[m+1] prediction coefficients           */
    289 	Word16 x[],                           /* (i)     : input signal                             */
    290 	Word16 y[],                           /* (o)     : output signal                            */
    291 	Word16 mem[]                          /* (i/o)   : memory associated with this filtering.   */
    292 	);
    293 
    294 void Syn_filt_32(
    295 	Word16 a[],                           /* (i) Q12 : a[m+1] prediction coefficients */
    296 	Word16 m,                             /* (i)     : order of LP filter             */
    297 	Word16 exc[],                         /* (i) Qnew: excitation (exc[i] >> Qnew)    */
    298 	Word16 Qnew,                          /* (i)     : exc scaling = 0(min) to 8(max) */
    299 	Word16 sig_hi[],                      /* (o) /16 : synthesis high                 */
    300 	Word16 sig_lo[],                      /* (o) /16 : synthesis low                  */
    301 	Word16 lg                             /* (i)     : size of filtering              */
    302 	);
    303 
    304 void Syn_filt_32_asm(
    305 	Word16 a[],                           /* (i) Q12 : a[m+1] prediction coefficients */
    306 	Word16 m,                             /* (i)     : order of LP filter             */
    307 	Word16 exc[],                         /* (i) Qnew: excitation (exc[i] >> Qnew)    */
    308 	Word16 Qnew,                          /* (i)     : exc scaling = 0(min) to 8(max) */
    309 	Word16 sig_hi[],                      /* (o) /16 : synthesis high                 */
    310 	Word16 sig_lo[],                      /* (o) /16 : synthesis low                  */
    311 	Word16 lg                             /* (i)     : size of filtering              */
    312 	);
    313 /*-----------------------------------------------------------------*
    314  *                       pitch prototypes                          *
    315  *-----------------------------------------------------------------*/
    316 
    317 Word16 Pitch_ol(                           /* output: open loop pitch lag                        */
    318      Word16 signal[],                      /* input : signal used to compute the open loop pitch */
    319 /* signal[-pit_max] to signal[-1] should be known */
    320      Word16 pit_min,                       /* input : minimum pitch lag                          */
    321      Word16 pit_max,                       /* input : maximum pitch lag                          */
    322      Word16 L_frame                        /* input : length of frame to compute pitch           */
    323 );
    324 
    325 Word16 Pitch_med_ol(                       /* output: open loop pitch lag                        */
    326      Word16 wsp[],                         /* input : signal used to compute the open loop pitch */
    327                                            /* wsp[-pit_max] to wsp[-1] should be known   */
    328      Coder_State *st,                      /* i/o : global codec structure */
    329      Word16 L_frame                        /* input : length of frame to compute pitch           */
    330 );
    331 
    332 Word16 Med_olag(                           /* output : median of  5 previous open-loop lags       */
    333      Word16 prev_ol_lag,                   /* input  : previous open-loop lag                     */
    334      Word16 old_ol_lag[5]
    335 );
    336 
    337 void Init_Hp_wsp(Word16 mem[]);
    338 void scale_mem_Hp_wsp(Word16 mem[], Word16 exp);
    339 void Hp_wsp(
    340      Word16 wsp[],                         /* i   : wsp[]  signal       */
    341      Word16 hp_wsp[],                      /* o   : hypass wsp[]        */
    342      Word16 lg,                            /* i   : lenght of signal    */
    343      Word16 mem[]                          /* i/o : filter memory [9]   */
    344 );
    345 
    346 Word16 Pitch_fr4(                          /* (o)     : pitch period.                         */
    347      Word16 exc[],                         /* (i)     : excitation buffer                     */
    348      Word16 xn[],                          /* (i)     : target vector                         */
    349      Word16 h[],                           /* (i) Q15 : impulse response of synth/wgt filters */
    350      Word16 t0_min,                        /* (i)     : minimum value in the searched range.  */
    351      Word16 t0_max,                        /* (i)     : maximum value in the searched range.  */
    352      Word16 * pit_frac,                    /* (o)     : chosen fraction (0, 1, 2 or 3).       */
    353      Word16 i_subfr,                       /* (i)     : indicator for first subframe.         */
    354      Word16 t0_fr2,                        /* (i)     : minimum value for resolution 1/2      */
    355      Word16 t0_fr1,                        /* (i)     : minimum value for resolution 1        */
    356      Word16 L_subfr                        /* (i)     : Length of subframe                    */
    357 );
    358 void Pred_lt4(
    359      Word16 exc[],                         /* in/out: excitation buffer */
    360      Word16 T0,                            /* input : integer pitch lag */
    361      Word16 frac,                          /* input : fraction of lag   */
    362      Word16 L_subfr                        /* input : subframe size     */
    363 );
    364 
    365 void pred_lt4_asm(
    366      Word16 exc[],                         /* in/out: excitation buffer */
    367      Word16 T0,                            /* input : integer pitch lag */
    368      Word16 frac,                          /* input : fraction of lag   */
    369      Word16 L_subfr                        /* input : subframe size     */
    370 );
    371 
    372 /*-----------------------------------------------------------------*
    373  *                       gain prototypes                           *
    374  *-----------------------------------------------------------------*/
    375 
    376 Word16 G_pitch(                            /* (o) Q14 : Gain of pitch lag saturated to 1.2   */
    377      Word16 xn[],                          /* (i)     : Pitch target.                        */
    378      Word16 y1[],                          /* (i)     : filtered adaptive codebook.          */
    379      Word16 g_coeff[],                     /* : Correlations need for gain quantization. */
    380      Word16 L_subfr                        /* : Length of subframe.                  */
    381 );
    382 void Init_Q_gain2(
    383      Word16 * mem                          /* output  :static memory (2 words)      */
    384 );
    385 Word16 Q_gain2(                            /* Return index of quantization.        */
    386      Word16 xn[],                          /* (i) Q_xn:Target vector.               */
    387      Word16 y1[],                          /* (i) Q_xn:Adaptive codebook.           */
    388      Word16 Q_xn,                          /* (i)     :xn and y1 format             */
    389      Word16 y2[],                          /* (i) Q9  :Filtered innovative vector.  */
    390      Word16 code[],                        /* (i) Q9  :Innovative vector.           */
    391      Word16 g_coeff[],                     /* (i)     :Correlations <xn y1> <y1 y1> */
    392 /* Compute in G_pitch().        */
    393      Word16 L_subfr,                       /* (i)     :Subframe lenght.             */
    394      Word16 nbits,                         /* (i)     : number of bits (6 or 7)     */
    395      Word16 * gain_pit,                    /* (i/o)Q14:Pitch gain.                  */
    396      Word32 * gain_cod,                    /* (o) Q16 :Code gain.                   */
    397      Word16 gp_clip,                       /* (i)     : Gp Clipping flag            */
    398      Word16 * mem                          /* (i/o)   :static memory (2 words)      */
    399 );
    400 
    401 void Init_D_gain2(
    402      Word16 * mem                          /* output  :static memory (4 words)      */
    403 );
    404 void D_gain2(
    405      Word16 index,                         /* (i)     :index of quantization.       */
    406      Word16 nbits,                         /* (i)     : number of bits (6 or 7)     */
    407      Word16 code[],                        /* (i) Q9  :Innovative vector.           */
    408      Word16 L_subfr,                       /* (i)     :Subframe lenght.             */
    409      Word16 * gain_pit,                    /* (o) Q14 :Pitch gain.                  */
    410      Word32 * gain_cod,                    /* (o) Q16 :Code gain.                   */
    411      Word16 bfi,                           /* (i)     :bad frame indicator          */
    412      Word16 prev_bfi,                      /* (i) : Previous BF indicator      */
    413      Word16 state,                         /* (i) : State of BFH               */
    414      Word16 unusable_frame,                /* (i) : UF indicator            */
    415      Word16 vad_hist,                      /* (i)         :number of non-speech frames  */
    416      Word16 * mem                          /* (i/o)   :static memory (4 words)      */
    417 );
    418 
    419 /*-----------------------------------------------------------------*
    420  *                       acelp prototypes                          *
    421  *-----------------------------------------------------------------*/
    422 
    423 void cor_h_x(
    424      Word16 h[],                           /* (i) Q12 : impulse response of weighted synthesis filter */
    425      Word16 x[],                           /* (i) Q0  : target vector                                 */
    426      Word16 dn[]                           /* (o) <12bit : correlation between target and h[]         */
    427 );
    428 void ACELP_2t64_fx(
    429      Word16 dn[],                          /* (i) <12b : correlation between target x[] and H[]      */
    430      Word16 cn[],                          /* (i) <12b : residual after long term prediction         */
    431      Word16 H[],                           /* (i) Q12: impulse response of weighted synthesis filter */
    432      Word16 code[],                        /* (o) Q9 : algebraic (fixed) codebook excitation         */
    433      Word16 y[],                           /* (o) Q9 : filtered fixed codebook excitation            */
    434      Word16 * index                        /* (o) : index (12): 5+1+5+1 = 11 bits.                     */
    435 );
    436 
    437 void ACELP_4t64_fx(
    438      Word16 dn[],                          /* (i) <12b : correlation between target x[] and H[]      */
    439      Word16 cn[],                          /* (i) <12b : residual after long term prediction         */
    440      Word16 H[],                           /* (i) Q12: impulse response of weighted synthesis filter */
    441      Word16 code[],                        /* (o) Q9 : algebraic (fixed) codebook excitation         */
    442      Word16 y[],                           /* (o) Q9 : filtered fixed codebook excitation            */
    443      Word16 nbbits,                        /* (i) : 20, 36, 44, 52, 64, 72 or 88 bits                */
    444      Word16 ser_size,                      /* (i) : bit rate                                         */
    445      Word16 _index[]                       /* (o) : index (20): 5+5+5+5 = 20 bits.                   */
    446 					   /* (o) : index (36): 9+9+9+9 = 36 bits.                   */
    447 					   /* (o) : index (44): 13+9+13+9 = 44 bits.                 */
    448 					   /* (o) : index (52): 13+13+13+13 = 52 bits.               */
    449 					   /* (o) : index (64): 2+2+2+2+14+14+14+14 = 64 bits.       */
    450 					   /* (o) : index (72): 10+2+10+2+10+14+10+14 = 72 bits.     */
    451 					   /* (o) : index (88): 11+11+11+11+11+11+11+11 = 88 bits.   */
    452 );
    453 
    454 void Pit_shrp(
    455      Word16 * x,                           /* in/out: impulse response (or algebraic code) */
    456      Word16 pit_lag,                       /* input : pitch lag                            */
    457      Word16 sharp,                         /* input : pitch sharpening factor (Q15)        */
    458      Word16 L_subfr                        /* input : subframe size                        */
    459 );
    460 
    461 
    462 /*-----------------------------------------------------------------*
    463  *                        others prototypes                        *
    464  *-----------------------------------------------------------------*/
    465 
    466 void Copy(
    467      Word16 x[],                           /* (i)   : input vector   */
    468      Word16 y[],                           /* (o)   : output vector  */
    469      Word16 L                              /* (i)   : vector length  */
    470 );
    471 void Set_zero(
    472      Word16 x[],                           /* (o)    : vector to clear     */
    473      Word16 L                              /* (i)    : length of vector    */
    474 );
    475 void Updt_tar(
    476      Word16 * x,                           /* (i) Q0  : old target (for pitch search)     */
    477      Word16 * x2,                          /* (o) Q0  : new target (for codebook search)  */
    478      Word16 * y,                           /* (i) Q0  : filtered adaptive codebook vector */
    479      Word16 gain,                          /* (i) Q14 : adaptive codebook gain            */
    480      Word16 L                              /* (i)     : subframe size                     */
    481 );
    482 Word16 voice_factor(                       /* (o) Q15 : factor (-1=unvoiced to 1=voiced) */
    483      Word16 exc[],                         /* (i) Q_exc: pitch excitation                */
    484      Word16 Q_exc,                         /* (i)     : exc format                       */
    485      Word16 gain_pit,                      /* (i) Q14 : gain of pitch                    */
    486      Word16 code[],                        /* (i) Q9  : Fixed codebook excitation        */
    487      Word16 gain_code,                     /* (i) Q0  : gain of code                     */
    488      Word16 L_subfr                        /* (i)     : subframe length                  */
    489 );
    490 void Scale_sig(
    491      Word16 x[],                           /* (i/o) : signal to scale               */
    492      Word16 lg,                            /* (i)   : size of x[]                   */
    493      Word16 exp                            /* (i)   : exponent: x = round(x << exp) */
    494 );
    495 
    496 void Scale_sig_opt(
    497      Word16 x[],                           /* (i/o) : signal to scale               */
    498      Word16 lg,                            /* (i)   : size of x[]                   */
    499      Word16 exp                            /* (i)   : exponent: x = round(x << exp) */
    500 );
    501 
    502 Word16 Random(Word16 * seed);
    503 
    504 void Init_gp_clip(
    505      Word16 mem[]                          /* (o) : memory of gain of pitch clipping algorithm */
    506 );
    507 Word16 Gp_clip(
    508      Word16 mem[]                          /* (i/o) : memory of gain of pitch clipping algorithm */
    509 );
    510 void Gp_clip_test_isf(
    511      Word16 isf[],                         /* (i)   : isf values (in frequency domain)           */
    512      Word16 mem[]                          /* (i/o) : memory of gain of pitch clipping algorithm */
    513 );
    514 void Gp_clip_test_gain_pit(
    515      Word16 gain_pit,                      /* (i)   : gain of quantized pitch                    */
    516      Word16 mem[]                          /* (i/o) : memory of gain of pitch clipping algorithm */
    517 );
    518 
    519 
    520 #endif   //__ACELP_H__
    521 
    522