WebRtc_Word32 => int32_t etc. in audio_coding/

BUG=314

Review URL: https://webrtc-codereview.appspot.com/1271006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3789 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2013-04-09 00:28:06 +00:00
parent 6faf71d27b
commit 0946a56023
382 changed files with 8469 additions and 8488 deletions

View File

@ -49,12 +49,12 @@
#define TRUE (!FALSE)
#endif
static __inline WebRtc_Word16 saturate(WebRtc_Word32 amp)
static __inline int16_t saturate(int32_t amp)
{
WebRtc_Word16 amp16;
int16_t amp16;
/* Hopefully this is optimised for the common case - not clipping */
amp16 = (WebRtc_Word16) amp;
amp16 = (int16_t) amp;
if (amp == amp16)
return amp16;
if (amp > WEBRTC_INT16_MAX)
@ -190,8 +190,8 @@ int WebRtc_g722_decode_release(g722_decode_state_t *s)
}
/*- End of function --------------------------------------------------------*/
int WebRtc_g722_decode(g722_decode_state_t *s, WebRtc_Word16 amp[],
const WebRtc_UWord8 g722_data[], int len)
int WebRtc_g722_decode(g722_decode_state_t *s, int16_t amp[],
const uint8_t g722_data[], int len)
{
static const int wl[8] = {-60, -30, 58, 172, 334, 538, 1198, 3042 };
static const int rl42[16] = {0, 7, 6, 5, 4, 3, 2, 1,
@ -372,14 +372,14 @@ int WebRtc_g722_decode(g722_decode_state_t *s, WebRtc_Word16 amp[],
if (s->itu_test_mode)
{
amp[outlen++] = (WebRtc_Word16) (rlow << 1);
amp[outlen++] = (WebRtc_Word16) (rhigh << 1);
amp[outlen++] = (int16_t) (rlow << 1);
amp[outlen++] = (int16_t) (rhigh << 1);
}
else
{
if (s->eight_k)
{
amp[outlen++] = (WebRtc_Word16) (rlow << 1);
amp[outlen++] = (int16_t) (rlow << 1);
}
else
{

View File

@ -138,8 +138,8 @@ g722_encode_state_t *WebRtc_g722_encode_init(g722_encode_state_t *s,
int options);
int WebRtc_g722_encode_release(g722_encode_state_t *s);
int WebRtc_g722_encode(g722_encode_state_t *s,
WebRtc_UWord8 g722_data[],
const WebRtc_Word16 amp[],
uint8_t g722_data[],
const int16_t amp[],
int len);
g722_decode_state_t *WebRtc_g722_decode_init(g722_decode_state_t *s,
@ -147,8 +147,8 @@ g722_decode_state_t *WebRtc_g722_decode_init(g722_decode_state_t *s,
int options);
int WebRtc_g722_decode_release(g722_decode_state_t *s);
int WebRtc_g722_decode(g722_decode_state_t *s,
WebRtc_Word16 amp[],
const WebRtc_UWord8 g722_data[],
int16_t amp[],
const uint8_t g722_data[],
int len);
#ifdef __cplusplus

View File

@ -48,12 +48,12 @@
#define TRUE (!FALSE)
#endif
static __inline WebRtc_Word16 saturate(WebRtc_Word32 amp)
static __inline int16_t saturate(int32_t amp)
{
WebRtc_Word16 amp16;
int16_t amp16;
/* Hopefully this is optimised for the common case - not clipping */
amp16 = (WebRtc_Word16) amp;
amp16 = (int16_t) amp;
if (amp == amp16)
return amp16;
if (amp > WEBRTC_INT16_MAX)
@ -191,10 +191,10 @@ int WebRtc_g722_encode_release(g722_encode_state_t *s)
*/
//#define RUN_LIKE_REFERENCE_G722
#ifdef RUN_LIKE_REFERENCE_G722
WebRtc_Word16 limitValues (WebRtc_Word16 rl)
int16_t limitValues (int16_t rl)
{
WebRtc_Word16 yl;
int16_t yl;
yl = (rl > 16383) ? 16383 : ((rl < -16384) ? -16384 : rl);
@ -202,8 +202,8 @@ WebRtc_Word16 limitValues (WebRtc_Word16 rl)
}
#endif
int WebRtc_g722_encode(g722_encode_state_t *s, WebRtc_UWord8 g722_data[],
const WebRtc_Word16 amp[], int len)
int WebRtc_g722_encode(g722_encode_state_t *s, uint8_t g722_data[],
const int16_t amp[], int len)
{
static const int q6[32] =
{
@ -418,14 +418,14 @@ int WebRtc_g722_encode(g722_encode_state_t *s, WebRtc_UWord8 g722_data[],
s->out_bits += s->bits_per_sample;
if (s->out_bits >= 8)
{
g722_data[g722_bytes++] = (WebRtc_UWord8) (s->out_buffer & 0xFF);
g722_data[g722_bytes++] = (uint8_t) (s->out_buffer & 0xFF);
s->out_bits -= 8;
s->out_buffer >>= 8;
}
}
else
{
g722_data[g722_bytes++] = (WebRtc_UWord8) code;
g722_data[g722_bytes++] = (uint8_t) code;
}
}
return g722_bytes;

View File

@ -17,7 +17,7 @@
#include "typedefs.h"
WebRtc_Word16 WebRtcG722_CreateEncoder(G722EncInst **G722enc_inst)
int16_t WebRtcG722_CreateEncoder(G722EncInst **G722enc_inst)
{
*G722enc_inst=(G722EncInst*)malloc(sizeof(g722_encode_state_t));
if (*G722enc_inst!=NULL) {
@ -27,7 +27,7 @@ WebRtc_Word16 WebRtcG722_CreateEncoder(G722EncInst **G722enc_inst)
}
}
WebRtc_Word16 WebRtcG722_EncoderInit(G722EncInst *G722enc_inst)
int16_t WebRtcG722_EncoderInit(G722EncInst *G722enc_inst)
{
// Create and/or reset the G.722 encoder
// Bitrate 64 kbps and wideband mode (2)
@ -40,16 +40,16 @@ WebRtc_Word16 WebRtcG722_EncoderInit(G722EncInst *G722enc_inst)
}
}
WebRtc_Word16 WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst)
int16_t WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst)
{
// Free encoder memory
return WebRtc_g722_encode_release((g722_encode_state_t*) G722enc_inst);
}
WebRtc_Word16 WebRtcG722_Encode(G722EncInst *G722enc_inst,
WebRtc_Word16 *speechIn,
WebRtc_Word16 len,
WebRtc_Word16 *encoded)
int16_t WebRtcG722_Encode(G722EncInst *G722enc_inst,
int16_t *speechIn,
int16_t len,
int16_t *encoded)
{
unsigned char *codechar = (unsigned char*) encoded;
// Encode the input speech vector
@ -57,7 +57,7 @@ WebRtc_Word16 WebRtcG722_Encode(G722EncInst *G722enc_inst,
codechar, speechIn, len);
}
WebRtc_Word16 WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst)
int16_t WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst)
{
*G722dec_inst=(G722DecInst*)malloc(sizeof(g722_decode_state_t));
if (*G722dec_inst!=NULL) {
@ -67,7 +67,7 @@ WebRtc_Word16 WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst)
}
}
WebRtc_Word16 WebRtcG722_DecoderInit(G722DecInst *G722dec_inst)
int16_t WebRtcG722_DecoderInit(G722DecInst *G722dec_inst)
{
// Create and/or reset the G.722 decoder
// Bitrate 64 kbps and wideband mode (2)
@ -80,25 +80,25 @@ WebRtc_Word16 WebRtcG722_DecoderInit(G722DecInst *G722dec_inst)
}
}
WebRtc_Word16 WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst)
int16_t WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst)
{
// Free encoder memory
return WebRtc_g722_decode_release((g722_decode_state_t*) G722dec_inst);
}
WebRtc_Word16 WebRtcG722_Decode(G722DecInst *G722dec_inst,
WebRtc_Word16 *encoded,
WebRtc_Word16 len,
WebRtc_Word16 *decoded,
WebRtc_Word16 *speechType)
int16_t WebRtcG722_Decode(G722DecInst *G722dec_inst,
int16_t *encoded,
int16_t len,
int16_t *decoded,
int16_t *speechType)
{
// Decode the G.722 encoder stream
*speechType=G722_WEBRTC_SPEECH;
return WebRtc_g722_decode((g722_decode_state_t*) G722dec_inst,
decoded, (WebRtc_UWord8*) encoded, len);
decoded, (uint8_t*) encoded, len);
}
WebRtc_Word16 WebRtcG722_Version(char *versionStr, short len)
int16_t WebRtcG722_Version(char *versionStr, short len)
{
// Get version string
char version[30] = "2.0.0\n";

View File

@ -43,7 +43,7 @@ extern "C" {
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcG722_CreateEncoder(G722EncInst **G722enc_inst);
int16_t WebRtcG722_CreateEncoder(G722EncInst **G722enc_inst);
/****************************************************************************
@ -59,7 +59,7 @@ WebRtc_Word16 WebRtcG722_CreateEncoder(G722EncInst **G722enc_inst);
* -1 - Error
*/
WebRtc_Word16 WebRtcG722_EncoderInit(G722EncInst *G722enc_inst);
int16_t WebRtcG722_EncoderInit(G722EncInst *G722enc_inst);
/****************************************************************************
@ -73,7 +73,7 @@ WebRtc_Word16 WebRtcG722_EncoderInit(G722EncInst *G722enc_inst);
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst);
int16_t WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst);
@ -95,10 +95,10 @@ WebRtc_Word16 WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst);
* -1 - Error
*/
WebRtc_Word16 WebRtcG722_Encode(G722EncInst *G722enc_inst,
WebRtc_Word16 *speechIn,
WebRtc_Word16 len,
WebRtc_Word16 *encoded);
int16_t WebRtcG722_Encode(G722EncInst *G722enc_inst,
int16_t *speechIn,
int16_t len,
int16_t *encoded);
/****************************************************************************
@ -112,7 +112,7 @@ WebRtc_Word16 WebRtcG722_Encode(G722EncInst *G722enc_inst,
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst);
int16_t WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst);
/****************************************************************************
@ -128,7 +128,7 @@ WebRtc_Word16 WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst);
* -1 - Error
*/
WebRtc_Word16 WebRtcG722_DecoderInit(G722DecInst *G722dec_inst);
int16_t WebRtcG722_DecoderInit(G722DecInst *G722dec_inst);
/****************************************************************************
@ -143,7 +143,7 @@ WebRtc_Word16 WebRtcG722_DecoderInit(G722DecInst *G722dec_inst);
* -1 - Error
*/
WebRtc_Word16 WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst);
int16_t WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst);
/****************************************************************************
@ -167,11 +167,11 @@ WebRtc_Word16 WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst);
* -1 - Error
*/
WebRtc_Word16 WebRtcG722_Decode(G722DecInst *G722dec_inst,
WebRtc_Word16 *encoded,
WebRtc_Word16 len,
WebRtc_Word16 *decoded,
WebRtc_Word16 *speechType);
int16_t WebRtcG722_Decode(G722DecInst *G722dec_inst,
int16_t *encoded,
int16_t len,
int16_t *decoded,
int16_t *speechType);
/****************************************************************************
* WebRtcG722_Version(...)
@ -179,7 +179,7 @@ WebRtc_Word16 WebRtcG722_Decode(G722DecInst *G722dec_inst,
* Get a string with the current version of the codec
*/
WebRtc_Word16 WebRtcG722_Version(char *versionStr, short len);
int16_t WebRtcG722_Version(char *versionStr, short len);
#ifdef __cplusplus

View File

@ -29,11 +29,11 @@ typedef struct WebRtcG722EncInst G722EncInst;
typedef struct WebRtcG722DecInst G722DecInst;
/* function for reading audio data from PCM file */
int readframe(WebRtc_Word16 *data, FILE *inp, int length)
int readframe(int16_t *data, FILE *inp, int length)
{
short k, rlen, status = 0;
rlen = (short)fread(data, sizeof(WebRtc_Word16), length, inp);
rlen = (short)fread(data, sizeof(int16_t), length, inp);
if (rlen < length) {
for (k = rlen; k < length; k++)
data[k] = 0;
@ -49,7 +49,7 @@ int main(int argc, char* argv[])
FILE *inp, *outbitp, *outp;
int framecnt, endfile;
WebRtc_Word16 framelength = 160;
int16_t framelength = 160;
G722EncInst *G722enc_inst;
G722DecInst *G722dec_inst;
int err;
@ -59,11 +59,11 @@ int main(int argc, char* argv[])
double runtime = 0;
double length_file;
WebRtc_Word16 stream_len = 0;
WebRtc_Word16 shortdata[960];
WebRtc_Word16 decoded[960];
WebRtc_Word16 streamdata[80*3];
WebRtc_Word16 speechType[1];
int16_t stream_len = 0;
int16_t shortdata[960];
int16_t decoded[960];
int16_t streamdata[80*3];
int16_t speechType[1];
/* handling wrong input arguments in the command line */
if (argc!=5) {

View File

@ -32,16 +32,16 @@ void WebRtcIlbcfix_AbsQuant(
iLBC_bits *iLBC_encbits, /* (i/o) Encoded bits (outputs idxForMax
and idxVec, uses state_first as
input) */
WebRtc_Word16 *in, /* (i) vector to encode */
WebRtc_Word16 *weightDenum /* (i) denominator of synthesis filter */
int16_t *in, /* (i) vector to encode */
int16_t *weightDenum /* (i) denominator of synthesis filter */
) {
WebRtc_Word16 *syntOut;
WebRtc_Word16 quantLen[2];
int16_t *syntOut;
int16_t quantLen[2];
/* Stack based */
WebRtc_Word16 syntOutBuf[LPC_FILTERORDER+STATE_SHORT_LEN_30MS];
WebRtc_Word16 in_weightedVec[STATE_SHORT_LEN_30MS+LPC_FILTERORDER];
WebRtc_Word16 *in_weighted = &in_weightedVec[LPC_FILTERORDER];
int16_t syntOutBuf[LPC_FILTERORDER+STATE_SHORT_LEN_30MS];
int16_t in_weightedVec[STATE_SHORT_LEN_30MS+LPC_FILTERORDER];
int16_t *in_weighted = &in_weightedVec[LPC_FILTERORDER];
/* Initialize the buffers */
WebRtcSpl_MemSetW16(syntOutBuf, 0, LPC_FILTERORDER+STATE_SHORT_LEN_30MS);

View File

@ -32,8 +32,8 @@ void WebRtcIlbcfix_AbsQuant(
iLBC_bits *iLBC_encbits, /* (i/o) Encoded bits (outputs idxForMax
and idxVec, uses state_first as
input) */
WebRtc_Word16 *in, /* (i) vector to encode */
WebRtc_Word16 *weightDenum /* (i) denominator of synthesis filter */
int16_t *in, /* (i) vector to encode */
int16_t *weightDenum /* (i) denominator of synthesis filter */
);
#endif

View File

@ -20,26 +20,21 @@
#include "constants.h"
#include "sort_sq.h"
void WebRtcIlbcfix_AbsQuantLoop(
WebRtc_Word16 *syntOutIN,
WebRtc_Word16 *in_weightedIN,
WebRtc_Word16 *weightDenumIN,
WebRtc_Word16 *quantLenIN,
WebRtc_Word16 *idxVecIN
)
{
void WebRtcIlbcfix_AbsQuantLoop(int16_t *syntOutIN, int16_t *in_weightedIN,
int16_t *weightDenumIN, int16_t *quantLenIN,
int16_t *idxVecIN ) {
int n, k1, k2;
WebRtc_Word16 index;
WebRtc_Word32 toQW32;
WebRtc_Word32 toQ32;
WebRtc_Word16 tmp16a;
WebRtc_Word16 xq;
int16_t index;
int32_t toQW32;
int32_t toQ32;
int16_t tmp16a;
int16_t xq;
WebRtc_Word16 *syntOut = syntOutIN;
WebRtc_Word16 *in_weighted = in_weightedIN;
WebRtc_Word16 *weightDenum = weightDenumIN;
WebRtc_Word16 *quantLen = quantLenIN;
WebRtc_Word16 *idxVec = idxVecIN;
int16_t *syntOut = syntOutIN;
int16_t *in_weighted = in_weightedIN;
int16_t *weightDenum = weightDenumIN;
int16_t *quantLen = quantLenIN;
int16_t *idxVec = idxVecIN;
n=0;
@ -52,14 +47,14 @@ void WebRtcIlbcfix_AbsQuantLoop(
weightDenum, LPC_FILTERORDER+1, 1);
/* the quantizer */
toQW32 = (WebRtc_Word32)(*in_weighted) - (WebRtc_Word32)(*syntOut);
toQW32 = (int32_t)(*in_weighted) - (int32_t)(*syntOut);
toQ32 = (((WebRtc_Word32)toQW32)<<2);
toQ32 = (((int32_t)toQW32)<<2);
if (toQ32 > 32767) {
toQ32 = (WebRtc_Word32) 32767;
toQ32 = (int32_t) 32767;
} else if (toQ32 < -32768) {
toQ32 = (WebRtc_Word32) -32768;
toQ32 = (int32_t) -32768;
}
/* Quantize the state */
@ -74,7 +69,7 @@ void WebRtcIlbcfix_AbsQuantLoop(
(state_sq3Tbl is in Q13 and toQ is in Q11)
*/
WebRtcIlbcfix_SortSq(&xq, &index,
(WebRtc_Word16)toQ32,
(int16_t)toQ32,
WebRtcIlbcfix_kStateSq3, 8);
}
@ -84,7 +79,7 @@ void WebRtcIlbcfix_AbsQuantLoop(
/* Compute decoded sample and update of the prediction filter */
tmp16a = ((WebRtcIlbcfix_kStateSq3[index] + 2 ) >> 2);
*syntOut = (WebRtc_Word16) (tmp16a + (WebRtc_Word32)(*in_weighted) - toQW32);
*syntOut = (int16_t) (tmp16a + (int32_t)(*in_weighted) - toQW32);
n++;
syntOut++; in_weighted++;

View File

@ -26,12 +26,8 @@
* (subrutine for WebRtcIlbcfix_StateSearch)
*---------------------------------------------------------------*/
void WebRtcIlbcfix_AbsQuantLoop(
WebRtc_Word16 *syntOutIN,
WebRtc_Word16 *in_weightedIN,
WebRtc_Word16 *weightDenumIN,
WebRtc_Word16 *quantLenIN,
WebRtc_Word16 *idxVecIN
);
void WebRtcIlbcfix_AbsQuantLoop(int16_t *syntOutIN, int16_t *in_weightedIN,
int16_t *weightDenumIN, int16_t *quantLenIN,
int16_t *idxVecIN);
#endif

View File

@ -21,24 +21,24 @@
#include "augmented_cb_corr.h"
void WebRtcIlbcfix_AugmentedCbCorr(
WebRtc_Word16 *target, /* (i) Target vector */
WebRtc_Word16 *buffer, /* (i) Memory buffer */
WebRtc_Word16 *interpSamples, /* (i) buffer with
int16_t *target, /* (i) Target vector */
int16_t *buffer, /* (i) Memory buffer */
int16_t *interpSamples, /* (i) buffer with
interpolated samples */
WebRtc_Word32 *crossDot, /* (o) The cross correlation between
int32_t *crossDot, /* (o) The cross correlation between
the target and the Augmented
vector */
WebRtc_Word16 low, /* (i) Lag to start from (typically
int16_t low, /* (i) Lag to start from (typically
20) */
WebRtc_Word16 high, /* (i) Lag to end at (typically 39) */
WebRtc_Word16 scale) /* (i) Scale factor to use for
int16_t high, /* (i) Lag to end at (typically 39) */
int16_t scale) /* (i) Scale factor to use for
the crossDot */
{
int lagcount;
WebRtc_Word16 ilow;
WebRtc_Word16 *targetPtr;
WebRtc_Word32 *crossDotPtr;
WebRtc_Word16 *iSPtr=interpSamples;
int16_t ilow;
int16_t *targetPtr;
int32_t *crossDotPtr;
int16_t *iSPtr=interpSamples;
/* Calculate the correlation between the target and the
interpolated codebook. The correlation is calculated in
@ -46,7 +46,7 @@ void WebRtcIlbcfix_AugmentedCbCorr(
crossDotPtr=crossDot;
for (lagcount=low; lagcount<=high; lagcount++) {
ilow = (WebRtc_Word16) (lagcount-4);
ilow = (int16_t) (lagcount-4);
/* Compute dot product for the first (lagcount-4) samples */
(*crossDotPtr) = WebRtcSpl_DotProductWithScale(target, buffer-lagcount, ilow, scale);

View File

@ -26,17 +26,17 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_AugmentedCbCorr(
WebRtc_Word16 *target, /* (i) Target vector */
WebRtc_Word16 *buffer, /* (i) Memory buffer */
WebRtc_Word16 *interpSamples, /* (i) buffer with
int16_t *target, /* (i) Target vector */
int16_t *buffer, /* (i) Memory buffer */
int16_t *interpSamples, /* (i) buffer with
interpolated samples */
WebRtc_Word32 *crossDot, /* (o) The cross correlation between
int32_t *crossDot, /* (o) The cross correlation between
the target and the Augmented
vector */
WebRtc_Word16 low, /* (i) Lag to start from (typically
int16_t low, /* (i) Lag to start from (typically
20) */
WebRtc_Word16 high, /* (i) Lag to end at (typically 39 */
WebRtc_Word16 scale); /* (i) Scale factor to use for
int16_t high, /* (i) Lag to end at (typically 39 */
int16_t scale); /* (i) Scale factor to use for
the crossDot */
#endif

View File

@ -24,11 +24,11 @@
/* The output is in the same domain as the input */
void WebRtcIlbcfix_BwExpand(
WebRtc_Word16 *out, /* (o) the bandwidth expanded lpc coefficients */
WebRtc_Word16 *in, /* (i) the lpc coefficients before bandwidth
int16_t *out, /* (o) the bandwidth expanded lpc coefficients */
int16_t *in, /* (i) the lpc coefficients before bandwidth
expansion */
WebRtc_Word16 *coef, /* (i) the bandwidth expansion factor Q15 */
WebRtc_Word16 length /* (i) the length of lpc coefficient vectors */
int16_t *coef, /* (i) the bandwidth expansion factor Q15 */
int16_t length /* (i) the length of lpc coefficient vectors */
) {
int i;
@ -37,6 +37,6 @@ void WebRtcIlbcfix_BwExpand(
/* out[i] = coef[i] * in[i] with rounding.
in[] and out[] are in Q12 and coef[] is in Q15
*/
out[i] = (WebRtc_Word16)((WEBRTC_SPL_MUL_16_16(coef[i], in[i])+16384)>>15);
out[i] = (int16_t)((WEBRTC_SPL_MUL_16_16(coef[i], in[i])+16384)>>15);
}
}

View File

@ -26,11 +26,11 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_BwExpand(
WebRtc_Word16 *out, /* (o) the bandwidth expanded lpc coefficients */
WebRtc_Word16 *in, /* (i) the lpc coefficients before bandwidth
int16_t *out, /* (o) the bandwidth expanded lpc coefficients */
int16_t *in, /* (i) the lpc coefficients before bandwidth
expansion */
WebRtc_Word16 *coef, /* (i) the bandwidth expansion factor Q15 */
WebRtc_Word16 length /* (i) the length of lpc coefficient vectors */
int16_t *coef, /* (i) the bandwidth expansion factor Q15 */
int16_t length /* (i) the length of lpc coefficient vectors */
);
#endif

View File

@ -25,21 +25,21 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_CbConstruct(
WebRtc_Word16 *decvector, /* (o) Decoded vector */
WebRtc_Word16 *index, /* (i) Codebook indices */
WebRtc_Word16 *gain_index, /* (i) Gain quantization indices */
WebRtc_Word16 *mem, /* (i) Buffer for codevector construction */
WebRtc_Word16 lMem, /* (i) Length of buffer */
WebRtc_Word16 veclen /* (i) Length of vector */
int16_t *decvector, /* (o) Decoded vector */
int16_t *index, /* (i) Codebook indices */
int16_t *gain_index, /* (i) Gain quantization indices */
int16_t *mem, /* (i) Buffer for codevector construction */
int16_t lMem, /* (i) Length of buffer */
int16_t veclen /* (i) Length of vector */
){
int j;
WebRtc_Word16 gain[CB_NSTAGES];
int16_t gain[CB_NSTAGES];
/* Stack based */
WebRtc_Word16 cbvec0[SUBL];
WebRtc_Word16 cbvec1[SUBL];
WebRtc_Word16 cbvec2[SUBL];
WebRtc_Word32 a32;
WebRtc_Word16 *gainPtr;
int16_t cbvec0[SUBL];
int16_t cbvec1[SUBL];
int16_t cbvec2[SUBL];
int32_t a32;
int16_t *gainPtr;
/* gain de-quantization */
@ -60,7 +60,7 @@ void WebRtcIlbcfix_CbConstruct(
a32 += WEBRTC_SPL_MUL_16_16(*gainPtr++, cbvec1[j]);
a32 += WEBRTC_SPL_MUL_16_16(*gainPtr, cbvec2[j]);
gainPtr -= 2;
decvector[j] = (WebRtc_Word16) WEBRTC_SPL_RSHIFT_W32(a32 + 8192, 14);
decvector[j] = (int16_t) WEBRTC_SPL_RSHIFT_W32(a32 + 8192, 14);
}
return;

View File

@ -26,12 +26,12 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_CbConstruct(
WebRtc_Word16 *decvector, /* (o) Decoded vector */
WebRtc_Word16 *index, /* (i) Codebook indices */
WebRtc_Word16 *gain_index, /* (i) Gain quantization indices */
WebRtc_Word16 *mem, /* (i) Buffer for codevector construction */
WebRtc_Word16 lMem, /* (i) Length of buffer */
WebRtc_Word16 veclen /* (i) Length of vector */
int16_t *decvector, /* (o) Decoded vector */
int16_t *index, /* (i) Codebook indices */
int16_t *gain_index, /* (i) Gain quantization indices */
int16_t *mem, /* (i) Buffer for codevector construction */
int16_t lMem, /* (i) Length of buffer */
int16_t veclen /* (i) Length of vector */
);

View File

@ -27,18 +27,18 @@
*----------------------------------------------------------------*/
void WebRtcIlbcfix_CbMemEnergy(
WebRtc_Word16 range,
WebRtc_Word16 *CB, /* (i) The CB memory (1:st section) */
WebRtc_Word16 *filteredCB, /* (i) The filtered CB memory (2:nd section) */
WebRtc_Word16 lMem, /* (i) Length of the CB memory */
WebRtc_Word16 lTarget, /* (i) Length of the target vector */
WebRtc_Word16 *energyW16, /* (o) Energy in the CB vectors */
WebRtc_Word16 *energyShifts, /* (o) Shift value of the energy */
WebRtc_Word16 scale, /* (i) The scaling of all energy values */
WebRtc_Word16 base_size /* (i) Index to where the energy values should be stored */
int16_t range,
int16_t *CB, /* (i) The CB memory (1:st section) */
int16_t *filteredCB, /* (i) The filtered CB memory (2:nd section) */
int16_t lMem, /* (i) Length of the CB memory */
int16_t lTarget, /* (i) Length of the target vector */
int16_t *energyW16, /* (o) Energy in the CB vectors */
int16_t *energyShifts, /* (o) Shift value of the energy */
int16_t scale, /* (i) The scaling of all energy values */
int16_t base_size /* (i) Index to where the energy values should be stored */
) {
WebRtc_Word16 *ppi, *ppo, *pp;
WebRtc_Word32 energy, tmp32;
int16_t *ppi, *ppo, *pp;
int32_t energy, tmp32;
/* Compute the energy and store it in a vector. Also the
* corresponding shift values are stored. The energy values
@ -52,9 +52,9 @@ void WebRtcIlbcfix_CbMemEnergy(
energy = WebRtcSpl_DotProductWithScale( pp, pp, lTarget, scale);
/* Normalize the energy and store the number of shifts */
energyShifts[0] = (WebRtc_Word16)WebRtcSpl_NormW32(energy);
energyShifts[0] = (int16_t)WebRtcSpl_NormW32(energy);
tmp32 = WEBRTC_SPL_LSHIFT_W32(energy, energyShifts[0]);
energyW16[0] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
energyW16[0] = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
/* Compute the energy of the rest of the cb memory
* by step wise adding and subtracting the next
@ -68,9 +68,9 @@ void WebRtcIlbcfix_CbMemEnergy(
energy = WebRtcSpl_DotProductWithScale( pp, pp, lTarget, scale);
/* Normalize the energy and store the number of shifts */
energyShifts[base_size] = (WebRtc_Word16)WebRtcSpl_NormW32(energy);
energyShifts[base_size] = (int16_t)WebRtcSpl_NormW32(energy);
tmp32 = WEBRTC_SPL_LSHIFT_W32(energy, energyShifts[base_size]);
energyW16[base_size] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
energyW16[base_size] = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
ppi = filteredCB + lMem - 1 - lTarget;
ppo = filteredCB + lMem - 1;

View File

@ -20,15 +20,15 @@
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_CB_MEM_ENERGY_H_
void WebRtcIlbcfix_CbMemEnergy(
WebRtc_Word16 range,
WebRtc_Word16 *CB, /* (i) The CB memory (1:st section) */
WebRtc_Word16 *filteredCB, /* (i) The filtered CB memory (2:nd section) */
WebRtc_Word16 lMem, /* (i) Length of the CB memory */
WebRtc_Word16 lTarget, /* (i) Length of the target vector */
WebRtc_Word16 *energyW16, /* (o) Energy in the CB vectors */
WebRtc_Word16 *energyShifts, /* (o) Shift value of the energy */
WebRtc_Word16 scale, /* (i) The scaling of all energy values */
WebRtc_Word16 base_size /* (i) Index to where the energy values should be stored */
int16_t range,
int16_t *CB, /* (i) The CB memory (1:st section) */
int16_t *filteredCB, /* (i) The filtered CB memory (2:nd section) */
int16_t lMem, /* (i) Length of the CB memory */
int16_t lTarget, /* (i) Length of the target vector */
int16_t *energyW16, /* (o) Energy in the CB vectors */
int16_t *energyShifts, /* (o) Shift value of the energy */
int16_t scale, /* (i) The scaling of all energy values */
int16_t base_size /* (i) Index to where the energy values should be stored */
);
#endif

View File

@ -20,19 +20,19 @@
#include "constants.h"
void WebRtcIlbcfix_CbMemEnergyAugmentation(
WebRtc_Word16 *interpSamples, /* (i) The interpolated samples */
WebRtc_Word16 *CBmem, /* (i) The CB memory */
WebRtc_Word16 scale, /* (i) The scaling of all energy values */
WebRtc_Word16 base_size, /* (i) Index to where the energy values should be stored */
WebRtc_Word16 *energyW16, /* (o) Energy in the CB vectors */
WebRtc_Word16 *energyShifts /* (o) Shift value of the energy */
int16_t *interpSamples, /* (i) The interpolated samples */
int16_t *CBmem, /* (i) The CB memory */
int16_t scale, /* (i) The scaling of all energy values */
int16_t base_size, /* (i) Index to where the energy values should be stored */
int16_t *energyW16, /* (o) Energy in the CB vectors */
int16_t *energyShifts /* (o) Shift value of the energy */
){
WebRtc_Word32 energy, tmp32;
WebRtc_Word16 *ppe, *pp, *interpSamplesPtr;
WebRtc_Word16 *CBmemPtr, lagcount;
WebRtc_Word16 *enPtr=&energyW16[base_size-20];
WebRtc_Word16 *enShPtr=&energyShifts[base_size-20];
WebRtc_Word32 nrjRecursive;
int32_t energy, tmp32;
int16_t *ppe, *pp, *interpSamplesPtr;
int16_t *CBmemPtr, lagcount;
int16_t *enPtr=&energyW16[base_size-20];
int16_t *enShPtr=&energyShifts[base_size-20];
int32_t nrjRecursive;
CBmemPtr = CBmem+147;
interpSamplesPtr = interpSamples;
@ -58,9 +58,9 @@ void WebRtcIlbcfix_CbMemEnergyAugmentation(
energy += WebRtcSpl_DotProductWithScale(pp, pp, SUBL-lagcount, scale);
/* Normalize the energy and store the number of shifts */
(*enShPtr) = (WebRtc_Word16)WebRtcSpl_NormW32(energy);
(*enShPtr) = (int16_t)WebRtcSpl_NormW32(energy);
tmp32 = WEBRTC_SPL_LSHIFT_W32(energy, (*enShPtr));
(*enPtr) = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
(*enPtr) = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
enShPtr++;
enPtr++;
}

View File

@ -20,12 +20,12 @@
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_CB_MEM_ENERGY_AUGMENTATION_H_
void WebRtcIlbcfix_CbMemEnergyAugmentation(
WebRtc_Word16 *interpSamples, /* (i) The interpolated samples */
WebRtc_Word16 *CBmem, /* (i) The CB memory */
WebRtc_Word16 scale, /* (i) The scaling of all energy values */
WebRtc_Word16 base_size, /* (i) Index to where the energy values should be stored */
WebRtc_Word16 *energyW16, /* (o) Energy in the CB vectors */
WebRtc_Word16 *energyShifts /* (o) Shift value of the energy */
int16_t *interpSamples, /* (i) The interpolated samples */
int16_t *CBmem, /* (i) The CB memory */
int16_t scale, /* (i) The scaling of all energy values */
int16_t base_size, /* (i) Index to where the energy values should be stored */
int16_t *energyW16, /* (o) Energy in the CB vectors */
int16_t *energyShifts /* (o) Shift value of the energy */
);
#endif

View File

@ -22,20 +22,20 @@
* by step wise adding and subtracting the next
* sample and the last sample respectively */
void WebRtcIlbcfix_CbMemEnergyCalc(
WebRtc_Word32 energy, /* (i) input start energy */
WebRtc_Word16 range, /* (i) number of iterations */
WebRtc_Word16 *ppi, /* (i) input pointer 1 */
WebRtc_Word16 *ppo, /* (i) input pointer 2 */
WebRtc_Word16 *energyW16, /* (o) Energy in the CB vectors */
WebRtc_Word16 *energyShifts, /* (o) Shift value of the energy */
WebRtc_Word16 scale, /* (i) The scaling of all energy values */
WebRtc_Word16 base_size /* (i) Index to where the energy values should be stored */
int32_t energy, /* (i) input start energy */
int16_t range, /* (i) number of iterations */
int16_t *ppi, /* (i) input pointer 1 */
int16_t *ppo, /* (i) input pointer 2 */
int16_t *energyW16, /* (o) Energy in the CB vectors */
int16_t *energyShifts, /* (o) Shift value of the energy */
int16_t scale, /* (i) The scaling of all energy values */
int16_t base_size /* (i) Index to where the energy values should be stored */
)
{
WebRtc_Word16 j,shft;
WebRtc_Word32 tmp;
WebRtc_Word16 *eSh_ptr;
WebRtc_Word16 *eW16_ptr;
int16_t j,shft;
int32_t tmp;
int16_t *eSh_ptr;
int16_t *eW16_ptr;
eSh_ptr = &energyShifts[1+base_size];
@ -53,13 +53,13 @@ void WebRtcIlbcfix_CbMemEnergyCalc(
ppi--;
ppo--;
/* Normalize the energy into a WebRtc_Word16 and store
/* Normalize the energy into a int16_t and store
the number of shifts */
shft = (WebRtc_Word16)WebRtcSpl_NormW32(energy);
shft = (int16_t)WebRtcSpl_NormW32(energy);
*eSh_ptr++ = shft;
tmp = WEBRTC_SPL_LSHIFT_W32(energy, shft);
*eW16_ptr++ = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp, 16);
*eW16_ptr++ = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp, 16);
}
}

View File

@ -20,14 +20,14 @@
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_CB_MEM_ENERGY_CALC_H_
void WebRtcIlbcfix_CbMemEnergyCalc(
WebRtc_Word32 energy, /* (i) input start energy */
WebRtc_Word16 range, /* (i) number of iterations */
WebRtc_Word16 *ppi, /* (i) input pointer 1 */
WebRtc_Word16 *ppo, /* (i) input pointer 2 */
WebRtc_Word16 *energyW16, /* (o) Energy in the CB vectors */
WebRtc_Word16 *energyShifts, /* (o) Shift value of the energy */
WebRtc_Word16 scale, /* (i) The scaling of all energy values */
WebRtc_Word16 base_size /* (i) Index to where the energy values should be stored */
int32_t energy, /* (i) input start energy */
int16_t range, /* (i) number of iterations */
int16_t *ppi, /* (i) input pointer 1 */
int16_t *ppo, /* (i) input pointer 2 */
int16_t *energyW16, /* (o) Energy in the CB vectors */
int16_t *energyShifts, /* (o) Shift value of the energy */
int16_t scale, /* (i) The scaling of all energy values */
int16_t base_size /* (i) Index to where the energy values should be stored */
);
#endif

View File

@ -36,51 +36,51 @@
void WebRtcIlbcfix_CbSearch(
iLBC_Enc_Inst_t *iLBCenc_inst,
/* (i) the encoder state structure */
WebRtc_Word16 *index, /* (o) Codebook indices */
WebRtc_Word16 *gain_index, /* (o) Gain quantization indices */
WebRtc_Word16 *intarget, /* (i) Target vector for encoding */
WebRtc_Word16 *decResidual,/* (i) Decoded residual for codebook construction */
WebRtc_Word16 lMem, /* (i) Length of buffer */
WebRtc_Word16 lTarget, /* (i) Length of vector */
WebRtc_Word16 *weightDenum,/* (i) weighting filter coefficients in Q12 */
WebRtc_Word16 block /* (i) the subblock number */
int16_t *index, /* (o) Codebook indices */
int16_t *gain_index, /* (o) Gain quantization indices */
int16_t *intarget, /* (i) Target vector for encoding */
int16_t *decResidual,/* (i) Decoded residual for codebook construction */
int16_t lMem, /* (i) Length of buffer */
int16_t lTarget, /* (i) Length of vector */
int16_t *weightDenum,/* (i) weighting filter coefficients in Q12 */
int16_t block /* (i) the subblock number */
) {
WebRtc_Word16 i, j, stage, range;
WebRtc_Word16 *pp, scale, tmp;
WebRtc_Word16 bits, temp1, temp2;
WebRtc_Word16 base_size;
WebRtc_Word32 codedEner, targetEner;
WebRtc_Word16 gains[CB_NSTAGES+1];
WebRtc_Word16 *cb_vecPtr;
WebRtc_Word16 indexOffset, sInd, eInd;
WebRtc_Word32 CritMax=0;
WebRtc_Word16 shTotMax=WEBRTC_SPL_WORD16_MIN;
WebRtc_Word16 bestIndex=0;
WebRtc_Word16 bestGain=0;
WebRtc_Word16 indexNew, CritNewSh;
WebRtc_Word32 CritNew;
WebRtc_Word32 *cDotPtr;
WebRtc_Word16 noOfZeros;
WebRtc_Word16 *gainPtr;
WebRtc_Word32 t32, tmpW32;
WebRtc_Word16 *WebRtcIlbcfix_kGainSq5_ptr;
int16_t i, j, stage, range;
int16_t *pp, scale, tmp;
int16_t bits, temp1, temp2;
int16_t base_size;
int32_t codedEner, targetEner;
int16_t gains[CB_NSTAGES+1];
int16_t *cb_vecPtr;
int16_t indexOffset, sInd, eInd;
int32_t CritMax=0;
int16_t shTotMax=WEBRTC_SPL_WORD16_MIN;
int16_t bestIndex=0;
int16_t bestGain=0;
int16_t indexNew, CritNewSh;
int32_t CritNew;
int32_t *cDotPtr;
int16_t noOfZeros;
int16_t *gainPtr;
int32_t t32, tmpW32;
int16_t *WebRtcIlbcfix_kGainSq5_ptr;
/* Stack based */
WebRtc_Word16 CBbuf[CB_MEML+LPC_FILTERORDER+CB_HALFFILTERLEN];
WebRtc_Word32 cDot[128];
WebRtc_Word32 Crit[128];
WebRtc_Word16 targetVec[SUBL+LPC_FILTERORDER];
WebRtc_Word16 cbvectors[CB_MEML + 1]; /* Adding one extra position for
int16_t CBbuf[CB_MEML+LPC_FILTERORDER+CB_HALFFILTERLEN];
int32_t cDot[128];
int32_t Crit[128];
int16_t targetVec[SUBL+LPC_FILTERORDER];
int16_t cbvectors[CB_MEML + 1]; /* Adding one extra position for
Coverity warnings. */
WebRtc_Word16 codedVec[SUBL];
WebRtc_Word16 interpSamples[20*4];
WebRtc_Word16 interpSamplesFilt[20*4];
WebRtc_Word16 energyW16[CB_EXPAND*128];
WebRtc_Word16 energyShifts[CB_EXPAND*128];
WebRtc_Word16 *inverseEnergy=energyW16; /* Reuse memory */
WebRtc_Word16 *inverseEnergyShifts=energyShifts; /* Reuse memory */
WebRtc_Word16 *buf = &CBbuf[LPC_FILTERORDER];
WebRtc_Word16 *target = &targetVec[LPC_FILTERORDER];
WebRtc_Word16 *aug_vec = (WebRtc_Word16*)cDot; /* length [SUBL], reuse memory */
int16_t codedVec[SUBL];
int16_t interpSamples[20*4];
int16_t interpSamplesFilt[20*4];
int16_t energyW16[CB_EXPAND*128];
int16_t energyShifts[CB_EXPAND*128];
int16_t *inverseEnergy=energyW16; /* Reuse memory */
int16_t *inverseEnergyShifts=energyShifts; /* Reuse memory */
int16_t *buf = &CBbuf[LPC_FILTERORDER];
int16_t *target = &targetVec[LPC_FILTERORDER];
int16_t *aug_vec = (int16_t*)cDot; /* length [SUBL], reuse memory */
/* Determine size of codebook sections */
@ -108,8 +108,8 @@ void WebRtcIlbcfix_CbSearch(
/* Find the highest absolute value to calculate proper
vector scale factor (so that it uses 12 bits) */
temp1 = WebRtcSpl_MaxAbsValueW16(buf, (WebRtc_Word16)lMem);
temp2 = WebRtcSpl_MaxAbsValueW16(target, (WebRtc_Word16)lTarget);
temp1 = WebRtcSpl_MaxAbsValueW16(buf, (int16_t)lMem);
temp2 = WebRtcSpl_MaxAbsValueW16(target, (int16_t)lTarget);
if ((temp1>0)&&(temp2>0)) {
temp1 = WEBRTC_SPL_MAX(temp1, temp2);
@ -147,7 +147,7 @@ void WebRtcIlbcfix_CbSearch(
/* Compute the CB vectors' energies for the second cb section (filtered cb) */
WebRtcIlbcfix_CbMemEnergyAugmentation(interpSamplesFilt, cbvectors,
scale, (WebRtc_Word16)(base_size+20), energyW16, energyShifts);
scale, (int16_t)(base_size+20), energyW16, energyShifts);
/* Compute the CB vectors' energies and store them in the vector
* energyW16. Also the corresponding shift values are stored. The
@ -221,11 +221,11 @@ void WebRtcIlbcfix_CbSearch(
/* Update the global best index and the corresponding gain */
WebRtcIlbcfix_CbUpdateBestIndex(
CritNew, CritNewSh, (WebRtc_Word16)(indexNew+indexOffset), cDot[indexNew+indexOffset],
CritNew, CritNewSh, (int16_t)(indexNew+indexOffset), cDot[indexNew+indexOffset],
inverseEnergy[indexNew+indexOffset], inverseEnergyShifts[indexNew+indexOffset],
&CritMax, &shTotMax, &bestIndex, &bestGain);
sInd=bestIndex-(WebRtc_Word16)(CB_RESRANGE>>1);
sInd=bestIndex-(int16_t)(CB_RESRANGE>>1);
eInd=sInd+CB_RESRANGE;
if (sInd<0) {
eInd-=sInd;
@ -243,7 +243,7 @@ void WebRtcIlbcfix_CbSearch(
if (sInd<20) {
WebRtcIlbcfix_AugmentedCbCorr(target, cbvectors+lMem,
interpSamplesFilt, cDot,
(WebRtc_Word16)(sInd+20), (WebRtc_Word16)(WEBRTC_SPL_MIN(39, (eInd+20))), scale);
(int16_t)(sInd+20), (int16_t)(WEBRTC_SPL_MIN(39, (eInd+20))), scale);
i=20;
}
@ -251,14 +251,14 @@ void WebRtcIlbcfix_CbSearch(
cb_vecPtr = cbvectors+lMem-20-i;
/* Calculate the cross correlations (main part of the filtered CB) */
WebRtcSpl_CrossCorrelation(cDotPtr, target, cb_vecPtr, lTarget, (WebRtc_Word16)(eInd-i+1), scale, -1);
WebRtcSpl_CrossCorrelation(cDotPtr, target, cb_vecPtr, lTarget, (int16_t)(eInd-i+1), scale, -1);
} else {
cDotPtr = cDot;
cb_vecPtr = cbvectors+lMem-lTarget-sInd;
/* Calculate the cross correlations (main part of the filtered CB) */
WebRtcSpl_CrossCorrelation(cDotPtr, target, cb_vecPtr, lTarget, (WebRtc_Word16)(eInd-sInd+1), scale, -1);
WebRtcSpl_CrossCorrelation(cDotPtr, target, cb_vecPtr, lTarget, (int16_t)(eInd-sInd+1), scale, -1);
}
@ -267,13 +267,13 @@ void WebRtcIlbcfix_CbSearch(
/* Search for best index in this part of the vector */
WebRtcIlbcfix_CbSearchCore(
cDot, (WebRtc_Word16)(eInd-sInd+1), stage, inverseEnergy+indexOffset,
cDot, (int16_t)(eInd-sInd+1), stage, inverseEnergy+indexOffset,
inverseEnergyShifts+indexOffset, Crit,
&indexNew, &CritNew, &CritNewSh);
/* Update the global best index and the corresponding gain */
WebRtcIlbcfix_CbUpdateBestIndex(
CritNew, CritNewSh, (WebRtc_Word16)(indexNew+indexOffset), cDot[indexNew],
CritNew, CritNewSh, (int16_t)(indexNew+indexOffset), cDot[indexNew],
inverseEnergy[indexNew+indexOffset], inverseEnergyShifts[indexNew+indexOffset],
&CritMax, &shTotMax, &bestIndex, &bestGain);
@ -281,7 +281,7 @@ void WebRtcIlbcfix_CbSearch(
bestGain = WebRtcIlbcfix_GainQuant(bestGain,
(WebRtc_Word16)WEBRTC_SPL_ABS_W16(gains[stage]), stage, &gain_index[stage]);
(int16_t)WEBRTC_SPL_ABS_W16(gains[stage]), stage, &gain_index[stage]);
/* Extract the best (according to measure) codebook vector
Also adjust the index, so that the augmented vectors are last.
@ -308,7 +308,7 @@ void WebRtcIlbcfix_CbSearch(
/* Adjust index and extract vector */
index[stage]+=(base_size-20);
WebRtcIlbcfix_CreateAugmentedVec((WebRtc_Word16)(index[stage]-base_size+40),
WebRtcIlbcfix_CreateAugmentedVec((int16_t)(index[stage]-base_size+40),
buf+lMem, aug_vec);
pp = aug_vec;
@ -323,7 +323,7 @@ void WebRtcIlbcfix_CbSearch(
} else {
/* Adjust index and extract vector */
index[stage]+=(base_size-20);
WebRtcIlbcfix_CreateAugmentedVec((WebRtc_Word16)(index[stage]-2*base_size+40),
WebRtcIlbcfix_CreateAugmentedVec((int16_t)(index[stage]-2*base_size+40),
cbvectors+lMem, aug_vec);
pp = aug_vec;
}
@ -333,7 +333,7 @@ void WebRtcIlbcfix_CbSearch(
/* Subtract the best codebook vector, according
to measure, from the target vector */
WebRtcSpl_AddAffineVectorToVector(target, pp, (WebRtc_Word16)(-bestGain), (WebRtc_Word32)8192, (WebRtc_Word16)14, (int)lTarget);
WebRtcSpl_AddAffineVectorToVector(target, pp, (int16_t)(-bestGain), (int32_t)8192, (int16_t)14, (int)lTarget);
/* record quantized gain */
gains[stage+1] = bestGain;
@ -350,8 +350,8 @@ void WebRtcIlbcfix_CbSearch(
j=gain_index[0];
temp1 = (WebRtc_Word16)WebRtcSpl_NormW32(codedEner);
temp2 = (WebRtc_Word16)WebRtcSpl_NormW32(targetEner);
temp1 = (int16_t)WebRtcSpl_NormW32(codedEner);
temp2 = (int16_t)WebRtcSpl_NormW32(targetEner);
if(temp1 < temp2) {
bits = 16 - temp1;
@ -359,19 +359,19 @@ void WebRtcIlbcfix_CbSearch(
bits = 16 - temp2;
}
tmp = (WebRtc_Word16) WEBRTC_SPL_MUL_16_16_RSFT(gains[1],gains[1], 14);
tmp = (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(gains[1],gains[1], 14);
targetEner = WEBRTC_SPL_MUL_16_16(
WEBRTC_SPL_SHIFT_W32(targetEner, -bits), tmp);
tmpW32 = ((WebRtc_Word32)(gains[1]-1))<<1;
tmpW32 = ((int32_t)(gains[1]-1))<<1;
/* Pointer to the table that contains
gain_sq5TblFIX * gain_sq5TblFIX in Q14 */
gainPtr=(WebRtc_Word16*)WebRtcIlbcfix_kGainSq5Sq+gain_index[0];
temp1 = (WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(codedEner, -bits);
gainPtr=(int16_t*)WebRtcIlbcfix_kGainSq5Sq+gain_index[0];
temp1 = (int16_t)WEBRTC_SPL_SHIFT_W32(codedEner, -bits);
WebRtcIlbcfix_kGainSq5_ptr = (WebRtc_Word16*)&WebRtcIlbcfix_kGainSq5[j];
WebRtcIlbcfix_kGainSq5_ptr = (int16_t*)&WebRtcIlbcfix_kGainSq5[j];
/* targetEner and codedEner are in Q(-2*scale) */
for (i=gain_index[0];i<32;i++) {
@ -386,7 +386,7 @@ void WebRtcIlbcfix_CbSearch(
if (t32 < 0) {
if ((*WebRtcIlbcfix_kGainSq5_ptr) < tmpW32) {
j=i;
WebRtcIlbcfix_kGainSq5_ptr = (WebRtc_Word16*)&WebRtcIlbcfix_kGainSq5[i];
WebRtcIlbcfix_kGainSq5_ptr = (int16_t*)&WebRtcIlbcfix_kGainSq5[i];
}
}
gainPtr++;

View File

@ -22,14 +22,14 @@
void WebRtcIlbcfix_CbSearch(
iLBC_Enc_Inst_t *iLBCenc_inst,
/* (i) the encoder state structure */
WebRtc_Word16 *index, /* (o) Codebook indices */
WebRtc_Word16 *gain_index, /* (o) Gain quantization indices */
WebRtc_Word16 *intarget, /* (i) Target vector for encoding */
WebRtc_Word16 *decResidual,/* (i) Decoded residual for codebook construction */
WebRtc_Word16 lMem, /* (i) Length of buffer */
WebRtc_Word16 lTarget, /* (i) Length of vector */
WebRtc_Word16 *weightDenum,/* (i) weighting filter coefficients in Q12 */
WebRtc_Word16 block /* (i) the subblock number */
int16_t *index, /* (o) Codebook indices */
int16_t *gain_index, /* (o) Gain quantization indices */
int16_t *intarget, /* (i) Target vector for encoding */
int16_t *decResidual,/* (i) Decoded residual for codebook construction */
int16_t lMem, /* (i) Length of buffer */
int16_t lTarget, /* (i) Length of vector */
int16_t *weightDenum,/* (i) weighting filter coefficients in Q12 */
int16_t block /* (i) the subblock number */
);
#endif

View File

@ -20,29 +20,29 @@
#include "constants.h"
void WebRtcIlbcfix_CbSearchCore(
WebRtc_Word32 *cDot, /* (i) Cross Correlation */
WebRtc_Word16 range, /* (i) Search range */
WebRtc_Word16 stage, /* (i) Stage of this search */
WebRtc_Word16 *inverseEnergy, /* (i) Inversed energy */
WebRtc_Word16 *inverseEnergyShift, /* (i) Shifts of inversed energy
int32_t *cDot, /* (i) Cross Correlation */
int16_t range, /* (i) Search range */
int16_t stage, /* (i) Stage of this search */
int16_t *inverseEnergy, /* (i) Inversed energy */
int16_t *inverseEnergyShift, /* (i) Shifts of inversed energy
with the offset 2*16-29 */
WebRtc_Word32 *Crit, /* (o) The criteria */
WebRtc_Word16 *bestIndex, /* (o) Index that corresponds to
int32_t *Crit, /* (o) The criteria */
int16_t *bestIndex, /* (o) Index that corresponds to
maximum criteria (in this
vector) */
WebRtc_Word32 *bestCrit, /* (o) Value of critera for the
int32_t *bestCrit, /* (o) Value of critera for the
chosen index */
WebRtc_Word16 *bestCritSh) /* (o) The domain of the chosen
int16_t *bestCritSh) /* (o) The domain of the chosen
criteria */
{
WebRtc_Word32 maxW32, tmp32;
WebRtc_Word16 max, sh, tmp16;
int32_t maxW32, tmp32;
int16_t max, sh, tmp16;
int i;
WebRtc_Word32 *cDotPtr;
WebRtc_Word16 cDotSqW16;
WebRtc_Word16 *inverseEnergyPtr;
WebRtc_Word32 *critPtr;
WebRtc_Word16 *inverseEnergyShiftPtr;
int32_t *cDotPtr;
int16_t cDotSqW16;
int16_t *inverseEnergyPtr;
int32_t *critPtr;
int16_t *inverseEnergyShiftPtr;
/* Don't allow negative values for stage 0 */
if (stage==0) {
@ -53,10 +53,10 @@ void WebRtcIlbcfix_CbSearchCore(
}
}
/* Normalize cDot to WebRtc_Word16, calculate the square of cDot and store the upper WebRtc_Word16 */
/* Normalize cDot to int16_t, calculate the square of cDot and store the upper int16_t */
maxW32 = WebRtcSpl_MaxAbsValueW32(cDot, range);
sh = (WebRtc_Word16)WebRtcSpl_NormW32(maxW32);
sh = (int16_t)WebRtcSpl_NormW32(maxW32);
cDotPtr = cDot;
inverseEnergyPtr = inverseEnergy;
critPtr = Crit;
@ -64,10 +64,10 @@ void WebRtcIlbcfix_CbSearchCore(
max=WEBRTC_SPL_WORD16_MIN;
for (i=0;i<range;i++) {
/* Calculate cDot*cDot and put the result in a WebRtc_Word16 */
/* Calculate cDot*cDot and put the result in a int16_t */
tmp32 = WEBRTC_SPL_LSHIFT_W32(*cDotPtr,sh);
tmp16 = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp32,16);
cDotSqW16 = (WebRtc_Word16)(((WebRtc_Word32)(tmp16)*(tmp16))>>16);
tmp16 = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32,16);
cDotSqW16 = (int16_t)(((int32_t)(tmp16)*(tmp16))>>16);
/* Calculate the criteria (cDot*cDot/energy) */
*critPtr=WEBRTC_SPL_MUL_16_16(cDotSqW16, (*inverseEnergyPtr));

View File

@ -22,19 +22,19 @@
#include "defines.h"
void WebRtcIlbcfix_CbSearchCore(
WebRtc_Word32 *cDot, /* (i) Cross Correlation */
WebRtc_Word16 range, /* (i) Search range */
WebRtc_Word16 stage, /* (i) Stage of this search */
WebRtc_Word16 *inverseEnergy, /* (i) Inversed energy */
WebRtc_Word16 *inverseEnergyShift, /* (i) Shifts of inversed energy
int32_t *cDot, /* (i) Cross Correlation */
int16_t range, /* (i) Search range */
int16_t stage, /* (i) Stage of this search */
int16_t *inverseEnergy, /* (i) Inversed energy */
int16_t *inverseEnergyShift, /* (i) Shifts of inversed energy
with the offset 2*16-29 */
WebRtc_Word32 *Crit, /* (o) The criteria */
WebRtc_Word16 *bestIndex, /* (o) Index that corresponds to
int32_t *Crit, /* (o) The criteria */
int16_t *bestIndex, /* (o) Index that corresponds to
maximum criteria (in this
vector) */
WebRtc_Word32 *bestCrit, /* (o) Value of critera for the
int32_t *bestCrit, /* (o) Value of critera for the
chosen index */
WebRtc_Word16 *bestCritSh); /* (o) The domain of the chosen
int16_t *bestCritSh); /* (o) The domain of the chosen
criteria */
#endif

View File

@ -21,22 +21,22 @@
#include "constants.h"
void WebRtcIlbcfix_CbUpdateBestIndex(
WebRtc_Word32 CritNew, /* (i) New Potentially best Criteria */
WebRtc_Word16 CritNewSh, /* (i) Shift value of above Criteria */
WebRtc_Word16 IndexNew, /* (i) Index of new Criteria */
WebRtc_Word32 cDotNew, /* (i) Cross dot of new index */
WebRtc_Word16 invEnergyNew, /* (i) Inversed energy new index */
WebRtc_Word16 energyShiftNew, /* (i) Energy shifts of new index */
WebRtc_Word32 *CritMax, /* (i/o) Maximum Criteria (so far) */
WebRtc_Word16 *shTotMax, /* (i/o) Shifts of maximum criteria */
WebRtc_Word16 *bestIndex, /* (i/o) Index that corresponds to
int32_t CritNew, /* (i) New Potentially best Criteria */
int16_t CritNewSh, /* (i) Shift value of above Criteria */
int16_t IndexNew, /* (i) Index of new Criteria */
int32_t cDotNew, /* (i) Cross dot of new index */
int16_t invEnergyNew, /* (i) Inversed energy new index */
int16_t energyShiftNew, /* (i) Energy shifts of new index */
int32_t *CritMax, /* (i/o) Maximum Criteria (so far) */
int16_t *shTotMax, /* (i/o) Shifts of maximum criteria */
int16_t *bestIndex, /* (i/o) Index that corresponds to
maximum criteria */
WebRtc_Word16 *bestGain) /* (i/o) Gain in Q14 that corresponds
int16_t *bestGain) /* (i/o) Gain in Q14 that corresponds
to maximum criteria */
{
WebRtc_Word16 shOld, shNew, tmp16;
WebRtc_Word16 scaleTmp;
WebRtc_Word32 gainW32;
int16_t shOld, shNew, tmp16;
int16_t scaleTmp;
int32_t gainW32;
/* Normalize the new and old Criteria to the same domain */
if (CritNewSh>(*shTotMax)) {
@ -54,19 +54,19 @@ void WebRtcIlbcfix_CbUpdateBestIndex(
if (WEBRTC_SPL_RSHIFT_W32(CritNew, shNew)>
WEBRTC_SPL_RSHIFT_W32((*CritMax),shOld)) {
tmp16 = (WebRtc_Word16)WebRtcSpl_NormW32(cDotNew);
tmp16 = (int16_t)WebRtcSpl_NormW32(cDotNew);
tmp16 = 16 - tmp16;
/* Calculate the gain in Q14
Compensate for inverseEnergyshift in Q29 and that the energy
value was stored in a WebRtc_Word16 (shifted down 16 steps)
value was stored in a int16_t (shifted down 16 steps)
=> 29-14+16 = 31 */
scaleTmp = -energyShiftNew-tmp16+31;
scaleTmp = WEBRTC_SPL_MIN(31, scaleTmp);
gainW32 = WEBRTC_SPL_MUL_16_16_RSFT(
((WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(cDotNew, -tmp16)), invEnergyNew, scaleTmp);
((int16_t)WEBRTC_SPL_SHIFT_W32(cDotNew, -tmp16)), invEnergyNew, scaleTmp);
/* Check if criteria satisfies Gain criteria (max 1.3)
if it is larger set the gain to 1.3
@ -77,7 +77,7 @@ void WebRtcIlbcfix_CbUpdateBestIndex(
} else if (gainW32<-21299) {
*bestGain=-21299;
} else {
*bestGain=(WebRtc_Word16)gainW32;
*bestGain=(int16_t)gainW32;
}
*CritMax=CritNew;

View File

@ -22,17 +22,17 @@
#include "defines.h"
void WebRtcIlbcfix_CbUpdateBestIndex(
WebRtc_Word32 CritNew, /* (i) New Potentially best Criteria */
WebRtc_Word16 CritNewSh, /* (i) Shift value of above Criteria */
WebRtc_Word16 IndexNew, /* (i) Index of new Criteria */
WebRtc_Word32 cDotNew, /* (i) Cross dot of new index */
WebRtc_Word16 invEnergyNew, /* (i) Inversed energy new index */
WebRtc_Word16 energyShiftNew, /* (i) Energy shifts of new index */
WebRtc_Word32 *CritMax, /* (i/o) Maximum Criteria (so far) */
WebRtc_Word16 *shTotMax, /* (i/o) Shifts of maximum criteria */
WebRtc_Word16 *bestIndex, /* (i/o) Index that corresponds to
int32_t CritNew, /* (i) New Potentially best Criteria */
int16_t CritNewSh, /* (i) Shift value of above Criteria */
int16_t IndexNew, /* (i) Index of new Criteria */
int32_t cDotNew, /* (i) Cross dot of new index */
int16_t invEnergyNew, /* (i) Inversed energy new index */
int16_t energyShiftNew, /* (i) Energy shifts of new index */
int32_t *CritMax, /* (i/o) Maximum Criteria (so far) */
int16_t *shTotMax, /* (i/o) Shifts of maximum criteria */
int16_t *bestIndex, /* (i/o) Index that corresponds to
maximum criteria */
WebRtc_Word16 *bestGain); /* (i/o) Gain in Q14 that corresponds
int16_t *bestGain); /* (i/o) Gain in Q14 that corresponds
to maximum criteria */
#endif

View File

@ -26,57 +26,57 @@
* T_i(x) is the i:th order Chebyshev polynomial
*------------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_Chebyshev(
int16_t WebRtcIlbcfix_Chebyshev(
/* (o) Result of C(x) */
WebRtc_Word16 x, /* (i) Value to the Chevyshev polynomial */
WebRtc_Word16 *f /* (i) The coefficients in the polynomial */
int16_t x, /* (i) Value to the Chevyshev polynomial */
int16_t *f /* (i) The coefficients in the polynomial */
) {
WebRtc_Word16 b1_high, b1_low; /* Use the high, low format to increase the accuracy */
WebRtc_Word32 b2;
WebRtc_Word32 tmp1W32;
WebRtc_Word32 tmp2W32;
int16_t b1_high, b1_low; /* Use the high, low format to increase the accuracy */
int32_t b2;
int32_t tmp1W32;
int32_t tmp2W32;
int i;
b2 = (WebRtc_Word32)0x1000000; /* b2 = 1.0 (Q23) */
b2 = (int32_t)0x1000000; /* b2 = 1.0 (Q23) */
/* Calculate b1 = 2*x + f[1] */
tmp1W32 = WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)x, 10);
tmp1W32 += WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)f[1], 14);
tmp1W32 = WEBRTC_SPL_LSHIFT_W32((int32_t)x, 10);
tmp1W32 += WEBRTC_SPL_LSHIFT_W32((int32_t)f[1], 14);
for (i = 2; i < 5; i++) {
tmp2W32 = tmp1W32;
/* Split b1 (in tmp1W32) into a high and low part */
b1_high = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp1W32, 16);
b1_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp1W32-WEBRTC_SPL_LSHIFT_W32(((WebRtc_Word32)b1_high),16), 1);
b1_high = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp1W32, 16);
b1_low = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp1W32-WEBRTC_SPL_LSHIFT_W32(((int32_t)b1_high),16), 1);
/* Calculate 2*x*b1-b2+f[i] */
tmp1W32 = WEBRTC_SPL_LSHIFT_W32( (WEBRTC_SPL_MUL_16_16(b1_high, x) +
WEBRTC_SPL_MUL_16_16_RSFT(b1_low, x, 15)), 2);
tmp1W32 -= b2;
tmp1W32 += WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)f[i], 14);
tmp1W32 += WEBRTC_SPL_LSHIFT_W32((int32_t)f[i], 14);
/* Update b2 for next round */
b2 = tmp2W32;
}
/* Split b1 (in tmp1W32) into a high and low part */
b1_high = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp1W32, 16);
b1_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp1W32-WEBRTC_SPL_LSHIFT_W32(((WebRtc_Word32)b1_high),16), 1);
b1_high = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp1W32, 16);
b1_low = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp1W32-WEBRTC_SPL_LSHIFT_W32(((int32_t)b1_high),16), 1);
/* tmp1W32 = x*b1 - b2 + f[i]/2 */
tmp1W32 = WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16(b1_high, x), 1) +
WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16_RSFT(b1_low, x, 15), 1);
tmp1W32 -= b2;
tmp1W32 += WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)f[i], 13);
tmp1W32 += WEBRTC_SPL_LSHIFT_W32((int32_t)f[i], 13);
/* Handle overflows and set to maximum or minimum WebRtc_Word16 instead */
if (tmp1W32>((WebRtc_Word32)33553408)) {
/* Handle overflows and set to maximum or minimum int16_t instead */
if (tmp1W32>((int32_t)33553408)) {
return(WEBRTC_SPL_WORD16_MAX);
} else if (tmp1W32<((WebRtc_Word32)-33554432)) {
} else if (tmp1W32<((int32_t)-33554432)) {
return(WEBRTC_SPL_WORD16_MIN);
} else {
return((WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp1W32, 10));
return((int16_t)WEBRTC_SPL_RSHIFT_W32(tmp1W32, 10));
}
}

View File

@ -28,10 +28,10 @@
* T_i(x) is the i:th order Chebyshev polynomial
*------------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_Chebyshev(
int16_t WebRtcIlbcfix_Chebyshev(
/* (o) Result of C(x) */
WebRtc_Word16 x, /* (i) Value to the Chevyshev polynomial */
WebRtc_Word16 *f /* (i) The coefficients in the polynomial */
int16_t x, /* (i) Value to the Chevyshev polynomial */
int16_t *f /* (i) The coefficients in the polynomial */
);
#endif

View File

@ -24,15 +24,15 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_CompCorr(
WebRtc_Word32 *corr, /* (o) cross correlation */
WebRtc_Word32 *ener, /* (o) energy */
WebRtc_Word16 *buffer, /* (i) signal buffer */
WebRtc_Word16 lag, /* (i) pitch lag */
WebRtc_Word16 bLen, /* (i) length of buffer */
WebRtc_Word16 sRange, /* (i) correlation search length */
WebRtc_Word16 scale /* (i) number of rightshifts to use */
int32_t *corr, /* (o) cross correlation */
int32_t *ener, /* (o) energy */
int16_t *buffer, /* (i) signal buffer */
int16_t lag, /* (i) pitch lag */
int16_t bLen, /* (i) length of buffer */
int16_t sRange, /* (i) correlation search length */
int16_t scale /* (i) number of rightshifts to use */
){
WebRtc_Word16 *w16ptr;
int16_t *w16ptr;
w16ptr=&buffer[bLen-sRange-lag];

View File

@ -27,13 +27,13 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_CompCorr(
WebRtc_Word32 *corr, /* (o) cross correlation */
WebRtc_Word32 *ener, /* (o) energy */
WebRtc_Word16 *buffer, /* (i) signal buffer */
WebRtc_Word16 lag, /* (i) pitch lag */
WebRtc_Word16 bLen, /* (i) length of buffer */
WebRtc_Word16 sRange, /* (i) correlation search length */
WebRtc_Word16 scale /* (i) number of rightshifts to use */
int32_t *corr, /* (o) cross correlation */
int32_t *ener, /* (o) energy */
int16_t *buffer, /* (i) signal buffer */
int16_t lag, /* (i) pitch lag */
int16_t bLen, /* (i) length of buffer */
int16_t sRange, /* (i) correlation search length */
int16_t scale /* (i) number of rightshifts to use */
);
#endif

View File

@ -21,25 +21,25 @@
/* HP Filters {b[0] b[1] b[2] -a[1] -a[2]} */
const WebRtc_Word16 WebRtcIlbcfix_kHpInCoefs[5] = {3798, -7596, 3798, 7807, -3733};
const WebRtc_Word16 WebRtcIlbcfix_kHpOutCoefs[5] = {3849, -7699, 3849, 7918, -3833};
const int16_t WebRtcIlbcfix_kHpInCoefs[5] = {3798, -7596, 3798, 7807, -3733};
const int16_t WebRtcIlbcfix_kHpOutCoefs[5] = {3849, -7699, 3849, 7918, -3833};
/* Window in Q11 to window the energies of the 5 choises (3 for 20ms) in the choise for
the 80 sample start state
*/
const WebRtc_Word16 WebRtcIlbcfix_kStartSequenceEnrgWin[NSUB_MAX-1]= {
const int16_t WebRtcIlbcfix_kStartSequenceEnrgWin[NSUB_MAX-1]= {
1638, 1843, 2048, 1843, 1638
};
/* LP Filter coeffs used for downsampling */
const WebRtc_Word16 WebRtcIlbcfix_kLpFiltCoefs[FILTERORDER_DS_PLUS1]= {
const int16_t WebRtcIlbcfix_kLpFiltCoefs[FILTERORDER_DS_PLUS1]= {
-273, 512, 1297, 1696, 1297, 512, -273
};
/* Constants used in the LPC calculations */
/* Hanning LPC window (in Q15) */
const WebRtc_Word16 WebRtcIlbcfix_kLpcWin[BLOCKL_MAX] = {
const int16_t WebRtcIlbcfix_kLpcWin[BLOCKL_MAX] = {
6, 22, 50, 89, 139, 200, 272, 355, 449, 554, 669, 795,
932, 1079, 1237, 1405, 1583, 1771, 1969, 2177, 2395, 2622, 2858, 3104,
3359, 3622, 3894, 4175, 4464, 4761, 5066, 5379, 5699, 6026, 6361, 6702,
@ -63,7 +63,7 @@ const WebRtc_Word16 WebRtcIlbcfix_kLpcWin[BLOCKL_MAX] = {
};
/* Asymmetric LPC window (in Q15)*/
const WebRtc_Word16 WebRtcIlbcfix_kLpcAsymWin[BLOCKL_MAX] = {
const int16_t WebRtcIlbcfix_kLpcAsymWin[BLOCKL_MAX] = {
2, 7, 15, 27, 42, 60, 81, 106, 135, 166, 201, 239,
280, 325, 373, 424, 478, 536, 597, 661, 728, 798, 872, 949,
1028, 1111, 1197, 1287, 1379, 1474, 1572, 1674, 1778, 1885, 1995, 2108,
@ -87,7 +87,7 @@ const WebRtc_Word16 WebRtcIlbcfix_kLpcAsymWin[BLOCKL_MAX] = {
};
/* Lag window for LPC (Q31) */
const WebRtc_Word32 WebRtcIlbcfix_kLpcLagWin[LPC_FILTERORDER + 1]={
const int32_t WebRtcIlbcfix_kLpcLagWin[LPC_FILTERORDER + 1]={
2147483647, 2144885453, 2137754373, 2125918626, 2109459810,
2088483140, 2063130336, 2033564590, 1999977009, 1962580174,
1921610283};
@ -95,7 +95,7 @@ const WebRtc_Word32 WebRtcIlbcfix_kLpcLagWin[LPC_FILTERORDER + 1]={
/* WebRtcIlbcfix_kLpcChirpSyntDenum vector in Q15 corresponding
* floating point vector {1 0.9025 0.9025^2 0.9025^3 ...}
*/
const WebRtc_Word16 WebRtcIlbcfix_kLpcChirpSyntDenum[LPC_FILTERORDER + 1] = {
const int16_t WebRtcIlbcfix_kLpcChirpSyntDenum[LPC_FILTERORDER + 1] = {
32767, 29573, 26690, 24087,
21739, 19619, 17707, 15980,
14422, 13016, 11747};
@ -103,12 +103,12 @@ const WebRtc_Word16 WebRtcIlbcfix_kLpcChirpSyntDenum[LPC_FILTERORDER + 1] = {
/* WebRtcIlbcfix_kLpcChirpWeightDenum in Q15 corresponding to
* floating point vector {1 0.4222 0.4222^2... }
*/
const WebRtc_Word16 WebRtcIlbcfix_kLpcChirpWeightDenum[LPC_FILTERORDER + 1] = {
const int16_t WebRtcIlbcfix_kLpcChirpWeightDenum[LPC_FILTERORDER + 1] = {
32767, 13835, 5841, 2466, 1041, 440,
186, 78, 33, 14, 6};
/* LSF quantization Q13 domain */
const WebRtc_Word16 WebRtcIlbcfix_kLsfCb[64 * 3 + 128 * 3 + 128 * 4] = {
const int16_t WebRtcIlbcfix_kLsfCb[64 * 3 + 128 * 3 + 128 * 4] = {
1273, 2238, 3696,
3199, 5309, 8209,
3606, 5671, 7829,
@ -431,22 +431,22 @@ const WebRtc_Word16 WebRtcIlbcfix_kLsfCb[64 * 3 + 128 * 3 + 128 * 4] = {
15878, 18550, 20718, 22906
};
const WebRtc_Word16 WebRtcIlbcfix_kLsfDimCb[LSF_NSPLIT] = {3, 3, 4};
const WebRtc_Word16 WebRtcIlbcfix_kLsfSizeCb[LSF_NSPLIT] = {64,128,128};
const int16_t WebRtcIlbcfix_kLsfDimCb[LSF_NSPLIT] = {3, 3, 4};
const int16_t WebRtcIlbcfix_kLsfSizeCb[LSF_NSPLIT] = {64,128,128};
const WebRtc_Word16 WebRtcIlbcfix_kLsfMean[LPC_FILTERORDER] = {
const int16_t WebRtcIlbcfix_kLsfMean[LPC_FILTERORDER] = {
2308, 3652, 5434, 7885,
10255, 12559, 15160, 17513,
20328, 22752};
const WebRtc_Word16 WebRtcIlbcfix_kLspMean[LPC_FILTERORDER] = {
const int16_t WebRtcIlbcfix_kLspMean[LPC_FILTERORDER] = {
31476, 29565, 25819, 18725, 10276,
1236, -9049, -17600, -25884, -30618
};
/* Q14 */
const WebRtc_Word16 WebRtcIlbcfix_kLsfWeight20ms[4] = {12288, 8192, 4096, 0};
const WebRtc_Word16 WebRtcIlbcfix_kLsfWeight30ms[6] = {8192, 16384, 10923, 5461, 0, 0};
const int16_t WebRtcIlbcfix_kLsfWeight20ms[4] = {12288, 8192, 4096, 0};
const int16_t WebRtcIlbcfix_kLsfWeight30ms[6] = {8192, 16384, 10923, 5461, 0, 0};
/*
cos(x) in Q15
@ -454,7 +454,7 @@ const WebRtc_Word16 WebRtcIlbcfix_kLsfWeight30ms[6] = {8192, 16384, 10923, 5461,
used in WebRtcIlbcfix_Lsp2Lsf()
*/
const WebRtc_Word16 WebRtcIlbcfix_kCos[64] = {
const int16_t WebRtcIlbcfix_kCos[64] = {
32767, 32729, 32610, 32413, 32138, 31786, 31357, 30853,
30274, 29622, 28899, 28106, 27246, 26320, 25330, 24279,
23170, 22006, 20788, 19520, 18205, 16846, 15447, 14010,
@ -469,7 +469,7 @@ const WebRtc_Word16 WebRtcIlbcfix_kCos[64] = {
Derivative in Q19, used to interpolate between the
WebRtcIlbcfix_kCos[] values to get a more exact y = cos(x)
*/
const WebRtc_Word16 WebRtcIlbcfix_kCosDerivative[64] = {
const int16_t WebRtcIlbcfix_kCosDerivative[64] = {
-632, -1893, -3150, -4399, -5638, -6863, -8072, -9261,
-10428, -11570, -12684, -13767, -14817, -15832, -16808, -17744,
-18637, -19486, -20287, -21039, -21741, -22390, -22986, -23526,
@ -484,7 +484,7 @@ const WebRtc_Word16 WebRtcIlbcfix_kCosDerivative[64] = {
WebRtcIlbcfix_kCosGrid[i] = cos((2*pi*i)/(float)(2*COS_GRID_POINTS));
*/
const WebRtc_Word16 WebRtcIlbcfix_kCosGrid[COS_GRID_POINTS + 1] = {
const int16_t WebRtcIlbcfix_kCosGrid[COS_GRID_POINTS + 1] = {
32760, 32723, 32588, 32364, 32051, 31651, 31164, 30591,
29935, 29196, 28377, 27481, 26509, 25465, 24351, 23170,
21926, 20621, 19260, 17846, 16384, 14876, 13327, 11743,
@ -500,7 +500,7 @@ const WebRtc_Word16 WebRtcIlbcfix_kCosGrid[COS_GRID_POINTS + 1] = {
used in WebRtcIlbcfix_Lsp2Lsf()
*/
const WebRtc_Word16 WebRtcIlbcfix_kAcosDerivative[64] = {
const int16_t WebRtcIlbcfix_kAcosDerivative[64] = {
-26887, -8812, -5323, -3813, -2979, -2444, -2081, -1811,
-1608, -1450, -1322, -1219, -1132, -1059, -998, -946,
-901, -861, -827, -797, -772, -750, -730, -713,
@ -515,7 +515,7 @@ const WebRtc_Word16 WebRtcIlbcfix_kAcosDerivative[64] = {
/* Tables for quantization of start state */
/* State quantization tables */
const WebRtc_Word16 WebRtcIlbcfix_kStateSq3[8] = { /* Values in Q13 */
const int16_t WebRtcIlbcfix_kStateSq3[8] = { /* Values in Q13 */
-30473, -17838, -9257, -2537,
3639, 10893, 19958, 32636
};
@ -524,7 +524,7 @@ const WebRtc_Word16 WebRtcIlbcfix_kStateSq3[8] = { /* Values in Q13 */
less or equal than value 0 => index = 0
less or equal than value k => index = k
*/
const WebRtc_Word32 WebRtcIlbcfix_kChooseFrgQuant[64] = {
const int32_t WebRtcIlbcfix_kChooseFrgQuant[64] = {
118, 163, 222, 305, 425, 604,
851, 1174, 1617, 2222, 3080, 4191,
5525, 7215, 9193, 11540, 14397, 17604,
@ -538,7 +538,7 @@ const WebRtc_Word32 WebRtcIlbcfix_kChooseFrgQuant[64] = {
37302935, 58819185, 109782723, WEBRTC_SPL_WORD32_MAX
};
const WebRtc_Word16 WebRtcIlbcfix_kScale[64] = {
const int16_t WebRtcIlbcfix_kScale[64] = {
/* Values in Q16 */
29485, 25003, 21345, 18316, 15578, 13128, 10973, 9310, 7955,
6762, 5789, 4877, 4255, 3699, 3258, 2904, 2595, 2328,
@ -560,7 +560,7 @@ const WebRtc_Word16 WebRtcIlbcfix_kScale[64] = {
37:58 in Q5
59:63 in Q3
*/
const WebRtc_Word16 WebRtcIlbcfix_kFrgQuantMod[64] = {
const int16_t WebRtcIlbcfix_kFrgQuantMod[64] = {
/* First 37 values in Q8 */
569, 671, 786, 916, 1077, 1278,
1529, 1802, 2109, 2481, 2898, 3440,
@ -583,36 +583,36 @@ const WebRtc_Word16 WebRtcIlbcfix_kFrgQuantMod[64] = {
/* Expansion filter to get additional cb section.
* Q12 and reversed compared to flp
*/
const WebRtc_Word16 WebRtcIlbcfix_kCbFiltersRev[CB_FILTERLEN]={
const int16_t WebRtcIlbcfix_kCbFiltersRev[CB_FILTERLEN]={
-140, 446, -755, 3302, 2922, -590, 343, -138};
/* Weighting coefficients for short lags.
* [0.2 0.4 0.6 0.8] in Q15 */
const WebRtc_Word16 WebRtcIlbcfix_kAlpha[4]={
const int16_t WebRtcIlbcfix_kAlpha[4]={
6554, 13107, 19661, 26214};
/* Ranges for search and filters at different subframes */
const WebRtc_Word16 WebRtcIlbcfix_kSearchRange[5][CB_NSTAGES]={
const int16_t WebRtcIlbcfix_kSearchRange[5][CB_NSTAGES]={
{58,58,58}, {108,44,44}, {108,108,108}, {108,108,108}, {108,108,108}};
const WebRtc_Word16 WebRtcIlbcfix_kFilterRange[5]={63, 85, 125, 147, 147};
const int16_t WebRtcIlbcfix_kFilterRange[5]={63, 85, 125, 147, 147};
/* Gain Quantization for the codebook gains of the 3 stages */
/* Q14 (one extra value (max WebRtc_Word16) to simplify for the search) */
const WebRtc_Word16 WebRtcIlbcfix_kGainSq3[9]={
/* Q14 (one extra value (max int16_t) to simplify for the search) */
const int16_t WebRtcIlbcfix_kGainSq3[9]={
-16384, -10813, -5407, 0, 4096, 8192,
12288, 16384, 32767};
/* Q14 (one extra value (max WebRtc_Word16) to simplify for the search) */
const WebRtc_Word16 WebRtcIlbcfix_kGainSq4[17]={
/* Q14 (one extra value (max int16_t) to simplify for the search) */
const int16_t WebRtcIlbcfix_kGainSq4[17]={
-17203, -14746, -12288, -9830, -7373, -4915,
-2458, 0, 2458, 4915, 7373, 9830,
12288, 14746, 17203, 19661, 32767};
/* Q14 (one extra value (max WebRtc_Word16) to simplify for the search) */
const WebRtc_Word16 WebRtcIlbcfix_kGainSq5[33]={
/* Q14 (one extra value (max int16_t) to simplify for the search) */
const int16_t WebRtcIlbcfix_kGainSq5[33]={
614, 1229, 1843, 2458, 3072, 3686,
4301, 4915, 5530, 6144, 6758, 7373,
7987, 8602, 9216, 9830, 10445, 11059,
@ -621,7 +621,7 @@ const WebRtc_Word16 WebRtcIlbcfix_kGainSq5[33]={
19046, 19661, 32767};
/* Q14 gain_sq5Tbl squared in Q14 */
const WebRtc_Word16 WebRtcIlbcfix_kGainSq5Sq[32] = {
const int16_t WebRtcIlbcfix_kGainSq5Sq[32] = {
23, 92, 207, 368, 576, 829,
1129, 1474, 1866, 2304, 2787, 3317,
3893, 4516, 5184, 5897, 6658, 7464,
@ -630,37 +630,37 @@ const WebRtc_Word16 WebRtcIlbcfix_kGainSq5Sq[32] = {
22140, 23593
};
const WebRtc_Word16* const WebRtcIlbcfix_kGain[3] =
const int16_t* const WebRtcIlbcfix_kGain[3] =
{WebRtcIlbcfix_kGainSq5, WebRtcIlbcfix_kGainSq4, WebRtcIlbcfix_kGainSq3};
/* Tables for the Enhancer, using upsamling factor 4 (ENH_UPS0 = 4) */
const WebRtc_Word16 WebRtcIlbcfix_kEnhPolyPhaser[ENH_UPS0][ENH_FLO_MULT2_PLUS1]={
const int16_t WebRtcIlbcfix_kEnhPolyPhaser[ENH_UPS0][ENH_FLO_MULT2_PLUS1]={
{0, 0, 0, 4096, 0, 0, 0},
{64, -315, 1181, 3531, -436, 77, -64},
{97, -509, 2464, 2464, -509, 97, -97},
{77, -436, 3531, 1181, -315, 64, -77}
};
const WebRtc_Word16 WebRtcIlbcfix_kEnhWt[3] = {
const int16_t WebRtcIlbcfix_kEnhWt[3] = {
4800, 16384, 27968 /* Q16 */
};
const WebRtc_Word16 WebRtcIlbcfix_kEnhPlocs[ENH_NBLOCKS_TOT] = {
const int16_t WebRtcIlbcfix_kEnhPlocs[ENH_NBLOCKS_TOT] = {
160, 480, 800, 1120, 1440, 1760, 2080, 2400 /* Q(-2) */
};
/* PLC table */
const WebRtc_Word16 WebRtcIlbcfix_kPlcPerSqr[6] = { /* Grid points for square of periodiciy in Q15 */
const int16_t WebRtcIlbcfix_kPlcPerSqr[6] = { /* Grid points for square of periodiciy in Q15 */
839, 1343, 2048, 2998, 4247, 5849
};
const WebRtc_Word16 WebRtcIlbcfix_kPlcPitchFact[6] = { /* Value of y=(x^4-0.4)/(0.7-0.4) in grid points in Q15 */
const int16_t WebRtcIlbcfix_kPlcPitchFact[6] = { /* Value of y=(x^4-0.4)/(0.7-0.4) in grid points in Q15 */
0, 5462, 10922, 16384, 21846, 27306
};
const WebRtc_Word16 WebRtcIlbcfix_kPlcPfSlope[6] = { /* Slope of y=(x^4-0.4)/(0.7-0.4) in Q11 */
const int16_t WebRtcIlbcfix_kPlcPfSlope[6] = { /* Slope of y=(x^4-0.4)/(0.7-0.4) in Q11 */
26667, 18729, 13653, 10258, 7901, 6214
};

View File

@ -24,69 +24,69 @@
/* high pass filters */
extern const WebRtc_Word16 WebRtcIlbcfix_kHpInCoefs[];
extern const WebRtc_Word16 WebRtcIlbcfix_kHpOutCoefs[];
extern const int16_t WebRtcIlbcfix_kHpInCoefs[];
extern const int16_t WebRtcIlbcfix_kHpOutCoefs[];
/* Window for start state decision */
extern const WebRtc_Word16 WebRtcIlbcfix_kStartSequenceEnrgWin[];
extern const int16_t WebRtcIlbcfix_kStartSequenceEnrgWin[];
/* low pass filter used for downsampling */
extern const WebRtc_Word16 WebRtcIlbcfix_kLpFiltCoefs[];
extern const int16_t WebRtcIlbcfix_kLpFiltCoefs[];
/* LPC analysis and quantization */
extern const WebRtc_Word16 WebRtcIlbcfix_kLpcWin[];
extern const WebRtc_Word16 WebRtcIlbcfix_kLpcAsymWin[];
extern const WebRtc_Word32 WebRtcIlbcfix_kLpcLagWin[];
extern const WebRtc_Word16 WebRtcIlbcfix_kLpcChirpSyntDenum[];
extern const WebRtc_Word16 WebRtcIlbcfix_kLpcChirpWeightDenum[];
extern const WebRtc_Word16 WebRtcIlbcfix_kLsfDimCb[];
extern const WebRtc_Word16 WebRtcIlbcfix_kLsfSizeCb[];
extern const WebRtc_Word16 WebRtcIlbcfix_kLsfCb[];
extern const WebRtc_Word16 WebRtcIlbcfix_kLsfWeight20ms[];
extern const WebRtc_Word16 WebRtcIlbcfix_kLsfWeight30ms[];
extern const WebRtc_Word16 WebRtcIlbcfix_kLsfMean[];
extern const WebRtc_Word16 WebRtcIlbcfix_kLspMean[];
extern const WebRtc_Word16 WebRtcIlbcfix_kCos[];
extern const WebRtc_Word16 WebRtcIlbcfix_kCosDerivative[];
extern const WebRtc_Word16 WebRtcIlbcfix_kCosGrid[];
extern const WebRtc_Word16 WebRtcIlbcfix_kAcosDerivative[];
extern const int16_t WebRtcIlbcfix_kLpcWin[];
extern const int16_t WebRtcIlbcfix_kLpcAsymWin[];
extern const int32_t WebRtcIlbcfix_kLpcLagWin[];
extern const int16_t WebRtcIlbcfix_kLpcChirpSyntDenum[];
extern const int16_t WebRtcIlbcfix_kLpcChirpWeightDenum[];
extern const int16_t WebRtcIlbcfix_kLsfDimCb[];
extern const int16_t WebRtcIlbcfix_kLsfSizeCb[];
extern const int16_t WebRtcIlbcfix_kLsfCb[];
extern const int16_t WebRtcIlbcfix_kLsfWeight20ms[];
extern const int16_t WebRtcIlbcfix_kLsfWeight30ms[];
extern const int16_t WebRtcIlbcfix_kLsfMean[];
extern const int16_t WebRtcIlbcfix_kLspMean[];
extern const int16_t WebRtcIlbcfix_kCos[];
extern const int16_t WebRtcIlbcfix_kCosDerivative[];
extern const int16_t WebRtcIlbcfix_kCosGrid[];
extern const int16_t WebRtcIlbcfix_kAcosDerivative[];
/* state quantization tables */
extern const WebRtc_Word16 WebRtcIlbcfix_kStateSq3[];
extern const WebRtc_Word32 WebRtcIlbcfix_kChooseFrgQuant[];
extern const WebRtc_Word16 WebRtcIlbcfix_kScale[];
extern const WebRtc_Word16 WebRtcIlbcfix_kFrgQuantMod[];
extern const int16_t WebRtcIlbcfix_kStateSq3[];
extern const int32_t WebRtcIlbcfix_kChooseFrgQuant[];
extern const int16_t WebRtcIlbcfix_kScale[];
extern const int16_t WebRtcIlbcfix_kFrgQuantMod[];
/* Ranges for search and filters at different subframes */
extern const WebRtc_Word16 WebRtcIlbcfix_kSearchRange[5][CB_NSTAGES];
extern const WebRtc_Word16 WebRtcIlbcfix_kFilterRange[];
extern const int16_t WebRtcIlbcfix_kSearchRange[5][CB_NSTAGES];
extern const int16_t WebRtcIlbcfix_kFilterRange[];
/* gain quantization tables */
extern const WebRtc_Word16 WebRtcIlbcfix_kGainSq3[];
extern const WebRtc_Word16 WebRtcIlbcfix_kGainSq4[];
extern const WebRtc_Word16 WebRtcIlbcfix_kGainSq5[];
extern const WebRtc_Word16 WebRtcIlbcfix_kGainSq5Sq[];
extern const WebRtc_Word16* const WebRtcIlbcfix_kGain[];
extern const int16_t WebRtcIlbcfix_kGainSq3[];
extern const int16_t WebRtcIlbcfix_kGainSq4[];
extern const int16_t WebRtcIlbcfix_kGainSq5[];
extern const int16_t WebRtcIlbcfix_kGainSq5Sq[];
extern const int16_t* const WebRtcIlbcfix_kGain[];
/* adaptive codebook definitions */
extern const WebRtc_Word16 WebRtcIlbcfix_kCbFiltersRev[];
extern const WebRtc_Word16 WebRtcIlbcfix_kAlpha[];
extern const int16_t WebRtcIlbcfix_kCbFiltersRev[];
extern const int16_t WebRtcIlbcfix_kAlpha[];
/* enhancer definitions */
extern const WebRtc_Word16 WebRtcIlbcfix_kEnhPolyPhaser[ENH_UPS0][ENH_FLO_MULT2_PLUS1];
extern const WebRtc_Word16 WebRtcIlbcfix_kEnhWt[];
extern const WebRtc_Word16 WebRtcIlbcfix_kEnhPlocs[];
extern const int16_t WebRtcIlbcfix_kEnhPolyPhaser[ENH_UPS0][ENH_FLO_MULT2_PLUS1];
extern const int16_t WebRtcIlbcfix_kEnhWt[];
extern const int16_t WebRtcIlbcfix_kEnhPlocs[];
/* PLC tables */
extern const WebRtc_Word16 WebRtcIlbcfix_kPlcPerSqr[];
extern const WebRtc_Word16 WebRtcIlbcfix_kPlcPitchFact[];
extern const WebRtc_Word16 WebRtcIlbcfix_kPlcPfSlope[];
extern const int16_t WebRtcIlbcfix_kPlcPerSqr[];
extern const int16_t WebRtcIlbcfix_kPlcPitchFact[];
extern const int16_t WebRtcIlbcfix_kPlcPfSlope[];
#endif

View File

@ -25,14 +25,14 @@
*----------------------------------------------------------------*/
void WebRtcIlbcfix_CreateAugmentedVec(
WebRtc_Word16 index, /* (i) Index for the augmented vector to be created */
WebRtc_Word16 *buffer, /* (i) Pointer to the end of the codebook memory that
int16_t index, /* (i) Index for the augmented vector to be created */
int16_t *buffer, /* (i) Pointer to the end of the codebook memory that
is used for creation of the augmented codebook */
WebRtc_Word16 *cbVec /* (o) The construced codebook vector */
int16_t *cbVec /* (o) The construced codebook vector */
) {
WebRtc_Word16 ilow;
WebRtc_Word16 *ppo, *ppi;
WebRtc_Word16 cbVecTmp[4];
int16_t ilow;
int16_t *ppo, *ppi;
int16_t cbVecTmp[4];
ilow = index-4;

View File

@ -27,10 +27,10 @@
*----------------------------------------------------------------*/
void WebRtcIlbcfix_CreateAugmentedVec(
WebRtc_Word16 index, /* (i) Index for the augmented vector to be created */
WebRtc_Word16 *buffer, /* (i) Pointer to the end of the codebook memory that
int16_t index, /* (i) Index for the augmented vector to be created */
int16_t *buffer, /* (i) Pointer to the end of the codebook memory that
is used for creation of the augmented codebook */
WebRtc_Word16 *cbVec /* (o) The construced codebook vector */
int16_t *cbVec /* (o) The construced codebook vector */
);
#endif

View File

@ -37,25 +37,25 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_DecodeImpl(
WebRtc_Word16 *decblock, /* (o) decoded signal block */
const WebRtc_UWord16 *bytes, /* (i) encoded signal bits */
int16_t *decblock, /* (o) decoded signal block */
const uint16_t *bytes, /* (i) encoded signal bits */
iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) the decoder state
structure */
WebRtc_Word16 mode /* (i) 0: bad packet, PLC,
int16_t mode /* (i) 0: bad packet, PLC,
1: normal */
) {
int i;
WebRtc_Word16 order_plus_one;
int16_t order_plus_one;
WebRtc_Word16 last_bit;
WebRtc_Word16 *data;
int16_t last_bit;
int16_t *data;
/* Stack based */
WebRtc_Word16 decresidual[BLOCKL_MAX];
WebRtc_Word16 PLCresidual[BLOCKL_MAX + LPC_FILTERORDER];
WebRtc_Word16 syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)];
WebRtc_Word16 PLClpc[LPC_FILTERORDER + 1];
int16_t decresidual[BLOCKL_MAX];
int16_t PLCresidual[BLOCKL_MAX + LPC_FILTERORDER];
int16_t syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)];
int16_t PLClpc[LPC_FILTERORDER + 1];
#ifndef WEBRTC_BIG_ENDIAN
WebRtc_UWord16 swapped[NO_OF_WORDS_30MS];
uint16_t swapped[NO_OF_WORDS_30MS];
#endif
iLBC_bits *iLBCbits_inst = (iLBC_bits*)PLCresidual;
@ -87,14 +87,14 @@ void WebRtcIlbcfix_DecodeImpl(
if (mode) { /* No bit errors was detected, continue decoding */
/* Stack based */
WebRtc_Word16 lsfdeq[LPC_FILTERORDER*LPC_N_MAX];
WebRtc_Word16 weightdenum[(LPC_FILTERORDER + 1)*NSUB_MAX];
int16_t lsfdeq[LPC_FILTERORDER*LPC_N_MAX];
int16_t weightdenum[(LPC_FILTERORDER + 1)*NSUB_MAX];
/* adjust index */
WebRtcIlbcfix_IndexConvDec(iLBCbits_inst->cb_index);
/* decode the lsf */
WebRtcIlbcfix_SimpleLsfDeQ(lsfdeq, (WebRtc_Word16*)(iLBCbits_inst->lsf), iLBCdec_inst->lpc_n);
WebRtcIlbcfix_SimpleLsfDeQ(lsfdeq, (int16_t*)(iLBCbits_inst->lsf), iLBCdec_inst->lpc_n);
WebRtcIlbcfix_LsfCheck(lsfdeq, LPC_FILTERORDER, iLBCdec_inst->lpc_n);
WebRtcIlbcfix_DecoderInterpolateLsp(syntdenum, weightdenum,
lsfdeq, LPC_FILTERORDER, iLBCdec_inst);
@ -105,7 +105,7 @@ void WebRtcIlbcfix_DecodeImpl(
/* preparing the plc for a future loss! */
WebRtcIlbcfix_DoThePlc( PLCresidual, PLClpc, 0,
decresidual, syntdenum + (LPC_FILTERORDER + 1)*(iLBCdec_inst->nsub - 1),
(WebRtc_Word16)(iLBCdec_inst->last_lag), iLBCdec_inst);
(int16_t)(iLBCdec_inst->last_lag), iLBCdec_inst);
/* Use the output from doThePLC */
WEBRTC_SPL_MEMCPY_W16(decresidual, PLCresidual, iLBCdec_inst->blockl);
@ -121,7 +121,7 @@ void WebRtcIlbcfix_DecodeImpl(
/* packet loss conceal */
WebRtcIlbcfix_DoThePlc( PLCresidual, PLClpc, 1,
decresidual, syntdenum, (WebRtc_Word16)(iLBCdec_inst->last_lag), iLBCdec_inst);
decresidual, syntdenum, (int16_t)(iLBCdec_inst->last_lag), iLBCdec_inst);
WEBRTC_SPL_MEMCPY_W16(decresidual, PLCresidual, iLBCdec_inst->blockl);
@ -187,18 +187,18 @@ void WebRtcIlbcfix_DecodeImpl(
WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->syntMem, &data[iLBCdec_inst->blockl-LPC_FILTERORDER], LPC_FILTERORDER);
} else { /* Enhancer not activated */
WebRtc_Word16 lag;
int16_t lag;
/* Find last lag (since the enhancer is not called to give this info) */
lag = 20;
if (iLBCdec_inst->mode==20) {
lag = (WebRtc_Word16)WebRtcIlbcfix_XcorrCoef(
lag = (int16_t)WebRtcIlbcfix_XcorrCoef(
&decresidual[iLBCdec_inst->blockl-60],
&decresidual[iLBCdec_inst->blockl-60-lag],
60,
80, lag, -1);
} else {
lag = (WebRtc_Word16)WebRtcIlbcfix_XcorrCoef(
lag = (int16_t)WebRtcIlbcfix_XcorrCoef(
&decresidual[iLBCdec_inst->blockl-ENH_BLOCKL],
&decresidual[iLBCdec_inst->blockl-ENH_BLOCKL-lag],
ENH_BLOCKL,
@ -228,7 +228,7 @@ void WebRtcIlbcfix_DecodeImpl(
WEBRTC_SPL_MEMCPY_W16(decblock,data,iLBCdec_inst->blockl);
/* High pass filter the signal (with upscaling a factor 2 and saturation) */
WebRtcIlbcfix_HpOutput(decblock, (WebRtc_Word16*)WebRtcIlbcfix_kHpOutCoefs,
WebRtcIlbcfix_HpOutput(decblock, (int16_t*)WebRtcIlbcfix_kHpOutCoefs,
iLBCdec_inst->hpimemy, iLBCdec_inst->hpimemx,
iLBCdec_inst->blockl);

View File

@ -26,11 +26,11 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_DecodeImpl(
WebRtc_Word16 *decblock, /* (o) decoded signal block */
const WebRtc_UWord16 *bytes, /* (i) encoded signal bits */
int16_t *decblock, /* (o) decoded signal block */
const uint16_t *bytes, /* (i) encoded signal bits */
iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) the decoder state
structure */
WebRtc_Word16 mode /* (i) 0: bad packet, PLC,
int16_t mode /* (i) 0: bad packet, PLC,
1: normal */
);

View File

@ -35,15 +35,15 @@ void WebRtcIlbcfix_DecodeResidual(
/* (i/o) the decoder state structure */
iLBC_bits *iLBC_encbits, /* (i/o) Encoded bits, which are used
for the decoding */
WebRtc_Word16 *decresidual, /* (o) decoded residual frame */
WebRtc_Word16 *syntdenum /* (i) the decoded synthesis filter
int16_t *decresidual, /* (o) decoded residual frame */
int16_t *syntdenum /* (i) the decoded synthesis filter
coefficients */
) {
WebRtc_Word16 meml_gotten, Nfor, Nback, diff, start_pos;
WebRtc_Word16 subcount, subframe;
WebRtc_Word16 *reverseDecresidual = iLBCdec_inst->enh_buf; /* Reversed decoded data, used for decoding backwards in time (reuse memory in state) */
WebRtc_Word16 *memVec = iLBCdec_inst->prevResidual; /* Memory for codebook and filter state (reuse memory in state) */
WebRtc_Word16 *mem = &memVec[CB_HALFFILTERLEN]; /* Memory for codebook */
int16_t meml_gotten, Nfor, Nback, diff, start_pos;
int16_t subcount, subframe;
int16_t *reverseDecresidual = iLBCdec_inst->enh_buf; /* Reversed decoded data, used for decoding backwards in time (reuse memory in state) */
int16_t *memVec = iLBCdec_inst->prevResidual; /* Memory for codebook and filter state (reuse memory in state) */
int16_t *mem = &memVec[CB_HALFFILTERLEN]; /* Memory for codebook */
diff = STATE_LEN - iLBCdec_inst->state_short_len;
@ -64,7 +64,7 @@ void WebRtcIlbcfix_DecodeResidual(
/* setup memory */
WebRtcSpl_MemSetW16(mem, 0, (WebRtc_Word16)(CB_MEML-iLBCdec_inst->state_short_len));
WebRtcSpl_MemSetW16(mem, 0, (int16_t)(CB_MEML-iLBCdec_inst->state_short_len));
WEBRTC_SPL_MEMCPY_W16(mem+CB_MEML-iLBCdec_inst->state_short_len, decresidual+start_pos,
iLBCdec_inst->state_short_len);
@ -74,7 +74,7 @@ void WebRtcIlbcfix_DecodeResidual(
&decresidual[start_pos+iLBCdec_inst->state_short_len],
iLBC_encbits->cb_index, iLBC_encbits->gain_index,
mem+CB_MEML-ST_MEM_L_TBL,
ST_MEM_L_TBL, (WebRtc_Word16)diff
ST_MEM_L_TBL, (int16_t)diff
);
}
@ -85,7 +85,7 @@ void WebRtcIlbcfix_DecodeResidual(
meml_gotten = iLBCdec_inst->state_short_len;
WebRtcSpl_MemCpyReversedOrder(mem+CB_MEML-1,
decresidual+start_pos, meml_gotten);
WebRtcSpl_MemSetW16(mem, 0, (WebRtc_Word16)(CB_MEML-meml_gotten));
WebRtcSpl_MemSetW16(mem, 0, (int16_t)(CB_MEML-meml_gotten));
/* construct decoded vector */
@ -154,7 +154,7 @@ void WebRtcIlbcfix_DecodeResidual(
WebRtcSpl_MemCpyReversedOrder(mem+CB_MEML-1,
decresidual+(iLBC_encbits->startIdx-1)*SUBL, meml_gotten);
WebRtcSpl_MemSetW16(mem, 0, (WebRtc_Word16)(CB_MEML-meml_gotten));
WebRtcSpl_MemSetW16(mem, 0, (int16_t)(CB_MEML-meml_gotten));
/* loop over subframes to decode */

View File

@ -30,8 +30,8 @@ void WebRtcIlbcfix_DecodeResidual(
/* (i/o) the decoder state structure */
iLBC_bits *iLBC_encbits, /* (i/o) Encoded bits, which are used
for the decoding */
WebRtc_Word16 *decresidual, /* (o) decoded residual frame */
WebRtc_Word16 *syntdenum /* (i) the decoded synthesis filter
int16_t *decresidual, /* (o) decoded residual frame */
int16_t *syntdenum /* (i) the decoded synthesis filter
coefficients */
);

View File

@ -26,16 +26,16 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_DecoderInterpolateLsp(
WebRtc_Word16 *syntdenum, /* (o) synthesis filter coefficients */
WebRtc_Word16 *weightdenum, /* (o) weighting denumerator
int16_t *syntdenum, /* (o) synthesis filter coefficients */
int16_t *weightdenum, /* (o) weighting denumerator
coefficients */
WebRtc_Word16 *lsfdeq, /* (i) dequantized lsf coefficients */
WebRtc_Word16 length, /* (i) length of lsf coefficient vector */
int16_t *lsfdeq, /* (i) dequantized lsf coefficients */
int16_t length, /* (i) length of lsf coefficient vector */
iLBC_Dec_Inst_t *iLBCdec_inst
/* (i) the decoder state structure */
){
int i, pos, lp_length;
WebRtc_Word16 lp[LPC_FILTERORDER + 1], *lsfdeq2;
int16_t lp[LPC_FILTERORDER + 1], *lsfdeq2;
lsfdeq2 = lsfdeq + length;
lp_length = length + 1;
@ -46,7 +46,7 @@ void WebRtcIlbcfix_DecoderInterpolateLsp(
WebRtcIlbcfix_LspInterpolate2PolyDec(lp, (*iLBCdec_inst).lsfdeqold, lsfdeq,
WebRtcIlbcfix_kLsfWeight30ms[0], length);
WEBRTC_SPL_MEMCPY_W16(syntdenum,lp,lp_length);
WebRtcIlbcfix_BwExpand(weightdenum, lp, (WebRtc_Word16*)WebRtcIlbcfix_kLpcChirpSyntDenum, (WebRtc_Word16)lp_length);
WebRtcIlbcfix_BwExpand(weightdenum, lp, (int16_t*)WebRtcIlbcfix_kLpcChirpSyntDenum, (int16_t)lp_length);
/* subframes 2 to 6: interpolation between first and last LSF */
@ -56,7 +56,7 @@ void WebRtcIlbcfix_DecoderInterpolateLsp(
WebRtcIlbcfix_kLsfWeight30ms[i], length);
WEBRTC_SPL_MEMCPY_W16(syntdenum + pos,lp,lp_length);
WebRtcIlbcfix_BwExpand(weightdenum + pos, lp,
(WebRtc_Word16*)WebRtcIlbcfix_kLpcChirpSyntDenum, (WebRtc_Word16)lp_length);
(int16_t*)WebRtcIlbcfix_kLpcChirpSyntDenum, (int16_t)lp_length);
pos += lp_length;
}
} else { /* iLBCdec_inst->mode=20 */
@ -67,7 +67,7 @@ void WebRtcIlbcfix_DecoderInterpolateLsp(
WebRtcIlbcfix_kLsfWeight20ms[i], length);
WEBRTC_SPL_MEMCPY_W16(syntdenum+pos,lp,lp_length);
WebRtcIlbcfix_BwExpand(weightdenum+pos, lp,
(WebRtc_Word16*)WebRtcIlbcfix_kLpcChirpSyntDenum, (WebRtc_Word16)lp_length);
(int16_t*)WebRtcIlbcfix_kLpcChirpSyntDenum, (int16_t)lp_length);
pos += lp_length;
}
}

View File

@ -26,11 +26,11 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_DecoderInterpolateLsp(
WebRtc_Word16 *syntdenum, /* (o) synthesis filter coefficients */
WebRtc_Word16 *weightdenum, /* (o) weighting denumerator
int16_t *syntdenum, /* (o) synthesis filter coefficients */
int16_t *weightdenum, /* (o) weighting denumerator
coefficients */
WebRtc_Word16 *lsfdeq, /* (i) dequantized lsf coefficients */
WebRtc_Word16 length, /* (i) length of lsf coefficient vector */
int16_t *lsfdeq, /* (i) dequantized lsf coefficients */
int16_t length, /* (i) length of lsf coefficient vector */
iLBC_Dec_Inst_t *iLBCdec_inst
/* (i) the decoder state structure */
);

View File

@ -118,53 +118,53 @@
/* Struct for the bits */
typedef struct iLBC_bits_t_ {
WebRtc_Word16 lsf[LSF_NSPLIT*LPC_N_MAX];
WebRtc_Word16 cb_index[CB_NSTAGES*(NASUB_MAX+1)]; /* First CB_NSTAGES values contains extra CB index */
WebRtc_Word16 gain_index[CB_NSTAGES*(NASUB_MAX+1)]; /* First CB_NSTAGES values contains extra CB gain */
WebRtc_Word16 idxForMax;
WebRtc_Word16 state_first;
WebRtc_Word16 idxVec[STATE_SHORT_LEN_30MS];
WebRtc_Word16 firstbits;
WebRtc_Word16 startIdx;
int16_t lsf[LSF_NSPLIT*LPC_N_MAX];
int16_t cb_index[CB_NSTAGES*(NASUB_MAX+1)]; /* First CB_NSTAGES values contains extra CB index */
int16_t gain_index[CB_NSTAGES*(NASUB_MAX+1)]; /* First CB_NSTAGES values contains extra CB gain */
int16_t idxForMax;
int16_t state_first;
int16_t idxVec[STATE_SHORT_LEN_30MS];
int16_t firstbits;
int16_t startIdx;
} iLBC_bits;
/* type definition encoder instance */
typedef struct iLBC_Enc_Inst_t_ {
/* flag for frame size mode */
WebRtc_Word16 mode;
int16_t mode;
/* basic parameters for different frame sizes */
WebRtc_Word16 blockl;
WebRtc_Word16 nsub;
WebRtc_Word16 nasub;
WebRtc_Word16 no_of_bytes, no_of_words;
WebRtc_Word16 lpc_n;
WebRtc_Word16 state_short_len;
int16_t blockl;
int16_t nsub;
int16_t nasub;
int16_t no_of_bytes, no_of_words;
int16_t lpc_n;
int16_t state_short_len;
/* analysis filter state */
WebRtc_Word16 anaMem[LPC_FILTERORDER];
int16_t anaMem[LPC_FILTERORDER];
/* Fix-point old lsf parameters for interpolation */
WebRtc_Word16 lsfold[LPC_FILTERORDER];
WebRtc_Word16 lsfdeqold[LPC_FILTERORDER];
int16_t lsfold[LPC_FILTERORDER];
int16_t lsfdeqold[LPC_FILTERORDER];
/* signal buffer for LP analysis */
WebRtc_Word16 lpc_buffer[LPC_LOOKBACK + BLOCKL_MAX];
int16_t lpc_buffer[LPC_LOOKBACK + BLOCKL_MAX];
/* state of input HP filter */
WebRtc_Word16 hpimemx[2];
WebRtc_Word16 hpimemy[4];
int16_t hpimemx[2];
int16_t hpimemy[4];
#ifdef SPLIT_10MS
WebRtc_Word16 weightdenumbuf[66];
WebRtc_Word16 past_samples[160];
WebRtc_UWord16 bytes[25];
WebRtc_Word16 section;
WebRtc_Word16 Nfor_flag;
WebRtc_Word16 Nback_flag;
WebRtc_Word16 start_pos;
WebRtc_Word16 diff;
int16_t weightdenumbuf[66];
int16_t past_samples[160];
uint16_t bytes[25];
int16_t section;
int16_t Nfor_flag;
int16_t Nback_flag;
int16_t start_pos;
int16_t diff;
#endif
} iLBC_Enc_Inst_t;
@ -173,46 +173,46 @@ typedef struct iLBC_Enc_Inst_t_ {
typedef struct iLBC_Dec_Inst_t_ {
/* flag for frame size mode */
WebRtc_Word16 mode;
int16_t mode;
/* basic parameters for different frame sizes */
WebRtc_Word16 blockl;
WebRtc_Word16 nsub;
WebRtc_Word16 nasub;
WebRtc_Word16 no_of_bytes, no_of_words;
WebRtc_Word16 lpc_n;
WebRtc_Word16 state_short_len;
int16_t blockl;
int16_t nsub;
int16_t nasub;
int16_t no_of_bytes, no_of_words;
int16_t lpc_n;
int16_t state_short_len;
/* synthesis filter state */
WebRtc_Word16 syntMem[LPC_FILTERORDER];
int16_t syntMem[LPC_FILTERORDER];
/* old LSF for interpolation */
WebRtc_Word16 lsfdeqold[LPC_FILTERORDER];
int16_t lsfdeqold[LPC_FILTERORDER];
/* pitch lag estimated in enhancer and used in PLC */
int last_lag;
/* PLC state information */
int consPLICount, prev_enh_pl;
WebRtc_Word16 perSquare;
int16_t perSquare;
WebRtc_Word16 prevScale, prevPLI;
WebRtc_Word16 prevLag, prevLpc[LPC_FILTERORDER+1];
WebRtc_Word16 prevResidual[NSUB_MAX*SUBL];
WebRtc_Word16 seed;
int16_t prevScale, prevPLI;
int16_t prevLag, prevLpc[LPC_FILTERORDER+1];
int16_t prevResidual[NSUB_MAX*SUBL];
int16_t seed;
/* previous synthesis filter parameters */
WebRtc_Word16 old_syntdenum[(LPC_FILTERORDER + 1)*NSUB_MAX];
int16_t old_syntdenum[(LPC_FILTERORDER + 1)*NSUB_MAX];
/* state of output HP filter */
WebRtc_Word16 hpimemx[2];
WebRtc_Word16 hpimemy[4];
int16_t hpimemx[2];
int16_t hpimemy[4];
/* enhancer state information */
int use_enhancer;
WebRtc_Word16 enh_buf[ENH_BUFL+ENH_BUFL_FILTEROVERHEAD];
WebRtc_Word16 enh_period[ENH_NBLOCKS_TOT];
int16_t enh_buf[ENH_BUFL+ENH_BUFL_FILTEROVERHEAD];
int16_t enh_period[ENH_NBLOCKS_TOT];
} iLBC_Dec_Inst_t;

View File

@ -27,36 +27,36 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_DoThePlc(
WebRtc_Word16 *PLCresidual, /* (o) concealed residual */
WebRtc_Word16 *PLClpc, /* (o) concealed LP parameters */
WebRtc_Word16 PLI, /* (i) packet loss indicator
int16_t *PLCresidual, /* (o) concealed residual */
int16_t *PLClpc, /* (o) concealed LP parameters */
int16_t PLI, /* (i) packet loss indicator
0 - no PL, 1 = PL */
WebRtc_Word16 *decresidual, /* (i) decoded residual */
WebRtc_Word16 *lpc, /* (i) decoded LPC (only used for no PL) */
WebRtc_Word16 inlag, /* (i) pitch lag */
int16_t *decresidual, /* (i) decoded residual */
int16_t *lpc, /* (i) decoded LPC (only used for no PL) */
int16_t inlag, /* (i) pitch lag */
iLBC_Dec_Inst_t *iLBCdec_inst
/* (i/o) decoder instance */
){
WebRtc_Word16 i, pick;
WebRtc_Word32 cross, ener, cross_comp, ener_comp = 0;
WebRtc_Word32 measure, maxMeasure, energy;
WebRtc_Word16 max, crossSquareMax, crossSquare;
WebRtc_Word16 j, lag, tmp1, tmp2, randlag;
WebRtc_Word16 shift1, shift2, shift3, shiftMax;
WebRtc_Word16 scale3;
WebRtc_Word16 corrLen;
WebRtc_Word32 tmpW32, tmp2W32;
WebRtc_Word16 use_gain;
WebRtc_Word16 tot_gain;
WebRtc_Word16 max_perSquare;
WebRtc_Word16 scale1, scale2;
WebRtc_Word16 totscale;
WebRtc_Word32 nom;
WebRtc_Word16 denom;
WebRtc_Word16 pitchfact;
WebRtc_Word16 use_lag;
int16_t i, pick;
int32_t cross, ener, cross_comp, ener_comp = 0;
int32_t measure, maxMeasure, energy;
int16_t max, crossSquareMax, crossSquare;
int16_t j, lag, tmp1, tmp2, randlag;
int16_t shift1, shift2, shift3, shiftMax;
int16_t scale3;
int16_t corrLen;
int32_t tmpW32, tmp2W32;
int16_t use_gain;
int16_t tot_gain;
int16_t max_perSquare;
int16_t scale1, scale2;
int16_t totscale;
int32_t nom;
int16_t denom;
int16_t pitchfact;
int16_t use_lag;
int ind;
WebRtc_Word16 randvec[BLOCKL_MAX];
int16_t randvec[BLOCKL_MAX];
/* Packet Loss */
if (PLI == 1) {
@ -70,7 +70,7 @@ void WebRtcIlbcfix_DoThePlc(
/* Maximum 60 samples are correlated, preserve as high accuracy
as possible without getting overflow */
max = WebRtcSpl_MaxAbsValueW16((*iLBCdec_inst).prevResidual, (WebRtc_Word16)iLBCdec_inst->blockl);
max = WebRtcSpl_MaxAbsValueW16((*iLBCdec_inst).prevResidual, (int16_t)iLBCdec_inst->blockl);
scale3 = (WebRtcSpl_GetSizeInBits(max)<<1) - 25;
if (scale3 < 0) {
scale3 = 0;
@ -92,7 +92,7 @@ void WebRtcIlbcfix_DoThePlc(
/* Normalize and store cross^2 and the number of shifts */
shiftMax = WebRtcSpl_GetSizeInBits(WEBRTC_SPL_ABS_W32(cross))-15;
crossSquareMax = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(WEBRTC_SPL_SHIFT_W32(cross, -shiftMax),
crossSquareMax = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(WEBRTC_SPL_SHIFT_W32(cross, -shiftMax),
WEBRTC_SPL_SHIFT_W32(cross, -shiftMax), 15);
for (j=inlag-2;j<=inlag+3;j++) {
@ -103,7 +103,7 @@ void WebRtcIlbcfix_DoThePlc(
this lag is better or not. To avoid the division,
do a cross multiplication */
shift1 = WebRtcSpl_GetSizeInBits(WEBRTC_SPL_ABS_W32(cross_comp))-15;
crossSquare = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(WEBRTC_SPL_SHIFT_W32(cross_comp, -shift1),
crossSquare = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(WEBRTC_SPL_SHIFT_W32(cross_comp, -shift1),
WEBRTC_SPL_SHIFT_W32(cross_comp, -shift1), 15);
shift2 = WebRtcSpl_GetSizeInBits(ener)-15;
@ -147,25 +147,25 @@ void WebRtcIlbcfix_DoThePlc(
corrLen, scale3);
if ((tmp2W32>0)&&(ener_comp>0)) {
/* norm energies to WebRtc_Word16, compute the product of the energies and
use the upper WebRtc_Word16 as the denominator */
/* norm energies to int16_t, compute the product of the energies and
use the upper int16_t as the denominator */
scale1=(WebRtc_Word16)WebRtcSpl_NormW32(tmp2W32)-16;
tmp1=(WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(tmp2W32, scale1);
scale1=(int16_t)WebRtcSpl_NormW32(tmp2W32)-16;
tmp1=(int16_t)WEBRTC_SPL_SHIFT_W32(tmp2W32, scale1);
scale2=(WebRtc_Word16)WebRtcSpl_NormW32(ener)-16;
tmp2=(WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(ener, scale2);
denom=(WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(tmp1, tmp2, 16); /* denom in Q(scale1+scale2-16) */
scale2=(int16_t)WebRtcSpl_NormW32(ener)-16;
tmp2=(int16_t)WEBRTC_SPL_SHIFT_W32(ener, scale2);
denom=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT(tmp1, tmp2, 16); /* denom in Q(scale1+scale2-16) */
/* Square the cross correlation and norm it such that max_perSquare
will be in Q15 after the division */
totscale = scale1+scale2-1;
tmp1 = (WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(cross, (totscale>>1));
tmp2 = (WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(cross, totscale-(totscale>>1));
tmp1 = (int16_t)WEBRTC_SPL_SHIFT_W32(cross, (totscale>>1));
tmp2 = (int16_t)WEBRTC_SPL_SHIFT_W32(cross, totscale-(totscale>>1));
nom = WEBRTC_SPL_MUL_16_16(tmp1, tmp2);
max_perSquare = (WebRtc_Word16)WebRtcSpl_DivW32W16(nom, denom);
max_perSquare = (int16_t)WebRtcSpl_DivW32W16(nom, denom);
} else {
max_perSquare = 0;
@ -209,10 +209,10 @@ void WebRtcIlbcfix_DoThePlc(
ind--;
}
/* pitch fact is approximated by first order */
tmpW32 = (WebRtc_Word32)WebRtcIlbcfix_kPlcPitchFact[ind] +
tmpW32 = (int32_t)WebRtcIlbcfix_kPlcPitchFact[ind] +
WEBRTC_SPL_MUL_16_16_RSFT(WebRtcIlbcfix_kPlcPfSlope[ind], (max_perSquare-WebRtcIlbcfix_kPlcPerSqr[ind]), 11);
pitchfact = (WebRtc_Word16)WEBRTC_SPL_MIN(tmpW32, 32767); /* guard against overflow */
pitchfact = (int16_t)WEBRTC_SPL_MIN(tmpW32, 32767); /* guard against overflow */
} else { /* periodicity < 0.4 */
pitchfact = 0;
@ -230,8 +230,8 @@ void WebRtcIlbcfix_DoThePlc(
for (i=0; i<iLBCdec_inst->blockl; i++) {
/* noise component - 52 < randlagFIX < 117 */
iLBCdec_inst->seed = (WebRtc_Word16)(WEBRTC_SPL_MUL_16_16(iLBCdec_inst->seed, 31821)+(WebRtc_Word32)13849);
randlag = 53 + (WebRtc_Word16)(iLBCdec_inst->seed & 63);
iLBCdec_inst->seed = (int16_t)(WEBRTC_SPL_MUL_16_16(iLBCdec_inst->seed, 31821)+(int32_t)13849);
randlag = 53 + (int16_t)(iLBCdec_inst->seed & 63);
pick = i - randlag;
@ -254,16 +254,16 @@ void WebRtcIlbcfix_DoThePlc(
if (i<80) {
tot_gain=use_gain;
} else if (i<160) {
tot_gain=(WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(31130, use_gain, 15); /* 0.95*use_gain */
tot_gain=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT(31130, use_gain, 15); /* 0.95*use_gain */
} else {
tot_gain=(WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(29491, use_gain, 15); /* 0.9*use_gain */
tot_gain=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT(29491, use_gain, 15); /* 0.9*use_gain */
}
/* mix noise and pitch repeatition */
PLCresidual[i] = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(tot_gain,
(WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32( (WEBRTC_SPL_MUL_16_16(pitchfact, PLCresidual[i]) +
PLCresidual[i] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(tot_gain,
(int16_t)WEBRTC_SPL_RSHIFT_W32( (WEBRTC_SPL_MUL_16_16(pitchfact, PLCresidual[i]) +
WEBRTC_SPL_MUL_16_16((32767-pitchfact), randvec[i]) + 16384),
15),
15);
@ -276,7 +276,7 @@ void WebRtcIlbcfix_DoThePlc(
}
/* less than 30 dB, use only noise */
if (energy < (WEBRTC_SPL_SHIFT_W32(((WebRtc_Word32)iLBCdec_inst->blockl*900),-(iLBCdec_inst->prevScale+1)))) {
if (energy < (WEBRTC_SPL_SHIFT_W32(((int32_t)iLBCdec_inst->blockl*900),-(iLBCdec_inst->prevScale+1)))) {
energy = 0;
for (i=0; i<iLBCdec_inst->blockl; i++) {
PLCresidual[i] = randvec[i];

View File

@ -27,13 +27,13 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_DoThePlc(
WebRtc_Word16 *PLCresidual, /* (o) concealed residual */
WebRtc_Word16 *PLClpc, /* (o) concealed LP parameters */
WebRtc_Word16 PLI, /* (i) packet loss indicator
int16_t *PLCresidual, /* (o) concealed residual */
int16_t *PLClpc, /* (o) concealed LP parameters */
int16_t PLI, /* (i) packet loss indicator
0 - no PL, 1 = PL */
WebRtc_Word16 *decresidual, /* (i) decoded residual */
WebRtc_Word16 *lpc, /* (i) decoded LPC (only used for no PL) */
WebRtc_Word16 inlag, /* (i) pitch lag */
int16_t *decresidual, /* (i) decoded residual */
int16_t *lpc, /* (i) decoded LPC (only used for no PL) */
int16_t inlag, /* (i) pitch lag */
iLBC_Dec_Inst_t *iLBCdec_inst
/* (i/o) decoder instance */
);

View File

@ -41,38 +41,38 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_EncodeImpl(
WebRtc_UWord16 *bytes, /* (o) encoded data bits iLBC */
const WebRtc_Word16 *block, /* (i) speech vector to encode */
uint16_t *bytes, /* (o) encoded data bits iLBC */
const int16_t *block, /* (i) speech vector to encode */
iLBC_Enc_Inst_t *iLBCenc_inst /* (i/o) the general encoder
state */
){
int n, meml_gotten, Nfor, Nback;
WebRtc_Word16 diff, start_pos;
int16_t diff, start_pos;
int index;
int subcount, subframe;
WebRtc_Word16 start_count, end_count;
WebRtc_Word16 *residual;
WebRtc_Word32 en1, en2;
WebRtc_Word16 scale, max;
WebRtc_Word16 *syntdenum;
WebRtc_Word16 *decresidual;
WebRtc_Word16 *reverseResidual;
WebRtc_Word16 *reverseDecresidual;
int16_t start_count, end_count;
int16_t *residual;
int32_t en1, en2;
int16_t scale, max;
int16_t *syntdenum;
int16_t *decresidual;
int16_t *reverseResidual;
int16_t *reverseDecresidual;
/* Stack based */
WebRtc_Word16 weightdenum[(LPC_FILTERORDER + 1)*NSUB_MAX];
WebRtc_Word16 dataVec[BLOCKL_MAX + LPC_FILTERORDER];
WebRtc_Word16 memVec[CB_MEML+CB_FILTERLEN];
WebRtc_Word16 bitsMemory[sizeof(iLBC_bits)/sizeof(WebRtc_Word16)];
int16_t weightdenum[(LPC_FILTERORDER + 1)*NSUB_MAX];
int16_t dataVec[BLOCKL_MAX + LPC_FILTERORDER];
int16_t memVec[CB_MEML+CB_FILTERLEN];
int16_t bitsMemory[sizeof(iLBC_bits)/sizeof(int16_t)];
iLBC_bits *iLBCbits_inst = (iLBC_bits*)bitsMemory;
#ifdef SPLIT_10MS
WebRtc_Word16 *weightdenumbuf = iLBCenc_inst->weightdenumbuf;
WebRtc_Word16 last_bit;
int16_t *weightdenumbuf = iLBCenc_inst->weightdenumbuf;
int16_t last_bit;
#endif
WebRtc_Word16 *data = &dataVec[LPC_FILTERORDER];
WebRtc_Word16 *mem = &memVec[CB_HALFFILTERLEN];
int16_t *data = &dataVec[LPC_FILTERORDER];
int16_t *mem = &memVec[CB_HALFFILTERLEN];
/* Reuse som buffers to save stack memory */
residual = &iLBCenc_inst->lpc_buffer[LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl];
@ -83,8 +83,8 @@ void WebRtcIlbcfix_EncodeImpl(
#ifdef SPLIT_10MS
WebRtcSpl_MemSetW16 ( (WebRtc_Word16 *) iLBCbits_inst, 0,
(WebRtc_Word16) (sizeof(iLBC_bits) / sizeof(WebRtc_Word16)) );
WebRtcSpl_MemSetW16 ( (int16_t *) iLBCbits_inst, 0,
(int16_t) (sizeof(iLBC_bits) / sizeof(int16_t)) );
start_pos = iLBCenc_inst->start_pos;
diff = iLBCenc_inst->diff;
@ -121,7 +121,7 @@ void WebRtcIlbcfix_EncodeImpl(
#endif
/* high pass filtering of input signal and scale down the residual (*0.5) */
WebRtcIlbcfix_HpInput(data, (WebRtc_Word16*)WebRtcIlbcfix_kHpInCoefs,
WebRtcIlbcfix_HpInput(data, (int16_t*)WebRtcIlbcfix_kHpInCoefs,
iLBCenc_inst->hpimemy, iLBCenc_inst->hpimemx,
iLBCenc_inst->blockl);
@ -191,7 +191,7 @@ void WebRtcIlbcfix_EncodeImpl(
/* setup memory */
WebRtcSpl_MemSetW16(mem, 0, (WebRtc_Word16)(CB_MEML-iLBCenc_inst->state_short_len));
WebRtcSpl_MemSetW16(mem, 0, (int16_t)(CB_MEML-iLBCenc_inst->state_short_len));
WEBRTC_SPL_MEMCPY_W16(mem+CB_MEML-iLBCenc_inst->state_short_len,
decresidual+start_pos, iLBCenc_inst->state_short_len);
@ -222,7 +222,7 @@ void WebRtcIlbcfix_EncodeImpl(
meml_gotten = iLBCenc_inst->state_short_len;
WebRtcSpl_MemCpyReversedOrder(&mem[CB_MEML-1], &decresidual[start_pos], meml_gotten);
WebRtcSpl_MemSetW16(mem, 0, (WebRtc_Word16)(CB_MEML-iLBCenc_inst->state_short_len));
WebRtcSpl_MemSetW16(mem, 0, (int16_t)(CB_MEML-iLBCenc_inst->state_short_len));
/* encode subframes */
WebRtcIlbcfix_CbSearch(iLBCenc_inst, iLBCbits_inst->cb_index, iLBCbits_inst->gain_index,
@ -325,7 +325,7 @@ void WebRtcIlbcfix_EncodeImpl(
}
#else
start_count = 0;
end_count = (WebRtc_Word16)Nfor;
end_count = (int16_t)Nfor;
#endif
/* loop over subframes to encode */
@ -339,7 +339,7 @@ void WebRtcIlbcfix_EncodeImpl(
&residual[(iLBCbits_inst->startIdx+1+subframe)*SUBL],
mem, MEM_LF_TBL, SUBL,
&weightdenum[(iLBCbits_inst->startIdx+1+subframe)*(LPC_FILTERORDER+1)],
(WebRtc_Word16)subcount);
(int16_t)subcount);
/* construct decoded vector */
@ -396,7 +396,7 @@ void WebRtcIlbcfix_EncodeImpl(
}
WebRtcSpl_MemCpyReversedOrder(&mem[CB_MEML-1], &decresidual[Nback*SUBL], meml_gotten);
WebRtcSpl_MemSetW16(mem, 0, (WebRtc_Word16)(CB_MEML-meml_gotten));
WebRtcSpl_MemSetW16(mem, 0, (int16_t)(CB_MEML-meml_gotten));
#ifdef SPLIT_10MS
if (iLBCenc_inst->Nback_flag > 0)
@ -433,7 +433,7 @@ void WebRtcIlbcfix_EncodeImpl(
}
#else
start_count = 0;
end_count = (WebRtc_Word16)Nback;
end_count = (int16_t)Nback;
#endif
/* loop over subframes to encode */
@ -446,7 +446,7 @@ void WebRtcIlbcfix_EncodeImpl(
iLBCbits_inst->gain_index+subcount*CB_NSTAGES, &reverseResidual[subframe*SUBL],
mem, MEM_LF_TBL, SUBL,
&weightdenum[(iLBCbits_inst->startIdx-2-subframe)*(LPC_FILTERORDER+1)],
(WebRtc_Word16)subcount);
(int16_t)subcount);
/* construct decoded vector */

View File

@ -26,8 +26,8 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_EncodeImpl(
WebRtc_UWord16 *bytes, /* (o) encoded data bits iLBC */
const WebRtc_Word16 *block, /* (i) speech vector to encode */
uint16_t *bytes, /* (o) encoded data bits iLBC */
const int16_t *block, /* (i) speech vector to encode */
iLBC_Enc_Inst_t *iLBCenc_inst /* (i/o) the general encoder
state */
);

View File

@ -21,13 +21,13 @@
#include "energy_inverse.h"
void WebRtcIlbcfix_EnergyInverse(
WebRtc_Word16 *energy, /* (i/o) Energy and inverse
int16_t *energy, /* (i/o) Energy and inverse
energy (in Q29) */
int noOfEnergies) /* (i) The length of the energy
vector */
{
WebRtc_Word32 Nom=(WebRtc_Word32)0x1FFFFFFF;
WebRtc_Word16 *energyPtr;
int32_t Nom=(int32_t)0x1FFFFFFF;
int16_t *energyPtr;
int i;
/* Set the minimum energy value to 16384 to avoid overflow */
@ -40,7 +40,7 @@ void WebRtcIlbcfix_EnergyInverse(
/* Calculate inverse energy in Q29 */
energyPtr=energy;
for (i=0; i<noOfEnergies; i++) {
(*energyPtr) = (WebRtc_Word16)WebRtcSpl_DivW32W16(Nom, (*energyPtr));
(*energyPtr) = (int16_t)WebRtcSpl_DivW32W16(Nom, (*energyPtr));
energyPtr++;
}
}

View File

@ -24,7 +24,7 @@
/* Inverses the in vector in into Q29 domain */
void WebRtcIlbcfix_EnergyInverse(
WebRtc_Word16 *energy, /* (i/o) Energy and inverse
int16_t *energy, /* (i/o) Energy and inverse
energy (in Q29) */
int noOfEnergies); /* (i) The length of the energy
vector */

View File

@ -24,13 +24,13 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_EnhUpsample(
WebRtc_Word32 *useq1, /* (o) upsampled output sequence */
WebRtc_Word16 *seq1 /* (i) unupsampled sequence */
int32_t *useq1, /* (o) upsampled output sequence */
int16_t *seq1 /* (i) unupsampled sequence */
){
int j;
WebRtc_Word32 *pu1, *pu11;
WebRtc_Word16 *ps, *w16tmp;
const WebRtc_Word16 *pp;
int32_t *pu1, *pu11;
int16_t *ps, *w16tmp;
const int16_t *pp;
/* filtering: filter overhangs left side of sequence */
pu1=useq1;

View File

@ -26,8 +26,8 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_EnhUpsample(
WebRtc_Word32 *useq1, /* (o) upsampled output sequence */
WebRtc_Word16 *seq1 /* (i) unupsampled sequence */
int32_t *useq1, /* (o) upsampled output sequence */
int16_t *seq1 /* (i) unupsampled sequence */
);
#endif

View File

@ -27,16 +27,16 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Enhancer(
WebRtc_Word16 *odata, /* (o) smoothed block, dimension blockl */
WebRtc_Word16 *idata, /* (i) data buffer used for enhancing */
WebRtc_Word16 idatal, /* (i) dimension idata */
WebRtc_Word16 centerStartPos, /* (i) first sample current block within idata */
WebRtc_Word16 *period, /* (i) pitch period array (pitch bward-in time) */
WebRtc_Word16 *plocs, /* (i) locations where period array values valid */
WebRtc_Word16 periodl /* (i) dimension of period and plocs */
int16_t *odata, /* (o) smoothed block, dimension blockl */
int16_t *idata, /* (i) data buffer used for enhancing */
int16_t idatal, /* (i) dimension idata */
int16_t centerStartPos, /* (i) first sample current block within idata */
int16_t *period, /* (i) pitch period array (pitch bward-in time) */
int16_t *plocs, /* (i) locations where period array values valid */
int16_t periodl /* (i) dimension of period and plocs */
){
/* Stack based */
WebRtc_Word16 surround[ENH_BLOCKL];
int16_t surround[ENH_BLOCKL];
WebRtcSpl_MemSetW16(surround, 0, ENH_BLOCKL);

View File

@ -27,13 +27,13 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Enhancer(
WebRtc_Word16 *odata, /* (o) smoothed block, dimension blockl */
WebRtc_Word16 *idata, /* (i) data buffer used for enhancing */
WebRtc_Word16 idatal, /* (i) dimension idata */
WebRtc_Word16 centerStartPos, /* (i) first sample current block within idata */
WebRtc_Word16 *period, /* (i) pitch period array (pitch bward-in time) */
WebRtc_Word16 *plocs, /* (i) locations where period array values valid */
WebRtc_Word16 periodl /* (i) dimension of period and plocs */
int16_t *odata, /* (o) smoothed block, dimension blockl */
int16_t *idata, /* (i) data buffer used for enhancing */
int16_t idatal, /* (i) dimension idata */
int16_t centerStartPos, /* (i) first sample current block within idata */
int16_t *period, /* (i) pitch period array (pitch bward-in time) */
int16_t *plocs, /* (i) locations where period array values valid */
int16_t periodl /* (i) dimension of period and plocs */
);
#endif

View File

@ -29,41 +29,41 @@
*---------------------------------------------------------------*/
int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
WebRtc_Word16 *out, /* (o) enhanced signal */
WebRtc_Word16 *in, /* (i) unenhanced signal */
int16_t *out, /* (o) enhanced signal */
int16_t *in, /* (i) unenhanced signal */
iLBC_Dec_Inst_t *iLBCdec_inst /* (i) buffers etc */
){
int iblock;
int lag=20, tlag=20;
int inLen=iLBCdec_inst->blockl+120;
WebRtc_Word16 scale, scale1, plc_blockl;
WebRtc_Word16 *enh_buf, *enh_period;
WebRtc_Word32 tmp1, tmp2, max, new_blocks;
WebRtc_Word16 *enh_bufPtr1;
int16_t scale, scale1, plc_blockl;
int16_t *enh_buf, *enh_period;
int32_t tmp1, tmp2, max, new_blocks;
int16_t *enh_bufPtr1;
int i, k;
WebRtc_Word16 EnChange;
WebRtc_Word16 SqrtEnChange;
WebRtc_Word16 inc;
WebRtc_Word16 win;
WebRtc_Word16 *tmpW16ptr;
WebRtc_Word16 startPos;
WebRtc_Word16 *plc_pred;
WebRtc_Word16 *target, *regressor;
WebRtc_Word16 max16;
int16_t EnChange;
int16_t SqrtEnChange;
int16_t inc;
int16_t win;
int16_t *tmpW16ptr;
int16_t startPos;
int16_t *plc_pred;
int16_t *target, *regressor;
int16_t max16;
int shifts;
WebRtc_Word32 ener;
WebRtc_Word16 enerSh;
WebRtc_Word16 corrSh;
WebRtc_Word16 ind, sh;
WebRtc_Word16 start, stop;
int32_t ener;
int16_t enerSh;
int16_t corrSh;
int16_t ind, sh;
int16_t start, stop;
/* Stack based */
WebRtc_Word16 totsh[3];
WebRtc_Word16 downsampled[(BLOCKL_MAX+120)>>1]; /* length 180 */
WebRtc_Word32 corr32[50];
WebRtc_Word32 corrmax[3];
WebRtc_Word16 corr16[3];
WebRtc_Word16 en16[3];
WebRtc_Word16 lagmax[3];
int16_t totsh[3];
int16_t downsampled[(BLOCKL_MAX+120)>>1]; /* length 180 */
int32_t corr32[50];
int32_t corrmax[3];
int16_t corr16[3];
int16_t en16[3];
int16_t lagmax[3];
plc_pred = downsampled; /* Reuse memory since plc_pred[ENH_BLOCKL] and
downsampled are non overlapping */
@ -97,10 +97,10 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
k=WebRtcSpl_DownsampleFast(
enh_buf+ENH_BUFL-inLen, /* Input samples */
(WebRtc_Word16)(inLen+ENH_BUFL_FILTEROVERHEAD),
(int16_t)(inLen+ENH_BUFL_FILTEROVERHEAD),
downsampled,
(WebRtc_Word16)WEBRTC_SPL_RSHIFT_W16(inLen, 1),
(WebRtc_Word16*)WebRtcIlbcfix_kLpFiltCoefs, /* Coefficients in Q12 */
(int16_t)WEBRTC_SPL_RSHIFT_W16(inLen, 1),
(int16_t*)WebRtcIlbcfix_kLpFiltCoefs, /* Coefficients in Q12 */
FILTERORDER_DS_PLUS1, /* Length of filter (order-1) */
FACTOR_DS,
DELAY_DS);
@ -115,13 +115,13 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
/* scaling */
max16=WebRtcSpl_MaxAbsValueW16(&regressor[-50],
(WebRtc_Word16)(ENH_BLOCKL_HALF+50-1));
(int16_t)(ENH_BLOCKL_HALF+50-1));
shifts = WebRtcSpl_GetSizeInBits(WEBRTC_SPL_MUL_16_16(max16, max16)) - 25;
shifts = WEBRTC_SPL_MAX(0, shifts);
/* compute cross correlation */
WebRtcSpl_CrossCorrelation(corr32, target, regressor,
ENH_BLOCKL_HALF, 50, (WebRtc_Word16)shifts, -1);
ENH_BLOCKL_HALF, 50, (int16_t)shifts, -1);
/* Find 3 highest correlations that should be compared for the
highest (corr*corr)/ener */
@ -147,10 +147,10 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
&regressor[-lagmax[i]],
ENH_BLOCKL_HALF, shifts);
enerSh = 15-WebRtcSpl_GetSizeInBits(ener);
corr16[i] = (WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(corrmax[i], corrSh);
corr16[i] = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(corr16[i],
corr16[i] = (int16_t)WEBRTC_SPL_SHIFT_W32(corrmax[i], corrSh);
corr16[i] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(corr16[i],
corr16[i], 16);
en16[i] = (WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(ener, enerSh);
en16[i] = (int16_t)WEBRTC_SPL_SHIFT_W32(ener, enerSh);
totsh[i] = enerSh - WEBRTC_SPL_LSHIFT_W32(corrSh, 1);
}
@ -176,7 +176,7 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
/* Store the estimated lag in the non-downsampled domain */
enh_period[ENH_NBLOCKS_TOT-new_blocks+iblock] =
(WebRtc_Word16)WEBRTC_SPL_MUL_16_16(lag, 8);
(int16_t)WEBRTC_SPL_MUL_16_16(lag, 8);
/* Store the estimated lag for backward PLC */
if (iLBCdec_inst->prev_enh_pl==1) {
@ -203,7 +203,7 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
regressor=in+tlag-1;
/* scaling */
max16=WebRtcSpl_MaxAbsValueW16(regressor, (WebRtc_Word16)(plc_blockl+3-1));
max16=WebRtcSpl_MaxAbsValueW16(regressor, (int16_t)(plc_blockl+3-1));
if (max16>5000)
shifts=2;
else
@ -211,7 +211,7 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
/* compute cross correlation */
WebRtcSpl_CrossCorrelation(corr32, target, regressor,
plc_blockl, 3, (WebRtc_Word16)shifts, 1);
plc_blockl, 3, (int16_t)shifts, 1);
/* find lag */
lag=WebRtcSpl_MaxIndexW32(corr32, 3);
@ -257,7 +257,7 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
&enh_buf[ENH_BUFL-iLBCdec_inst->blockl-plc_blockl], plc_blockl);
max16=WebRtcSpl_MaxAbsValueW16(plc_pred, plc_blockl);
max = WEBRTC_SPL_MAX(max, max16);
scale=22-(WebRtc_Word16)WebRtcSpl_NormW32(max);
scale=22-(int16_t)WebRtcSpl_NormW32(max);
scale=WEBRTC_SPL_MAX(scale,0);
tmp2 = WebRtcSpl_DotProductWithScale(
@ -273,21 +273,21 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
Calculate EnChange=tmp2/tmp1 in Q16
*/
scale1=(WebRtc_Word16)WebRtcSpl_NormW32(tmp1);
scale1=(int16_t)WebRtcSpl_NormW32(tmp1);
tmp1=WEBRTC_SPL_SHIFT_W32(tmp1, (scale1-16)); /* using 15 bits */
tmp2=WEBRTC_SPL_SHIFT_W32(tmp2, (scale1));
EnChange = (WebRtc_Word16)WebRtcSpl_DivW32W16(tmp2,
(WebRtc_Word16)tmp1);
EnChange = (int16_t)WebRtcSpl_DivW32W16(tmp2,
(int16_t)tmp1);
/* Calculate the Sqrt of the energy in Q15 ((14+16)/2) */
SqrtEnChange = (WebRtc_Word16)WebRtcSpl_SqrtFloor(
WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)EnChange, 14));
SqrtEnChange = (int16_t)WebRtcSpl_SqrtFloor(
WEBRTC_SPL_LSHIFT_W32((int32_t)EnChange, 14));
/* Multiply first part of vector with 2*SqrtEnChange */
WebRtcSpl_ScaleVector(plc_pred, plc_pred, SqrtEnChange,
(WebRtc_Word16)(plc_blockl-16), 14);
(int16_t)(plc_blockl-16), 14);
/* Calculate increase parameter for window part (16 last samples) */
/* (1-2*SqrtEnChange)/16 in Q15 */
@ -297,7 +297,7 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
tmpW16ptr=&plc_pred[plc_blockl-16];
for (i=16;i>0;i--) {
(*tmpW16ptr)=(WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(
(*tmpW16ptr)=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT(
(*tmpW16ptr), (SqrtEnChange+(win>>1)), 14);
/* multiply by (2.0*SqrtEnChange+win) */
@ -320,13 +320,13 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
for (i=0; i<plc_blockl; i++) {
win+=inc;
*enh_bufPtr1 =
(WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT((*enh_bufPtr1), win, 14);
*enh_bufPtr1 += (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(
(int16_t)WEBRTC_SPL_MUL_16_16_RSFT((*enh_bufPtr1), win, 14);
*enh_bufPtr1 += (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(
(16384-win), plc_pred[plc_blockl-1-i], 14);
enh_bufPtr1--;
}
} else {
WebRtc_Word16 *synt = &downsampled[LPC_FILTERORDER];
int16_t *synt = &downsampled[LPC_FILTERORDER];
enh_bufPtr1=&enh_buf[ENH_BUFL-iLBCdec_inst->blockl-plc_blockl];
WEBRTC_SPL_MEMCPY_W16(enh_bufPtr1, plc_pred, plc_blockl);
@ -344,24 +344,24 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
synt,
&iLBCdec_inst->old_syntdenum[
(iLBCdec_inst->nsub-1)*(LPC_FILTERORDER+1)],
LPC_FILTERORDER+1, (WebRtc_Word16)lag);
LPC_FILTERORDER+1, (int16_t)lag);
WEBRTC_SPL_MEMCPY_W16(&synt[-LPC_FILTERORDER], &synt[lag-LPC_FILTERORDER],
LPC_FILTERORDER);
WebRtcIlbcfix_HpOutput(synt, (WebRtc_Word16*)WebRtcIlbcfix_kHpOutCoefs,
WebRtcIlbcfix_HpOutput(synt, (int16_t*)WebRtcIlbcfix_kHpOutCoefs,
iLBCdec_inst->hpimemy, iLBCdec_inst->hpimemx,
(WebRtc_Word16)lag);
(int16_t)lag);
WebRtcSpl_FilterARFastQ12(
enh_bufPtr1, synt,
&iLBCdec_inst->old_syntdenum[
(iLBCdec_inst->nsub-1)*(LPC_FILTERORDER+1)],
LPC_FILTERORDER+1, (WebRtc_Word16)lag);
LPC_FILTERORDER+1, (int16_t)lag);
WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->syntMem, &synt[lag-LPC_FILTERORDER],
LPC_FILTERORDER);
WebRtcIlbcfix_HpOutput(synt, (WebRtc_Word16*)WebRtcIlbcfix_kHpOutCoefs,
WebRtcIlbcfix_HpOutput(synt, (int16_t*)WebRtcIlbcfix_kHpOutCoefs,
iLBCdec_inst->hpimemy, iLBCdec_inst->hpimemx,
(WebRtc_Word16)lag);
(int16_t)lag);
}
}
@ -372,9 +372,9 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
WebRtcIlbcfix_Enhancer(out+WEBRTC_SPL_MUL_16_16(iblock, ENH_BLOCKL),
enh_buf,
ENH_BUFL,
(WebRtc_Word16)(WEBRTC_SPL_MUL_16_16(iblock, ENH_BLOCKL)+startPos),
(int16_t)(WEBRTC_SPL_MUL_16_16(iblock, ENH_BLOCKL)+startPos),
enh_period,
(WebRtc_Word16*)WebRtcIlbcfix_kEnhPlocs, ENH_NBLOCKS_TOT);
(int16_t*)WebRtcIlbcfix_kEnhPlocs, ENH_NBLOCKS_TOT);
}
return (lag);

View File

@ -26,8 +26,8 @@
*---------------------------------------------------------------*/
int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */
WebRtc_Word16 *out, /* (o) enhanced signal */
WebRtc_Word16 *in, /* (i) unenhanced signal */
int16_t *out, /* (o) enhanced signal */
int16_t *in, /* (i) unenhanced signal */
iLBC_Dec_Inst_t *iLBCdec_inst /* (i) buffers etc */
);

View File

@ -26,11 +26,11 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_FilteredCbVecs(
WebRtc_Word16 *cbvectors, /* (o) Codebook vector for the higher section */
WebRtc_Word16 *CBmem, /* (i) Codebook memory that is filtered to create a
int16_t *cbvectors, /* (o) Codebook vector for the higher section */
int16_t *CBmem, /* (i) Codebook memory that is filtered to create a
second CB section */
int lMem, /* (i) Length of codebook memory */
WebRtc_Word16 samples /* (i) Number of samples to filter */
int16_t samples /* (i) Number of samples to filter */
) {
/* Set up the memory, start with zero state */
@ -42,7 +42,7 @@ void WebRtcIlbcfix_FilteredCbVecs(
WebRtcSpl_FilterMAFastQ12(
CBmem+CB_HALFFILTERLEN+lMem-samples, cbvectors+lMem-samples,
(WebRtc_Word16*)WebRtcIlbcfix_kCbFiltersRev, CB_FILTERLEN, samples);
(int16_t*)WebRtcIlbcfix_kCbFiltersRev, CB_FILTERLEN, samples);
return;
}

View File

@ -28,11 +28,11 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_FilteredCbVecs(
WebRtc_Word16 *cbvectors, /* (o) Codebook vector for the higher section */
WebRtc_Word16 *CBmem, /* (i) Codebook memory that is filtered to create a
int16_t *cbvectors, /* (o) Codebook vector for the higher section */
int16_t *CBmem, /* (i) Codebook memory that is filtered to create a
second CB section */
int lMem, /* (i) Length of codebook memory */
WebRtc_Word16 samples /* (i) Number of samples to filter */
int16_t samples /* (i) Number of samples to filter */
);
#endif

View File

@ -23,19 +23,19 @@
* Classification of subframes to localize start state
*---------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_FrameClassify(
int16_t WebRtcIlbcfix_FrameClassify(
/* (o) Index to the max-energy sub frame */
iLBC_Enc_Inst_t *iLBCenc_inst,
/* (i/o) the encoder state structure */
WebRtc_Word16 *residualFIX /* (i) lpc residual signal */
int16_t *residualFIX /* (i) lpc residual signal */
){
WebRtc_Word16 max, scale;
WebRtc_Word32 ssqEn[NSUB_MAX-1];
WebRtc_Word16 *ssqPtr;
WebRtc_Word32 *seqEnPtr;
WebRtc_Word32 maxW32;
WebRtc_Word16 scale1;
WebRtc_Word16 pos;
int16_t max, scale;
int32_t ssqEn[NSUB_MAX-1];
int16_t *ssqPtr;
int32_t *seqEnPtr;
int32_t maxW32;
int16_t scale1;
int16_t pos;
int n;
/*
@ -62,7 +62,7 @@ WebRtc_Word16 WebRtcIlbcfix_FrameClassify(
}
/* Scale to maximum 20 bits in order to allow for the 11 bit window */
maxW32 = WebRtcSpl_MaxValueW32(ssqEn, (WebRtc_Word16)(iLBCenc_inst->nsub-1));
maxW32 = WebRtcSpl_MaxValueW32(ssqEn, (int16_t)(iLBCenc_inst->nsub-1));
scale = WebRtcSpl_GetSizeInBits(maxW32) - 20;
scale1 = WEBRTC_SPL_MAX(0, scale);
@ -71,9 +71,9 @@ WebRtc_Word16 WebRtcIlbcfix_FrameClassify(
*/
seqEnPtr=ssqEn;
if (iLBCenc_inst->mode==20) {
ssqPtr=(WebRtc_Word16*)WebRtcIlbcfix_kStartSequenceEnrgWin+1;
ssqPtr=(int16_t*)WebRtcIlbcfix_kStartSequenceEnrgWin+1;
} else {
ssqPtr=(WebRtc_Word16*)WebRtcIlbcfix_kStartSequenceEnrgWin;
ssqPtr=(int16_t*)WebRtcIlbcfix_kStartSequenceEnrgWin;
}
for (n=(iLBCenc_inst->nsub-1); n>0; n--) {
(*seqEnPtr)=WEBRTC_SPL_MUL(((*seqEnPtr)>>scale1), (*ssqPtr));
@ -82,7 +82,7 @@ WebRtc_Word16 WebRtcIlbcfix_FrameClassify(
}
/* Extract the best choise of start state */
pos = WebRtcSpl_MaxIndexW32(ssqEn, (WebRtc_Word16)(iLBCenc_inst->nsub-1)) + 1;
pos = WebRtcSpl_MaxIndexW32(ssqEn, (int16_t)(iLBCenc_inst->nsub-1)) + 1;
return(pos);
}

View File

@ -19,11 +19,11 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_FRAME_CLASSIFY_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_FRAME_CLASSIFY_H_
WebRtc_Word16 WebRtcIlbcfix_FrameClassify(
int16_t WebRtcIlbcfix_FrameClassify(
/* (o) Index to the max-energy sub frame */
iLBC_Enc_Inst_t *iLBCenc_inst,
/* (i/o) the encoder state structure */
WebRtc_Word16 *residualFIX /* (i) lpc residual signal */
int16_t *residualFIX /* (i) lpc residual signal */
);
#endif

View File

@ -24,14 +24,14 @@
* residual
*---------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_GainDequant(
int16_t WebRtcIlbcfix_GainDequant(
/* (o) quantized gain value (Q14) */
WebRtc_Word16 index, /* (i) quantization index */
WebRtc_Word16 maxIn, /* (i) maximum of unquantized gain (Q14) */
WebRtc_Word16 stage /* (i) The stage of the search */
int16_t index, /* (i) quantization index */
int16_t maxIn, /* (i) maximum of unquantized gain (Q14) */
int16_t stage /* (i) The stage of the search */
){
WebRtc_Word16 scale;
const WebRtc_Word16 *gain;
int16_t scale;
const int16_t *gain;
/* obtain correct scale factor */
@ -41,5 +41,5 @@ WebRtc_Word16 WebRtcIlbcfix_GainDequant(
/* select the quantization table and return the decoded value */
gain = WebRtcIlbcfix_kGain[stage];
return((WebRtc_Word16)((WEBRTC_SPL_MUL_16_16(scale, gain[index])+8192)>>14));
return((int16_t)((WEBRTC_SPL_MUL_16_16(scale, gain[index])+8192)>>14));
}

View File

@ -26,11 +26,11 @@
* residual
*---------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_GainDequant(
int16_t WebRtcIlbcfix_GainDequant(
/* (o) quantized gain value (Q14) */
WebRtc_Word16 index, /* (i) quantization index */
WebRtc_Word16 maxIn, /* (i) maximum of unquantized gain (Q14) */
WebRtc_Word16 stage /* (i) The stage of the search */
int16_t index, /* (i) quantization index */
int16_t maxIn, /* (i) maximum of unquantized gain (Q14) */
int16_t stage /* (i) The stage of the search */
);
#endif

View File

@ -23,16 +23,16 @@
* quantizer for the gain in the gain-shape coding of residual
*---------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
WebRtc_Word16 gain, /* (i) gain value Q14 */
WebRtc_Word16 maxIn, /* (i) maximum of gain value Q14 */
WebRtc_Word16 stage, /* (i) The stage of the search */
WebRtc_Word16 *index /* (o) quantization index */
int16_t WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
int16_t gain, /* (i) gain value Q14 */
int16_t maxIn, /* (i) maximum of gain value Q14 */
int16_t stage, /* (i) The stage of the search */
int16_t *index /* (o) quantization index */
) {
WebRtc_Word16 scale, returnVal, cblen;
WebRtc_Word32 gainW32, measure1, measure2;
const WebRtc_Word16 *cbPtr, *cb;
int16_t scale, returnVal, cblen;
int32_t gainW32, measure1, measure2;
const int16_t *cbPtr, *cb;
int loc, noMoves, noChecks, i;
/* ensure a lower bound (0.1) on the scaling factor */
@ -48,7 +48,7 @@ WebRtc_Word16 WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
/* Multiply the gain with 2^14 to make the comparison
easier and with higher precision */
gainW32 = WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)gain, 14);
gainW32 = WEBRTC_SPL_LSHIFT_W32((int32_t)gain, 14);
/* Do a binary search, starting in the middle of the CB
loc - defines the current position in the table
@ -99,7 +99,7 @@ WebRtc_Word16 WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
*index=loc;
/* Calculate the quantized gain value (in Q14) */
returnVal=(WebRtc_Word16)((WEBRTC_SPL_MUL_16_16(scale, cb[loc])+8192)>>14);
returnVal=(int16_t)((WEBRTC_SPL_MUL_16_16(scale, cb[loc])+8192)>>14);
/* return the quantized value */
return(returnVal);

View File

@ -25,11 +25,11 @@
* quantizer for the gain in the gain-shape coding of residual
*---------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
WebRtc_Word16 gain, /* (i) gain value Q14 */
WebRtc_Word16 maxIn, /* (i) maximum of gain value Q14 */
WebRtc_Word16 stage, /* (i) The stage of the search */
WebRtc_Word16 *index /* (o) quantization index */
int16_t WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
int16_t gain, /* (i) gain value Q14 */
int16_t maxIn, /* (i) maximum of gain value Q14 */
int16_t stage, /* (i) The stage of the search */
int16_t *index /* (o) quantization index */
);
#endif

View File

@ -25,16 +25,16 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_GetCbVec(
WebRtc_Word16 *cbvec, /* (o) Constructed codebook vector */
WebRtc_Word16 *mem, /* (i) Codebook buffer */
WebRtc_Word16 index, /* (i) Codebook index */
WebRtc_Word16 lMem, /* (i) Length of codebook buffer */
WebRtc_Word16 cbveclen /* (i) Codebook vector length */
int16_t *cbvec, /* (o) Constructed codebook vector */
int16_t *mem, /* (i) Codebook buffer */
int16_t index, /* (i) Codebook index */
int16_t lMem, /* (i) Length of codebook buffer */
int16_t cbveclen /* (i) Codebook vector length */
){
WebRtc_Word16 k, base_size;
WebRtc_Word16 lag;
int16_t k, base_size;
int16_t lag;
/* Stack based */
WebRtc_Word16 tempbuff2[SUBL+5];
int16_t tempbuff2[SUBL+5];
/* Determine size of codebook sections */
@ -58,7 +58,7 @@ void WebRtcIlbcfix_GetCbVec(
/* Calculate lag */
k=(WebRtc_Word16)WEBRTC_SPL_MUL_16_16(2, (index-(lMem-cbveclen+1)))+cbveclen;
k=(int16_t)WEBRTC_SPL_MUL_16_16(2, (index-(lMem-cbveclen+1)))+cbveclen;
lag=WEBRTC_SPL_RSHIFT_W16(k, 1);
@ -70,7 +70,7 @@ void WebRtcIlbcfix_GetCbVec(
else {
WebRtc_Word16 memIndTest;
int16_t memIndTest;
/* first non-interpolated vectors */
@ -86,7 +86,7 @@ void WebRtcIlbcfix_GetCbVec(
/* do filtering to get the codebook vector */
WebRtcSpl_FilterMAFastQ12(
&mem[memIndTest+4], cbvec, (WebRtc_Word16*)WebRtcIlbcfix_kCbFiltersRev,
&mem[memIndTest+4], cbvec, (int16_t*)WebRtcIlbcfix_kCbFiltersRev,
CB_FILTERLEN, cbveclen);
}
@ -99,8 +99,8 @@ void WebRtcIlbcfix_GetCbVec(
/* do filtering */
WebRtcSpl_FilterMAFastQ12(
&mem[memIndTest+7], tempbuff2, (WebRtc_Word16*)WebRtcIlbcfix_kCbFiltersRev,
CB_FILTERLEN, (WebRtc_Word16)(cbveclen+5));
&mem[memIndTest+7], tempbuff2, (int16_t*)WebRtcIlbcfix_kCbFiltersRev,
CB_FILTERLEN, (int16_t)(cbveclen+5));
/* Calculate lag index */
lag = (cbveclen<<1)-20+index-base_size-lMem-1;

View File

@ -20,11 +20,11 @@
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_GET_CD_VEC_H_
void WebRtcIlbcfix_GetCbVec(
WebRtc_Word16 *cbvec, /* (o) Constructed codebook vector */
WebRtc_Word16 *mem, /* (i) Codebook buffer */
WebRtc_Word16 index, /* (i) Codebook index */
WebRtc_Word16 lMem, /* (i) Length of codebook buffer */
WebRtc_Word16 cbveclen /* (i) Codebook vector length */
int16_t *cbvec, /* (o) Constructed codebook vector */
int16_t *mem, /* (i) Codebook buffer */
int16_t index, /* (i) Codebook index */
int16_t lMem, /* (i) Length of codebook buffer */
int16_t cbveclen /* (i) Codebook vector length */
);
#endif

View File

@ -38,19 +38,19 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_GetLspPoly(
WebRtc_Word16 *lsp, /* (i) LSP in Q15 */
WebRtc_Word32 *f) /* (o) polonymial in Q24 */
int16_t *lsp, /* (i) LSP in Q15 */
int32_t *f) /* (o) polonymial in Q24 */
{
WebRtc_Word32 tmpW32;
int32_t tmpW32;
int i, j;
WebRtc_Word16 high, low;
WebRtc_Word16 *lspPtr;
WebRtc_Word32 *fPtr;
int16_t high, low;
int16_t *lspPtr;
int32_t *fPtr;
lspPtr = lsp;
fPtr = f;
/* f[0] = 1.0 (Q24) */
(*fPtr) = (WebRtc_Word32)16777216;
(*fPtr) = (int32_t)16777216;
fPtr++;
(*fPtr) = WEBRTC_SPL_MUL((*lspPtr), -1024);
@ -64,8 +64,8 @@ void WebRtcIlbcfix_GetLspPoly(
for(j=i; j>1; j--)
{
/* Compute f[j] = f[j] + tmp*f[j-1] + f[j-2]; */
high = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(fPtr[-1], 16);
low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(fPtr[-1]-WEBRTC_SPL_LSHIFT_W32(((WebRtc_Word32)high),16), 1);
high = (int16_t)WEBRTC_SPL_RSHIFT_W32(fPtr[-1], 16);
low = (int16_t)WEBRTC_SPL_RSHIFT_W32(fPtr[-1]-WEBRTC_SPL_LSHIFT_W32(((int32_t)high),16), 1);
tmpW32 = WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16(high, (*lspPtr)), 2) +
WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16_RSFT(low, (*lspPtr), 15), 2);
@ -74,7 +74,7 @@ void WebRtcIlbcfix_GetLspPoly(
(*fPtr) -= tmpW32;
fPtr--;
}
(*fPtr) -= (WebRtc_Word32)WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)(*lspPtr), 10);
(*fPtr) -= (int32_t)WEBRTC_SPL_LSHIFT_W32((int32_t)(*lspPtr), 10);
fPtr+=i;
lspPtr+=2;

View File

@ -41,7 +41,7 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_GetLspPoly(
WebRtc_Word16 *lsp, /* (i) LSP in Q15 */
WebRtc_Word32 *f); /* (o) polonymial in Q24 */
int16_t *lsp, /* (i) LSP in Q15 */
int32_t *f); /* (o) polonymial in Q24 */
#endif

View File

@ -26,31 +26,31 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_GetSyncSeq(
WebRtc_Word16 *idata, /* (i) original data */
WebRtc_Word16 idatal, /* (i) dimension of data */
WebRtc_Word16 centerStartPos, /* (i) where current block starts */
WebRtc_Word16 *period, /* (i) rough-pitch-period array (Q-2) */
WebRtc_Word16 *plocs, /* (i) where periods of period array are taken (Q-2) */
WebRtc_Word16 periodl, /* (i) dimension period array */
WebRtc_Word16 hl, /* (i) 2*hl+1 is the number of sequences */
WebRtc_Word16 *surround /* (i/o) The contribution from this sequence
int16_t *idata, /* (i) original data */
int16_t idatal, /* (i) dimension of data */
int16_t centerStartPos, /* (i) where current block starts */
int16_t *period, /* (i) rough-pitch-period array (Q-2) */
int16_t *plocs, /* (i) where periods of period array are taken (Q-2) */
int16_t periodl, /* (i) dimension period array */
int16_t hl, /* (i) 2*hl+1 is the number of sequences */
int16_t *surround /* (i/o) The contribution from this sequence
summed with earlier contributions */
){
WebRtc_Word16 i,centerEndPos,q;
int16_t i,centerEndPos,q;
/* Stack based */
WebRtc_Word16 lagBlock[2*ENH_HL+1];
WebRtc_Word16 blockStartPos[2*ENH_HL+1]; /* Defines the position to search around (Q2) */
WebRtc_Word16 plocs2[ENH_PLOCSL];
int16_t lagBlock[2*ENH_HL+1];
int16_t blockStartPos[2*ENH_HL+1]; /* Defines the position to search around (Q2) */
int16_t plocs2[ENH_PLOCSL];
centerEndPos=centerStartPos+ENH_BLOCKL-1;
/* present (find predicted lag from this position) */
WebRtcIlbcfix_NearestNeighbor(lagBlock+hl,plocs,
(WebRtc_Word16)WEBRTC_SPL_MUL_16_16(2, (centerStartPos+centerEndPos)),
(int16_t)WEBRTC_SPL_MUL_16_16(2, (centerStartPos+centerEndPos)),
periodl);
blockStartPos[hl]=(WebRtc_Word16)WEBRTC_SPL_MUL_16_16(4, centerStartPos);
blockStartPos[hl]=(int16_t)WEBRTC_SPL_MUL_16_16(4, centerStartPos);
/* past (find predicted position and perform a refined
search to find the best sequence) */
@ -59,10 +59,10 @@ void WebRtcIlbcfix_GetSyncSeq(
blockStartPos[q]=blockStartPos[q+1]-period[lagBlock[q+1]];
WebRtcIlbcfix_NearestNeighbor(lagBlock+q, plocs,
(WebRtc_Word16)(blockStartPos[q] + (WebRtc_Word16)WEBRTC_SPL_MUL_16_16(4, ENH_BLOCKL_HALF)-period[lagBlock[q+1]]),
(int16_t)(blockStartPos[q] + (int16_t)WEBRTC_SPL_MUL_16_16(4, ENH_BLOCKL_HALF)-period[lagBlock[q+1]]),
periodl);
if((blockStartPos[q]-(WebRtc_Word16)WEBRTC_SPL_MUL_16_16(4, ENH_OVERHANG))>=0) {
if((blockStartPos[q]-(int16_t)WEBRTC_SPL_MUL_16_16(4, ENH_OVERHANG))>=0) {
/* Find the best possible sequence in the 4 times upsampled
domain around blockStartPos+q */
@ -85,14 +85,14 @@ void WebRtcIlbcfix_GetSyncSeq(
for(q=hl+1;q<=WEBRTC_SPL_MUL_16_16(2, hl);q++) {
WebRtcIlbcfix_NearestNeighbor(lagBlock+q,plocs2,
(WebRtc_Word16)(blockStartPos[q-1]+
(WebRtc_Word16)WEBRTC_SPL_MUL_16_16(4, ENH_BLOCKL_HALF)),periodl);
(int16_t)(blockStartPos[q-1]+
(int16_t)WEBRTC_SPL_MUL_16_16(4, ENH_BLOCKL_HALF)),periodl);
blockStartPos[q]=blockStartPos[q-1]+period[lagBlock[q]];
if( (blockStartPos[q]+(WebRtc_Word16)WEBRTC_SPL_MUL_16_16(4, (ENH_BLOCKL+ENH_OVERHANG)))
if( (blockStartPos[q]+(int16_t)WEBRTC_SPL_MUL_16_16(4, (ENH_BLOCKL+ENH_OVERHANG)))
<
(WebRtc_Word16)WEBRTC_SPL_MUL_16_16(4, idatal)) {
(int16_t)WEBRTC_SPL_MUL_16_16(4, idatal)) {
/* Find the best possible sequence in the 4 times upsampled
domain around blockStartPos+q */

View File

@ -26,14 +26,14 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_GetSyncSeq(
WebRtc_Word16 *idata, /* (i) original data */
WebRtc_Word16 idatal, /* (i) dimension of data */
WebRtc_Word16 centerStartPos, /* (i) where current block starts */
WebRtc_Word16 *period, /* (i) rough-pitch-period array (Q-2) */
WebRtc_Word16 *plocs, /* (i) where periods of period array are taken (Q-2) */
WebRtc_Word16 periodl, /* (i) dimension period array */
WebRtc_Word16 hl, /* (i) 2*hl+1 is the number of sequences */
WebRtc_Word16 *surround /* (i/o) The contribution from this sequence
int16_t *idata, /* (i) original data */
int16_t idatal, /* (i) dimension of data */
int16_t centerStartPos, /* (i) where current block starts */
int16_t *period, /* (i) rough-pitch-period array (Q-2) */
int16_t *plocs, /* (i) where periods of period array are taken (Q-2) */
int16_t periodl, /* (i) dimension period array */
int16_t hl, /* (i) 2*hl+1 is the number of sequences */
int16_t *surround /* (i/o) The contribution from this sequence
summed with earlier contributions */
);

View File

@ -23,18 +23,18 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_HpInput(
WebRtc_Word16 *signal, /* (i/o) signal vector */
WebRtc_Word16 *ba, /* (i) B- and A-coefficients (2:nd order)
int16_t *signal, /* (i/o) signal vector */
int16_t *ba, /* (i) B- and A-coefficients (2:nd order)
{b[0] b[1] b[2] -a[1] -a[2]} a[0]
is assumed to be 1.0 */
WebRtc_Word16 *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
int16_t *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
yhi[n-2] ylow[n-2] */
WebRtc_Word16 *x, /* (i/o) Filter state x[n-1] x[n-2] */
WebRtc_Word16 len) /* (i) Number of samples to filter */
int16_t *x, /* (i/o) Filter state x[n-1] x[n-2] */
int16_t len) /* (i) Number of samples to filter */
{
int i;
WebRtc_Word32 tmpW32;
WebRtc_Word32 tmpW32b;
int32_t tmpW32;
int32_t tmpW32b;
for (i=0; i<len; i++) {
@ -62,10 +62,10 @@ void WebRtcIlbcfix_HpInput(
tmpW32b = tmpW32 + 4096;
/* Saturate (to 2^28) so that the HP filtered signal does not overflow */
tmpW32b = WEBRTC_SPL_SAT((WebRtc_Word32)268435455, tmpW32b, (WebRtc_Word32)-268435456);
tmpW32b = WEBRTC_SPL_SAT((int32_t)268435455, tmpW32b, (int32_t)-268435456);
/* Convert back to Q0 and multiply with 0.5 */
signal[i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmpW32b, 13);
signal[i] = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmpW32b, 13);
/* Update state (filtered part) */
y[2] = y[0];
@ -80,8 +80,8 @@ void WebRtcIlbcfix_HpInput(
tmpW32 = WEBRTC_SPL_LSHIFT_W32(tmpW32, 3);
}
y[0] = (WebRtc_Word16)(tmpW32 >> 16);
y[1] = (WebRtc_Word16)((tmpW32 - WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)y[0], 16))>>1);
y[0] = (int16_t)(tmpW32 >> 16);
y[1] = (int16_t)((tmpW32 - WEBRTC_SPL_LSHIFT_W32((int32_t)y[0], 16))>>1);
}
return;

View File

@ -22,13 +22,13 @@
#include "defines.h"
void WebRtcIlbcfix_HpInput(
WebRtc_Word16 *signal, /* (i/o) signal vector */
WebRtc_Word16 *ba, /* (i) B- and A-coefficients (2:nd order)
int16_t *signal, /* (i/o) signal vector */
int16_t *ba, /* (i) B- and A-coefficients (2:nd order)
{b[0] b[1] b[2] -a[1] -a[2]} a[0]
is assumed to be 1.0 */
WebRtc_Word16 *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
int16_t *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
yhi[n-2] ylow[n-2] */
WebRtc_Word16 *x, /* (i/o) Filter state x[n-1] x[n-2] */
WebRtc_Word16 len); /* (i) Number of samples to filter */
int16_t *x, /* (i/o) Filter state x[n-1] x[n-2] */
int16_t len); /* (i) Number of samples to filter */
#endif

View File

@ -23,18 +23,18 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_HpOutput(
WebRtc_Word16 *signal, /* (i/o) signal vector */
WebRtc_Word16 *ba, /* (i) B- and A-coefficients (2:nd order)
int16_t *signal, /* (i/o) signal vector */
int16_t *ba, /* (i) B- and A-coefficients (2:nd order)
{b[0] b[1] b[2] -a[1] -a[2]} a[0]
is assumed to be 1.0 */
WebRtc_Word16 *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
int16_t *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
yhi[n-2] ylow[n-2] */
WebRtc_Word16 *x, /* (i/o) Filter state x[n-1] x[n-2] */
WebRtc_Word16 len) /* (i) Number of samples to filter */
int16_t *x, /* (i/o) Filter state x[n-1] x[n-2] */
int16_t len) /* (i) Number of samples to filter */
{
int i;
WebRtc_Word32 tmpW32;
WebRtc_Word32 tmpW32b;
int32_t tmpW32;
int32_t tmpW32b;
for (i=0; i<len; i++) {
@ -62,10 +62,10 @@ void WebRtcIlbcfix_HpOutput(
tmpW32b = tmpW32 + 1024;
/* Saturate (to 2^26) so that the HP filtered signal does not overflow */
tmpW32b = WEBRTC_SPL_SAT((WebRtc_Word32)67108863, tmpW32b, (WebRtc_Word32)-67108864);
tmpW32b = WEBRTC_SPL_SAT((int32_t)67108863, tmpW32b, (int32_t)-67108864);
/* Convert back to Q0 and multiply with 2 */
signal[i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmpW32b, 11);
signal[i] = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmpW32b, 11);
/* Update state (filtered part) */
y[2] = y[0];
@ -80,8 +80,8 @@ void WebRtcIlbcfix_HpOutput(
tmpW32 = WEBRTC_SPL_LSHIFT_W32(tmpW32, 3);
}
y[0] = (WebRtc_Word16)(tmpW32 >> 16);
y[1] = (WebRtc_Word16)((tmpW32 - WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)y[0], 16))>>1);
y[0] = (int16_t)(tmpW32 >> 16);
y[1] = (int16_t)((tmpW32 - WEBRTC_SPL_LSHIFT_W32((int32_t)y[0], 16))>>1);
}

View File

@ -22,13 +22,13 @@
#include "defines.h"
void WebRtcIlbcfix_HpOutput(
WebRtc_Word16 *signal, /* (i/o) signal vector */
WebRtc_Word16 *ba, /* (i) B- and A-coefficients (2:nd order)
int16_t *signal, /* (i/o) signal vector */
int16_t *ba, /* (i) B- and A-coefficients (2:nd order)
{b[0] b[1] b[2] -a[1] -a[2]} a[0]
is assumed to be 1.0 */
WebRtc_Word16 *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
int16_t *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
yhi[n-2] ylow[n-2] */
WebRtc_Word16 *x, /* (i/o) Filter state x[n-1] x[n-2] */
WebRtc_Word16 len); /* (i) Number of samples to filter */
int16_t *x, /* (i/o) Filter state x[n-1] x[n-2] */
int16_t len); /* (i) Number of samples to filter */
#endif

View File

@ -25,9 +25,9 @@
#include <stdlib.h>
WebRtc_Word16 WebRtcIlbcfix_EncoderAssign(iLBC_encinst_t **iLBC_encinst, WebRtc_Word16 *ILBCENC_inst_Addr, WebRtc_Word16 *size) {
int16_t WebRtcIlbcfix_EncoderAssign(iLBC_encinst_t **iLBC_encinst, int16_t *ILBCENC_inst_Addr, int16_t *size) {
*iLBC_encinst=(iLBC_encinst_t*)ILBCENC_inst_Addr;
*size=sizeof(iLBC_Enc_Inst_t)/sizeof(WebRtc_Word16);
*size=sizeof(iLBC_Enc_Inst_t)/sizeof(int16_t);
if (*iLBC_encinst!=NULL) {
return(0);
} else {
@ -35,9 +35,9 @@ WebRtc_Word16 WebRtcIlbcfix_EncoderAssign(iLBC_encinst_t **iLBC_encinst, WebRtc_
}
}
WebRtc_Word16 WebRtcIlbcfix_DecoderAssign(iLBC_decinst_t **iLBC_decinst, WebRtc_Word16 *ILBCDEC_inst_Addr, WebRtc_Word16 *size) {
int16_t WebRtcIlbcfix_DecoderAssign(iLBC_decinst_t **iLBC_decinst, int16_t *ILBCDEC_inst_Addr, int16_t *size) {
*iLBC_decinst=(iLBC_decinst_t*)ILBCDEC_inst_Addr;
*size=sizeof(iLBC_Dec_Inst_t)/sizeof(WebRtc_Word16);
*size=sizeof(iLBC_Dec_Inst_t)/sizeof(int16_t);
if (*iLBC_decinst!=NULL) {
return(0);
} else {
@ -45,7 +45,7 @@ WebRtc_Word16 WebRtcIlbcfix_DecoderAssign(iLBC_decinst_t **iLBC_decinst, WebRtc_
}
}
WebRtc_Word16 WebRtcIlbcfix_EncoderCreate(iLBC_encinst_t **iLBC_encinst) {
int16_t WebRtcIlbcfix_EncoderCreate(iLBC_encinst_t **iLBC_encinst) {
*iLBC_encinst=(iLBC_encinst_t*)malloc(sizeof(iLBC_Enc_Inst_t));
if (*iLBC_encinst!=NULL) {
WebRtcSpl_Init();
@ -55,7 +55,7 @@ WebRtc_Word16 WebRtcIlbcfix_EncoderCreate(iLBC_encinst_t **iLBC_encinst) {
}
}
WebRtc_Word16 WebRtcIlbcfix_DecoderCreate(iLBC_decinst_t **iLBC_decinst) {
int16_t WebRtcIlbcfix_DecoderCreate(iLBC_decinst_t **iLBC_decinst) {
*iLBC_decinst=(iLBC_decinst_t*)malloc(sizeof(iLBC_Dec_Inst_t));
if (*iLBC_decinst!=NULL) {
WebRtcSpl_Init();
@ -65,18 +65,18 @@ WebRtc_Word16 WebRtcIlbcfix_DecoderCreate(iLBC_decinst_t **iLBC_decinst) {
}
}
WebRtc_Word16 WebRtcIlbcfix_EncoderFree(iLBC_encinst_t *iLBC_encinst) {
int16_t WebRtcIlbcfix_EncoderFree(iLBC_encinst_t *iLBC_encinst) {
free(iLBC_encinst);
return(0);
}
WebRtc_Word16 WebRtcIlbcfix_DecoderFree(iLBC_decinst_t *iLBC_decinst) {
int16_t WebRtcIlbcfix_DecoderFree(iLBC_decinst_t *iLBC_decinst) {
free(iLBC_decinst);
return(0);
}
WebRtc_Word16 WebRtcIlbcfix_EncoderInit(iLBC_encinst_t *iLBCenc_inst, WebRtc_Word16 mode)
int16_t WebRtcIlbcfix_EncoderInit(iLBC_encinst_t *iLBCenc_inst, int16_t mode)
{
if ((mode==20)||(mode==30)) {
WebRtcIlbcfix_InitEncode((iLBC_Enc_Inst_t*) iLBCenc_inst, mode);
@ -86,10 +86,10 @@ WebRtc_Word16 WebRtcIlbcfix_EncoderInit(iLBC_encinst_t *iLBCenc_inst, WebRtc_Wor
}
}
WebRtc_Word16 WebRtcIlbcfix_Encode(iLBC_encinst_t *iLBCenc_inst, const WebRtc_Word16 *speechIn, WebRtc_Word16 len, WebRtc_Word16 *encoded) {
int16_t WebRtcIlbcfix_Encode(iLBC_encinst_t *iLBCenc_inst, const int16_t *speechIn, int16_t len, int16_t *encoded) {
WebRtc_Word16 pos = 0;
WebRtc_Word16 encpos = 0;
int16_t pos = 0;
int16_t encpos = 0;
if ((len != ((iLBC_Enc_Inst_t*)iLBCenc_inst)->blockl) &&
#ifdef SPLIT_10MS
@ -104,7 +104,7 @@ WebRtc_Word16 WebRtcIlbcfix_Encode(iLBC_encinst_t *iLBCenc_inst, const WebRtc_Wo
/* call encoder */
while (pos<len) {
WebRtcIlbcfix_EncodeImpl((WebRtc_UWord16*) &encoded[encpos], &speechIn[pos], (iLBC_Enc_Inst_t*) iLBCenc_inst);
WebRtcIlbcfix_EncodeImpl((uint16_t*) &encoded[encpos], &speechIn[pos], (iLBC_Enc_Inst_t*) iLBCenc_inst);
#ifdef SPLIT_10MS
pos += 80;
if(((iLBC_Enc_Inst_t*)iLBCenc_inst)->section == 0)
@ -117,7 +117,7 @@ WebRtc_Word16 WebRtcIlbcfix_Encode(iLBC_encinst_t *iLBCenc_inst, const WebRtc_Wo
}
}
WebRtc_Word16 WebRtcIlbcfix_DecoderInit(iLBC_decinst_t *iLBCdec_inst, WebRtc_Word16 mode) {
int16_t WebRtcIlbcfix_DecoderInit(iLBC_decinst_t *iLBCdec_inst, int16_t mode) {
if ((mode==20)||(mode==30)) {
WebRtcIlbcfix_InitDecode((iLBC_Dec_Inst_t*) iLBCdec_inst, mode, 1);
return(0);
@ -125,21 +125,21 @@ WebRtc_Word16 WebRtcIlbcfix_DecoderInit(iLBC_decinst_t *iLBCdec_inst, WebRtc_Wor
return(-1);
}
}
WebRtc_Word16 WebRtcIlbcfix_DecoderInit20Ms(iLBC_decinst_t *iLBCdec_inst) {
int16_t WebRtcIlbcfix_DecoderInit20Ms(iLBC_decinst_t *iLBCdec_inst) {
WebRtcIlbcfix_InitDecode((iLBC_Dec_Inst_t*) iLBCdec_inst, 20, 1);
return(0);
}
WebRtc_Word16 WebRtcIlbcfix_Decoderinit30Ms(iLBC_decinst_t *iLBCdec_inst) {
int16_t WebRtcIlbcfix_Decoderinit30Ms(iLBC_decinst_t *iLBCdec_inst) {
WebRtcIlbcfix_InitDecode((iLBC_Dec_Inst_t*) iLBCdec_inst, 30, 1);
return(0);
}
WebRtc_Word16 WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
const WebRtc_Word16 *encoded,
WebRtc_Word16 len,
WebRtc_Word16 *decoded,
WebRtc_Word16 *speechType)
int16_t WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
const int16_t *encoded,
int16_t len,
int16_t *decoded,
int16_t *speechType)
{
int i=0;
/* Allow for automatic switching between the frame sizes
@ -172,7 +172,7 @@ WebRtc_Word16 WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
}
while ((i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)<len) {
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (const WebRtc_UWord16*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (const uint16_t*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
i++;
}
/* iLBC does not support VAD/CNG yet */
@ -180,11 +180,11 @@ WebRtc_Word16 WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
return(i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl);
}
WebRtc_Word16 WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
const WebRtc_Word16 *encoded,
WebRtc_Word16 len,
WebRtc_Word16 *decoded,
WebRtc_Word16 *speechType)
int16_t WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
const int16_t *encoded,
int16_t len,
int16_t *decoded,
int16_t *speechType)
{
int i=0;
if ((len==((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)||
@ -196,7 +196,7 @@ WebRtc_Word16 WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
}
while ((i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)<len) {
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (const WebRtc_UWord16*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (const uint16_t*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
i++;
}
/* iLBC does not support VAD/CNG yet */
@ -204,11 +204,11 @@ WebRtc_Word16 WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
return(i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl);
}
WebRtc_Word16 WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
const WebRtc_Word16 *encoded,
WebRtc_Word16 len,
WebRtc_Word16 *decoded,
WebRtc_Word16 *speechType)
int16_t WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
const int16_t *encoded,
int16_t len,
int16_t *decoded,
int16_t *speechType)
{
int i=0;
if ((len==((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)||
@ -220,7 +220,7 @@ WebRtc_Word16 WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
}
while ((i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)<len) {
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (const WebRtc_UWord16*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (const uint16_t*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
i++;
}
/* iLBC does not support VAD/CNG yet */
@ -228,9 +228,9 @@ WebRtc_Word16 WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
return(i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl);
}
WebRtc_Word16 WebRtcIlbcfix_DecodePlc(iLBC_decinst_t *iLBCdec_inst, WebRtc_Word16 *decoded, WebRtc_Word16 noOfLostFrames) {
int16_t WebRtcIlbcfix_DecodePlc(iLBC_decinst_t *iLBCdec_inst, int16_t *decoded, int16_t noOfLostFrames) {
int i;
WebRtc_UWord16 dummy;
uint16_t dummy;
for (i=0;i<noOfLostFrames;i++) {
/* call decoder */
@ -239,7 +239,7 @@ WebRtc_Word16 WebRtcIlbcfix_DecodePlc(iLBC_decinst_t *iLBCdec_inst, WebRtc_Word1
return (noOfLostFrames*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl);
}
WebRtc_Word16 WebRtcIlbcfix_NetEqPlc(iLBC_decinst_t *iLBCdec_inst, WebRtc_Word16 *decoded, WebRtc_Word16 noOfLostFrames) {
int16_t WebRtcIlbcfix_NetEqPlc(iLBC_decinst_t *iLBCdec_inst, int16_t *decoded, int16_t noOfLostFrames) {
/* Two input parameters not used, but needed for function pointers in NetEQ */
(void)(decoded = NULL);

View File

@ -19,7 +19,7 @@
#include "defines.h"
void WebRtcIlbcfix_IndexConvDec(
WebRtc_Word16 *index /* (i/o) Codebook indexes */
int16_t *index /* (i/o) Codebook indexes */
){
int k;

View File

@ -22,7 +22,7 @@
#include "defines.h"
void WebRtcIlbcfix_IndexConvDec(
WebRtc_Word16 *index /* (i/o) Codebook indexes */
int16_t *index /* (i/o) Codebook indexes */
);
#endif

View File

@ -22,7 +22,7 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_IndexConvEnc(
WebRtc_Word16 *index /* (i/o) Codebook indexes */
int16_t *index /* (i/o) Codebook indexes */
){
int k;

View File

@ -26,7 +26,7 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_IndexConvEnc(
WebRtc_Word16 *index /* (i/o) Codebook indexes */
int16_t *index /* (i/o) Codebook indexes */
);
#endif

View File

@ -23,9 +23,9 @@
* Initiation of decoder instance.
*---------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_InitDecode( /* (o) Number of decoded samples */
int16_t WebRtcIlbcfix_InitDecode( /* (o) Number of decoded samples */
iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) Decoder instance */
WebRtc_Word16 mode, /* (i) frame size mode */
int16_t mode, /* (i) frame size mode */
int use_enhancer) { /* (i) 1: use enhancer, 0: no enhancer */
int i;

View File

@ -25,9 +25,9 @@
* Initiation of decoder instance.
*---------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_InitDecode( /* (o) Number of decoded samples */
int16_t WebRtcIlbcfix_InitDecode( /* (o) Number of decoded samples */
iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) Decoder instance */
WebRtc_Word16 mode, /* (i) frame size mode */
int16_t mode, /* (i) frame size mode */
int use_enhancer /* (i) 1 to use enhancer
0 to run without enhancer */
);

View File

@ -23,9 +23,9 @@
* Initiation of encoder instance.
*---------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_InitEncode( /* (o) Number of bytes encoded */
int16_t WebRtcIlbcfix_InitEncode( /* (o) Number of bytes encoded */
iLBC_Enc_Inst_t *iLBCenc_inst, /* (i/o) Encoder instance */
WebRtc_Word16 mode) { /* (i) frame size mode */
int16_t mode) { /* (i) frame size mode */
iLBCenc_inst->mode = mode;
/* Set all the variables that are dependent on the frame size mode */

View File

@ -25,9 +25,9 @@
* Initiation of encoder instance.
*---------------------------------------------------------------*/
WebRtc_Word16 WebRtcIlbcfix_InitEncode( /* (o) Number of bytes encoded */
int16_t WebRtcIlbcfix_InitEncode( /* (o) Number of bytes encoded */
iLBC_Enc_Inst_t *iLBCenc_inst, /* (i/o) Encoder instance */
WebRtc_Word16 mode /* (i) frame size mode */
int16_t mode /* (i) frame size mode */
);
#endif

View File

@ -60,12 +60,12 @@ extern "C" {
* -1 - Error
*/
WebRtc_Word16 WebRtcIlbcfix_EncoderAssign(iLBC_encinst_t **iLBC_encinst,
WebRtc_Word16 *ILBCENC_inst_Addr,
WebRtc_Word16 *size);
WebRtc_Word16 WebRtcIlbcfix_DecoderAssign(iLBC_decinst_t **iLBC_decinst,
WebRtc_Word16 *ILBCDEC_inst_Addr,
WebRtc_Word16 *size);
int16_t WebRtcIlbcfix_EncoderAssign(iLBC_encinst_t **iLBC_encinst,
int16_t *ILBCENC_inst_Addr,
int16_t *size);
int16_t WebRtcIlbcfix_DecoderAssign(iLBC_decinst_t **iLBC_decinst,
int16_t *ILBCDEC_inst_Addr,
int16_t *size);
/****************************************************************************
@ -80,8 +80,8 @@ extern "C" {
* -1 - Error
*/
WebRtc_Word16 WebRtcIlbcfix_EncoderCreate(iLBC_encinst_t **iLBC_encinst);
WebRtc_Word16 WebRtcIlbcfix_DecoderCreate(iLBC_decinst_t **iLBC_decinst);
int16_t WebRtcIlbcfix_EncoderCreate(iLBC_encinst_t **iLBC_encinst);
int16_t WebRtcIlbcfix_DecoderCreate(iLBC_decinst_t **iLBC_decinst);
/****************************************************************************
* WebRtcIlbcfix_XxxFree(...)
@ -95,8 +95,8 @@ extern "C" {
* -1 - Error
*/
WebRtc_Word16 WebRtcIlbcfix_EncoderFree(iLBC_encinst_t *iLBC_encinst);
WebRtc_Word16 WebRtcIlbcfix_DecoderFree(iLBC_decinst_t *iLBC_decinst);
int16_t WebRtcIlbcfix_EncoderFree(iLBC_encinst_t *iLBC_encinst);
int16_t WebRtcIlbcfix_DecoderFree(iLBC_decinst_t *iLBC_decinst);
/****************************************************************************
@ -113,8 +113,8 @@ extern "C" {
* -1 - Error
*/
WebRtc_Word16 WebRtcIlbcfix_EncoderInit(iLBC_encinst_t *iLBCenc_inst,
WebRtc_Word16 frameLen);
int16_t WebRtcIlbcfix_EncoderInit(iLBC_encinst_t *iLBCenc_inst,
int16_t frameLen);
/****************************************************************************
* WebRtcIlbcfix_Encode(...)
@ -135,10 +135,10 @@ extern "C" {
* -1 - Error
*/
WebRtc_Word16 WebRtcIlbcfix_Encode(iLBC_encinst_t *iLBCenc_inst,
const WebRtc_Word16 *speechIn,
WebRtc_Word16 len,
WebRtc_Word16 *encoded);
int16_t WebRtcIlbcfix_Encode(iLBC_encinst_t *iLBCenc_inst,
const int16_t *speechIn,
int16_t len,
int16_t *encoded);
/****************************************************************************
* WebRtcIlbcfix_DecoderInit(...)
@ -156,10 +156,10 @@ extern "C" {
* -1 - Error
*/
WebRtc_Word16 WebRtcIlbcfix_DecoderInit(iLBC_decinst_t *iLBCdec_inst,
WebRtc_Word16 frameLen);
WebRtc_Word16 WebRtcIlbcfix_DecoderInit20Ms(iLBC_decinst_t *iLBCdec_inst);
WebRtc_Word16 WebRtcIlbcfix_Decoderinit30Ms(iLBC_decinst_t *iLBCdec_inst);
int16_t WebRtcIlbcfix_DecoderInit(iLBC_decinst_t *iLBCdec_inst,
int16_t frameLen);
int16_t WebRtcIlbcfix_DecoderInit20Ms(iLBC_decinst_t *iLBCdec_inst);
int16_t WebRtcIlbcfix_Decoderinit30Ms(iLBC_decinst_t *iLBCdec_inst);
/****************************************************************************
* WebRtcIlbcfix_Decode(...)
@ -181,21 +181,21 @@ extern "C" {
* -1 - Error
*/
WebRtc_Word16 WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
const WebRtc_Word16* encoded,
WebRtc_Word16 len,
WebRtc_Word16 *decoded,
WebRtc_Word16 *speechType);
WebRtc_Word16 WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
const WebRtc_Word16 *encoded,
WebRtc_Word16 len,
WebRtc_Word16 *decoded,
WebRtc_Word16 *speechType);
WebRtc_Word16 WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
const WebRtc_Word16 *encoded,
WebRtc_Word16 len,
WebRtc_Word16 *decoded,
WebRtc_Word16 *speechType);
int16_t WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
const int16_t* encoded,
int16_t len,
int16_t *decoded,
int16_t *speechType);
int16_t WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
const int16_t *encoded,
int16_t len,
int16_t *decoded,
int16_t *speechType);
int16_t WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
const int16_t *encoded,
int16_t len,
int16_t *decoded,
int16_t *speechType);
/****************************************************************************
* WebRtcIlbcfix_DecodePlc(...)
@ -215,9 +215,9 @@ extern "C" {
* -1 - Error
*/
WebRtc_Word16 WebRtcIlbcfix_DecodePlc(iLBC_decinst_t *iLBCdec_inst,
WebRtc_Word16 *decoded,
WebRtc_Word16 noOfLostFrames);
int16_t WebRtcIlbcfix_DecodePlc(iLBC_decinst_t *iLBCdec_inst,
int16_t *decoded,
int16_t noOfLostFrames);
/****************************************************************************
* WebRtcIlbcfix_NetEqPlc(...)
@ -237,9 +237,9 @@ extern "C" {
* -1 - Error
*/
WebRtc_Word16 WebRtcIlbcfix_NetEqPlc(iLBC_decinst_t *iLBCdec_inst,
WebRtc_Word16 *decoded,
WebRtc_Word16 noOfLostFrames);
int16_t WebRtcIlbcfix_NetEqPlc(iLBC_decinst_t *iLBCdec_inst,
int16_t *decoded,
int16_t noOfLostFrames);
/****************************************************************************
* WebRtcIlbcfix_version(...)

View File

@ -24,14 +24,14 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Interpolate(
WebRtc_Word16 *out, /* (o) output vector */
WebRtc_Word16 *in1, /* (i) first input vector */
WebRtc_Word16 *in2, /* (i) second input vector */
WebRtc_Word16 coef, /* (i) weight coefficient in Q14 */
WebRtc_Word16 length) /* (i) number of sample is vectors */
int16_t *out, /* (o) output vector */
int16_t *in1, /* (i) first input vector */
int16_t *in2, /* (i) second input vector */
int16_t coef, /* (i) weight coefficient in Q14 */
int16_t length) /* (i) number of sample is vectors */
{
int i;
WebRtc_Word16 invcoef;
int16_t invcoef;
/*
Performs the operation out[i] = in[i]*coef + (1-coef)*in2[i] (with rounding)
@ -39,7 +39,7 @@ void WebRtcIlbcfix_Interpolate(
invcoef = 16384 - coef; /* 16384 = 1.0 (Q14)*/
for (i = 0; i < length; i++) {
out[i] = (WebRtc_Word16) WEBRTC_SPL_RSHIFT_W32(
out[i] = (int16_t) WEBRTC_SPL_RSHIFT_W32(
(WEBRTC_SPL_MUL_16_16(coef, in1[i]) + WEBRTC_SPL_MUL_16_16(invcoef, in2[i]))+8192,
14);
}

View File

@ -26,10 +26,10 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Interpolate(
WebRtc_Word16 *out, /* (o) output vector */
WebRtc_Word16 *in1, /* (i) first input vector */
WebRtc_Word16 *in2, /* (i) second input vector */
WebRtc_Word16 coef, /* (i) weight coefficient in Q14 */
WebRtc_Word16 length); /* (i) number of sample is vectors */
int16_t *out, /* (o) output vector */
int16_t *in1, /* (i) first input vector */
int16_t *in2, /* (i) second input vector */
int16_t coef, /* (i) weight coefficient in Q14 */
int16_t length); /* (i) number of sample is vectors */
#endif

View File

@ -20,12 +20,12 @@
#include "constants.h"
void WebRtcIlbcfix_InterpolateSamples(
WebRtc_Word16 *interpSamples, /* (o) The interpolated samples */
WebRtc_Word16 *CBmem, /* (i) The CB memory */
WebRtc_Word16 lMem /* (i) Length of the CB memory */
int16_t *interpSamples, /* (o) The interpolated samples */
int16_t *CBmem, /* (i) The CB memory */
int16_t lMem /* (i) Length of the CB memory */
) {
WebRtc_Word16 *ppi, *ppo, i, j, temp1, temp2;
WebRtc_Word16 *tmpPtr;
int16_t *ppi, *ppo, i, j, temp1, temp2;
int16_t *tmpPtr;
/* Calculate the 20 vectors of interpolated samples (4 samples each)
that are used in the codebooks for lag 20 to 39 */
@ -37,8 +37,8 @@ void WebRtcIlbcfix_InterpolateSamples(
ppi = CBmem+lMem-j-24;
for (i=0; i<4; i++) {
*tmpPtr++ = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(WebRtcIlbcfix_kAlpha[temp2],*ppo, 15) +
(WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(WebRtcIlbcfix_kAlpha[temp1], *ppi, 15);
*tmpPtr++ = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(WebRtcIlbcfix_kAlpha[temp2],*ppo, 15) +
(int16_t)WEBRTC_SPL_MUL_16_16_RSFT(WebRtcIlbcfix_kAlpha[temp1], *ppi, 15);
ppo++;
ppi++;

View File

@ -26,9 +26,9 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_InterpolateSamples(
WebRtc_Word16 *interpSamples, /* (o) The interpolated samples */
WebRtc_Word16 *CBmem, /* (i) The CB memory */
WebRtc_Word16 lMem /* (i) Length of the CB memory */
int16_t *interpSamples, /* (o) The interpolated samples */
int16_t *CBmem, /* (i) The CB memory */
int16_t lMem /* (i) Length of the CB memory */
);
#endif

View File

@ -28,18 +28,18 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_LpcEncode(
WebRtc_Word16 *syntdenum, /* (i/o) synthesis filter coefficients
int16_t *syntdenum, /* (i/o) synthesis filter coefficients
before/after encoding */
WebRtc_Word16 *weightdenum, /* (i/o) weighting denumerator coefficients
int16_t *weightdenum, /* (i/o) weighting denumerator coefficients
before/after encoding */
WebRtc_Word16 *lsf_index, /* (o) lsf quantization index */
WebRtc_Word16 *data, /* (i) Speech to do LPC analysis on */
int16_t *lsf_index, /* (o) lsf quantization index */
int16_t *data, /* (i) Speech to do LPC analysis on */
iLBC_Enc_Inst_t *iLBCenc_inst
/* (i/o) the encoder state structure */
) {
/* Stack based */
WebRtc_Word16 lsf[LPC_FILTERORDER * LPC_N_MAX];
WebRtc_Word16 lsfdeq[LPC_FILTERORDER * LPC_N_MAX];
int16_t lsf[LPC_FILTERORDER * LPC_N_MAX];
int16_t lsfdeq[LPC_FILTERORDER * LPC_N_MAX];
/* Calculate LSF's from the input speech */
WebRtcIlbcfix_SimpleLpcAnalysis(lsf, data, iLBCenc_inst);

View File

@ -26,12 +26,12 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_LpcEncode(
WebRtc_Word16 *syntdenum, /* (i/o) synthesis filter coefficients
int16_t *syntdenum, /* (i/o) synthesis filter coefficients
before/after encoding */
WebRtc_Word16 *weightdenum, /* (i/o) weighting denumerator coefficients
int16_t *weightdenum, /* (i/o) weighting denumerator coefficients
before/after encoding */
WebRtc_Word16 *lsf_index, /* (o) lsf quantization index */
WebRtc_Word16 *data, /* (i) Speech to do LPC analysis on */
int16_t *lsf_index, /* (o) lsf quantization index */
int16_t *data, /* (i) Speech to do LPC analysis on */
iLBC_Enc_Inst_t *iLBCenc_inst
/* (i/o) the encoder state structure */
);

View File

@ -24,15 +24,15 @@
*---------------------------------------------------------------*/
int WebRtcIlbcfix_LsfCheck(
WebRtc_Word16 *lsf, /* LSF parameters */
int16_t *lsf, /* LSF parameters */
int dim, /* dimension of LSF */
int NoAn) /* No of analysis per frame */
{
int k,n,m, Nit=2, change=0,pos;
const WebRtc_Word16 eps=319; /* 0.039 in Q13 (50 Hz)*/
const WebRtc_Word16 eps2=160; /* eps/2.0 in Q13;*/
const WebRtc_Word16 maxlsf=25723; /* 3.14; (4000 Hz)*/
const WebRtc_Word16 minlsf=82; /* 0.01; (0 Hz)*/
const int16_t eps=319; /* 0.039 in Q13 (50 Hz)*/
const int16_t eps2=160; /* eps/2.0 in Q13;*/
const int16_t maxlsf=25723; /* 3.14; (4000 Hz)*/
const int16_t minlsf=82; /* 0.01; (0 Hz)*/
/* LSF separation check*/
for (n=0;n<Nit;n++) { /* Run through a 2 times */

View File

@ -26,7 +26,7 @@
*---------------------------------------------------------------*/
int WebRtcIlbcfix_LsfCheck(
WebRtc_Word16 *lsf, /* LSF parameters */
int16_t *lsf, /* LSF parameters */
int dim, /* dimension of LSF */
int NoAn); /* No of analysis per frame */

View File

@ -25,14 +25,14 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_LspInterpolate2PolyDec(
WebRtc_Word16 *a, /* (o) lpc coefficients Q12 */
WebRtc_Word16 *lsf1, /* (i) first set of lsf coefficients Q13 */
WebRtc_Word16 *lsf2, /* (i) second set of lsf coefficients Q13 */
WebRtc_Word16 coef, /* (i) weighting coefficient to use between
int16_t *a, /* (o) lpc coefficients Q12 */
int16_t *lsf1, /* (i) first set of lsf coefficients Q13 */
int16_t *lsf2, /* (i) second set of lsf coefficients Q13 */
int16_t coef, /* (i) weighting coefficient to use between
lsf1 and lsf2 Q14 */
WebRtc_Word16 length /* (i) length of coefficient vectors */
int16_t length /* (i) length of coefficient vectors */
){
WebRtc_Word16 lsftmp[LPC_FILTERORDER];
int16_t lsftmp[LPC_FILTERORDER];
/* interpolate LSF */
WebRtcIlbcfix_Interpolate(lsftmp, lsf1, lsf2, coef, length);

View File

@ -26,12 +26,12 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_LspInterpolate2PolyDec(
WebRtc_Word16 *a, /* (o) lpc coefficients Q12 */
WebRtc_Word16 *lsf1, /* (i) first set of lsf coefficients Q13 */
WebRtc_Word16 *lsf2, /* (i) second set of lsf coefficients Q13 */
WebRtc_Word16 coef, /* (i) weighting coefficient to use between
int16_t *a, /* (o) lpc coefficients Q12 */
int16_t *lsf1, /* (i) first set of lsf coefficients Q13 */
int16_t *lsf2, /* (i) second set of lsf coefficients Q13 */
int16_t coef, /* (i) weighting coefficient to use between
lsf1 and lsf2 Q14 */
WebRtc_Word16 length /* (i) length of coefficient vectors */
int16_t length /* (i) length of coefficient vectors */
);
#endif

View File

@ -26,15 +26,15 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_LsfInterpolate2PloyEnc(
WebRtc_Word16 *a, /* (o) lpc coefficients Q12 */
WebRtc_Word16 *lsf1, /* (i) first set of lsf coefficients Q13 */
WebRtc_Word16 *lsf2, /* (i) second set of lsf coefficients Q13 */
WebRtc_Word16 coef, /* (i) weighting coefficient to use between
int16_t *a, /* (o) lpc coefficients Q12 */
int16_t *lsf1, /* (i) first set of lsf coefficients Q13 */
int16_t *lsf2, /* (i) second set of lsf coefficients Q13 */
int16_t coef, /* (i) weighting coefficient to use between
lsf1 and lsf2 Q14 */
WebRtc_Word16 length /* (i) length of coefficient vectors */
int16_t length /* (i) length of coefficient vectors */
) {
/* Stack based */
WebRtc_Word16 lsftmp[LPC_FILTERORDER];
int16_t lsftmp[LPC_FILTERORDER];
/* interpolate LSF */
WebRtcIlbcfix_Interpolate(lsftmp, lsf1, lsf2, coef, length);

View File

@ -27,12 +27,12 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_LsfInterpolate2PloyEnc(
WebRtc_Word16 *a, /* (o) lpc coefficients Q12 */
WebRtc_Word16 *lsf1, /* (i) first set of lsf coefficients Q13 */
WebRtc_Word16 *lsf2, /* (i) second set of lsf coefficients Q13 */
WebRtc_Word16 coef, /* (i) weighting coefficient to use between
int16_t *a, /* (o) lpc coefficients Q12 */
int16_t *lsf1, /* (i) first set of lsf coefficients Q13 */
int16_t *lsf2, /* (i) second set of lsf coefficients Q13 */
int16_t coef, /* (i) weighting coefficient to use between
lsf1 and lsf2 Q14 */
WebRtc_Word16 length /* (i) length of coefficient vectors */
int16_t length /* (i) length of coefficient vectors */
);
#endif

View File

@ -24,19 +24,19 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Lsf2Lsp(
WebRtc_Word16 *lsf, /* (i) lsf in Q13 values between 0 and pi */
WebRtc_Word16 *lsp, /* (o) lsp in Q15 values between -1 and 1 */
WebRtc_Word16 m /* (i) number of coefficients */
int16_t *lsf, /* (i) lsf in Q13 values between 0 and pi */
int16_t *lsp, /* (o) lsp in Q15 values between -1 and 1 */
int16_t m /* (i) number of coefficients */
) {
WebRtc_Word16 i, k;
WebRtc_Word16 diff; /* difference, which is used for the
int16_t i, k;
int16_t diff; /* difference, which is used for the
linear approximation (Q8) */
WebRtc_Word16 freq; /* normalized frequency in Q15 (0..1) */
WebRtc_Word32 tmpW32;
int16_t freq; /* normalized frequency in Q15 (0..1) */
int32_t tmpW32;
for(i=0; i<m; i++)
{
freq = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(lsf[i], 20861, 15);
freq = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(lsf[i], 20861, 15);
/* 20861: 1.0/(2.0*PI) in Q17 */
/*
Upper 8 bits give the index k and
@ -54,7 +54,7 @@ void WebRtcIlbcfix_Lsf2Lsp(
/* Calculate linear approximation */
tmpW32 = WEBRTC_SPL_MUL_16_16(WebRtcIlbcfix_kCosDerivative[k], diff);
lsp[i] = WebRtcIlbcfix_kCos[k]+(WebRtc_Word16)(WEBRTC_SPL_RSHIFT_W32(tmpW32, 12));
lsp[i] = WebRtcIlbcfix_kCos[k]+(int16_t)(WEBRTC_SPL_RSHIFT_W32(tmpW32, 12));
}
return;

View File

@ -26,9 +26,9 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Lsf2Lsp(
WebRtc_Word16 *lsf, /* (i) lsf in Q13 values between 0 and pi */
WebRtc_Word16 *lsp, /* (o) lsp in Q15 values between -1 and 1 */
WebRtc_Word16 m /* (i) number of coefficients */
int16_t *lsf, /* (i) lsf in Q13 values between 0 and pi */
int16_t *lsp, /* (o) lsp in Q15 values between -1 and 1 */
int16_t m /* (i) number of coefficients */
);
#endif

View File

@ -22,15 +22,15 @@
#include "constants.h"
void WebRtcIlbcfix_Lsf2Poly(
WebRtc_Word16 *a, /* (o) predictor coefficients (order = 10) in Q12 */
WebRtc_Word16 *lsf /* (i) line spectral frequencies in Q13 */
int16_t *a, /* (o) predictor coefficients (order = 10) in Q12 */
int16_t *lsf /* (i) line spectral frequencies in Q13 */
) {
WebRtc_Word32 f[2][6]; /* f[0][] and f[1][] corresponds to
int32_t f[2][6]; /* f[0][] and f[1][] corresponds to
F1(z) and F2(z) respectivly */
WebRtc_Word32 *f1ptr, *f2ptr;
WebRtc_Word16 *a1ptr, *a2ptr;
WebRtc_Word32 tmpW32;
WebRtc_Word16 lsp[10];
int32_t *f1ptr, *f2ptr;
int16_t *a1ptr, *a2ptr;
int32_t tmpW32;
int16_t lsp[10];
int i;
/* Convert lsf to lsp */
@ -71,10 +71,10 @@ void WebRtcIlbcfix_Lsf2Poly(
for (i=5; i>0; i--)
{
tmpW32 = (*f1ptr) + (*f2ptr);
(*a1ptr) = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((tmpW32+4096),13);
(*a1ptr) = (int16_t)WEBRTC_SPL_RSHIFT_W32((tmpW32+4096),13);
tmpW32 = (*f1ptr) - (*f2ptr);
(*a2ptr) = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((tmpW32+4096),13);
(*a2ptr) = (int16_t)WEBRTC_SPL_RSHIFT_W32((tmpW32+4096),13);
a1ptr++;
a2ptr--;

View File

@ -26,8 +26,8 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Lsf2Poly(
WebRtc_Word16 *a, /* (o) predictor coefficients (order = 10) in Q12 */
WebRtc_Word16 *lsf /* (i) line spectral frequencies in Q13 */
int16_t *a, /* (o) predictor coefficients (order = 10) in Q12 */
int16_t *lsf /* (i) line spectral frequencies in Q13 */
);
#endif

View File

@ -24,17 +24,17 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Lsp2Lsf(
WebRtc_Word16 *lsp, /* (i) lsp vector -1...+1 in Q15 */
WebRtc_Word16 *lsf, /* (o) Lsf vector 0...Pi in Q13
int16_t *lsp, /* (i) lsp vector -1...+1 in Q15 */
int16_t *lsf, /* (o) Lsf vector 0...Pi in Q13
(ordered, so that lsf[i]<lsf[i+1]) */
WebRtc_Word16 m /* (i) Number of coefficients */
int16_t m /* (i) Number of coefficients */
)
{
WebRtc_Word16 i, k;
WebRtc_Word16 diff; /* diff between table value and desired value (Q15) */
WebRtc_Word16 freq; /* lsf/(2*pi) (Q16) */
WebRtc_Word16 *lspPtr, *lsfPtr, *cosTblPtr;
WebRtc_Word16 tmp;
int16_t i, k;
int16_t diff; /* diff between table value and desired value (Q15) */
int16_t freq; /* lsf/(2*pi) (Q16) */
int16_t *lspPtr, *lsfPtr, *cosTblPtr;
int16_t tmp;
/* set the index to maximum index value in WebRtcIlbcfix_kCos */
k = 63;
@ -46,14 +46,14 @@ void WebRtcIlbcfix_Lsp2Lsf(
*/
lspPtr = &lsp[9];
lsfPtr = &lsf[9];
cosTblPtr=(WebRtc_Word16*)&WebRtcIlbcfix_kCos[k];
cosTblPtr=(int16_t*)&WebRtcIlbcfix_kCos[k];
for(i=m-1; i>=0; i--)
{
/*
locate value in the table, which is just above lsp[i],
basically an approximation to acos(x)
*/
while( (((WebRtc_Word32)(*cosTblPtr)-(*lspPtr)) < 0)&&(k>0) )
while( (((int32_t)(*cosTblPtr)-(*lspPtr)) < 0)&&(k>0) )
{
k-=1;
cosTblPtr--;
@ -68,13 +68,13 @@ void WebRtcIlbcfix_Lsp2Lsf(
*/
/* tmp (linear offset) in Q16 */
tmp = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(WebRtcIlbcfix_kAcosDerivative[k],diff, 11);
tmp = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(WebRtcIlbcfix_kAcosDerivative[k],diff, 11);
/* freq in Q16 */
freq = (WebRtc_Word16)WEBRTC_SPL_LSHIFT_W16(k,9)+tmp;
freq = (int16_t)WEBRTC_SPL_LSHIFT_W16(k,9)+tmp;
/* lsf = freq*2*pi */
(*lsfPtr) = (WebRtc_Word16)(((WebRtc_Word32)freq*25736)>>15);
(*lsfPtr) = (int16_t)(((int32_t)freq*25736)>>15);
lsfPtr--;
lspPtr--;

Some files were not shown because too many files have changed in this diff Show More