www.pudn.com > speakFreely-code.zip > acb_ex.c
/*======================================================================*/
/* Enhanced Variable Rate Codec - Bit-Exact C Specification */
/* Copyright (C) 1997-1998 Telecommunications Industry Association. */
/* All rights reserved. */
/*----------------------------------------------------------------------*/
/* Note: Reproduction and use of this software for the design and */
/* development of North American Wideband CDMA Digital */
/* Cellular Telephony Standards is authorized by the TIA. */
/* The TIA does not authorize the use of this software for any */
/* other purpose. */
/* */
/* The availability of this software does not provide any license */
/* by implication, estoppel, or otherwise under any patent rights */
/* of TIA member companies or others covering any use of the */
/* contents herein. */
/* */
/* Any copies of this software or derivative works must include */
/* this and all other proprietary notices. */
/*======================================================================*/
/* Module: acb_ex.c */
/* Memory Usage: */
/* ROM: 0 */
/* Static/Global RAM: 0 */
/* Stack/Local RAM: 0 */
/*----------------------------------------------------------------------*/
/************************************************************************
* Routine name: acb_excitation *
* Function: Adaptive codebook excitation. *
************************************************************************/
#include "mathevrc.h"
#include "mathdp31.h"
#include "mathadv.h"
#include "macro.h"
void acb_excitation(short *Ex1, short gain, long *delay3, short *PitchMemory, short length)
{
register short i;
long Ltemp;
putacbc(Ex1, PitchMemory + ACBMemSize, 0, length, 10, delay3, BLFREQ, BLPRECISION);
/* Scale excitation */
for (i = 0; i < length; i++)
{
Ltemp = L_mult(Ex1[i], gain);
Ex1[i] = round(L_shl(Ltemp, 1)); /*To account for 1/2 scale in gain */
}
}