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:
@ -18,7 +18,7 @@
|
||||
*/
|
||||
int WebRtcIsac_EncTerminate(Bitstr *streamdata) /* in-/output struct containing bitstream */
|
||||
{
|
||||
WebRtc_UWord8 *stream_ptr;
|
||||
uint8_t *stream_ptr;
|
||||
|
||||
|
||||
/* point to the right place in the stream buffer */
|
||||
@ -37,7 +37,7 @@ int WebRtcIsac_EncTerminate(Bitstr *streamdata) /* in-/output struct containing
|
||||
stream_ptr = streamdata->stream + streamdata->stream_index;
|
||||
}
|
||||
/* write remaining data to bitstream */
|
||||
*stream_ptr++ = (WebRtc_UWord8) (streamdata->streamval >> 24);
|
||||
*stream_ptr++ = (uint8_t) (streamdata->streamval >> 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -51,8 +51,8 @@ int WebRtcIsac_EncTerminate(Bitstr *streamdata) /* in-/output struct containing
|
||||
stream_ptr = streamdata->stream + streamdata->stream_index;
|
||||
}
|
||||
/* write remaining data to bitstream */
|
||||
*stream_ptr++ = (WebRtc_UWord8) (streamdata->streamval >> 24);
|
||||
*stream_ptr++ = (WebRtc_UWord8) ((streamdata->streamval >> 16) & 0x00FF);
|
||||
*stream_ptr++ = (uint8_t) (streamdata->streamval >> 24);
|
||||
*stream_ptr++ = (uint8_t) ((streamdata->streamval >> 16) & 0x00FF);
|
||||
}
|
||||
|
||||
/* calculate stream length */
|
||||
|
||||
@ -23,41 +23,41 @@
|
||||
|
||||
int WebRtcIsac_EncLogisticMulti2(
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
WebRtc_Word16 *dataQ7, /* input: data vector */
|
||||
const WebRtc_UWord16 *env, /* input: side info vector defining the width of the pdf */
|
||||
int16_t *dataQ7, /* input: data vector */
|
||||
const uint16_t *env, /* input: side info vector defining the width of the pdf */
|
||||
const int N, /* input: data vector length */
|
||||
const WebRtc_Word16 isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
|
||||
const int16_t isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
|
||||
|
||||
/* returns the number of bytes in the stream */
|
||||
int WebRtcIsac_EncTerminate(Bitstr *streamdata); /* in-/output struct containing bitstream */
|
||||
|
||||
/* returns the number of bytes in the stream so far */
|
||||
int WebRtcIsac_DecLogisticMulti2(
|
||||
WebRtc_Word16 *data, /* output: data vector */
|
||||
int16_t *data, /* output: data vector */
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
const WebRtc_UWord16 *env, /* input: side info vector defining the width of the pdf */
|
||||
const WebRtc_Word16 *dither, /* input: dither vector */
|
||||
const uint16_t *env, /* input: side info vector defining the width of the pdf */
|
||||
const int16_t *dither, /* input: dither vector */
|
||||
const int N, /* input: data vector length */
|
||||
const WebRtc_Word16 isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
|
||||
const int16_t isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
|
||||
|
||||
void WebRtcIsac_EncHistMulti(
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
const int *data, /* input: data vector */
|
||||
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
|
||||
const uint16_t **cdf, /* input: array of cdf arrays */
|
||||
const int N); /* input: data vector length */
|
||||
|
||||
int WebRtcIsac_DecHistBisectMulti(
|
||||
int *data, /* output: data vector */
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
|
||||
const WebRtc_UWord16 *cdf_size, /* input: array of cdf table sizes+1 (power of two: 2^k) */
|
||||
const uint16_t **cdf, /* input: array of cdf arrays */
|
||||
const uint16_t *cdf_size, /* input: array of cdf table sizes+1 (power of two: 2^k) */
|
||||
const int N); /* input: data vector length */
|
||||
|
||||
int WebRtcIsac_DecHistOneStepMulti(
|
||||
int *data, /* output: data vector */
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
|
||||
const WebRtc_UWord16 *init_index,/* input: vector of initial cdf table search entries */
|
||||
const uint16_t **cdf, /* input: array of cdf arrays */
|
||||
const uint16_t *init_index,/* input: vector of initial cdf table search entries */
|
||||
const int N); /* input: data vector length */
|
||||
|
||||
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_ */
|
||||
|
||||
@ -17,14 +17,14 @@
|
||||
*/
|
||||
void WebRtcIsac_EncHistMulti(Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
const int *data, /* input: data vector */
|
||||
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
|
||||
const uint16_t **cdf, /* input: array of cdf arrays */
|
||||
const int N) /* input: data vector length */
|
||||
{
|
||||
WebRtc_UWord32 W_lower, W_upper;
|
||||
WebRtc_UWord32 W_upper_LSB, W_upper_MSB;
|
||||
WebRtc_UWord8 *stream_ptr;
|
||||
WebRtc_UWord8 *stream_ptr_carry;
|
||||
WebRtc_UWord32 cdf_lo, cdf_hi;
|
||||
uint32_t W_lower, W_upper;
|
||||
uint32_t W_upper_LSB, W_upper_MSB;
|
||||
uint8_t *stream_ptr;
|
||||
uint8_t *stream_ptr_carry;
|
||||
uint32_t cdf_lo, cdf_hi;
|
||||
int k;
|
||||
|
||||
|
||||
@ -35,8 +35,8 @@ void WebRtcIsac_EncHistMulti(Bitstr *streamdata, /* in-/output struct containing
|
||||
for (k=N; k>0; k--)
|
||||
{
|
||||
/* fetch cdf_lower and cdf_upper from cdf tables */
|
||||
cdf_lo = (WebRtc_UWord32) *(*cdf + *data);
|
||||
cdf_hi = (WebRtc_UWord32) *(*cdf++ + *data++ + 1);
|
||||
cdf_lo = (uint32_t) *(*cdf + *data);
|
||||
cdf_hi = (uint32_t) *(*cdf++ + *data++ + 1);
|
||||
|
||||
/* update interval */
|
||||
W_upper_LSB = W_upper & 0x0000FFFF;
|
||||
@ -64,7 +64,7 @@ void WebRtcIsac_EncHistMulti(Bitstr *streamdata, /* in-/output struct containing
|
||||
while ( !(W_upper & 0xFF000000) ) /* W_upper < 2^24 */
|
||||
{
|
||||
W_upper <<= 8;
|
||||
*stream_ptr++ = (WebRtc_UWord8) (streamdata->streamval >> 24);
|
||||
*stream_ptr++ = (uint8_t) (streamdata->streamval >> 24);
|
||||
streamdata->streamval <<= 8;
|
||||
}
|
||||
}
|
||||
@ -84,16 +84,16 @@ void WebRtcIsac_EncHistMulti(Bitstr *streamdata, /* in-/output struct containing
|
||||
*/
|
||||
int WebRtcIsac_DecHistBisectMulti(int *data, /* output: data vector */
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
|
||||
const WebRtc_UWord16 *cdf_size, /* input: array of cdf table sizes+1 (power of two: 2^k) */
|
||||
const uint16_t **cdf, /* input: array of cdf arrays */
|
||||
const uint16_t *cdf_size, /* input: array of cdf table sizes+1 (power of two: 2^k) */
|
||||
const int N) /* input: data vector length */
|
||||
{
|
||||
WebRtc_UWord32 W_lower, W_upper;
|
||||
WebRtc_UWord32 W_tmp;
|
||||
WebRtc_UWord32 W_upper_LSB, W_upper_MSB;
|
||||
WebRtc_UWord32 streamval;
|
||||
const WebRtc_UWord8 *stream_ptr;
|
||||
const WebRtc_UWord16 *cdf_ptr;
|
||||
uint32_t W_lower, W_upper;
|
||||
uint32_t W_tmp;
|
||||
uint32_t W_upper_LSB, W_upper_MSB;
|
||||
uint32_t streamval;
|
||||
const uint8_t *stream_ptr;
|
||||
const uint16_t *cdf_ptr;
|
||||
int size_tmp;
|
||||
int k;
|
||||
|
||||
@ -192,16 +192,16 @@ int WebRtcIsac_DecHistBisectMulti(int *data, /* output: data vector */
|
||||
*/
|
||||
int WebRtcIsac_DecHistOneStepMulti(int *data, /* output: data vector */
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
|
||||
const WebRtc_UWord16 *init_index, /* input: vector of initial cdf table search entries */
|
||||
const uint16_t **cdf, /* input: array of cdf arrays */
|
||||
const uint16_t *init_index, /* input: vector of initial cdf table search entries */
|
||||
const int N) /* input: data vector length */
|
||||
{
|
||||
WebRtc_UWord32 W_lower, W_upper;
|
||||
WebRtc_UWord32 W_tmp;
|
||||
WebRtc_UWord32 W_upper_LSB, W_upper_MSB;
|
||||
WebRtc_UWord32 streamval;
|
||||
const WebRtc_UWord8 *stream_ptr;
|
||||
const WebRtc_UWord16 *cdf_ptr;
|
||||
uint32_t W_lower, W_upper;
|
||||
uint32_t W_tmp;
|
||||
uint32_t W_upper_LSB, W_upper_MSB;
|
||||
uint32_t streamval;
|
||||
const uint8_t *stream_ptr;
|
||||
const uint16_t *cdf_ptr;
|
||||
int k;
|
||||
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
|
||||
static const WebRtc_Word32 kHistEdgesQ15[51] = {
|
||||
static const int32_t kHistEdgesQ15[51] = {
|
||||
-327680, -314573, -301466, -288359, -275252, -262144, -249037, -235930, -222823, -209716,
|
||||
-196608, -183501, -170394, -157287, -144180, -131072, -117965, -104858, -91751, -78644,
|
||||
-65536, -52429, -39322, -26215, -13108, 0, 13107, 26214, 39321, 52428,
|
||||
@ -49,10 +49,10 @@ static const int kCdfQ16[51] = { /* Q16 */
|
||||
|
||||
|
||||
/* function to be converted to fixed point */
|
||||
static __inline WebRtc_UWord32 piecewise(WebRtc_Word32 xinQ15) {
|
||||
static __inline uint32_t piecewise(int32_t xinQ15) {
|
||||
|
||||
WebRtc_Word32 ind, qtmp1, qtmp2, qtmp3;
|
||||
WebRtc_UWord32 tmpUW32;
|
||||
int32_t ind, qtmp1, qtmp2, qtmp3;
|
||||
uint32_t tmpUW32;
|
||||
|
||||
|
||||
qtmp2 = xinQ15;
|
||||
@ -79,17 +79,17 @@ static __inline WebRtc_UWord32 piecewise(WebRtc_Word32 xinQ15) {
|
||||
|
||||
int WebRtcIsac_EncLogisticMulti2(
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
WebRtc_Word16 *dataQ7, /* input: data vector */
|
||||
const WebRtc_UWord16 *envQ8, /* input: side info vector defining the width of the pdf */
|
||||
int16_t *dataQ7, /* input: data vector */
|
||||
const uint16_t *envQ8, /* input: side info vector defining the width of the pdf */
|
||||
const int N, /* input: data vector length / 2 */
|
||||
const WebRtc_Word16 isSWB12kHz)
|
||||
const int16_t isSWB12kHz)
|
||||
{
|
||||
WebRtc_UWord32 W_lower, W_upper;
|
||||
WebRtc_UWord32 W_upper_LSB, W_upper_MSB;
|
||||
WebRtc_UWord8 *stream_ptr;
|
||||
WebRtc_UWord8 *maxStreamPtr;
|
||||
WebRtc_UWord8 *stream_ptr_carry;
|
||||
WebRtc_UWord32 cdf_lo, cdf_hi;
|
||||
uint32_t W_lower, W_upper;
|
||||
uint32_t W_upper_LSB, W_upper_MSB;
|
||||
uint8_t *stream_ptr;
|
||||
uint8_t *maxStreamPtr;
|
||||
uint8_t *stream_ptr_carry;
|
||||
uint32_t cdf_lo, cdf_hi;
|
||||
int k;
|
||||
|
||||
/* point to beginning of stream buffer */
|
||||
@ -149,7 +149,7 @@ int WebRtcIsac_EncLogisticMulti2(
|
||||
while ( !(W_upper & 0xFF000000) ) /* W_upper < 2^24 */
|
||||
{
|
||||
W_upper <<= 8;
|
||||
*stream_ptr++ = (WebRtc_UWord8) (streamdata->streamval >> 24);
|
||||
*stream_ptr++ = (uint8_t) (streamdata->streamval >> 24);
|
||||
|
||||
if(stream_ptr > maxStreamPtr)
|
||||
{
|
||||
@ -169,20 +169,20 @@ int WebRtcIsac_EncLogisticMulti2(
|
||||
|
||||
|
||||
int WebRtcIsac_DecLogisticMulti2(
|
||||
WebRtc_Word16 *dataQ7, /* output: data vector */
|
||||
int16_t *dataQ7, /* output: data vector */
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
const WebRtc_UWord16 *envQ8, /* input: side info vector defining the width of the pdf */
|
||||
const WebRtc_Word16 *ditherQ7,/* input: dither vector */
|
||||
const uint16_t *envQ8, /* input: side info vector defining the width of the pdf */
|
||||
const int16_t *ditherQ7,/* input: dither vector */
|
||||
const int N, /* input: data vector length */
|
||||
const WebRtc_Word16 isSWB12kHz)
|
||||
const int16_t isSWB12kHz)
|
||||
{
|
||||
WebRtc_UWord32 W_lower, W_upper;
|
||||
WebRtc_UWord32 W_tmp;
|
||||
WebRtc_UWord32 W_upper_LSB, W_upper_MSB;
|
||||
WebRtc_UWord32 streamval;
|
||||
const WebRtc_UWord8 *stream_ptr;
|
||||
WebRtc_UWord32 cdf_tmp;
|
||||
WebRtc_Word16 candQ7;
|
||||
uint32_t W_lower, W_upper;
|
||||
uint32_t W_tmp;
|
||||
uint32_t W_upper_LSB, W_upper_MSB;
|
||||
uint32_t streamval;
|
||||
const uint8_t *stream_ptr;
|
||||
uint32_t cdf_tmp;
|
||||
int16_t candQ7;
|
||||
int k;
|
||||
|
||||
stream_ptr = streamdata->stream + streamdata->stream_index;
|
||||
|
||||
@ -41,7 +41,7 @@ static const float kQRateTableSwb[24] =
|
||||
|
||||
|
||||
|
||||
WebRtc_Word32 WebRtcIsac_InitBandwidthEstimator(
|
||||
int32_t WebRtcIsac_InitBandwidthEstimator(
|
||||
BwEstimatorstr* bwest_str,
|
||||
enum IsacSamplingRate encoderSampRate,
|
||||
enum IsacSamplingRate decoderSampRate)
|
||||
@ -67,7 +67,7 @@ WebRtc_Word32 WebRtcIsac_InitBandwidthEstimator(
|
||||
bwest_str->prev_frame_length = INIT_FRAME_LEN_WB;
|
||||
bwest_str->rec_bw_inv = 1.0f /
|
||||
(INIT_BN_EST_WB + INIT_HDR_RATE_WB);
|
||||
bwest_str->rec_bw = (WebRtc_Word32)INIT_BN_EST_WB;
|
||||
bwest_str->rec_bw = (int32_t)INIT_BN_EST_WB;
|
||||
bwest_str->rec_bw_avg_Q = INIT_BN_EST_WB;
|
||||
bwest_str->rec_bw_avg = INIT_BN_EST_WB + INIT_HDR_RATE_WB;
|
||||
bwest_str->rec_header_rate = INIT_HDR_RATE_WB;
|
||||
@ -78,7 +78,7 @@ WebRtc_Word32 WebRtcIsac_InitBandwidthEstimator(
|
||||
bwest_str->prev_frame_length = INIT_FRAME_LEN_SWB;
|
||||
bwest_str->rec_bw_inv = 1.0f /
|
||||
(INIT_BN_EST_SWB + INIT_HDR_RATE_SWB);
|
||||
bwest_str->rec_bw = (WebRtc_Word32)INIT_BN_EST_SWB;
|
||||
bwest_str->rec_bw = (int32_t)INIT_BN_EST_SWB;
|
||||
bwest_str->rec_bw_avg_Q = INIT_BN_EST_SWB;
|
||||
bwest_str->rec_bw_avg = INIT_BN_EST_SWB + INIT_HDR_RATE_SWB;
|
||||
bwest_str->rec_header_rate = INIT_HDR_RATE_SWB;
|
||||
@ -131,14 +131,14 @@ WebRtc_Word32 WebRtcIsac_InitBandwidthEstimator(
|
||||
/* pksize - size of packet in bytes, from NetEq */
|
||||
/* Index - integer (range 0...23) indicating bottle neck & jitter as estimated by other side */
|
||||
/* returns 0 if everything went fine, -1 otherwise */
|
||||
WebRtc_Word16 WebRtcIsac_UpdateBandwidthEstimator(
|
||||
int16_t WebRtcIsac_UpdateBandwidthEstimator(
|
||||
BwEstimatorstr *bwest_str,
|
||||
const WebRtc_UWord16 rtp_number,
|
||||
const WebRtc_Word32 frame_length,
|
||||
const WebRtc_UWord32 send_ts,
|
||||
const WebRtc_UWord32 arr_ts,
|
||||
const WebRtc_Word32 pksize
|
||||
/*, const WebRtc_UWord16 Index*/)
|
||||
const uint16_t rtp_number,
|
||||
const int32_t frame_length,
|
||||
const uint32_t send_ts,
|
||||
const uint32_t arr_ts,
|
||||
const int32_t pksize
|
||||
/*, const uint16_t Index*/)
|
||||
{
|
||||
float weight = 0.0f;
|
||||
float curr_bw_inv = 0.0f;
|
||||
@ -207,7 +207,7 @@ WebRtc_Word16 WebRtcIsac_UpdateBandwidthEstimator(
|
||||
// that strict -DH
|
||||
{
|
||||
/* if not been updated for a long time, reduce the BN estimate */
|
||||
if((WebRtc_UWord32)(arr_ts - bwest_str->last_update_ts) *
|
||||
if((uint32_t)(arr_ts - bwest_str->last_update_ts) *
|
||||
1000.0f / FS > 3000)
|
||||
{
|
||||
//how many frames should have been received since the last
|
||||
@ -222,7 +222,7 @@ WebRtc_Word16 WebRtcIsac_UpdateBandwidthEstimator(
|
||||
0.9)
|
||||
{
|
||||
float inv_bitrate = (float) pow( 0.99995,
|
||||
(double)((WebRtc_UWord32)(arr_ts -
|
||||
(double)((uint32_t)(arr_ts -
|
||||
bwest_str->last_reduction_ts)*1000.0f/FS) );
|
||||
|
||||
if ( inv_bitrate )
|
||||
@ -303,7 +303,7 @@ WebRtc_Word16 WebRtcIsac_UpdateBandwidthEstimator(
|
||||
float averageLatencyMs = latencyMs / bwest_str->numConsecLatePkts;
|
||||
delay_correction_factor = frame_length / (frame_length + averageLatencyMs);
|
||||
immediate_set = 1;
|
||||
bwest_str->inWaitLatePkts = (WebRtc_Word16)((bwest_str->consecLatency/(FS/1000)) / 30);// + 150;
|
||||
bwest_str->inWaitLatePkts = (int16_t)((bwest_str->consecLatency/(FS/1000)) / 30);// + 150;
|
||||
bwest_str->start_wait_period = arr_ts;
|
||||
}
|
||||
///////////////////////////////////////////////
|
||||
@ -466,17 +466,17 @@ WebRtc_Word16 WebRtcIsac_UpdateBandwidthEstimator(
|
||||
bwest_str->prev_rec_send_ts = send_ts;
|
||||
|
||||
/* Replace bwest_str->rec_bw by the new value (atomic operation) */
|
||||
bwest_str->rec_bw = (WebRtc_Word32)(1.0f / bwest_str->rec_bw_inv -
|
||||
bwest_str->rec_bw = (int32_t)(1.0f / bwest_str->rec_bw_inv -
|
||||
bwest_str->rec_header_rate);
|
||||
|
||||
if (immediate_set)
|
||||
{
|
||||
bwest_str->rec_bw = (WebRtc_Word32) (delay_correction_factor *
|
||||
bwest_str->rec_bw = (int32_t) (delay_correction_factor *
|
||||
(float) bwest_str->rec_bw);
|
||||
|
||||
if (bwest_str->rec_bw < (WebRtc_Word32) MIN_ISAC_BW)
|
||||
if (bwest_str->rec_bw < (int32_t) MIN_ISAC_BW)
|
||||
{
|
||||
bwest_str->rec_bw = (WebRtc_Word32) MIN_ISAC_BW;
|
||||
bwest_str->rec_bw = (int32_t) MIN_ISAC_BW;
|
||||
}
|
||||
|
||||
bwest_str->rec_bw_avg = bwest_str->rec_bw +
|
||||
@ -503,9 +503,9 @@ WebRtc_Word16 WebRtcIsac_UpdateBandwidthEstimator(
|
||||
/* This function updates the send bottle neck rate */
|
||||
/* Index - integer (range 0...23) indicating bottle neck & jitter as estimated by other side */
|
||||
/* returns 0 if everything went fine, -1 otherwise */
|
||||
WebRtc_Word16 WebRtcIsac_UpdateUplinkBwImpl(
|
||||
int16_t WebRtcIsac_UpdateUplinkBwImpl(
|
||||
BwEstimatorstr* bwest_str,
|
||||
WebRtc_Word16 index,
|
||||
int16_t index,
|
||||
enum IsacSamplingRate encoderSamplingFreq)
|
||||
{
|
||||
if((index < 0) || (index > 23))
|
||||
@ -560,9 +560,9 @@ WebRtc_Word16 WebRtcIsac_UpdateUplinkBwImpl(
|
||||
|
||||
// called when there is upper-band bit-stream to update jitter
|
||||
// statistics.
|
||||
WebRtc_Word16 WebRtcIsac_UpdateUplinkJitter(
|
||||
int16_t WebRtcIsac_UpdateUplinkJitter(
|
||||
BwEstimatorstr* bwest_str,
|
||||
WebRtc_Word32 index)
|
||||
int32_t index)
|
||||
{
|
||||
if((index < 0) || (index > 23))
|
||||
{
|
||||
@ -589,25 +589,25 @@ WebRtc_Word16 WebRtcIsac_UpdateUplinkJitter(
|
||||
|
||||
// Returns the bandwidth/jitter estimation code (integer 0...23)
|
||||
// to put in the sending iSAC payload
|
||||
WebRtc_UWord16
|
||||
uint16_t
|
||||
WebRtcIsac_GetDownlinkBwJitIndexImpl(
|
||||
BwEstimatorstr* bwest_str,
|
||||
WebRtc_Word16* bottleneckIndex,
|
||||
WebRtc_Word16* jitterInfo,
|
||||
int16_t* bottleneckIndex,
|
||||
int16_t* jitterInfo,
|
||||
enum IsacSamplingRate decoderSamplingFreq)
|
||||
{
|
||||
float MaxDelay;
|
||||
//WebRtc_UWord16 MaxDelayBit;
|
||||
//uint16_t MaxDelayBit;
|
||||
|
||||
float rate;
|
||||
float r;
|
||||
float e1, e2;
|
||||
const float weight = 0.1f;
|
||||
const float* ptrQuantizationTable;
|
||||
WebRtc_Word16 addJitterInfo;
|
||||
WebRtc_Word16 minInd;
|
||||
WebRtc_Word16 maxInd;
|
||||
WebRtc_Word16 midInd;
|
||||
int16_t addJitterInfo;
|
||||
int16_t minInd;
|
||||
int16_t maxInd;
|
||||
int16_t midInd;
|
||||
|
||||
/* Get Max Delay Bit */
|
||||
/* get unquantized max delay */
|
||||
@ -691,9 +691,9 @@ WebRtcIsac_GetDownlinkBwJitIndexImpl(
|
||||
|
||||
|
||||
/* get the bottle neck rate from far side to here, as estimated on this side */
|
||||
WebRtc_Word32 WebRtcIsac_GetDownlinkBandwidth( const BwEstimatorstr *bwest_str)
|
||||
int32_t WebRtcIsac_GetDownlinkBandwidth( const BwEstimatorstr *bwest_str)
|
||||
{
|
||||
WebRtc_Word32 rec_bw;
|
||||
int32_t rec_bw;
|
||||
float jitter_sign;
|
||||
float bw_adjust;
|
||||
|
||||
@ -705,7 +705,7 @@ WebRtc_Word32 WebRtcIsac_GetDownlinkBandwidth( const BwEstimatorstr *bwest_str)
|
||||
bw_adjust = 1.0f - jitter_sign * (0.15f + 0.15f * jitter_sign * jitter_sign);
|
||||
|
||||
/* adjust Rate if jitter sign is mostly constant */
|
||||
rec_bw = (WebRtc_Word32)(bwest_str->rec_bw * bw_adjust);
|
||||
rec_bw = (int32_t)(bwest_str->rec_bw * bw_adjust);
|
||||
|
||||
/* limit range of bottle neck rate */
|
||||
if (rec_bw < MIN_ISAC_BW)
|
||||
@ -720,12 +720,12 @@ WebRtc_Word32 WebRtcIsac_GetDownlinkBandwidth( const BwEstimatorstr *bwest_str)
|
||||
}
|
||||
|
||||
/* Returns the max delay (in ms) */
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
WebRtcIsac_GetDownlinkMaxDelay(const BwEstimatorstr *bwest_str)
|
||||
{
|
||||
WebRtc_Word32 rec_max_delay;
|
||||
int32_t rec_max_delay;
|
||||
|
||||
rec_max_delay = (WebRtc_Word32)(bwest_str->rec_max_delay);
|
||||
rec_max_delay = (int32_t)(bwest_str->rec_max_delay);
|
||||
|
||||
/* limit range of jitter estimate */
|
||||
if (rec_max_delay < MIN_ISAC_MD)
|
||||
@ -743,7 +743,7 @@ WebRtcIsac_GetDownlinkMaxDelay(const BwEstimatorstr *bwest_str)
|
||||
void
|
||||
WebRtcIsac_GetUplinkBandwidth(
|
||||
const BwEstimatorstr* bwest_str,
|
||||
WebRtc_Word32* bitRate)
|
||||
int32_t* bitRate)
|
||||
{
|
||||
/* limit range of bottle neck rate */
|
||||
if (bwest_str->send_bw_avg < MIN_ISAC_BW)
|
||||
@ -756,18 +756,18 @@ WebRtcIsac_GetUplinkBandwidth(
|
||||
}
|
||||
else
|
||||
{
|
||||
*bitRate = (WebRtc_Word32)(bwest_str->send_bw_avg);
|
||||
*bitRate = (int32_t)(bwest_str->send_bw_avg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Returns the max delay value from the other side in ms */
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
WebRtcIsac_GetUplinkMaxDelay(const BwEstimatorstr *bwest_str)
|
||||
{
|
||||
WebRtc_Word32 send_max_delay;
|
||||
int32_t send_max_delay;
|
||||
|
||||
send_max_delay = (WebRtc_Word32)(bwest_str->send_max_delay_avg);
|
||||
send_max_delay = (int32_t)(bwest_str->send_max_delay_avg);
|
||||
|
||||
/* limit range of jitter estimate */
|
||||
if (send_max_delay < MIN_ISAC_MD)
|
||||
@ -793,7 +793,7 @@ int WebRtcIsac_GetMinBytes(
|
||||
const double BottleNeck, /* bottle neck rate; excl headers (bps) */
|
||||
const double DelayBuildUp, /* max delay from bottleneck buffering (ms) */
|
||||
enum ISACBandwidth bandwidth
|
||||
/*,WebRtc_Word16 frequentLargePackets*/)
|
||||
/*,int16_t frequentLargePackets*/)
|
||||
{
|
||||
double MinRate = 0.0;
|
||||
int MinBytes;
|
||||
|
||||
@ -75,7 +75,7 @@ extern "C" {
|
||||
/* This function initializes the struct */
|
||||
/* to be called before using the struct for anything else */
|
||||
/* returns 0 if everything went fine, -1 otherwise */
|
||||
WebRtc_Word32 WebRtcIsac_InitBandwidthEstimator(
|
||||
int32_t WebRtcIsac_InitBandwidthEstimator(
|
||||
BwEstimatorstr* bwest_str,
|
||||
enum IsacSamplingRate encoderSampRate,
|
||||
enum IsacSamplingRate decoderSampRate);
|
||||
@ -89,42 +89,42 @@ extern "C" {
|
||||
/* pksize - size of packet in bytes, from NetEq */
|
||||
/* Index - integer (range 0...23) indicating bottle neck & jitter as estimated by other side */
|
||||
/* returns 0 if everything went fine, -1 otherwise */
|
||||
WebRtc_Word16 WebRtcIsac_UpdateBandwidthEstimator(
|
||||
int16_t WebRtcIsac_UpdateBandwidthEstimator(
|
||||
BwEstimatorstr* bwest_str,
|
||||
const WebRtc_UWord16 rtp_number,
|
||||
const WebRtc_Word32 frame_length,
|
||||
const WebRtc_UWord32 send_ts,
|
||||
const WebRtc_UWord32 arr_ts,
|
||||
const WebRtc_Word32 pksize);
|
||||
const uint16_t rtp_number,
|
||||
const int32_t frame_length,
|
||||
const uint32_t send_ts,
|
||||
const uint32_t arr_ts,
|
||||
const int32_t pksize);
|
||||
|
||||
/* Update receiving estimates. Used when we only receive BWE index, no iSAC data packet. */
|
||||
WebRtc_Word16 WebRtcIsac_UpdateUplinkBwImpl(
|
||||
int16_t WebRtcIsac_UpdateUplinkBwImpl(
|
||||
BwEstimatorstr* bwest_str,
|
||||
WebRtc_Word16 Index,
|
||||
int16_t Index,
|
||||
enum IsacSamplingRate encoderSamplingFreq);
|
||||
|
||||
/* Returns the bandwidth/jitter estimation code (integer 0...23) to put in the sending iSAC payload */
|
||||
WebRtc_UWord16 WebRtcIsac_GetDownlinkBwJitIndexImpl(
|
||||
uint16_t WebRtcIsac_GetDownlinkBwJitIndexImpl(
|
||||
BwEstimatorstr* bwest_str,
|
||||
WebRtc_Word16* bottleneckIndex,
|
||||
WebRtc_Word16* jitterInfo,
|
||||
int16_t* bottleneckIndex,
|
||||
int16_t* jitterInfo,
|
||||
enum IsacSamplingRate decoderSamplingFreq);
|
||||
|
||||
/* Returns the bandwidth estimation (in bps) */
|
||||
WebRtc_Word32 WebRtcIsac_GetDownlinkBandwidth(
|
||||
int32_t WebRtcIsac_GetDownlinkBandwidth(
|
||||
const BwEstimatorstr *bwest_str);
|
||||
|
||||
/* Returns the max delay (in ms) */
|
||||
WebRtc_Word32 WebRtcIsac_GetDownlinkMaxDelay(
|
||||
int32_t WebRtcIsac_GetDownlinkMaxDelay(
|
||||
const BwEstimatorstr *bwest_str);
|
||||
|
||||
/* Returns the bandwidth that iSAC should send with in bps */
|
||||
void WebRtcIsac_GetUplinkBandwidth(
|
||||
const BwEstimatorstr* bwest_str,
|
||||
WebRtc_Word32* bitRate);
|
||||
int32_t* bitRate);
|
||||
|
||||
/* Returns the max delay value from the other side in ms */
|
||||
WebRtc_Word32 WebRtcIsac_GetUplinkMaxDelay(
|
||||
int32_t WebRtcIsac_GetUplinkMaxDelay(
|
||||
const BwEstimatorstr *bwest_str);
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ extern "C" {
|
||||
const double BottleNeck, /* bottle neck rate; excl headers (bps) */
|
||||
const double DelayBuildUp, /* max delay from bottleneck buffering (ms) */
|
||||
enum ISACBandwidth bandwidth
|
||||
/*,WebRtc_Word16 frequentLargePackets*/);
|
||||
/*,int16_t frequentLargePackets*/);
|
||||
|
||||
/*
|
||||
* update long-term average bitrate and amount of data in buffer
|
||||
@ -165,9 +165,9 @@ extern "C" {
|
||||
int new_framelength);
|
||||
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_UpdateUplinkJitter(
|
||||
int16_t WebRtcIsac_UpdateUplinkJitter(
|
||||
BwEstimatorstr* bwest_str,
|
||||
WebRtc_Word32 index);
|
||||
int32_t index);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@ -25,21 +25,21 @@
|
||||
void WebRtcIsac_ResetBitstream(Bitstr* bit_stream);
|
||||
|
||||
int WebRtcIsac_EstimateBandwidth(BwEstimatorstr* bwest_str, Bitstr* streamdata,
|
||||
WebRtc_Word32 packet_size,
|
||||
WebRtc_UWord16 rtp_seq_number,
|
||||
WebRtc_UWord32 send_ts, WebRtc_UWord32 arr_ts,
|
||||
int32_t packet_size,
|
||||
uint16_t rtp_seq_number,
|
||||
uint32_t send_ts, uint32_t arr_ts,
|
||||
enum IsacSamplingRate encoderSampRate,
|
||||
enum IsacSamplingRate decoderSampRate);
|
||||
|
||||
int WebRtcIsac_DecodeLb(float* signal_out, ISACLBDecStruct* ISACdec_obj,
|
||||
WebRtc_Word16* current_framesamples,
|
||||
WebRtc_Word16 isRCUPayload);
|
||||
int16_t* current_framesamples,
|
||||
int16_t isRCUPayload);
|
||||
|
||||
int WebRtcIsac_DecodeRcuLb(float* signal_out, ISACLBDecStruct* ISACdec_obj,
|
||||
WebRtc_Word16* current_framesamples);
|
||||
int16_t* current_framesamples);
|
||||
|
||||
int WebRtcIsac_EncodeLb(float* in, ISACLBEncStruct* ISACencLB_obj,
|
||||
WebRtc_Word16 codingMode, WebRtc_Word16
|
||||
int16_t codingMode, int16_t
|
||||
bottleneckIndex);
|
||||
|
||||
int WebRtcIsac_EncodeStoredDataLb(const ISAC_SaveEncData_t* ISACSavedEnc_obj,
|
||||
@ -48,9 +48,9 @@ int WebRtcIsac_EncodeStoredDataLb(const ISAC_SaveEncData_t* ISACSavedEnc_obj,
|
||||
|
||||
int WebRtcIsac_EncodeStoredDataUb(
|
||||
const ISACUBSaveEncDataStruct* ISACSavedEnc_obj, Bitstr* bitStream,
|
||||
WebRtc_Word32 jitterInfo, float scale, enum ISACBandwidth bandwidth);
|
||||
int32_t jitterInfo, float scale, enum ISACBandwidth bandwidth);
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_GetRedPayloadUb(
|
||||
int16_t WebRtcIsac_GetRedPayloadUb(
|
||||
const ISACUBSaveEncDataStruct* ISACSavedEncObj, Bitstr* bitStreamObj,
|
||||
enum ISACBandwidth bandwidth);
|
||||
|
||||
@ -72,10 +72,10 @@ WebRtc_Word16 WebRtcIsac_GetRedPayloadUb(
|
||||
* -1 if failed to allocate rates.
|
||||
*/
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_RateAllocation(WebRtc_Word32 inRateBitPerSec,
|
||||
double* rateLBBitPerSec,
|
||||
double* rateUBBitPerSec,
|
||||
enum ISACBandwidth* bandwidthKHz);
|
||||
int16_t WebRtcIsac_RateAllocation(int32_t inRateBitPerSec,
|
||||
double* rateLBBitPerSec,
|
||||
double* rateUBBitPerSec,
|
||||
enum ISACBandwidth* bandwidthKHz);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -94,7 +94,7 @@ WebRtc_Word16 WebRtcIsac_RateAllocation(WebRtc_Word32 inRateBitPerSec,
|
||||
* <0 if an error occurred.
|
||||
*/
|
||||
int WebRtcIsac_DecodeUb16(float* signal_out, ISACUBDecStruct* ISACdec_obj,
|
||||
WebRtc_Word16 isRCUPayload);
|
||||
int16_t isRCUPayload);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -113,7 +113,7 @@ int WebRtcIsac_DecodeUb16(float* signal_out, ISACUBDecStruct* ISACdec_obj,
|
||||
* <0 if an error occurred.
|
||||
*/
|
||||
int WebRtcIsac_DecodeUb12(float* signal_out, ISACUBDecStruct* ISACdec_obj,
|
||||
WebRtc_Word16 isRCUPayload);
|
||||
int16_t isRCUPayload);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -132,7 +132,7 @@ int WebRtcIsac_DecodeUb12(float* signal_out, ISACUBDecStruct* ISACdec_obj,
|
||||
* <0 if an error occurred.
|
||||
*/
|
||||
int WebRtcIsac_EncodeUb16(float* in, ISACUBEncStruct* ISACenc_obj,
|
||||
WebRtc_Word32 jitterInfo);
|
||||
int32_t jitterInfo);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -151,7 +151,7 @@ int WebRtcIsac_EncodeUb16(float* in, ISACUBEncStruct* ISACenc_obj,
|
||||
* <0 if an error occurred.
|
||||
*/
|
||||
int WebRtcIsac_EncodeUb12(float* in, ISACUBEncStruct* ISACenc_obj,
|
||||
WebRtc_Word32 jitterInfo);
|
||||
int32_t jitterInfo);
|
||||
|
||||
/************************** initialization functions *************************/
|
||||
|
||||
@ -170,8 +170,8 @@ void WebRtcIsac_InitPitchAnalysis(PitchAnalysisStruct* State);
|
||||
|
||||
void WebRtcIsac_InitTransform();
|
||||
|
||||
void WebRtcIsac_Time2Spec(double* inre1, double* inre2, WebRtc_Word16* outre,
|
||||
WebRtc_Word16* outim, FFTstr* fftstr_obj);
|
||||
void WebRtcIsac_Time2Spec(double* inre1, double* inre2, int16_t* outre,
|
||||
int16_t* outim, FFTstr* fftstr_obj);
|
||||
|
||||
void WebRtcIsac_Spec2time(double* inre, double* inim, double* outre1,
|
||||
double* outre2, FFTstr* fftstr_obj);
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#define POLYNOMIAL 0x04c11db7L
|
||||
|
||||
|
||||
static const WebRtc_UWord32 kCrcTable[256] = {
|
||||
static const uint32_t kCrcTable[256] = {
|
||||
0, 0x4c11db7, 0x9823b6e, 0xd4326d9, 0x130476dc, 0x17c56b6b,
|
||||
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
|
||||
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
|
||||
@ -80,12 +80,12 @@ static const WebRtc_UWord32 kCrcTable[256] = {
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_GetCrc(const WebRtc_Word16* bitstream,
|
||||
WebRtc_Word16 len_bitstream_in_bytes,
|
||||
WebRtc_UWord32* crc)
|
||||
int16_t WebRtcIsac_GetCrc(const int16_t* bitstream,
|
||||
int16_t len_bitstream_in_bytes,
|
||||
uint32_t* crc)
|
||||
{
|
||||
WebRtc_UWord8* bitstream_ptr_uw8;
|
||||
WebRtc_UWord32 crc_state;
|
||||
uint8_t* bitstream_ptr_uw8;
|
||||
uint32_t crc_state;
|
||||
int byte_cntr;
|
||||
int crc_tbl_indx;
|
||||
|
||||
@ -94,7 +94,7 @@ WebRtc_Word16 WebRtcIsac_GetCrc(const WebRtc_Word16* bitstream,
|
||||
return -1;
|
||||
}
|
||||
/* cast to UWord8 pointer */
|
||||
bitstream_ptr_uw8 = (WebRtc_UWord8 *)bitstream;
|
||||
bitstream_ptr_uw8 = (uint8_t *)bitstream;
|
||||
|
||||
/* initialize */
|
||||
crc_state = 0xFFFFFFFF;
|
||||
|
||||
@ -36,10 +36,10 @@
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_GetCrc(
|
||||
const WebRtc_Word16* encoded,
|
||||
WebRtc_Word16 no_of_word8s,
|
||||
WebRtc_UWord32* crc);
|
||||
int16_t WebRtcIsac_GetCrc(
|
||||
const int16_t* encoded,
|
||||
int16_t no_of_word8s,
|
||||
uint32_t* crc);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -36,11 +36,11 @@
|
||||
* returns the total number of bytes in the stream
|
||||
*/
|
||||
int WebRtcIsac_DecodeLb(float* signal_out, ISACLBDecStruct* ISACdecLB_obj,
|
||||
WebRtc_Word16* current_framesamples,
|
||||
WebRtc_Word16 isRCUPayload) {
|
||||
int16_t* current_framesamples,
|
||||
int16_t isRCUPayload) {
|
||||
int k;
|
||||
int len, err;
|
||||
WebRtc_Word16 bandwidthInd;
|
||||
int16_t bandwidthInd;
|
||||
|
||||
float LP_dec_float[FRAMESAMPLES_HALF];
|
||||
float HP_dec_float[FRAMESAMPLES_HALF];
|
||||
@ -58,8 +58,8 @@ int WebRtcIsac_DecodeLb(float* signal_out, ISACLBDecStruct* ISACdecLB_obj,
|
||||
double PitchLags[4];
|
||||
double PitchGains[4];
|
||||
double AvgPitchGain;
|
||||
WebRtc_Word16 PitchGains_Q12[4];
|
||||
WebRtc_Word16 AvgPitchGain_Q12;
|
||||
int16_t PitchGains_Q12[4];
|
||||
int16_t AvgPitchGain_Q12;
|
||||
|
||||
float gain;
|
||||
|
||||
@ -182,7 +182,7 @@ int WebRtcIsac_DecodeLb(float* signal_out, ISACLBDecStruct* ISACdecLB_obj,
|
||||
* frequency, but split to 12 sub-frames, i.e. twice as lower-band.
|
||||
*/
|
||||
int WebRtcIsac_DecodeUb16(float* signal_out, ISACUBDecStruct* ISACdecUB_obj,
|
||||
WebRtc_Word16 isRCUPayload) {
|
||||
int16_t isRCUPayload) {
|
||||
int len, err;
|
||||
|
||||
double halfFrameFirst[FRAMESAMPLES_HALF];
|
||||
@ -193,7 +193,7 @@ int WebRtcIsac_DecodeUb16(float* signal_out, ISACUBDecStruct* ISACdecUB_obj,
|
||||
|
||||
double real_f[FRAMESAMPLES_HALF];
|
||||
double imag_f[FRAMESAMPLES_HALF];
|
||||
const WebRtc_Word16 kAveragePitchGain = 0; /* No pitch-gain for upper-band. */
|
||||
const int16_t kAveragePitchGain = 0; /* No pitch-gain for upper-band. */
|
||||
len = 0;
|
||||
|
||||
/* Decode & de-quantize filter coefficients. */
|
||||
@ -246,7 +246,7 @@ int WebRtcIsac_DecodeUb16(float* signal_out, ISACUBDecStruct* ISACdecUB_obj,
|
||||
* are combined, to reconstruct the upperband 8-16 kHz.
|
||||
*/
|
||||
int WebRtcIsac_DecodeUb12(float* signal_out, ISACUBDecStruct* ISACdecUB_obj,
|
||||
WebRtc_Word16 isRCUPayload) {
|
||||
int16_t isRCUPayload) {
|
||||
int len, err;
|
||||
|
||||
float LP_dec_float[FRAMESAMPLES_HALF];
|
||||
@ -259,7 +259,7 @@ int WebRtcIsac_DecodeUb12(float* signal_out, ISACUBDecStruct* ISACdecUB_obj,
|
||||
|
||||
double real_f[FRAMESAMPLES_HALF];
|
||||
double imag_f[FRAMESAMPLES_HALF];
|
||||
const WebRtc_Word16 kAveragePitchGain = 0; /* No pitch-gain for upper-band. */
|
||||
const int16_t kAveragePitchGain = 0; /* No pitch-gain for upper-band. */
|
||||
len = 0;
|
||||
|
||||
/* Decode & dequantize filter coefficients. */
|
||||
|
||||
@ -18,19 +18,19 @@ int
|
||||
WebRtcIsac_EstimateBandwidth(
|
||||
BwEstimatorstr* bwest_str,
|
||||
Bitstr* streamdata,
|
||||
WebRtc_Word32 packet_size,
|
||||
WebRtc_UWord16 rtp_seq_number,
|
||||
WebRtc_UWord32 send_ts,
|
||||
WebRtc_UWord32 arr_ts,
|
||||
int32_t packet_size,
|
||||
uint16_t rtp_seq_number,
|
||||
uint32_t send_ts,
|
||||
uint32_t arr_ts,
|
||||
enum IsacSamplingRate encoderSampRate,
|
||||
enum IsacSamplingRate decoderSampRate)
|
||||
{
|
||||
WebRtc_Word16 index;
|
||||
WebRtc_Word16 frame_samples;
|
||||
WebRtc_UWord32 sendTimestampIn16kHz;
|
||||
WebRtc_UWord32 arrivalTimestampIn16kHz;
|
||||
WebRtc_UWord32 diffSendTime;
|
||||
WebRtc_UWord32 diffArrivalTime;
|
||||
int16_t index;
|
||||
int16_t frame_samples;
|
||||
uint32_t sendTimestampIn16kHz;
|
||||
uint32_t arrivalTimestampIn16kHz;
|
||||
uint32_t diffSendTime;
|
||||
uint32_t diffArrivalTime;
|
||||
int err;
|
||||
|
||||
/* decode framelength and BW estimation */
|
||||
@ -55,26 +55,26 @@ WebRtcIsac_EstimateBandwidth(
|
||||
// We like BWE to work at 16 kHz sampling rate,
|
||||
// therefore, we have to change the timestamps accordingly.
|
||||
// translate the send timestamp if required
|
||||
diffSendTime = (WebRtc_UWord32)((WebRtc_UWord32)send_ts -
|
||||
(WebRtc_UWord32)bwest_str->senderTimestamp);
|
||||
diffSendTime = (uint32_t)((uint32_t)send_ts -
|
||||
(uint32_t)bwest_str->senderTimestamp);
|
||||
bwest_str->senderTimestamp = send_ts;
|
||||
|
||||
diffArrivalTime = (WebRtc_UWord32)((WebRtc_UWord32)arr_ts -
|
||||
(WebRtc_UWord32)bwest_str->receiverTimestamp);
|
||||
diffArrivalTime = (uint32_t)((uint32_t)arr_ts -
|
||||
(uint32_t)bwest_str->receiverTimestamp);
|
||||
bwest_str->receiverTimestamp = arr_ts;
|
||||
|
||||
if(decoderSampRate == kIsacSuperWideband)
|
||||
{
|
||||
diffArrivalTime = (WebRtc_UWord32)diffArrivalTime >> 1;
|
||||
diffSendTime = (WebRtc_UWord32)diffSendTime >> 1;
|
||||
diffArrivalTime = (uint32_t)diffArrivalTime >> 1;
|
||||
diffSendTime = (uint32_t)diffSendTime >> 1;
|
||||
}
|
||||
|
||||
// arrival timestamp in 16 kHz
|
||||
arrivalTimestampIn16kHz = (WebRtc_UWord32)((WebRtc_UWord32)
|
||||
bwest_str->prev_rec_arr_ts + (WebRtc_UWord32)diffArrivalTime);
|
||||
arrivalTimestampIn16kHz = (uint32_t)((uint32_t)
|
||||
bwest_str->prev_rec_arr_ts + (uint32_t)diffArrivalTime);
|
||||
// send timestamp in 16 kHz
|
||||
sendTimestampIn16kHz = (WebRtc_UWord32)((WebRtc_UWord32)
|
||||
bwest_str->prev_rec_send_ts + (WebRtc_UWord32)diffSendTime);
|
||||
sendTimestampIn16kHz = (uint32_t)((uint32_t)
|
||||
bwest_str->prev_rec_send_ts + (uint32_t)diffSendTime);
|
||||
|
||||
err = WebRtcIsac_UpdateBandwidthEstimator(bwest_str, rtp_seq_number,
|
||||
(frame_samples * 1000) / FS, sendTimestampIn16kHz,
|
||||
|
||||
@ -70,15 +70,15 @@
|
||||
*/
|
||||
|
||||
/* 38 39.17 40.33 41.5 42.67 43.83 45 */
|
||||
static const WebRtc_Word16 kLowerBandBitRate12[7] = {
|
||||
static const int16_t kLowerBandBitRate12[7] = {
|
||||
29000, 30000, 30000, 31000, 31000, 32000, 32000 };
|
||||
static const WebRtc_Word16 kUpperBandBitRate12[7] = {
|
||||
static const int16_t kUpperBandBitRate12[7] = {
|
||||
25000, 25000, 27000, 27000, 29000, 29000, 32000 };
|
||||
|
||||
/* 50 51.2 52.4 53.6 54.8 56 */
|
||||
static const WebRtc_Word16 kLowerBandBitRate16[6] = {
|
||||
static const int16_t kLowerBandBitRate16[6] = {
|
||||
31000, 31000, 32000, 32000, 32000, 32000 };
|
||||
static const WebRtc_Word16 kUpperBandBitRate16[6] = {
|
||||
static const int16_t kUpperBandBitRate16[6] = {
|
||||
28000, 29000, 29000, 30000, 31000, 32000 };
|
||||
|
||||
/******************************************************************************
|
||||
@ -99,18 +99,18 @@ static const WebRtc_Word16 kUpperBandBitRate16[6] = {
|
||||
* -1 if failed to allocate rates.
|
||||
*/
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_RateAllocation(WebRtc_Word32 inRateBitPerSec,
|
||||
int16_t WebRtcIsac_RateAllocation(int32_t inRateBitPerSec,
|
||||
double* rateLBBitPerSec,
|
||||
double* rateUBBitPerSec,
|
||||
enum ISACBandwidth* bandwidthKHz) {
|
||||
WebRtc_Word16 idx;
|
||||
int16_t idx;
|
||||
double idxD;
|
||||
double idxErr;
|
||||
if (inRateBitPerSec < 38000) {
|
||||
/* If the given overall bottleneck is less than 38000 then
|
||||
* then codec has to operate in wideband mode, i.e. 8 kHz
|
||||
* bandwidth. */
|
||||
*rateLBBitPerSec = (WebRtc_Word16)((inRateBitPerSec > 32000) ?
|
||||
*rateLBBitPerSec = (int16_t)((inRateBitPerSec > 32000) ?
|
||||
32000 : inRateBitPerSec);
|
||||
*rateUBBitPerSec = 0;
|
||||
*bandwidthKHz = isac8kHz;
|
||||
@ -123,15 +123,15 @@ WebRtc_Word16 WebRtcIsac_RateAllocation(WebRtc_Word32 inRateBitPerSec,
|
||||
* step is (45000 - 38000)/6.0 we use the inverse of it. */
|
||||
const double stepSizeInv = 8.5714286e-4;
|
||||
idxD = (inRateBitPerSec - 38000) * stepSizeInv;
|
||||
idx = (idxD >= 6) ? 6 : ((WebRtc_Word16)idxD);
|
||||
idx = (idxD >= 6) ? 6 : ((int16_t)idxD);
|
||||
idxErr = idxD - idx;
|
||||
*rateLBBitPerSec = kLowerBandBitRate12[idx];
|
||||
*rateUBBitPerSec = kUpperBandBitRate12[idx];
|
||||
|
||||
if (idx < 6) {
|
||||
*rateLBBitPerSec += (WebRtc_Word16)(
|
||||
*rateLBBitPerSec += (int16_t)(
|
||||
idxErr * (kLowerBandBitRate12[idx + 1] - kLowerBandBitRate12[idx]));
|
||||
*rateUBBitPerSec += (WebRtc_Word16)(
|
||||
*rateUBBitPerSec += (int16_t)(
|
||||
idxErr * (kUpperBandBitRate12[idx + 1] - kUpperBandBitRate12[idx]));
|
||||
}
|
||||
*bandwidthKHz = isac12kHz;
|
||||
@ -144,17 +144,17 @@ WebRtc_Word16 WebRtcIsac_RateAllocation(WebRtc_Word32 inRateBitPerSec,
|
||||
* step is (56000 - 50000)/5 we use the inverse of it. */
|
||||
const double stepSizeInv = 8.3333333e-4;
|
||||
idxD = (inRateBitPerSec - 50000) * stepSizeInv;
|
||||
idx = (idxD >= 5) ? 5 : ((WebRtc_Word16)idxD);
|
||||
idx = (idxD >= 5) ? 5 : ((int16_t)idxD);
|
||||
idxErr = idxD - idx;
|
||||
*rateLBBitPerSec = kLowerBandBitRate16[idx];
|
||||
*rateUBBitPerSec = kUpperBandBitRate16[idx];
|
||||
|
||||
if (idx < 5) {
|
||||
*rateLBBitPerSec += (WebRtc_Word16)(idxErr *
|
||||
*rateLBBitPerSec += (int16_t)(idxErr *
|
||||
(kLowerBandBitRate16[idx + 1] -
|
||||
kLowerBandBitRate16[idx]));
|
||||
|
||||
*rateUBBitPerSec += (WebRtc_Word16)(idxErr *
|
||||
*rateUBBitPerSec += (int16_t)(idxErr *
|
||||
(kUpperBandBitRate16[idx + 1] -
|
||||
kUpperBandBitRate16[idx]));
|
||||
}
|
||||
@ -178,8 +178,8 @@ void WebRtcIsac_ResetBitstream(Bitstr* bit_stream) {
|
||||
}
|
||||
|
||||
int WebRtcIsac_EncodeLb(float* in, ISACLBEncStruct* ISACencLB_obj,
|
||||
WebRtc_Word16 codingMode,
|
||||
WebRtc_Word16 bottleneckIndex) {
|
||||
int16_t codingMode,
|
||||
int16_t bottleneckIndex) {
|
||||
int stream_length = 0;
|
||||
int err;
|
||||
int k;
|
||||
@ -197,20 +197,20 @@ int WebRtcIsac_EncodeLb(float* in, ISACLBEncStruct* ISACencLB_obj,
|
||||
|
||||
double HPw[FRAMESAMPLES_HALF];
|
||||
double LPw_pf[FRAMESAMPLES_HALF];
|
||||
WebRtc_Word16 fre[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
WebRtc_Word16 fim[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
int16_t fre[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
int16_t fim[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
|
||||
double PitchLags[4];
|
||||
double PitchGains[4];
|
||||
WebRtc_Word16 PitchGains_Q12[4];
|
||||
WebRtc_Word16 AvgPitchGain_Q12;
|
||||
int16_t PitchGains_Q12[4];
|
||||
int16_t AvgPitchGain_Q12;
|
||||
|
||||
int frame_mode; /* 0 for 30ms, 1 for 60ms */
|
||||
int status = 0;
|
||||
int my_index;
|
||||
transcode_obj transcodingParam;
|
||||
double bytesLeftSpecCoding;
|
||||
WebRtc_UWord16 payloadLimitBytes;
|
||||
uint16_t payloadLimitBytes;
|
||||
|
||||
/* Copy new frame-length and bottleneck rate only for the first 10 ms data */
|
||||
if (ISACencLB_obj->buffer_index == 0) {
|
||||
@ -292,7 +292,7 @@ int WebRtcIsac_EncodeLb(float* in, ISACLBEncStruct* ISACencLB_obj,
|
||||
|
||||
/* Convert PitchGain to Fixed point. */
|
||||
for (k = 0; k < PITCH_SUBFRAMES; k++) {
|
||||
PitchGains_Q12[k] = (WebRtc_Word16)(PitchGains[k] * 4096.0);
|
||||
PitchGains_Q12[k] = (int16_t)(PitchGains[k] * 4096.0);
|
||||
}
|
||||
|
||||
/* Set where to store data in multiple packets memory. */
|
||||
@ -458,8 +458,8 @@ int WebRtcIsac_EncodeLb(float* in, ISACLBEncStruct* ISACencLB_obj,
|
||||
|
||||
/* Scale DFT coefficients. */
|
||||
for (k = 0; k < FRAMESAMPLES_HALF; k++) {
|
||||
fre[k] = (WebRtc_Word16)(fre[k] * transcodeScale);
|
||||
fim[k] = (WebRtc_Word16)(fim[k] * transcodeScale);
|
||||
fre[k] = (int16_t)(fre[k] * transcodeScale);
|
||||
fim[k] = (int16_t)(fim[k] * transcodeScale);
|
||||
}
|
||||
|
||||
/* Save data for multiple packets memory. */
|
||||
@ -531,17 +531,17 @@ int WebRtcIsac_EncodeLb(float* in, ISACLBEncStruct* ISACencLB_obj,
|
||||
|
||||
|
||||
static int LimitPayloadUb(ISACUBEncStruct* ISACencUB_obj,
|
||||
WebRtc_UWord16 payloadLimitBytes,
|
||||
uint16_t payloadLimitBytes,
|
||||
double bytesLeftSpecCoding,
|
||||
transcode_obj* transcodingParam,
|
||||
WebRtc_Word16* fre, WebRtc_Word16* fim,
|
||||
int16_t* fre, int16_t* fim,
|
||||
double* lpcGains, enum ISACBand band, int status) {
|
||||
|
||||
int iterCntr = 0;
|
||||
int k;
|
||||
double bytesSpecCoderUsed;
|
||||
double transcodeScale;
|
||||
const WebRtc_Word16 kAveragePitchGain = 0.0;
|
||||
const int16_t kAveragePitchGain = 0.0;
|
||||
|
||||
do {
|
||||
if (iterCntr >= MAX_PAYLOAD_LIMIT_ITERATION) {
|
||||
@ -580,8 +580,8 @@ static int LimitPayloadUb(ISACUBEncStruct* ISACencUB_obj,
|
||||
|
||||
/* Scale DFT coefficients. */
|
||||
for (k = 0; k < FRAMESAMPLES_HALF; k++) {
|
||||
fre[k] = (WebRtc_Word16)(fre[k] * transcodeScale + 0.5);
|
||||
fim[k] = (WebRtc_Word16)(fim[k] * transcodeScale + 0.5);
|
||||
fre[k] = (int16_t)(fre[k] * transcodeScale + 0.5);
|
||||
fim[k] = (int16_t)(fim[k] * transcodeScale + 0.5);
|
||||
}
|
||||
/* Store FFT coefficients for multiple encoding. */
|
||||
memcpy(ISACencUB_obj->SaveEnc_obj.realFFT, fre,
|
||||
@ -642,7 +642,7 @@ static int LimitPayloadUb(ISACUBEncStruct* ISACencUB_obj,
|
||||
}
|
||||
|
||||
int WebRtcIsac_EncodeUb16(float* in, ISACUBEncStruct* ISACencUB_obj,
|
||||
WebRtc_Word32 jitterInfo) {
|
||||
int32_t jitterInfo) {
|
||||
int err;
|
||||
int k;
|
||||
|
||||
@ -651,8 +651,8 @@ int WebRtcIsac_EncodeUb16(float* in, ISACUBEncStruct* ISACencUB_obj,
|
||||
(1 + UB_LPC_ORDER)];
|
||||
|
||||
double LP_lookahead[FRAMESAMPLES];
|
||||
WebRtc_Word16 fre[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
WebRtc_Word16 fim[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
int16_t fre[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
int16_t fim[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
|
||||
int status = 0;
|
||||
|
||||
@ -660,9 +660,9 @@ int WebRtcIsac_EncodeUb16(float* in, ISACUBEncStruct* ISACencUB_obj,
|
||||
double corr[SUBFRAMES << 1][UB_LPC_ORDER + 1];
|
||||
double lpcGains[SUBFRAMES << 1];
|
||||
transcode_obj transcodingParam;
|
||||
WebRtc_UWord16 payloadLimitBytes;
|
||||
uint16_t payloadLimitBytes;
|
||||
double s2nr;
|
||||
const WebRtc_Word16 kAveragePitchGain = 0.0;
|
||||
const int16_t kAveragePitchGain = 0.0;
|
||||
int bytesLeftSpecCoding;
|
||||
|
||||
/* Buffer speech samples (by 10ms packet) until the frame-length is */
|
||||
@ -827,7 +827,7 @@ int WebRtcIsac_EncodeUb16(float* in, ISACUBEncStruct* ISACencUB_obj,
|
||||
|
||||
|
||||
int WebRtcIsac_EncodeUb12(float* in, ISACUBEncStruct* ISACencUB_obj,
|
||||
WebRtc_Word32 jitterInfo) {
|
||||
int32_t jitterInfo) {
|
||||
int err;
|
||||
int k;
|
||||
|
||||
@ -842,8 +842,8 @@ int WebRtcIsac_EncodeUb12(float* in, ISACUBEncStruct* ISACencUB_obj,
|
||||
double LPw[FRAMESAMPLES_HALF];
|
||||
|
||||
double HPw[FRAMESAMPLES_HALF];
|
||||
WebRtc_Word16 fre[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
WebRtc_Word16 fim[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
int16_t fre[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
int16_t fim[FRAMESAMPLES_HALF]; /* Q7 */
|
||||
|
||||
int status = 0;
|
||||
|
||||
@ -852,9 +852,9 @@ int WebRtcIsac_EncodeUb12(float* in, ISACUBEncStruct* ISACencUB_obj,
|
||||
double corr[UB_LPC_GAIN_DIM][UB_LPC_ORDER + 1];
|
||||
double lpcGains[SUBFRAMES];
|
||||
transcode_obj transcodingParam;
|
||||
WebRtc_UWord16 payloadLimitBytes;
|
||||
uint16_t payloadLimitBytes;
|
||||
double s2nr;
|
||||
const WebRtc_Word16 kAveragePitchGain = 0.0;
|
||||
const int16_t kAveragePitchGain = 0.0;
|
||||
double bytesLeftSpecCoding;
|
||||
|
||||
/* Buffer speech samples (by 10ms packet) until the framelength is */
|
||||
@ -1011,13 +1011,13 @@ int WebRtcIsac_EncodeStoredDataLb(const ISAC_SaveEncData_t* ISACSavedEnc_obj,
|
||||
int status;
|
||||
int BWno = BWnumber;
|
||||
|
||||
const WebRtc_UWord16* WebRtcIsac_kQPitchGainCdf_ptr[1];
|
||||
const WebRtc_UWord16** cdf;
|
||||
const uint16_t* WebRtcIsac_kQPitchGainCdf_ptr[1];
|
||||
const uint16_t** cdf;
|
||||
|
||||
double tmpLPCcoeffs_lo[(ORDERLO + 1)*SUBFRAMES * 2];
|
||||
double tmpLPCcoeffs_hi[(ORDERHI + 1)*SUBFRAMES * 2];
|
||||
int tmpLPCindex_g[12 * 2];
|
||||
WebRtc_Word16 tmp_fre[FRAMESAMPLES], tmp_fim[FRAMESAMPLES];
|
||||
int16_t tmp_fre[FRAMESAMPLES], tmp_fim[FRAMESAMPLES];
|
||||
const int kModel = 0;
|
||||
|
||||
/* Sanity Check - possible values for BWnumber is 0 - 23. */
|
||||
@ -1053,8 +1053,8 @@ int WebRtcIsac_EncodeStoredDataLb(const ISAC_SaveEncData_t* ISACSavedEnc_obj,
|
||||
for (ii = 0;
|
||||
ii < (FRAMESAMPLES_HALF * (1 + ISACSavedEnc_obj->startIdx));
|
||||
ii++) {
|
||||
tmp_fre[ii] = (WebRtc_Word16)((scale) * (float)ISACSavedEnc_obj->fre[ii]);
|
||||
tmp_fim[ii] = (WebRtc_Word16)((scale) * (float)ISACSavedEnc_obj->fim[ii]);
|
||||
tmp_fre[ii] = (int16_t)((scale) * (float)ISACSavedEnc_obj->fre[ii]);
|
||||
tmp_fim[ii] = (int16_t)((scale) * (float)ISACSavedEnc_obj->fim[ii]);
|
||||
}
|
||||
} else {
|
||||
for (ii = 0;
|
||||
@ -1134,17 +1134,17 @@ int WebRtcIsac_EncodeStoredDataLb(const ISAC_SaveEncData_t* ISACSavedEnc_obj,
|
||||
int WebRtcIsac_EncodeStoredDataUb(
|
||||
const ISACUBSaveEncDataStruct* ISACSavedEnc_obj,
|
||||
Bitstr* bitStream,
|
||||
WebRtc_Word32 jitterInfo,
|
||||
int32_t jitterInfo,
|
||||
float scale,
|
||||
enum ISACBandwidth bandwidth) {
|
||||
int n;
|
||||
int err;
|
||||
double lpcGain[SUBFRAMES];
|
||||
WebRtc_Word16 realFFT[FRAMESAMPLES_HALF];
|
||||
WebRtc_Word16 imagFFT[FRAMESAMPLES_HALF];
|
||||
const WebRtc_UWord16** shape_cdf;
|
||||
int16_t realFFT[FRAMESAMPLES_HALF];
|
||||
int16_t imagFFT[FRAMESAMPLES_HALF];
|
||||
const uint16_t** shape_cdf;
|
||||
int shape_len;
|
||||
const WebRtc_Word16 kAveragePitchGain = 0.0;
|
||||
const int16_t kAveragePitchGain = 0.0;
|
||||
enum ISACBand band;
|
||||
/* Reset bitstream. */
|
||||
WebRtcIsac_ResetBitstream(bitStream);
|
||||
@ -1201,9 +1201,9 @@ int WebRtcIsac_EncodeStoredDataUb(
|
||||
}
|
||||
|
||||
for (n = 0; n < FRAMESAMPLES_HALF; n++) {
|
||||
realFFT[n] = (WebRtc_Word16)(scale * (float)ISACSavedEnc_obj->realFFT[n] +
|
||||
realFFT[n] = (int16_t)(scale * (float)ISACSavedEnc_obj->realFFT[n] +
|
||||
0.5f);
|
||||
imagFFT[n] = (WebRtc_Word16)(scale * (float)ISACSavedEnc_obj->imagFFT[n] +
|
||||
imagFFT[n] = (int16_t)(scale * (float)ISACSavedEnc_obj->imagFFT[n] +
|
||||
0.5f);
|
||||
}
|
||||
/* Store FFT coefficients. */
|
||||
@ -1219,24 +1219,24 @@ int WebRtcIsac_EncodeStoredDataUb(
|
||||
return WebRtcIsac_EncTerminate(bitStream);
|
||||
}
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_GetRedPayloadUb(
|
||||
int16_t WebRtcIsac_GetRedPayloadUb(
|
||||
const ISACUBSaveEncDataStruct* ISACSavedEncObj,
|
||||
Bitstr* bitStreamObj,
|
||||
enum ISACBandwidth bandwidth) {
|
||||
int n;
|
||||
WebRtc_Word16 status;
|
||||
WebRtc_Word16 realFFT[FRAMESAMPLES_HALF];
|
||||
WebRtc_Word16 imagFFT[FRAMESAMPLES_HALF];
|
||||
int16_t status;
|
||||
int16_t realFFT[FRAMESAMPLES_HALF];
|
||||
int16_t imagFFT[FRAMESAMPLES_HALF];
|
||||
enum ISACBand band;
|
||||
const WebRtc_Word16 kAveragePitchGain = 0.0;
|
||||
const int16_t kAveragePitchGain = 0.0;
|
||||
/* Store bit-stream object. */
|
||||
memcpy(bitStreamObj, &ISACSavedEncObj->bitStreamObj, sizeof(Bitstr));
|
||||
|
||||
/* Scale FFT coefficients. */
|
||||
for (n = 0; n < FRAMESAMPLES_HALF; n++) {
|
||||
realFFT[n] = (WebRtc_Word16)((float)ISACSavedEncObj->realFFT[n] *
|
||||
realFFT[n] = (int16_t)((float)ISACSavedEncObj->realFFT[n] *
|
||||
RCU_TRANSCODING_SCALE_UB + 0.5);
|
||||
imagFFT[n] = (WebRtc_Word16)((float)ISACSavedEncObj->imagFFT[n] *
|
||||
imagFFT[n] = (int16_t)((float)ISACSavedEncObj->imagFFT[n] *
|
||||
RCU_TRANSCODING_SCALE_UB + 0.5);
|
||||
}
|
||||
|
||||
|
||||
@ -44,14 +44,14 @@
|
||||
*
|
||||
*
|
||||
*/
|
||||
WebRtc_Word16
|
||||
int16_t
|
||||
WebRtcIsac_RemoveLarMean(
|
||||
double* lar,
|
||||
WebRtc_Word16 bandwidth)
|
||||
int16_t bandwidth)
|
||||
{
|
||||
WebRtc_Word16 coeffCntr;
|
||||
WebRtc_Word16 vecCntr;
|
||||
WebRtc_Word16 numVec;
|
||||
int16_t coeffCntr;
|
||||
int16_t vecCntr;
|
||||
int16_t numVec;
|
||||
const double* meanLAR;
|
||||
switch(bandwidth)
|
||||
{
|
||||
@ -98,18 +98,18 @@ WebRtcIsac_RemoveLarMean(
|
||||
* Output:
|
||||
* -out : decorrelated LAR vectors.
|
||||
*/
|
||||
WebRtc_Word16
|
||||
int16_t
|
||||
WebRtcIsac_DecorrelateIntraVec(
|
||||
const double* data,
|
||||
double* out,
|
||||
WebRtc_Word16 bandwidth)
|
||||
int16_t bandwidth)
|
||||
{
|
||||
const double* ptrData;
|
||||
const double* ptrRow;
|
||||
WebRtc_Word16 rowCntr;
|
||||
WebRtc_Word16 colCntr;
|
||||
WebRtc_Word16 larVecCntr;
|
||||
WebRtc_Word16 numVec;
|
||||
int16_t rowCntr;
|
||||
int16_t colCntr;
|
||||
int16_t larVecCntr;
|
||||
int16_t numVec;
|
||||
const double* decorrMat;
|
||||
switch(bandwidth)
|
||||
{
|
||||
@ -172,17 +172,17 @@ WebRtcIsac_DecorrelateIntraVec(
|
||||
* Output:
|
||||
* -out : decorrelated LAR vectors.
|
||||
*/
|
||||
WebRtc_Word16
|
||||
int16_t
|
||||
WebRtcIsac_DecorrelateInterVec(
|
||||
const double* data,
|
||||
double* out,
|
||||
WebRtc_Word16 bandwidth)
|
||||
int16_t bandwidth)
|
||||
{
|
||||
WebRtc_Word16 coeffCntr;
|
||||
WebRtc_Word16 rowCntr;
|
||||
WebRtc_Word16 colCntr;
|
||||
int16_t coeffCntr;
|
||||
int16_t rowCntr;
|
||||
int16_t colCntr;
|
||||
const double* decorrMat;
|
||||
WebRtc_Word16 interVecDim;
|
||||
int16_t interVecDim;
|
||||
|
||||
switch(bandwidth)
|
||||
{
|
||||
@ -245,14 +245,14 @@ double
|
||||
WebRtcIsac_QuantizeUncorrLar(
|
||||
double* data,
|
||||
int* recIdx,
|
||||
WebRtc_Word16 bandwidth)
|
||||
int16_t bandwidth)
|
||||
{
|
||||
WebRtc_Word16 cntr;
|
||||
WebRtc_Word32 idx;
|
||||
WebRtc_Word16 interVecDim;
|
||||
int16_t cntr;
|
||||
int32_t idx;
|
||||
int16_t interVecDim;
|
||||
const double* leftRecPoint;
|
||||
double quantizationStepSize;
|
||||
const WebRtc_Word16* numQuantCell;
|
||||
const int16_t* numQuantCell;
|
||||
switch(bandwidth)
|
||||
{
|
||||
case isac12kHz:
|
||||
@ -280,7 +280,7 @@ WebRtcIsac_QuantizeUncorrLar(
|
||||
//
|
||||
for(cntr = 0; cntr < UB_LPC_ORDER * interVecDim; cntr++)
|
||||
{
|
||||
idx = (WebRtc_Word32)floor((*data - leftRecPoint[cntr]) /
|
||||
idx = (int32_t)floor((*data - leftRecPoint[cntr]) /
|
||||
quantizationStepSize + 0.5);
|
||||
if(idx < 0)
|
||||
{
|
||||
@ -311,14 +311,14 @@ WebRtcIsac_QuantizeUncorrLar(
|
||||
* Output:
|
||||
* -out : pointer to quantized values.
|
||||
*/
|
||||
WebRtc_Word16
|
||||
int16_t
|
||||
WebRtcIsac_DequantizeLpcParam(
|
||||
const int* idx,
|
||||
double* out,
|
||||
WebRtc_Word16 bandwidth)
|
||||
int16_t bandwidth)
|
||||
{
|
||||
WebRtc_Word16 cntr;
|
||||
WebRtc_Word16 interVecDim;
|
||||
int16_t cntr;
|
||||
int16_t interVecDim;
|
||||
const double* leftRecPoint;
|
||||
double quantizationStepSize;
|
||||
|
||||
@ -367,16 +367,16 @@ WebRtcIsac_DequantizeLpcParam(
|
||||
* Output:
|
||||
* -out : correlated parametrs.
|
||||
*/
|
||||
WebRtc_Word16
|
||||
int16_t
|
||||
WebRtcIsac_CorrelateIntraVec(
|
||||
const double* data,
|
||||
double* out,
|
||||
WebRtc_Word16 bandwidth)
|
||||
int16_t bandwidth)
|
||||
{
|
||||
WebRtc_Word16 vecCntr;
|
||||
WebRtc_Word16 rowCntr;
|
||||
WebRtc_Word16 colCntr;
|
||||
WebRtc_Word16 numVec;
|
||||
int16_t vecCntr;
|
||||
int16_t rowCntr;
|
||||
int16_t colCntr;
|
||||
int16_t numVec;
|
||||
const double* ptrData;
|
||||
const double* intraVecDecorrMat;
|
||||
|
||||
@ -430,16 +430,16 @@ WebRtcIsac_CorrelateIntraVec(
|
||||
* Output:
|
||||
* -out : correlated parametrs.
|
||||
*/
|
||||
WebRtc_Word16
|
||||
int16_t
|
||||
WebRtcIsac_CorrelateInterVec(
|
||||
const double* data,
|
||||
double* out,
|
||||
WebRtc_Word16 bandwidth)
|
||||
int16_t bandwidth)
|
||||
{
|
||||
WebRtc_Word16 coeffCntr;
|
||||
WebRtc_Word16 rowCntr;
|
||||
WebRtc_Word16 colCntr;
|
||||
WebRtc_Word16 interVecDim;
|
||||
int16_t coeffCntr;
|
||||
int16_t rowCntr;
|
||||
int16_t colCntr;
|
||||
int16_t interVecDim;
|
||||
double myVec[UB16_LPC_VEC_PER_FRAME];
|
||||
const double* interVecDecorrMat;
|
||||
|
||||
@ -495,14 +495,14 @@ WebRtcIsac_CorrelateInterVec(
|
||||
* Output:
|
||||
* -data : pointer to LARs.
|
||||
*/
|
||||
WebRtc_Word16
|
||||
int16_t
|
||||
WebRtcIsac_AddLarMean(
|
||||
double* data,
|
||||
WebRtc_Word16 bandwidth)
|
||||
int16_t bandwidth)
|
||||
{
|
||||
WebRtc_Word16 coeffCntr;
|
||||
WebRtc_Word16 vecCntr;
|
||||
WebRtc_Word16 numVec;
|
||||
int16_t coeffCntr;
|
||||
int16_t vecCntr;
|
||||
int16_t numVec;
|
||||
const double* meanLAR;
|
||||
|
||||
switch(bandwidth)
|
||||
@ -544,11 +544,11 @@ WebRtcIsac_AddLarMean(
|
||||
* Output:
|
||||
* -lpcGain : mean-removed in log domain.
|
||||
*/
|
||||
WebRtc_Word16
|
||||
int16_t
|
||||
WebRtcIsac_ToLogDomainRemoveMean(
|
||||
double* data)
|
||||
{
|
||||
WebRtc_Word16 coeffCntr;
|
||||
int16_t coeffCntr;
|
||||
for(coeffCntr = 0; coeffCntr < UB_LPC_GAIN_DIM; coeffCntr++)
|
||||
{
|
||||
data[coeffCntr] = log(data[coeffCntr]) - WebRtcIsac_kMeanLpcGain;
|
||||
@ -569,12 +569,12 @@ WebRtcIsac_ToLogDomainRemoveMean(
|
||||
* Output:
|
||||
* -out : decorrelated parameters.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DecorrelateLPGain(
|
||||
int16_t WebRtcIsac_DecorrelateLPGain(
|
||||
const double* data,
|
||||
double* out)
|
||||
{
|
||||
WebRtc_Word16 rowCntr;
|
||||
WebRtc_Word16 colCntr;
|
||||
int16_t rowCntr;
|
||||
int16_t colCntr;
|
||||
|
||||
for(colCntr = 0; colCntr < UB_LPC_GAIN_DIM; colCntr++)
|
||||
{
|
||||
@ -604,7 +604,7 @@ double WebRtcIsac_QuantizeLpcGain(
|
||||
double* data,
|
||||
int* idx)
|
||||
{
|
||||
WebRtc_Word16 coeffCntr;
|
||||
int16_t coeffCntr;
|
||||
for(coeffCntr = 0; coeffCntr < UB_LPC_GAIN_DIM; coeffCntr++)
|
||||
{
|
||||
*idx = (int)floor((*data - WebRtcIsac_kLeftRecPointLpcGain[coeffCntr]) /
|
||||
@ -638,11 +638,11 @@ double WebRtcIsac_QuantizeLpcGain(
|
||||
* Output:
|
||||
* -lpcGains : quantized values of the given parametes.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DequantizeLpcGain(
|
||||
int16_t WebRtcIsac_DequantizeLpcGain(
|
||||
const int* idx,
|
||||
double* out)
|
||||
{
|
||||
WebRtc_Word16 coeffCntr;
|
||||
int16_t coeffCntr;
|
||||
for(coeffCntr = 0; coeffCntr < UB_LPC_GAIN_DIM; coeffCntr++)
|
||||
{
|
||||
*out = WebRtcIsac_kLeftRecPointLpcGain[coeffCntr] + *idx *
|
||||
@ -664,12 +664,12 @@ WebRtc_Word16 WebRtcIsac_DequantizeLpcGain(
|
||||
* Output:
|
||||
* -out : correlated parameters.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_CorrelateLpcGain(
|
||||
int16_t WebRtcIsac_CorrelateLpcGain(
|
||||
const double* data,
|
||||
double* out)
|
||||
{
|
||||
WebRtc_Word16 rowCntr;
|
||||
WebRtc_Word16 colCntr;
|
||||
int16_t rowCntr;
|
||||
int16_t colCntr;
|
||||
|
||||
for(rowCntr = 0; rowCntr < UB_LPC_GAIN_DIM; rowCntr++)
|
||||
{
|
||||
@ -696,10 +696,10 @@ WebRtc_Word16 WebRtcIsac_CorrelateLpcGain(
|
||||
* Output:
|
||||
* -lpcGain : LPC gain in normal domain.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_AddMeanToLinearDomain(
|
||||
int16_t WebRtcIsac_AddMeanToLinearDomain(
|
||||
double* lpcGains)
|
||||
{
|
||||
WebRtc_Word16 coeffCntr;
|
||||
int16_t coeffCntr;
|
||||
for(coeffCntr = 0; coeffCntr < UB_LPC_GAIN_DIM; coeffCntr++)
|
||||
{
|
||||
lpcGains[coeffCntr] = exp(lpcGains[coeffCntr] + WebRtcIsac_kMeanLpcGain);
|
||||
|
||||
@ -40,9 +40,9 @@
|
||||
*
|
||||
*
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_RemoveLarMean(
|
||||
int16_t WebRtcIsac_RemoveLarMean(
|
||||
double* lar,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t bandwidth);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DecorrelateIntraVec()
|
||||
@ -60,10 +60,10 @@ WebRtc_Word16 WebRtcIsac_RemoveLarMean(
|
||||
* Output:
|
||||
* -out : decorrelated LAR vectors.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DecorrelateIntraVec(
|
||||
int16_t WebRtcIsac_DecorrelateIntraVec(
|
||||
const double* inLAR,
|
||||
double* out,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t bandwidth);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -83,10 +83,10 @@ WebRtc_Word16 WebRtcIsac_DecorrelateIntraVec(
|
||||
* Output:
|
||||
* -out : decorrelated LAR vectors.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DecorrelateInterVec(
|
||||
int16_t WebRtcIsac_DecorrelateInterVec(
|
||||
const double* data,
|
||||
double* out,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t bandwidth);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -106,7 +106,7 @@ WebRtc_Word16 WebRtcIsac_DecorrelateInterVec(
|
||||
double WebRtcIsac_QuantizeUncorrLar(
|
||||
double* data,
|
||||
int* idx,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t bandwidth);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -122,10 +122,10 @@ double WebRtcIsac_QuantizeUncorrLar(
|
||||
* Output:
|
||||
* -out : correlated parametrs.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_CorrelateIntraVec(
|
||||
int16_t WebRtcIsac_CorrelateIntraVec(
|
||||
const double* data,
|
||||
double* out,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t bandwidth);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -141,10 +141,10 @@ WebRtc_Word16 WebRtcIsac_CorrelateIntraVec(
|
||||
* Output:
|
||||
* -out : correlated parametrs.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_CorrelateInterVec(
|
||||
int16_t WebRtcIsac_CorrelateInterVec(
|
||||
const double* data,
|
||||
double* out,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t bandwidth);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -160,9 +160,9 @@ WebRtc_Word16 WebRtcIsac_CorrelateInterVec(
|
||||
* Output:
|
||||
* -data : pointer to LARs.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_AddLarMean(
|
||||
int16_t WebRtcIsac_AddLarMean(
|
||||
double* data,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t bandwidth);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -178,10 +178,10 @@ WebRtc_Word16 WebRtcIsac_AddLarMean(
|
||||
* Output:
|
||||
* -out : pointer to quantized values.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DequantizeLpcParam(
|
||||
int16_t WebRtcIsac_DequantizeLpcParam(
|
||||
const int* idx,
|
||||
double* out,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t bandwidth);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -195,7 +195,7 @@ WebRtc_Word16 WebRtcIsac_DequantizeLpcParam(
|
||||
* Output:
|
||||
* -lpcGain : mean-removed in log domain.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_ToLogDomainRemoveMean(
|
||||
int16_t WebRtcIsac_ToLogDomainRemoveMean(
|
||||
double* lpGains);
|
||||
|
||||
|
||||
@ -211,7 +211,7 @@ WebRtc_Word16 WebRtcIsac_ToLogDomainRemoveMean(
|
||||
* Output:
|
||||
* -out : decorrelated parameters.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DecorrelateLPGain(
|
||||
int16_t WebRtcIsac_DecorrelateLPGain(
|
||||
const double* data,
|
||||
double* out);
|
||||
|
||||
@ -244,7 +244,7 @@ double WebRtcIsac_QuantizeLpcGain(
|
||||
* Output:
|
||||
* -lpcGains : quantized values of the given parametes.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DequantizeLpcGain(
|
||||
int16_t WebRtcIsac_DequantizeLpcGain(
|
||||
const int* idx,
|
||||
double* lpGains);
|
||||
|
||||
@ -260,7 +260,7 @@ WebRtc_Word16 WebRtcIsac_DequantizeLpcGain(
|
||||
* Output:
|
||||
* -out : correlated parameters.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_CorrelateLpcGain(
|
||||
int16_t WebRtcIsac_CorrelateLpcGain(
|
||||
const double* data,
|
||||
double* out);
|
||||
|
||||
@ -276,7 +276,7 @@ WebRtc_Word16 WebRtcIsac_CorrelateLpcGain(
|
||||
* Output:
|
||||
* -lpcGain : LPC gain in normal domain.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_AddMeanToLinearDomain(
|
||||
int16_t WebRtcIsac_AddMeanToLinearDomain(
|
||||
double* lpcGains);
|
||||
|
||||
|
||||
|
||||
@ -34,32 +34,32 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
static const WebRtc_UWord16 kLpcVecPerSegmentUb12 = 5;
|
||||
static const WebRtc_UWord16 kLpcVecPerSegmentUb16 = 4;
|
||||
static const uint16_t kLpcVecPerSegmentUb12 = 5;
|
||||
static const uint16_t kLpcVecPerSegmentUb16 = 4;
|
||||
|
||||
/* CDF array for encoder bandwidth (12 vs 16 kHz) indicator. */
|
||||
static const WebRtc_UWord16 kOneBitEqualProbCdf[3] = {
|
||||
static const uint16_t kOneBitEqualProbCdf[3] = {
|
||||
0, 32768, 65535 };
|
||||
|
||||
/* Pointer to cdf array for encoder bandwidth (12 vs 16 kHz) indicator. */
|
||||
static const WebRtc_UWord16* kOneBitEqualProbCdf_ptr[1] = {
|
||||
static const uint16_t* kOneBitEqualProbCdf_ptr[1] = {
|
||||
kOneBitEqualProbCdf };
|
||||
|
||||
/*
|
||||
* Initial cdf index for decoder of encoded bandwidth
|
||||
* (12 vs 16 kHz) indicator.
|
||||
*/
|
||||
static const WebRtc_UWord16 kOneBitEqualProbInitIndex[1] = { 1 };
|
||||
static const uint16_t kOneBitEqualProbInitIndex[1] = { 1 };
|
||||
|
||||
|
||||
static const int kIsSWB12 = 1;
|
||||
|
||||
/* compute correlation from power spectrum */
|
||||
static void FindCorrelation(WebRtc_Word32* PSpecQ12, WebRtc_Word32* CorrQ7) {
|
||||
WebRtc_Word32 summ[FRAMESAMPLES / 8];
|
||||
WebRtc_Word32 diff[FRAMESAMPLES / 8];
|
||||
const WebRtc_Word16* CS_ptrQ9;
|
||||
WebRtc_Word32 sum;
|
||||
static void FindCorrelation(int32_t* PSpecQ12, int32_t* CorrQ7) {
|
||||
int32_t summ[FRAMESAMPLES / 8];
|
||||
int32_t diff[FRAMESAMPLES / 8];
|
||||
const int16_t* CS_ptrQ9;
|
||||
int32_t sum;
|
||||
int k, n;
|
||||
|
||||
for (k = 0; k < FRAMESAMPLES / 8; k++) {
|
||||
@ -92,15 +92,15 @@ static void FindCorrelation(WebRtc_Word32* PSpecQ12, WebRtc_Word32* CorrQ7) {
|
||||
|
||||
/* compute inverse AR power spectrum */
|
||||
/* Changed to the function used in iSAC FIX for compatibility reasons */
|
||||
static void FindInvArSpec(const WebRtc_Word16* ARCoefQ12,
|
||||
const WebRtc_Word32 gainQ10,
|
||||
WebRtc_Word32* CurveQ16) {
|
||||
WebRtc_Word32 CorrQ11[AR_ORDER + 1];
|
||||
WebRtc_Word32 sum, tmpGain;
|
||||
WebRtc_Word32 diffQ16[FRAMESAMPLES / 8];
|
||||
const WebRtc_Word16* CS_ptrQ9;
|
||||
static void FindInvArSpec(const int16_t* ARCoefQ12,
|
||||
const int32_t gainQ10,
|
||||
int32_t* CurveQ16) {
|
||||
int32_t CorrQ11[AR_ORDER + 1];
|
||||
int32_t sum, tmpGain;
|
||||
int32_t diffQ16[FRAMESAMPLES / 8];
|
||||
const int16_t* CS_ptrQ9;
|
||||
int k, n;
|
||||
WebRtc_Word16 round, shftVal = 0, sh;
|
||||
int16_t round, shftVal = 0, sh;
|
||||
|
||||
sum = 0;
|
||||
for (n = 0; n < AR_ORDER + 1; n++) {
|
||||
@ -174,10 +174,10 @@ static void FindInvArSpec(const WebRtc_Word16* ARCoefQ12,
|
||||
}
|
||||
|
||||
/* Generate array of dither samples in Q7. */
|
||||
static void GenerateDitherQ7Lb(WebRtc_Word16* bufQ7, WebRtc_UWord32 seed,
|
||||
int length, WebRtc_Word16 AvgPitchGain_Q12) {
|
||||
static void GenerateDitherQ7Lb(int16_t* bufQ7, uint32_t seed,
|
||||
int length, int16_t AvgPitchGain_Q12) {
|
||||
int k, shft;
|
||||
WebRtc_Word16 dither1_Q7, dither2_Q7, dither_gain_Q14;
|
||||
int16_t dither1_Q7, dither2_Q7, dither_gain_Q14;
|
||||
|
||||
/* This threshold should be equal to that in decode_spec(). */
|
||||
if (AvgPitchGain_Q12 < 614) {
|
||||
@ -187,13 +187,13 @@ static void GenerateDitherQ7Lb(WebRtc_Word16* bufQ7, WebRtc_UWord32 seed,
|
||||
|
||||
/* Fixed-point dither sample between -64 and 64 (Q7). */
|
||||
/* dither = seed * 128 / 4294967295 */
|
||||
dither1_Q7 = (WebRtc_Word16)(((int)seed + 16777216) >> 25);
|
||||
dither1_Q7 = (int16_t)(((int)seed + 16777216) >> 25);
|
||||
|
||||
/* New random unsigned int. */
|
||||
seed = (seed * 196314165) + 907633515;
|
||||
|
||||
/* Fixed-point dither sample between -64 and 64. */
|
||||
dither2_Q7 = (WebRtc_Word16)(((int)seed + 16777216) >> 25);
|
||||
dither2_Q7 = (int16_t)(((int)seed + 16777216) >> 25);
|
||||
|
||||
shft = (seed >> 25) & 15;
|
||||
if (shft < 5) {
|
||||
@ -211,7 +211,7 @@ static void GenerateDitherQ7Lb(WebRtc_Word16* bufQ7, WebRtc_UWord32 seed,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dither_gain_Q14 = (WebRtc_Word16)(22528 - 10 * AvgPitchGain_Q12);
|
||||
dither_gain_Q14 = (int16_t)(22528 - 10 * AvgPitchGain_Q12);
|
||||
|
||||
/* Dither on half of the coefficients. */
|
||||
for (k = 0; k < length - 1; k += 2) {
|
||||
@ -219,7 +219,7 @@ static void GenerateDitherQ7Lb(WebRtc_Word16* bufQ7, WebRtc_UWord32 seed,
|
||||
seed = (seed * 196314165) + 907633515;
|
||||
|
||||
/* Fixed-point dither sample between -64 and 64. */
|
||||
dither1_Q7 = (WebRtc_Word16)(((int)seed + 16777216) >> 25);
|
||||
dither1_Q7 = (int16_t)(((int)seed + 16777216) >> 25);
|
||||
|
||||
/* Dither sample is placed in either even or odd index. */
|
||||
shft = (seed >> 25) & 1; /* Either 0 or 1 */
|
||||
@ -249,8 +249,8 @@ static void GenerateDitherQ7Lb(WebRtc_Word16* bufQ7, WebRtc_UWord32 seed,
|
||||
* -bufQ7 : pointer to a buffer where dithers are written to.
|
||||
*/
|
||||
static void GenerateDitherQ7LbUB(
|
||||
WebRtc_Word16* bufQ7,
|
||||
WebRtc_UWord32 seed,
|
||||
int16_t* bufQ7,
|
||||
uint32_t seed,
|
||||
int length) {
|
||||
int k;
|
||||
for (k = 0; k < length; k++) {
|
||||
@ -259,10 +259,10 @@ static void GenerateDitherQ7LbUB(
|
||||
|
||||
/* Fixed-point dither sample between -64 and 64 (Q7). */
|
||||
/* bufQ7 = seed * 128 / 4294967295 */
|
||||
bufQ7[k] = (WebRtc_Word16)(((int)seed + 16777216) >> 25);
|
||||
bufQ7[k] = (int16_t)(((int)seed + 16777216) >> 25);
|
||||
|
||||
/* Scale by 0.35. */
|
||||
bufQ7[k] = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(bufQ7[k], 2048, 13);
|
||||
bufQ7[k] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(bufQ7[k], 2048, 13);
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,18 +270,18 @@ static void GenerateDitherQ7LbUB(
|
||||
* Function to decode the complex spectrum from the bit stream
|
||||
* returns the total number of bytes in the stream.
|
||||
*/
|
||||
int WebRtcIsac_DecodeSpec(Bitstr* streamdata, WebRtc_Word16 AvgPitchGain_Q12,
|
||||
int WebRtcIsac_DecodeSpec(Bitstr* streamdata, int16_t AvgPitchGain_Q12,
|
||||
enum ISACBand band, double* fr, double* fi) {
|
||||
WebRtc_Word16 DitherQ7[FRAMESAMPLES];
|
||||
WebRtc_Word16 data[FRAMESAMPLES];
|
||||
WebRtc_Word32 invARSpec2_Q16[FRAMESAMPLES_QUARTER];
|
||||
WebRtc_UWord16 invARSpecQ8[FRAMESAMPLES_QUARTER];
|
||||
WebRtc_Word16 ARCoefQ12[AR_ORDER + 1];
|
||||
WebRtc_Word16 RCQ15[AR_ORDER];
|
||||
WebRtc_Word16 gainQ10;
|
||||
WebRtc_Word32 gain2_Q10, res;
|
||||
WebRtc_Word32 in_sqrt;
|
||||
WebRtc_Word32 newRes;
|
||||
int16_t DitherQ7[FRAMESAMPLES];
|
||||
int16_t data[FRAMESAMPLES];
|
||||
int32_t invARSpec2_Q16[FRAMESAMPLES_QUARTER];
|
||||
uint16_t invARSpecQ8[FRAMESAMPLES_QUARTER];
|
||||
int16_t ARCoefQ12[AR_ORDER + 1];
|
||||
int16_t RCQ15[AR_ORDER];
|
||||
int16_t gainQ10;
|
||||
int32_t gain2_Q10, res;
|
||||
int32_t in_sqrt;
|
||||
int32_t newRes;
|
||||
int k, len, i;
|
||||
int is_12khz = !kIsSWB12;
|
||||
int num_dft_coeff = FRAMESAMPLES;
|
||||
@ -326,7 +326,7 @@ int WebRtcIsac_DecodeSpec(Bitstr* streamdata, WebRtc_Word16 AvgPitchGain_Q12,
|
||||
newRes = (in_sqrt / res + res) >> 1;
|
||||
} while (newRes != res && i-- > 0);
|
||||
|
||||
invARSpecQ8[k] = (WebRtc_Word16)newRes;
|
||||
invARSpecQ8[k] = (int16_t)newRes;
|
||||
}
|
||||
|
||||
len = WebRtcIsac_DecLogisticMulti2(data, streamdata, invARSpecQ8, DitherQ7,
|
||||
@ -339,8 +339,8 @@ int WebRtcIsac_DecodeSpec(Bitstr* streamdata, WebRtc_Word16 AvgPitchGain_Q12,
|
||||
switch (band) {
|
||||
case kIsacLowerBand: {
|
||||
/* Scale down spectral samples with low SNR. */
|
||||
WebRtc_Word32 p1;
|
||||
WebRtc_Word32 p2;
|
||||
int32_t p1;
|
||||
int32_t p2;
|
||||
if (AvgPitchGain_Q12 <= 614) {
|
||||
p1 = 30 << 10;
|
||||
p2 = 32768 + (33 << 16);
|
||||
@ -349,7 +349,7 @@ int WebRtcIsac_DecodeSpec(Bitstr* streamdata, WebRtc_Word16 AvgPitchGain_Q12,
|
||||
p2 = 32768 + (40 << 16);
|
||||
}
|
||||
for (k = 0; k < FRAMESAMPLES; k += 4) {
|
||||
gainQ10 = WebRtcSpl_DivW32W16ResW16(p1, (WebRtc_Word16)(
|
||||
gainQ10 = WebRtcSpl_DivW32W16ResW16(p1, (int16_t)(
|
||||
(invARSpec2_Q16[k >> 2] + p2) >> 16));
|
||||
*fr++ = (double)((data[ k ] * gainQ10 + 512) >> 10) / 128.0;
|
||||
*fi++ = (double)((data[k + 1] * gainQ10 + 512) >> 10) / 128.0;
|
||||
@ -391,26 +391,26 @@ int WebRtcIsac_DecodeSpec(Bitstr* streamdata, WebRtc_Word16 AvgPitchGain_Q12,
|
||||
}
|
||||
|
||||
|
||||
int WebRtcIsac_EncodeSpec(const WebRtc_Word16* fr, const WebRtc_Word16* fi,
|
||||
WebRtc_Word16 AvgPitchGain_Q12, enum ISACBand band,
|
||||
int WebRtcIsac_EncodeSpec(const int16_t* fr, const int16_t* fi,
|
||||
int16_t AvgPitchGain_Q12, enum ISACBand band,
|
||||
Bitstr* streamdata) {
|
||||
WebRtc_Word16 ditherQ7[FRAMESAMPLES];
|
||||
WebRtc_Word16 dataQ7[FRAMESAMPLES];
|
||||
WebRtc_Word32 PSpec[FRAMESAMPLES_QUARTER];
|
||||
WebRtc_Word32 invARSpec2_Q16[FRAMESAMPLES_QUARTER];
|
||||
WebRtc_UWord16 invARSpecQ8[FRAMESAMPLES_QUARTER];
|
||||
WebRtc_Word32 CorrQ7[AR_ORDER + 1];
|
||||
WebRtc_Word32 CorrQ7_norm[AR_ORDER + 1];
|
||||
WebRtc_Word16 RCQ15[AR_ORDER];
|
||||
WebRtc_Word16 ARCoefQ12[AR_ORDER + 1];
|
||||
WebRtc_Word32 gain2_Q10;
|
||||
WebRtc_Word16 val;
|
||||
WebRtc_Word32 nrg, res;
|
||||
WebRtc_UWord32 sum;
|
||||
WebRtc_Word32 in_sqrt;
|
||||
WebRtc_Word32 newRes;
|
||||
WebRtc_Word16 err;
|
||||
WebRtc_UWord32 nrg_u32;
|
||||
int16_t ditherQ7[FRAMESAMPLES];
|
||||
int16_t dataQ7[FRAMESAMPLES];
|
||||
int32_t PSpec[FRAMESAMPLES_QUARTER];
|
||||
int32_t invARSpec2_Q16[FRAMESAMPLES_QUARTER];
|
||||
uint16_t invARSpecQ8[FRAMESAMPLES_QUARTER];
|
||||
int32_t CorrQ7[AR_ORDER + 1];
|
||||
int32_t CorrQ7_norm[AR_ORDER + 1];
|
||||
int16_t RCQ15[AR_ORDER];
|
||||
int16_t ARCoefQ12[AR_ORDER + 1];
|
||||
int32_t gain2_Q10;
|
||||
int16_t val;
|
||||
int32_t nrg, res;
|
||||
uint32_t sum;
|
||||
int32_t in_sqrt;
|
||||
int32_t newRes;
|
||||
int16_t err;
|
||||
uint32_t nrg_u32;
|
||||
int shift_var;
|
||||
int k, n, j, i;
|
||||
int is_12khz = !kIsSWB12;
|
||||
@ -542,7 +542,7 @@ int WebRtcIsac_EncodeSpec(const WebRtc_Word16* fr, const WebRtc_Word16* fi,
|
||||
}
|
||||
}
|
||||
|
||||
nrg_u32 = (WebRtc_UWord32)nrg;
|
||||
nrg_u32 = (uint32_t)nrg;
|
||||
if (shift_var > 0) {
|
||||
nrg_u32 = nrg_u32 >> shift_var;
|
||||
} else {
|
||||
@ -551,7 +551,7 @@ int WebRtcIsac_EncodeSpec(const WebRtc_Word16* fr, const WebRtc_Word16* fi,
|
||||
if (nrg_u32 > 0x7FFFFFFF) {
|
||||
nrg = 0x7FFFFFFF;
|
||||
} else {
|
||||
nrg = (WebRtc_Word32)nrg_u32;
|
||||
nrg = (int32_t)nrg_u32;
|
||||
}
|
||||
/* Also shifts 31 bits to the left! */
|
||||
gain2_Q10 = WebRtcSpl_DivResultInQ31(FRAMESAMPLES_QUARTER, nrg);
|
||||
@ -579,7 +579,7 @@ int WebRtcIsac_EncodeSpec(const WebRtc_Word16* fr, const WebRtc_Word16* fi,
|
||||
newRes = (in_sqrt / res + res) >> 1;
|
||||
} while (newRes != res && i-- > 0);
|
||||
|
||||
invARSpecQ8[k] = (WebRtc_Word16)newRes;
|
||||
invARSpecQ8[k] = (int16_t)newRes;
|
||||
}
|
||||
/* arithmetic coding of spectrum */
|
||||
err = WebRtcIsac_EncLogisticMulti2(streamdata, dataQ7, invARSpecQ8,
|
||||
@ -682,13 +682,13 @@ void WebRtcIsac_Poly2Lar(double* lowband, int orderLo, double* hiband,
|
||||
}
|
||||
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_Poly2LarUB(double* lpcVecs, WebRtc_Word16 bandwidth) {
|
||||
int16_t WebRtcIsac_Poly2LarUB(double* lpcVecs, int16_t bandwidth) {
|
||||
double poly[MAX_ORDER];
|
||||
double rc[MAX_ORDER];
|
||||
double* ptrIO;
|
||||
WebRtc_Word16 vecCntr;
|
||||
WebRtc_Word16 vecSize;
|
||||
WebRtc_Word16 numVec;
|
||||
int16_t vecCntr;
|
||||
int16_t vecSize;
|
||||
int16_t numVec;
|
||||
|
||||
vecSize = UB_LPC_ORDER;
|
||||
switch (bandwidth) {
|
||||
@ -791,16 +791,16 @@ int WebRtcIsac_DecodeLpc(Bitstr* streamdata, double* LPCCoef_lo,
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_DecodeInterpolLpcUb(Bitstr* streamdata,
|
||||
double* percepFilterParams,
|
||||
WebRtc_Word16 bandwidth) {
|
||||
int16_t WebRtcIsac_DecodeInterpolLpcUb(Bitstr* streamdata,
|
||||
double* percepFilterParams,
|
||||
int16_t bandwidth) {
|
||||
double lpcCoeff[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
int err;
|
||||
int interpolCntr;
|
||||
int subframeCntr;
|
||||
WebRtc_Word16 numSegments;
|
||||
WebRtc_Word16 numVecPerSegment;
|
||||
WebRtc_Word16 numGains;
|
||||
int16_t numSegments;
|
||||
int16_t numVecPerSegment;
|
||||
int16_t numGains;
|
||||
|
||||
double percepFilterGains[SUBFRAMES << 1];
|
||||
double* ptrOutParam = percepFilterParams;
|
||||
@ -1181,9 +1181,9 @@ void WebRtcIsac_EncodeLpcLb(double* LPCCoef_lo, double* LPCCoef_hi,
|
||||
}
|
||||
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_EncodeLpcUB(double* lpcVecs, Bitstr* streamdata,
|
||||
double* interpolLPCCoeff,
|
||||
WebRtc_Word16 bandwidth,
|
||||
int16_t WebRtcIsac_EncodeLpcUB(double* lpcVecs, Bitstr* streamdata,
|
||||
double* interpolLPCCoeff,
|
||||
int16_t bandwidth,
|
||||
ISACUBSaveEncDataStruct* encData) {
|
||||
double U[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
int idx[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
@ -1402,7 +1402,7 @@ void WebRtcIsac_StoreLpcGainUb(double* lpGains, Bitstr* streamdata) {
|
||||
|
||||
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_DecodeLpcGainUb(double* lpGains, Bitstr* streamdata) {
|
||||
int16_t WebRtcIsac_DecodeLpcGainUb(double* lpGains, Bitstr* streamdata) {
|
||||
double U[UB_LPC_GAIN_DIM];
|
||||
int idx[UB_LPC_GAIN_DIM];
|
||||
int err;
|
||||
@ -1422,7 +1422,7 @@ WebRtc_Word16 WebRtcIsac_DecodeLpcGainUb(double* lpGains, Bitstr* streamdata) {
|
||||
|
||||
|
||||
/* decode & dequantize RC */
|
||||
int WebRtcIsac_DecodeRc(Bitstr* streamdata, WebRtc_Word16* RCQ15) {
|
||||
int WebRtcIsac_DecodeRc(Bitstr* streamdata, int16_t* RCQ15) {
|
||||
int k, err;
|
||||
int index[AR_ORDER];
|
||||
|
||||
@ -1442,7 +1442,7 @@ int WebRtcIsac_DecodeRc(Bitstr* streamdata, WebRtc_Word16* RCQ15) {
|
||||
|
||||
|
||||
/* quantize & code RC */
|
||||
void WebRtcIsac_EncodeRc(WebRtc_Word16* RCQ15, Bitstr* streamdata) {
|
||||
void WebRtcIsac_EncodeRc(int16_t* RCQ15, Bitstr* streamdata) {
|
||||
int k;
|
||||
int index[AR_ORDER];
|
||||
|
||||
@ -1466,7 +1466,7 @@ void WebRtcIsac_EncodeRc(WebRtc_Word16* RCQ15, Bitstr* streamdata) {
|
||||
|
||||
|
||||
/* decode & dequantize squared Gain */
|
||||
int WebRtcIsac_DecodeGain2(Bitstr* streamdata, WebRtc_Word32* gainQ10) {
|
||||
int WebRtcIsac_DecodeGain2(Bitstr* streamdata, int32_t* gainQ10) {
|
||||
int index, err;
|
||||
|
||||
/* entropy decoding of quantization index */
|
||||
@ -1483,7 +1483,7 @@ int WebRtcIsac_DecodeGain2(Bitstr* streamdata, WebRtc_Word32* gainQ10) {
|
||||
|
||||
|
||||
/* quantize & code squared Gain */
|
||||
int WebRtcIsac_EncodeGain2(WebRtc_Word32* gainQ10, Bitstr* streamdata) {
|
||||
int WebRtcIsac_EncodeGain2(int32_t* gainQ10, Bitstr* streamdata) {
|
||||
int index;
|
||||
|
||||
/* find quantization index */
|
||||
@ -1508,9 +1508,9 @@ int WebRtcIsac_EncodeGain2(WebRtc_Word32* gainQ10, Bitstr* streamdata) {
|
||||
|
||||
/* decode & dequantize Pitch Gains */
|
||||
int WebRtcIsac_DecodePitchGain(Bitstr* streamdata,
|
||||
WebRtc_Word16* PitchGains_Q12) {
|
||||
int16_t* PitchGains_Q12) {
|
||||
int index_comb, err;
|
||||
const WebRtc_UWord16* WebRtcIsac_kQPitchGainCdf_ptr[1];
|
||||
const uint16_t* WebRtcIsac_kQPitchGainCdf_ptr[1];
|
||||
|
||||
/* Entropy decoding of quantization indices */
|
||||
*WebRtcIsac_kQPitchGainCdf_ptr = WebRtcIsac_kQPitchGainCdf;
|
||||
@ -1531,7 +1531,7 @@ int WebRtcIsac_DecodePitchGain(Bitstr* streamdata,
|
||||
|
||||
|
||||
/* Quantize & code Pitch Gains. */
|
||||
void WebRtcIsac_EncodePitchGain(WebRtc_Word16* PitchGains_Q12,
|
||||
void WebRtcIsac_EncodePitchGain(int16_t* PitchGains_Q12,
|
||||
Bitstr* streamdata,
|
||||
ISAC_SaveEncData_t* encData) {
|
||||
int k, j;
|
||||
@ -1539,7 +1539,7 @@ void WebRtcIsac_EncodePitchGain(WebRtc_Word16* PitchGains_Q12,
|
||||
double S[PITCH_SUBFRAMES];
|
||||
int index[3];
|
||||
int index_comb;
|
||||
const WebRtc_UWord16* WebRtcIsac_kQPitchGainCdf_ptr[1];
|
||||
const uint16_t* WebRtcIsac_kQPitchGainCdf_ptr[1];
|
||||
double PitchGains[PITCH_SUBFRAMES] = {0, 0, 0, 0};
|
||||
|
||||
/* Take the asin. */
|
||||
@ -1589,7 +1589,7 @@ void WebRtcIsac_EncodePitchGain(WebRtc_Word16* PitchGains_Q12,
|
||||
|
||||
/* Pitch LAG */
|
||||
/* Decode & de-quantize Pitch Lags. */
|
||||
int WebRtcIsac_DecodePitchLag(Bitstr* streamdata, WebRtc_Word16* PitchGain_Q12,
|
||||
int WebRtcIsac_DecodePitchLag(Bitstr* streamdata, int16_t* PitchGain_Q12,
|
||||
double* PitchLags) {
|
||||
int k, err;
|
||||
double StepSize;
|
||||
@ -1597,10 +1597,10 @@ int WebRtcIsac_DecodePitchLag(Bitstr* streamdata, WebRtc_Word16* PitchGain_Q12,
|
||||
int index[PITCH_SUBFRAMES];
|
||||
double mean_gain;
|
||||
const double* mean_val2, *mean_val3, *mean_val4;
|
||||
const WebRtc_Word16* lower_limit;
|
||||
const WebRtc_UWord16* init_index;
|
||||
const WebRtc_UWord16* cdf_size;
|
||||
const WebRtc_UWord16** cdf;
|
||||
const int16_t* lower_limit;
|
||||
const uint16_t* init_index;
|
||||
const uint16_t* cdf_size;
|
||||
const uint16_t** cdf;
|
||||
double PitchGain[4] = {0, 0, 0, 0};
|
||||
|
||||
/* compute mean pitch gain */
|
||||
@ -1676,7 +1676,7 @@ int WebRtcIsac_DecodePitchLag(Bitstr* streamdata, WebRtc_Word16* PitchGain_Q12,
|
||||
|
||||
|
||||
/* Quantize & code pitch lags. */
|
||||
void WebRtcIsac_EncodePitchLag(double* PitchLags, WebRtc_Word16* PitchGain_Q12,
|
||||
void WebRtcIsac_EncodePitchLag(double* PitchLags, int16_t* PitchGain_Q12,
|
||||
Bitstr* streamdata,
|
||||
ISAC_SaveEncData_t* encData) {
|
||||
int k, j;
|
||||
@ -1685,8 +1685,8 @@ void WebRtcIsac_EncodePitchLag(double* PitchLags, WebRtc_Word16* PitchGain_Q12,
|
||||
int index[PITCH_SUBFRAMES];
|
||||
double mean_gain;
|
||||
const double* mean_val2, *mean_val3, *mean_val4;
|
||||
const WebRtc_Word16* lower_limit, *upper_limit;
|
||||
const WebRtc_UWord16** cdf;
|
||||
const int16_t* lower_limit, *upper_limit;
|
||||
const uint16_t** cdf;
|
||||
double PitchGain[4] = {0, 0, 0, 0};
|
||||
|
||||
/* compute mean pitch gain */
|
||||
@ -1777,18 +1777,18 @@ void WebRtcIsac_EncodePitchLag(double* PitchLags, WebRtc_Word16* PitchGain_Q12,
|
||||
|
||||
|
||||
/* cdf array for frame length indicator */
|
||||
const WebRtc_UWord16 WebRtcIsac_kFrameLengthCdf[4] = {
|
||||
const uint16_t WebRtcIsac_kFrameLengthCdf[4] = {
|
||||
0, 21845, 43690, 65535 };
|
||||
|
||||
/* pointer to cdf array for frame length indicator */
|
||||
const WebRtc_UWord16* WebRtcIsac_kFrameLengthCdf_ptr[1] = {
|
||||
const uint16_t* WebRtcIsac_kFrameLengthCdf_ptr[1] = {
|
||||
WebRtcIsac_kFrameLengthCdf };
|
||||
|
||||
/* initial cdf index for decoder of frame length indicator */
|
||||
const WebRtc_UWord16 WebRtcIsac_kFrameLengthInitIndex[1] = { 1 };
|
||||
const uint16_t WebRtcIsac_kFrameLengthInitIndex[1] = { 1 };
|
||||
|
||||
|
||||
int WebRtcIsac_DecodeFrameLen(Bitstr* streamdata, WebRtc_Word16* framesamples) {
|
||||
int WebRtcIsac_DecodeFrameLen(Bitstr* streamdata, int16_t* framesamples) {
|
||||
int frame_mode, err;
|
||||
err = 0;
|
||||
/* entropy decoding of frame length [1:30ms,2:60ms] */
|
||||
@ -1811,7 +1811,7 @@ int WebRtcIsac_DecodeFrameLen(Bitstr* streamdata, WebRtc_Word16* framesamples) {
|
||||
return err;
|
||||
}
|
||||
|
||||
int WebRtcIsac_EncodeFrameLen(WebRtc_Word16 framesamples, Bitstr* streamdata) {
|
||||
int WebRtcIsac_EncodeFrameLen(int16_t framesamples, Bitstr* streamdata) {
|
||||
int frame_mode, status;
|
||||
|
||||
status = 0;
|
||||
@ -1837,19 +1837,19 @@ int WebRtcIsac_EncodeFrameLen(WebRtc_Word16 framesamples, Bitstr* streamdata) {
|
||||
}
|
||||
|
||||
/* cdf array for estimated bandwidth */
|
||||
static const WebRtc_UWord16 kBwCdf[25] = {
|
||||
static const uint16_t kBwCdf[25] = {
|
||||
0, 2731, 5461, 8192, 10923, 13653, 16384, 19114, 21845, 24576, 27306, 30037,
|
||||
32768, 35498, 38229, 40959, 43690, 46421, 49151, 51882, 54613, 57343, 60074,
|
||||
62804, 65535 };
|
||||
|
||||
/* pointer to cdf array for estimated bandwidth */
|
||||
static const WebRtc_UWord16* kBwCdfPtr[1] = { kBwCdf };
|
||||
static const uint16_t* kBwCdfPtr[1] = { kBwCdf };
|
||||
|
||||
/* initial cdf index for decoder of estimated bandwidth*/
|
||||
static const WebRtc_UWord16 kBwInitIndex[1] = { 7 };
|
||||
static const uint16_t kBwInitIndex[1] = { 7 };
|
||||
|
||||
|
||||
int WebRtcIsac_DecodeSendBW(Bitstr* streamdata, WebRtc_Word16* BWno) {
|
||||
int WebRtcIsac_DecodeSendBW(Bitstr* streamdata, int16_t* BWno) {
|
||||
int BWno32, err;
|
||||
|
||||
/* entropy decoding of sender's BW estimation [0..23] */
|
||||
@ -1858,7 +1858,7 @@ int WebRtcIsac_DecodeSendBW(Bitstr* streamdata, WebRtc_Word16* BWno) {
|
||||
if (err < 0) {
|
||||
return -ISAC_RANGE_ERROR_DECODE_BANDWIDTH;
|
||||
}
|
||||
*BWno = (WebRtc_Word16)BWno32;
|
||||
*BWno = (int16_t)BWno32;
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1950,7 +1950,7 @@ void WebRtcIsac_TranscodeLPCCoef(double* LPCCoef_lo, double* LPCCoef_hi,
|
||||
/* Decode & de-quantize LPC Coefficients. */
|
||||
int WebRtcIsac_DecodeLpcCoefUB(Bitstr* streamdata, double* lpcVecs,
|
||||
double* percepFilterGains,
|
||||
WebRtc_Word16 bandwidth) {
|
||||
int16_t bandwidth) {
|
||||
int index_s[KLT_ORDER_SHAPE];
|
||||
|
||||
double U[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
@ -1993,8 +1993,8 @@ int WebRtcIsac_DecodeLpcCoefUB(Bitstr* streamdata, double* lpcVecs,
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_EncodeBandwidth(enum ISACBandwidth bandwidth,
|
||||
Bitstr* streamData) {
|
||||
int16_t WebRtcIsac_EncodeBandwidth(enum ISACBandwidth bandwidth,
|
||||
Bitstr* streamData) {
|
||||
int bandwidthMode;
|
||||
switch (bandwidth) {
|
||||
case isac12kHz: {
|
||||
@ -2013,8 +2013,8 @@ WebRtc_Word16 WebRtcIsac_EncodeBandwidth(enum ISACBandwidth bandwidth,
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_DecodeBandwidth(Bitstr* streamData,
|
||||
enum ISACBandwidth* bandwidth) {
|
||||
int16_t WebRtcIsac_DecodeBandwidth(Bitstr* streamData,
|
||||
enum ISACBandwidth* bandwidth) {
|
||||
int bandwidthMode;
|
||||
if (WebRtcIsac_DecHistOneStepMulti(&bandwidthMode, streamData,
|
||||
kOneBitEqualProbCdf_ptr,
|
||||
@ -2036,8 +2036,8 @@ WebRtc_Word16 WebRtcIsac_DecodeBandwidth(Bitstr* streamData,
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_EncodeJitterInfo(WebRtc_Word32 jitterIndex,
|
||||
Bitstr* streamData) {
|
||||
int16_t WebRtcIsac_EncodeJitterInfo(int32_t jitterIndex,
|
||||
Bitstr* streamData) {
|
||||
/* This is to avoid LINUX warning until we change 'int' to 'Word32'. */
|
||||
int intVar;
|
||||
|
||||
@ -2051,8 +2051,8 @@ WebRtc_Word16 WebRtcIsac_EncodeJitterInfo(WebRtc_Word32 jitterIndex,
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_DecodeJitterInfo(Bitstr* streamData,
|
||||
WebRtc_Word32* jitterInfo) {
|
||||
int16_t WebRtcIsac_DecodeJitterInfo(Bitstr* streamData,
|
||||
int32_t* jitterInfo) {
|
||||
int intVar;
|
||||
/* Use the same CDF table as for bandwidth
|
||||
* both take two values with equal probability. */
|
||||
@ -2061,6 +2061,6 @@ WebRtc_Word16 WebRtcIsac_DecodeJitterInfo(Bitstr* streamData,
|
||||
kOneBitEqualProbInitIndex, 1) < 0) {
|
||||
return -ISAC_RANGE_ERROR_DECODE_BANDWITH;
|
||||
}
|
||||
*jitterInfo = (WebRtc_Word16)(intVar);
|
||||
*jitterInfo = (int16_t)(intVar);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
* Return value : < 0 if an error occures
|
||||
* 0 if succeeded.
|
||||
*/
|
||||
int WebRtcIsac_DecodeSpec(Bitstr* streamdata, WebRtc_Word16 AvgPitchGain_Q12,
|
||||
int WebRtcIsac_DecodeSpec(Bitstr* streamdata, int16_t AvgPitchGain_Q12,
|
||||
enum ISACBand band, double* fr, double* fi);
|
||||
|
||||
/******************************************************************************
|
||||
@ -72,15 +72,15 @@ int WebRtcIsac_DecodeSpec(Bitstr* streamdata, WebRtc_Word16 AvgPitchGain_Q12,
|
||||
* Return value : < 0 if an error occures
|
||||
* 0 if succeeded.
|
||||
*/
|
||||
int WebRtcIsac_EncodeSpec(const WebRtc_Word16* fr, const WebRtc_Word16* fi,
|
||||
WebRtc_Word16 AvgPitchGain_Q12, enum ISACBand band,
|
||||
int WebRtcIsac_EncodeSpec(const int16_t* fr, const int16_t* fi,
|
||||
int16_t AvgPitchGain_Q12, enum ISACBand band,
|
||||
Bitstr* streamdata);
|
||||
|
||||
/* decode & dequantize LPC Coef */
|
||||
int WebRtcIsac_DecodeLpcCoef(Bitstr* streamdata, double* LPCCoef);
|
||||
int WebRtcIsac_DecodeLpcCoefUB(Bitstr* streamdata, double* lpcVecs,
|
||||
double* percepFilterGains,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t bandwidth);
|
||||
|
||||
int WebRtcIsac_DecodeLpc(Bitstr* streamdata, double* LPCCoef_lo,
|
||||
double* LPCCoef_hi);
|
||||
@ -126,10 +126,10 @@ void WebRtcIsac_EncodeLpcGainLb(double* LPCCoef_lo, double* LPCCoef_hi,
|
||||
* Return value : 0 if encoding is successful,
|
||||
* <0 if failed to encode.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_EncodeLpcUB(double* lpcCoeff, Bitstr* streamdata,
|
||||
double* interpolLPCCoeff,
|
||||
WebRtc_Word16 bandwidth,
|
||||
ISACUBSaveEncDataStruct* encData);
|
||||
int16_t WebRtcIsac_EncodeLpcUB(double* lpcCoeff, Bitstr* streamdata,
|
||||
double* interpolLPCCoeff,
|
||||
int16_t bandwidth,
|
||||
ISACUBSaveEncDataStruct* encData);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DecodeInterpolLpcUb()
|
||||
@ -159,37 +159,37 @@ WebRtc_Word16 WebRtcIsac_EncodeLpcUB(double* lpcCoeff, Bitstr* streamdata,
|
||||
* Return value : 0 if encoding is successful,
|
||||
* <0 if failed to encode.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DecodeInterpolLpcUb(Bitstr* streamdata,
|
||||
double* percepFilterParam,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t WebRtcIsac_DecodeInterpolLpcUb(Bitstr* streamdata,
|
||||
double* percepFilterParam,
|
||||
int16_t bandwidth);
|
||||
|
||||
/* Decode & dequantize RC */
|
||||
int WebRtcIsac_DecodeRc(Bitstr* streamdata, WebRtc_Word16* RCQ15);
|
||||
int WebRtcIsac_DecodeRc(Bitstr* streamdata, int16_t* RCQ15);
|
||||
|
||||
/* Quantize & code RC */
|
||||
void WebRtcIsac_EncodeRc(WebRtc_Word16* RCQ15, Bitstr* streamdata);
|
||||
void WebRtcIsac_EncodeRc(int16_t* RCQ15, Bitstr* streamdata);
|
||||
|
||||
/* Decode & dequantize squared Gain */
|
||||
int WebRtcIsac_DecodeGain2(Bitstr* streamdata, WebRtc_Word32* Gain2);
|
||||
int WebRtcIsac_DecodeGain2(Bitstr* streamdata, int32_t* Gain2);
|
||||
|
||||
/* Quantize & code squared Gain (input is squared gain) */
|
||||
int WebRtcIsac_EncodeGain2(WebRtc_Word32* gain2, Bitstr* streamdata);
|
||||
int WebRtcIsac_EncodeGain2(int32_t* gain2, Bitstr* streamdata);
|
||||
|
||||
void WebRtcIsac_EncodePitchGain(WebRtc_Word16* PitchGains_Q12,
|
||||
void WebRtcIsac_EncodePitchGain(int16_t* PitchGains_Q12,
|
||||
Bitstr* streamdata,
|
||||
ISAC_SaveEncData_t* encData);
|
||||
|
||||
void WebRtcIsac_EncodePitchLag(double* PitchLags, WebRtc_Word16* PitchGain_Q12,
|
||||
void WebRtcIsac_EncodePitchLag(double* PitchLags, int16_t* PitchGain_Q12,
|
||||
Bitstr* streamdata, ISAC_SaveEncData_t* encData);
|
||||
|
||||
int WebRtcIsac_DecodePitchGain(Bitstr* streamdata,
|
||||
WebRtc_Word16* PitchGain_Q12);
|
||||
int WebRtcIsac_DecodePitchLag(Bitstr* streamdata, WebRtc_Word16* PitchGain_Q12,
|
||||
int16_t* PitchGain_Q12);
|
||||
int WebRtcIsac_DecodePitchLag(Bitstr* streamdata, int16_t* PitchGain_Q12,
|
||||
double* PitchLag);
|
||||
|
||||
int WebRtcIsac_DecodeFrameLen(Bitstr* streamdata, WebRtc_Word16* framelength);
|
||||
int WebRtcIsac_EncodeFrameLen(WebRtc_Word16 framelength, Bitstr* streamdata);
|
||||
int WebRtcIsac_DecodeSendBW(Bitstr* streamdata, WebRtc_Word16* BWno);
|
||||
int WebRtcIsac_DecodeFrameLen(Bitstr* streamdata, int16_t* framelength);
|
||||
int WebRtcIsac_EncodeFrameLen(int16_t framelength, Bitstr* streamdata);
|
||||
int WebRtcIsac_DecodeSendBW(Bitstr* streamdata, int16_t* BWno);
|
||||
void WebRtcIsac_EncodeReceiveBw(int* BWno, Bitstr* streamdata);
|
||||
|
||||
/* Step-down */
|
||||
@ -253,7 +253,7 @@ void WebRtcIsac_StoreLpcGainUb(double* lpGains, Bitstr* streamdata);
|
||||
* Return value : 0 if succeeded.
|
||||
* <0 if failed.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DecodeLpcGainUb(double* lpGains, Bitstr* streamdata);
|
||||
int16_t WebRtcIsac_DecodeLpcGainUb(double* lpGains, Bitstr* streamdata);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -272,8 +272,8 @@ WebRtc_Word16 WebRtcIsac_DecodeLpcGainUb(double* lpGains, Bitstr* streamdata);
|
||||
* Return value : 0 if succeeded.
|
||||
* <0 if failed.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_EncodeBandwidth(enum ISACBandwidth bandwidth,
|
||||
Bitstr* streamData);
|
||||
int16_t WebRtcIsac_EncodeBandwidth(enum ISACBandwidth bandwidth,
|
||||
Bitstr* streamData);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -293,8 +293,8 @@ WebRtc_Word16 WebRtcIsac_EncodeBandwidth(enum ISACBandwidth bandwidth,
|
||||
* Return value : 0 if succeeded.
|
||||
* <0 if failed.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DecodeBandwidth(Bitstr* streamData,
|
||||
enum ISACBandwidth* bandwidth);
|
||||
int16_t WebRtcIsac_DecodeBandwidth(Bitstr* streamData,
|
||||
enum ISACBandwidth* bandwidth);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -314,8 +314,8 @@ WebRtc_Word16 WebRtcIsac_DecodeBandwidth(Bitstr* streamData,
|
||||
* Return value : 0 if succeeded.
|
||||
* <0 if failed.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_EncodeJitterInfo(WebRtc_Word32 jitterIndex,
|
||||
Bitstr* streamData);
|
||||
int16_t WebRtcIsac_EncodeJitterInfo(int32_t jitterIndex,
|
||||
Bitstr* streamData);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -335,7 +335,7 @@ WebRtc_Word16 WebRtcIsac_EncodeJitterInfo(WebRtc_Word32 jitterIndex,
|
||||
* Return value : 0 if succeeded.
|
||||
* <0 if failed.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DecodeJitterInfo(Bitstr* streamData,
|
||||
WebRtc_Word32* jitterInfo);
|
||||
int16_t WebRtcIsac_DecodeJitterInfo(Bitstr* streamData,
|
||||
int32_t* jitterInfo);
|
||||
|
||||
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENTROPY_CODING_H_ */
|
||||
|
||||
@ -55,10 +55,10 @@
|
||||
*
|
||||
*/
|
||||
static void UpdatePayloadSizeLimit(ISACMainStruct* instISAC) {
|
||||
WebRtc_Word16 lim30MsPayloadBytes = WEBRTC_SPL_MIN(
|
||||
int16_t lim30MsPayloadBytes = WEBRTC_SPL_MIN(
|
||||
(instISAC->maxPayloadSizeBytes),
|
||||
(instISAC->maxRateBytesPer30Ms));
|
||||
WebRtc_Word16 lim60MsPayloadBytes = WEBRTC_SPL_MIN(
|
||||
int16_t lim60MsPayloadBytes = WEBRTC_SPL_MIN(
|
||||
(instISAC->maxPayloadSizeBytes),
|
||||
(instISAC->maxRateBytesPer30Ms << 1));
|
||||
|
||||
@ -112,7 +112,7 @@ static void UpdateBottleneck(ISACMainStruct* instISAC) {
|
||||
if ((instISAC->codingMode == 0) &&
|
||||
(instISAC->instLB.ISACencLB_obj.buffer_index == 0) &&
|
||||
(instISAC->instLB.ISACencLB_obj.frame_nb == 0)) {
|
||||
WebRtc_Word32 bottleneck;
|
||||
int32_t bottleneck;
|
||||
WebRtcIsac_GetUplinkBandwidth(&(instISAC->bwestimator_obj),
|
||||
&bottleneck);
|
||||
|
||||
@ -190,8 +190,8 @@ static void UpdateBottleneck(ISACMainStruct* instISAC) {
|
||||
*
|
||||
*/
|
||||
static void GetSendBandwidthInfo(ISACMainStruct* instISAC,
|
||||
WebRtc_Word16* bandwidthIndex,
|
||||
WebRtc_Word16* jitterInfo) {
|
||||
int16_t* bandwidthIndex,
|
||||
int16_t* jitterInfo) {
|
||||
if ((instISAC->instLB.ISACencLB_obj.buffer_index ==
|
||||
(FRAMESAMPLES_10ms << 1)) &&
|
||||
(instISAC->instLB.ISACencLB_obj.frame_nb == 0)) {
|
||||
@ -216,8 +216,8 @@ static void GetSendBandwidthInfo(ISACMainStruct* instISAC,
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_AssignSize(int* sizeInBytes) {
|
||||
*sizeInBytes = sizeof(ISACMainStruct) * 2 / sizeof(WebRtc_Word16);
|
||||
int16_t WebRtcIsac_AssignSize(int* sizeInBytes) {
|
||||
*sizeInBytes = sizeof(ISACMainStruct) * 2 / sizeof(int16_t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -235,8 +235,8 @@ WebRtc_Word16 WebRtcIsac_AssignSize(int* sizeInBytes) {
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_Assign(ISACStruct** ISAC_main_inst,
|
||||
void* instISAC_Addr) {
|
||||
int16_t WebRtcIsac_Assign(ISACStruct** ISAC_main_inst,
|
||||
void* instISAC_Addr) {
|
||||
if (instISAC_Addr != NULL) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)instISAC_Addr;
|
||||
instISAC->errorCode = 0;
|
||||
@ -269,7 +269,7 @@ WebRtc_Word16 WebRtcIsac_Assign(ISACStruct** ISAC_main_inst,
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_Create(ISACStruct** ISAC_main_inst) {
|
||||
int16_t WebRtcIsac_Create(ISACStruct** ISAC_main_inst) {
|
||||
ISACMainStruct* instISAC;
|
||||
|
||||
instISAC = (ISACMainStruct*)WEBRTC_SPL_VNEW(ISACMainStruct, 1);
|
||||
@ -300,7 +300,7 @@ WebRtc_Word16 WebRtcIsac_Create(ISACStruct** ISAC_main_inst) {
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_Free(ISACStruct* ISAC_main_inst) {
|
||||
int16_t WebRtcIsac_Free(ISACStruct* ISAC_main_inst) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
WEBRTC_SPL_FREE(instISAC);
|
||||
return 0;
|
||||
@ -329,10 +329,10 @@ WebRtc_Word16 WebRtcIsac_Free(ISACStruct* ISAC_main_inst) {
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
static WebRtc_Word16 EncoderInitLb(ISACLBStruct* instLB,
|
||||
WebRtc_Word16 codingMode,
|
||||
enum IsacSamplingRate sampRate) {
|
||||
WebRtc_Word16 statusInit = 0;
|
||||
static int16_t EncoderInitLb(ISACLBStruct* instLB,
|
||||
int16_t codingMode,
|
||||
enum IsacSamplingRate sampRate) {
|
||||
int16_t statusInit = 0;
|
||||
int k;
|
||||
|
||||
/* Init stream vector to zero */
|
||||
@ -371,9 +371,9 @@ static WebRtc_Word16 EncoderInitLb(ISACLBStruct* instLB,
|
||||
return statusInit;
|
||||
}
|
||||
|
||||
static WebRtc_Word16 EncoderInitUb(ISACUBStruct* instUB,
|
||||
WebRtc_Word16 bandwidth) {
|
||||
WebRtc_Word16 statusInit = 0;
|
||||
static int16_t EncoderInitUb(ISACUBStruct* instUB,
|
||||
int16_t bandwidth) {
|
||||
int16_t statusInit = 0;
|
||||
int k;
|
||||
|
||||
/* Init stream vector to zero. */
|
||||
@ -406,10 +406,10 @@ static WebRtc_Word16 EncoderInitUb(ISACUBStruct* instUB,
|
||||
}
|
||||
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_EncoderInit(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word16 codingMode) {
|
||||
int16_t WebRtcIsac_EncoderInit(ISACStruct* ISAC_main_inst,
|
||||
int16_t codingMode) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
WebRtc_Word16 status;
|
||||
int16_t status;
|
||||
|
||||
if ((codingMode != 0) && (codingMode != 1)) {
|
||||
instISAC->errorCode = ISAC_DISALLOWED_CODING_MODE;
|
||||
@ -449,9 +449,9 @@ WebRtc_Word16 WebRtcIsac_EncoderInit(ISACStruct* ISAC_main_inst,
|
||||
if (instISAC->encoderSamplingRateKHz == kIsacSuperWideband) {
|
||||
/* Initialize encoder filter-bank. */
|
||||
memset(instISAC->analysisFBState1, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(WebRtc_Word32));
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
memset(instISAC->analysisFBState2, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(WebRtc_Word32));
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
|
||||
status = EncoderInitUb(&(instISAC->instUB),
|
||||
instISAC->bandwidthKHz);
|
||||
@ -489,21 +489,21 @@ WebRtc_Word16 WebRtcIsac_EncoderInit(ISACStruct* ISAC_main_inst,
|
||||
* samples.
|
||||
* : -1 - Error
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
|
||||
const WebRtc_Word16* speechIn,
|
||||
WebRtc_Word16* encoded) {
|
||||
int16_t WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
|
||||
const int16_t* speechIn,
|
||||
int16_t* encoded) {
|
||||
float inFrame[FRAMESAMPLES_10ms];
|
||||
WebRtc_Word16 speechInLB[FRAMESAMPLES_10ms];
|
||||
WebRtc_Word16 speechInUB[FRAMESAMPLES_10ms];
|
||||
WebRtc_Word16 streamLenLB = 0;
|
||||
WebRtc_Word16 streamLenUB = 0;
|
||||
WebRtc_Word16 streamLen = 0;
|
||||
WebRtc_Word16 k = 0;
|
||||
WebRtc_UWord8* ptrEncodedUW8 = (WebRtc_UWord8*)encoded;
|
||||
int16_t speechInLB[FRAMESAMPLES_10ms];
|
||||
int16_t speechInUB[FRAMESAMPLES_10ms];
|
||||
int16_t streamLenLB = 0;
|
||||
int16_t streamLenUB = 0;
|
||||
int16_t streamLen = 0;
|
||||
int16_t k = 0;
|
||||
uint8_t* ptrEncodedUW8 = (uint8_t*)encoded;
|
||||
int garbageLen = 0;
|
||||
WebRtc_Word32 bottleneck = 0;
|
||||
WebRtc_Word16 bottleneckIdx = 0;
|
||||
WebRtc_Word16 jitterInfo = 0;
|
||||
int32_t bottleneck = 0;
|
||||
int16_t bottleneckIdx = 0;
|
||||
int16_t jitterInfo = 0;
|
||||
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
ISACLBStruct* instLB = &(instISAC->instLB);
|
||||
@ -641,7 +641,7 @@ WebRtc_Word16 WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
|
||||
memcpy(ptrEncodedUW8, instLB->ISACencLB_obj.bitstr_obj.stream, streamLenLB);
|
||||
streamLen = streamLenLB;
|
||||
if (streamLenUB > 0) {
|
||||
ptrEncodedUW8[streamLenLB] = (WebRtc_UWord8)(streamLenUB + 1 +
|
||||
ptrEncodedUW8[streamLenLB] = (uint8_t)(streamLenUB + 1 +
|
||||
LEN_CHECK_SUM_WORD8);
|
||||
memcpy(&ptrEncodedUW8[streamLenLB + 1],
|
||||
instUB->ISACencUB_obj.bitstr_obj.stream, streamLenUB);
|
||||
@ -664,7 +664,7 @@ WebRtc_Word16 WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
|
||||
if (instISAC->codingMode == 0) {
|
||||
int minBytes;
|
||||
int limit;
|
||||
WebRtc_UWord8* ptrGarbage;
|
||||
uint8_t* ptrGarbage;
|
||||
|
||||
instISAC->MaxDelay = (double)WebRtcIsac_GetUplinkMaxDelay(
|
||||
&instISAC->bwestimator_obj);
|
||||
@ -706,20 +706,20 @@ WebRtc_Word16 WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
|
||||
/* If bit-stream too short then add garbage at the end. */
|
||||
if (garbageLen > 0) {
|
||||
for (k = 0; k < garbageLen; k++) {
|
||||
ptrGarbage[k] = (WebRtc_UWord8)(rand() & 0xFF);
|
||||
ptrGarbage[k] = (uint8_t)(rand() & 0xFF);
|
||||
}
|
||||
/* For a correct length of the upper-band bit-stream together
|
||||
* with the garbage. Garbage is embeded in upper-band bit-stream.
|
||||
* That is the only way to preserve backward compatibility. */
|
||||
if ((instISAC->bandwidthKHz == isac8kHz) ||
|
||||
(streamLenUB == 0)) {
|
||||
ptrEncodedUW8[streamLenLB] = (WebRtc_UWord8)garbageLen;
|
||||
ptrEncodedUW8[streamLenLB] = (uint8_t)garbageLen;
|
||||
} else {
|
||||
ptrEncodedUW8[streamLenLB] += (WebRtc_UWord8)garbageLen;
|
||||
ptrEncodedUW8[streamLenLB] += (uint8_t)garbageLen;
|
||||
/* Write the length of the garbage at the end of the upper-band
|
||||
* bit-stream, if exists. This helps for sanity check. */
|
||||
ptrEncodedUW8[streamLenLB + 1 + streamLenUB] =
|
||||
(WebRtc_UWord8)garbageLen;
|
||||
(uint8_t)garbageLen;
|
||||
|
||||
}
|
||||
streamLen += garbageLen;
|
||||
@ -734,14 +734,14 @@ WebRtc_Word16 WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
|
||||
|
||||
/* Generate CRC if required. */
|
||||
if ((instISAC->bandwidthKHz != isac8kHz) && (streamLenUB > 0)) {
|
||||
WebRtc_UWord32 crc;
|
||||
uint32_t crc;
|
||||
|
||||
WebRtcIsac_GetCrc((WebRtc_Word16*)(&(ptrEncodedUW8[streamLenLB + 1])),
|
||||
WebRtcIsac_GetCrc((int16_t*)(&(ptrEncodedUW8[streamLenLB + 1])),
|
||||
streamLenUB + garbageLen, &crc);
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) {
|
||||
ptrEncodedUW8[streamLen - LEN_CHECK_SUM_WORD8 + k] =
|
||||
(WebRtc_UWord8)((crc >> (24 - k * 8)) & 0xFF);
|
||||
(uint8_t)((crc >> (24 - k * 8)) & 0xFF);
|
||||
}
|
||||
#else
|
||||
memcpy(&ptrEncodedUW8[streamLenLB + streamLenUB + 1], &crc,
|
||||
@ -782,27 +782,27 @@ WebRtc_Word16 WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
|
||||
* the struct since it is only allowed to read
|
||||
* the struct.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word16 bweIndex,
|
||||
WebRtc_Word16 jitterInfo,
|
||||
WebRtc_Word32 rate,
|
||||
WebRtc_Word16* encoded,
|
||||
WebRtc_Word16 isRCU) {
|
||||
int16_t WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
|
||||
int16_t bweIndex,
|
||||
int16_t jitterInfo,
|
||||
int32_t rate,
|
||||
int16_t* encoded,
|
||||
int16_t isRCU) {
|
||||
Bitstr iSACBitStreamInst; /* Local struct for bitstream handling */
|
||||
WebRtc_Word16 streamLenLB;
|
||||
WebRtc_Word16 streamLenUB;
|
||||
WebRtc_Word16 totalStreamLen;
|
||||
int16_t streamLenLB;
|
||||
int16_t streamLenUB;
|
||||
int16_t totalStreamLen;
|
||||
double gain2;
|
||||
double gain1;
|
||||
float scale;
|
||||
enum ISACBandwidth bandwidthKHz;
|
||||
double rateLB;
|
||||
double rateUB;
|
||||
WebRtc_Word32 currentBN;
|
||||
WebRtc_UWord8* encodedPtrUW8 = (WebRtc_UWord8*)encoded;
|
||||
WebRtc_UWord32 crc;
|
||||
int32_t currentBN;
|
||||
uint8_t* encodedPtrUW8 = (uint8_t*)encoded;
|
||||
uint32_t crc;
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
WebRtc_Word16 k;
|
||||
int16_t k;
|
||||
#endif
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
|
||||
@ -849,7 +849,7 @@ WebRtc_Word16 WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert from bytes to WebRtc_Word16. */
|
||||
/* Convert from bytes to int16_t. */
|
||||
memcpy(encoded, iSACBitStreamInst.stream, streamLenLB);
|
||||
|
||||
if (bandwidthKHz == isac8kHz) {
|
||||
@ -890,12 +890,12 @@ WebRtc_Word16 WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
|
||||
memcpy(&encodedPtrUW8[streamLenLB + 1], iSACBitStreamInst.stream,
|
||||
streamLenUB);
|
||||
|
||||
WebRtcIsac_GetCrc((WebRtc_Word16*)(&(encodedPtrUW8[streamLenLB + 1])),
|
||||
WebRtcIsac_GetCrc((int16_t*)(&(encodedPtrUW8[streamLenLB + 1])),
|
||||
streamLenUB, &crc);
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) {
|
||||
encodedPtrUW8[totalStreamLen - LEN_CHECK_SUM_WORD8 + k] =
|
||||
(WebRtc_UWord8)((crc >> (24 - k * 8)) & 0xFF);
|
||||
(uint8_t)((crc >> (24 - k * 8)) & 0xFF);
|
||||
}
|
||||
#else
|
||||
memcpy(&encodedPtrUW8[streamLenLB + streamLenUB + 1], &crc,
|
||||
@ -921,7 +921,7 @@ WebRtc_Word16 WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
|
||||
* : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
static WebRtc_Word16 DecoderInitLb(ISACLBStruct* instISAC) {
|
||||
static int16_t DecoderInitLb(ISACLBStruct* instISAC) {
|
||||
int i;
|
||||
/* Initialize stream vector to zero. */
|
||||
for (i = 0; i < STREAM_SIZE_MAX_60; i++) {
|
||||
@ -935,7 +935,7 @@ static WebRtc_Word16 DecoderInitLb(ISACLBStruct* instISAC) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WebRtc_Word16 DecoderInitUb(ISACUBStruct* instISAC) {
|
||||
static int16_t DecoderInitUb(ISACUBStruct* instISAC) {
|
||||
int i;
|
||||
/* Init stream vector to zero */
|
||||
for (i = 0; i < STREAM_SIZE_MAX_60; i++) {
|
||||
@ -948,7 +948,7 @@ static WebRtc_Word16 DecoderInitUb(ISACUBStruct* instISAC) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_DecoderInit(ISACStruct* ISAC_main_inst) {
|
||||
int16_t WebRtcIsac_DecoderInit(ISACStruct* ISAC_main_inst) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
|
||||
if (DecoderInitLb(&instISAC->instLB) < 0) {
|
||||
@ -956,9 +956,9 @@ WebRtc_Word16 WebRtcIsac_DecoderInit(ISACStruct* ISAC_main_inst) {
|
||||
}
|
||||
if (instISAC->decoderSamplingRateKHz == kIsacSuperWideband) {
|
||||
memset(instISAC->synthesisFBState1, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(WebRtc_Word32));
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
memset(instISAC->synthesisFBState2, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(WebRtc_Word32));
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
|
||||
if (DecoderInitUb(&(instISAC->instUB)) < 0) {
|
||||
return -1;
|
||||
@ -996,18 +996,18 @@ WebRtc_Word16 WebRtcIsac_DecoderInit(ISACStruct* ISAC_main_inst) {
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_UpdateBwEstimate(ISACStruct* ISAC_main_inst,
|
||||
const WebRtc_UWord16* encoded,
|
||||
WebRtc_Word32 packet_size,
|
||||
WebRtc_UWord16 rtp_seq_number,
|
||||
WebRtc_UWord32 send_ts,
|
||||
WebRtc_UWord32 arr_ts) {
|
||||
int16_t WebRtcIsac_UpdateBwEstimate(ISACStruct* ISAC_main_inst,
|
||||
const uint16_t* encoded,
|
||||
int32_t packet_size,
|
||||
uint16_t rtp_seq_number,
|
||||
uint32_t send_ts,
|
||||
uint32_t arr_ts) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
Bitstr streamdata;
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
int k;
|
||||
#endif
|
||||
WebRtc_Word16 err;
|
||||
int16_t err;
|
||||
|
||||
/* Check if decoder initiated. */
|
||||
if ((instISAC->initFlag & BIT_MASK_DEC_INIT) != BIT_MASK_DEC_INIT) {
|
||||
@ -1025,7 +1025,7 @@ WebRtc_Word16 WebRtcIsac_UpdateBwEstimate(ISACStruct* ISAC_main_inst,
|
||||
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
for (k = 0; k < 10; k++) {
|
||||
streamdata.stream[k] = (WebRtc_UWord8)((encoded[k >> 1] >>
|
||||
streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >>
|
||||
((k & 1) << 3)) & 0xFF);
|
||||
}
|
||||
#else
|
||||
@ -1044,30 +1044,30 @@ WebRtc_Word16 WebRtcIsac_UpdateBwEstimate(ISACStruct* ISAC_main_inst,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WebRtc_Word16 Decode(ISACStruct* ISAC_main_inst,
|
||||
const WebRtc_UWord16* encoded,
|
||||
WebRtc_Word16 lenEncodedBytes,
|
||||
WebRtc_Word16* decoded,
|
||||
WebRtc_Word16* speechType,
|
||||
WebRtc_Word16 isRCUPayload) {
|
||||
static int16_t Decode(ISACStruct* ISAC_main_inst,
|
||||
const uint16_t* encoded,
|
||||
int16_t lenEncodedBytes,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType,
|
||||
int16_t isRCUPayload) {
|
||||
/* Number of samples (480 or 960), output from decoder
|
||||
that were actually used in the encoder/decoder
|
||||
(determined on the fly). */
|
||||
WebRtc_Word16 numSamplesLB;
|
||||
WebRtc_Word16 numSamplesUB;
|
||||
WebRtc_Word16 speechIdx;
|
||||
int16_t numSamplesLB;
|
||||
int16_t numSamplesUB;
|
||||
int16_t speechIdx;
|
||||
float outFrame[MAX_FRAMESAMPLES];
|
||||
WebRtc_Word16 outFrameLB[MAX_FRAMESAMPLES];
|
||||
WebRtc_Word16 outFrameUB[MAX_FRAMESAMPLES];
|
||||
WebRtc_Word16 numDecodedBytesLB;
|
||||
WebRtc_Word16 numDecodedBytesUB;
|
||||
WebRtc_Word16 lenEncodedLBBytes;
|
||||
WebRtc_Word16 validChecksum = 1;
|
||||
WebRtc_Word16 k;
|
||||
WebRtc_UWord8* ptrEncodedUW8 = (WebRtc_UWord8*)encoded;
|
||||
WebRtc_UWord16 numLayer;
|
||||
WebRtc_Word16 totSizeBytes;
|
||||
WebRtc_Word16 err;
|
||||
int16_t outFrameLB[MAX_FRAMESAMPLES];
|
||||
int16_t outFrameUB[MAX_FRAMESAMPLES];
|
||||
int16_t numDecodedBytesLB;
|
||||
int16_t numDecodedBytesUB;
|
||||
int16_t lenEncodedLBBytes;
|
||||
int16_t validChecksum = 1;
|
||||
int16_t k;
|
||||
uint8_t* ptrEncodedUW8 = (uint8_t*)encoded;
|
||||
uint16_t numLayer;
|
||||
int16_t totSizeBytes;
|
||||
int16_t err;
|
||||
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
ISACUBDecStruct* decInstUB = &(instISAC->instUB.ISACdecUB_obj);
|
||||
@ -1131,12 +1131,12 @@ static WebRtc_Word16 Decode(ISACStruct* ISAC_main_inst,
|
||||
} else if (outFrame[k] < -32768) {
|
||||
decoded[k] = -32768;
|
||||
} else {
|
||||
decoded[k] = (WebRtc_Word16)WebRtcIsac_lrint(outFrame[k]);
|
||||
decoded[k] = (int16_t)WebRtcIsac_lrint(outFrame[k]);
|
||||
}
|
||||
}
|
||||
numSamplesUB = 0;
|
||||
} else {
|
||||
WebRtc_UWord32 crc;
|
||||
uint32_t crc;
|
||||
/* We don't accept larger than 30ms (480 samples at lower-band)
|
||||
* frame-size. */
|
||||
for (k = 0; k < numSamplesLB; k++) {
|
||||
@ -1145,7 +1145,7 @@ static WebRtc_Word16 Decode(ISACStruct* ISAC_main_inst,
|
||||
} else if (outFrame[k] < -32768) {
|
||||
outFrameLB[k] = -32768;
|
||||
} else {
|
||||
outFrameLB[k] = (WebRtc_Word16)WebRtcIsac_lrint(outFrame[k]);
|
||||
outFrameLB[k] = (int16_t)WebRtcIsac_lrint(outFrame[k]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1153,13 +1153,13 @@ static WebRtc_Word16 Decode(ISACStruct* ISAC_main_inst,
|
||||
if (numDecodedBytesLB == lenEncodedBytes) {
|
||||
/* Decoding was successful. No super-wideband bit-stream exists. */
|
||||
numSamplesUB = numSamplesLB;
|
||||
memset(outFrameUB, 0, sizeof(WebRtc_Word16) * numSamplesUB);
|
||||
memset(outFrameUB, 0, sizeof(int16_t) * numSamplesUB);
|
||||
|
||||
/* Prepare for the potential increase of signal bandwidth. */
|
||||
instISAC->resetFlag_8kHz = 2;
|
||||
} else {
|
||||
/* This includes the checksum and the bytes that stores the length. */
|
||||
WebRtc_Word16 lenNextStream = ptrEncodedUW8[numDecodedBytesLB];
|
||||
int16_t lenNextStream = ptrEncodedUW8[numDecodedBytesLB];
|
||||
|
||||
/* Is this garbage or valid super-wideband bit-stream?
|
||||
* Check if checksum is valid. */
|
||||
@ -1169,7 +1169,7 @@ static WebRtc_Word16 Decode(ISACStruct* ISAC_main_inst,
|
||||
validChecksum = 0;
|
||||
} else {
|
||||
/* Run CRC to see if the checksum match. */
|
||||
WebRtcIsac_GetCrc((WebRtc_Word16*)(
|
||||
WebRtcIsac_GetCrc((int16_t*)(
|
||||
&ptrEncodedUW8[numDecodedBytesLB + 1]),
|
||||
lenNextStream - LEN_CHECK_SUM_WORD8 - 1, &crc);
|
||||
|
||||
@ -1185,11 +1185,11 @@ static WebRtc_Word16 Decode(ISACStruct* ISAC_main_inst,
|
||||
/* This is a garbage, we have received a wideband
|
||||
* bit-stream with garbage. */
|
||||
numSamplesUB = numSamplesLB;
|
||||
memset(outFrameUB, 0, sizeof(WebRtc_Word16) * numSamplesUB);
|
||||
memset(outFrameUB, 0, sizeof(int16_t) * numSamplesUB);
|
||||
} else {
|
||||
/* A valid super-wideband biststream exists. */
|
||||
enum ISACBandwidth bandwidthKHz;
|
||||
WebRtc_Word32 maxDelayBit;
|
||||
int32_t maxDelayBit;
|
||||
|
||||
/* If we have super-wideband bit-stream, we cannot
|
||||
* have 60 ms frame-size. */
|
||||
@ -1298,7 +1298,7 @@ static WebRtc_Word16 Decode(ISACStruct* ISAC_main_inst,
|
||||
} else if (outFrame[k] < -32768) {
|
||||
outFrameUB[k] = -32768;
|
||||
} else {
|
||||
outFrameUB[k] = (WebRtc_Word16)WebRtcIsac_lrint(
|
||||
outFrameUB[k] = (int16_t)WebRtcIsac_lrint(
|
||||
outFrame[k]);
|
||||
}
|
||||
}
|
||||
@ -1344,12 +1344,12 @@ static WebRtc_Word16 Decode(ISACStruct* ISAC_main_inst,
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_Decode(ISACStruct* ISAC_main_inst,
|
||||
const WebRtc_UWord16* encoded,
|
||||
WebRtc_Word16 lenEncodedBytes,
|
||||
WebRtc_Word16* decoded,
|
||||
WebRtc_Word16* speechType) {
|
||||
WebRtc_Word16 isRCUPayload = 0;
|
||||
int16_t WebRtcIsac_Decode(ISACStruct* ISAC_main_inst,
|
||||
const uint16_t* encoded,
|
||||
int16_t lenEncodedBytes,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType) {
|
||||
int16_t isRCUPayload = 0;
|
||||
return Decode(ISAC_main_inst, encoded, lenEncodedBytes, decoded,
|
||||
speechType, isRCUPayload);
|
||||
}
|
||||
@ -1376,12 +1376,12 @@ WebRtc_Word16 WebRtcIsac_Decode(ISACStruct* ISAC_main_inst,
|
||||
|
||||
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_DecodeRcu(ISACStruct* ISAC_main_inst,
|
||||
const WebRtc_UWord16* encoded,
|
||||
WebRtc_Word16 lenEncodedBytes,
|
||||
WebRtc_Word16* decoded,
|
||||
WebRtc_Word16* speechType) {
|
||||
WebRtc_Word16 isRCUPayload = 1;
|
||||
int16_t WebRtcIsac_DecodeRcu(ISACStruct* ISAC_main_inst,
|
||||
const uint16_t* encoded,
|
||||
int16_t lenEncodedBytes,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType) {
|
||||
int16_t isRCUPayload = 1;
|
||||
return Decode(ISAC_main_inst, encoded, lenEncodedBytes, decoded,
|
||||
speechType, isRCUPayload);
|
||||
}
|
||||
@ -1404,10 +1404,10 @@ WebRtc_Word16 WebRtcIsac_DecodeRcu(ISACStruct* ISAC_main_inst,
|
||||
* Return value : >0 - number of samples in decoded PLC vector
|
||||
* -1 - Error
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_DecodePlc(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word16* decoded,
|
||||
WebRtc_Word16 noOfLostFrames) {
|
||||
WebRtc_Word16 numSamples = 0;
|
||||
int16_t WebRtcIsac_DecodePlc(ISACStruct* ISAC_main_inst,
|
||||
int16_t* decoded,
|
||||
int16_t noOfLostFrames) {
|
||||
int16_t numSamples = 0;
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
|
||||
/* Limit number of frames to two = 60 millisecond.
|
||||
@ -1429,7 +1429,7 @@ WebRtc_Word16 WebRtcIsac_DecodePlc(ISACStruct* ISAC_main_inst,
|
||||
}
|
||||
|
||||
/* Set output samples to zero. */
|
||||
memset(decoded, 0, numSamples * sizeof(WebRtc_Word16));
|
||||
memset(decoded, 0, numSamples * sizeof(int16_t));
|
||||
return numSamples;
|
||||
}
|
||||
|
||||
@ -1451,8 +1451,8 @@ WebRtc_Word16 WebRtcIsac_DecodePlc(ISACStruct* ISAC_main_inst,
|
||||
* Return value : 0 - ok
|
||||
* -1 - Error
|
||||
*/
|
||||
static WebRtc_Word16 ControlLb(ISACLBStruct* instISAC, double rate,
|
||||
WebRtc_Word16 frameSize) {
|
||||
static int16_t ControlLb(ISACLBStruct* instISAC, double rate,
|
||||
int16_t frameSize) {
|
||||
if ((rate >= 10000) && (rate <= 32000)) {
|
||||
instISAC->ISACencLB_obj.bottleneck = rate;
|
||||
} else {
|
||||
@ -1468,7 +1468,7 @@ static WebRtc_Word16 ControlLb(ISACLBStruct* instISAC, double rate,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WebRtc_Word16 ControlUb(ISACUBStruct* instISAC, double rate) {
|
||||
static int16_t ControlUb(ISACUBStruct* instISAC, double rate) {
|
||||
if ((rate >= 10000) && (rate <= 32000)) {
|
||||
instISAC->ISACencUB_obj.bottleneck = rate;
|
||||
} else {
|
||||
@ -1477,11 +1477,11 @@ static WebRtc_Word16 ControlUb(ISACUBStruct* instISAC, double rate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word16 WebRtcIsac_Control(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word32 bottleneckBPS,
|
||||
WebRtc_Word16 frameSize) {
|
||||
int16_t WebRtcIsac_Control(ISACStruct* ISAC_main_inst,
|
||||
int32_t bottleneckBPS,
|
||||
int16_t frameSize) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
WebRtc_Word16 status;
|
||||
int16_t status;
|
||||
double rateLB;
|
||||
double rateUB;
|
||||
enum ISACBandwidth bandwidthKHz;
|
||||
@ -1586,10 +1586,10 @@ WebRtc_Word16 WebRtcIsac_Control(ISACStruct* ISAC_main_inst,
|
||||
* Return value : 0 - ok
|
||||
* -1 - Error
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_ControlBwe(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word32 bottleneckBPS,
|
||||
WebRtc_Word16 frameSizeMs,
|
||||
WebRtc_Word16 enforceFrameSize) {
|
||||
int16_t WebRtcIsac_ControlBwe(ISACStruct* ISAC_main_inst,
|
||||
int32_t bottleneckBPS,
|
||||
int16_t frameSizeMs,
|
||||
int16_t enforceFrameSize) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
enum ISACBandwidth bandwidth;
|
||||
|
||||
@ -1659,9 +1659,9 @@ WebRtc_Word16 WebRtcIsac_ControlBwe(ISACStruct* ISAC_main_inst,
|
||||
* - bweIndex : Bandwidth estimate to transmit to other side.
|
||||
*
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_GetDownLinkBwIndex(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word16* bweIndex,
|
||||
WebRtc_Word16* jitterInfo) {
|
||||
int16_t WebRtcIsac_GetDownLinkBwIndex(ISACStruct* ISAC_main_inst,
|
||||
int16_t* bweIndex,
|
||||
int16_t* jitterInfo) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
|
||||
/* Check if encoder initialized. */
|
||||
@ -1692,10 +1692,10 @@ WebRtc_Word16 WebRtcIsac_GetDownLinkBwIndex(ISACStruct* ISAC_main_inst,
|
||||
* Return value : 0 - ok
|
||||
* -1 - index out of range
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_UpdateUplinkBw(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word16 bweIndex) {
|
||||
int16_t WebRtcIsac_UpdateUplinkBw(ISACStruct* ISAC_main_inst,
|
||||
int16_t bweIndex) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
WebRtc_Word16 returnVal;
|
||||
int16_t returnVal;
|
||||
|
||||
/* Check if encoder initiated. */
|
||||
if ((instISAC->initFlag & BIT_MASK_ENC_INIT) !=
|
||||
@ -1732,19 +1732,19 @@ WebRtc_Word16 WebRtcIsac_UpdateUplinkBw(ISACStruct* ISAC_main_inst,
|
||||
* - bweIndex : Bandwidth estimate in bit-stream
|
||||
*
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_ReadBwIndex(const WebRtc_Word16* encoded,
|
||||
WebRtc_Word16* bweIndex) {
|
||||
int16_t WebRtcIsac_ReadBwIndex(const int16_t* encoded,
|
||||
int16_t* bweIndex) {
|
||||
Bitstr streamdata;
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
int k;
|
||||
#endif
|
||||
WebRtc_Word16 err;
|
||||
int16_t err;
|
||||
|
||||
WebRtcIsac_ResetBitstream(&(streamdata));
|
||||
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
for (k = 0; k < 10; k++) {
|
||||
streamdata.stream[k] = (WebRtc_UWord8)((encoded[k >> 1] >>
|
||||
streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >>
|
||||
((k & 1) << 3)) & 0xFF);
|
||||
}
|
||||
#else
|
||||
@ -1780,21 +1780,21 @@ WebRtc_Word16 WebRtcIsac_ReadBwIndex(const WebRtc_Word16* encoded,
|
||||
* - frameLength : Length of frame in packet (in samples)
|
||||
*
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst,
|
||||
const WebRtc_Word16* encoded,
|
||||
WebRtc_Word16* frameLength) {
|
||||
int16_t WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst,
|
||||
const int16_t* encoded,
|
||||
int16_t* frameLength) {
|
||||
Bitstr streamdata;
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
int k;
|
||||
#endif
|
||||
WebRtc_Word16 err;
|
||||
int16_t err;
|
||||
ISACMainStruct* instISAC;
|
||||
|
||||
WebRtcIsac_ResetBitstream(&(streamdata));
|
||||
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
for (k = 0; k < 10; k++) {
|
||||
streamdata.stream[k] = (WebRtc_UWord8)((encoded[k >> 1] >>
|
||||
streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >>
|
||||
((k & 1) << 3)) & 0xFF);
|
||||
}
|
||||
#else
|
||||
@ -1834,7 +1834,7 @@ WebRtc_Word16 WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst,
|
||||
* Return Value : frame lenght in samples
|
||||
*
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_GetNewFrameLen(ISACStruct* ISAC_main_inst) {
|
||||
int16_t WebRtcIsac_GetNewFrameLen(ISACStruct* ISAC_main_inst) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
|
||||
/* Return new frame length. */
|
||||
@ -1860,7 +1860,7 @@ WebRtc_Word16 WebRtcIsac_GetNewFrameLen(ISACStruct* ISAC_main_inst) {
|
||||
*
|
||||
* Return value : Error code
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_GetErrorCode(ISACStruct* ISAC_main_inst) {
|
||||
int16_t WebRtcIsac_GetErrorCode(ISACStruct* ISAC_main_inst) {
|
||||
return ((ISACMainStruct*)ISAC_main_inst)->errorCode;
|
||||
}
|
||||
|
||||
@ -1886,13 +1886,13 @@ WebRtc_Word16 WebRtcIsac_GetErrorCode(ISACStruct* ISAC_main_inst) {
|
||||
* Return value : -1 if error happens
|
||||
* 0 bit-rates computed correctly.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_GetUplinkBw(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word32* bottleneck) {
|
||||
int16_t WebRtcIsac_GetUplinkBw(ISACStruct* ISAC_main_inst,
|
||||
int32_t* bottleneck) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
|
||||
if (instISAC->codingMode == 0) {
|
||||
/* We are in adaptive mode then get the bottleneck from BWE. */
|
||||
*bottleneck = (WebRtc_Word32)instISAC->bwestimator_obj.send_bw_avg;
|
||||
*bottleneck = (int32_t)instISAC->bwestimator_obj.send_bw_avg;
|
||||
} else {
|
||||
*bottleneck = instISAC->bottleneck;
|
||||
}
|
||||
@ -1939,10 +1939,10 @@ WebRtc_Word16 WebRtcIsac_GetUplinkBw(ISACStruct* ISAC_main_inst,
|
||||
* Return value : 0 if successful
|
||||
* -1 if error happens
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_SetMaxPayloadSize(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word16 maxPayloadBytes) {
|
||||
int16_t WebRtcIsac_SetMaxPayloadSize(ISACStruct* ISAC_main_inst,
|
||||
int16_t maxPayloadBytes) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
WebRtc_Word16 status = 0;
|
||||
int16_t status = 0;
|
||||
|
||||
/* Check if encoder initiated */
|
||||
if ((instISAC->initFlag & BIT_MASK_ENC_INIT) !=
|
||||
@ -2022,11 +2022,11 @@ WebRtc_Word16 WebRtcIsac_SetMaxPayloadSize(ISACStruct* ISAC_main_inst,
|
||||
* Return value : 0 if successful
|
||||
* -1 if error happens
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_SetMaxRate(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word32 maxRate) {
|
||||
int16_t WebRtcIsac_SetMaxRate(ISACStruct* ISAC_main_inst,
|
||||
int32_t maxRate) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
WebRtc_Word16 maxRateInBytesPer30Ms;
|
||||
WebRtc_Word16 status = 0;
|
||||
int16_t maxRateInBytesPer30Ms;
|
||||
int16_t status = 0;
|
||||
|
||||
/* check if encoder initiated */
|
||||
if ((instISAC->initFlag & BIT_MASK_ENC_INIT) != BIT_MASK_ENC_INIT) {
|
||||
@ -2037,7 +2037,7 @@ WebRtc_Word16 WebRtcIsac_SetMaxRate(ISACStruct* ISAC_main_inst,
|
||||
given maximum rate. Multiply with 30/1000 to get number of
|
||||
bits per 30 ms, divide by 8 to get number of bytes per 30 ms:
|
||||
maxRateInBytes = floor((maxRate * 30/1000) / 8); */
|
||||
maxRateInBytesPer30Ms = (WebRtc_Word16)(maxRate * 3 / 800);
|
||||
maxRateInBytesPer30Ms = (int16_t)(maxRate * 3 / 800);
|
||||
|
||||
if (instISAC->encoderSamplingRateKHz == kIsacWideband) {
|
||||
if (maxRate < 32000) {
|
||||
@ -2093,14 +2093,14 @@ WebRtc_Word16 WebRtcIsac_SetMaxRate(ISACStruct* ISAC_main_inst,
|
||||
* Return value : >0 - Length (in bytes) of coded data
|
||||
* : -1 - Error
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_Word16* encoded) {
|
||||
int16_t WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst,
|
||||
int16_t* encoded) {
|
||||
Bitstr iSACBitStreamInst;
|
||||
WebRtc_Word16 streamLenLB;
|
||||
WebRtc_Word16 streamLenUB;
|
||||
WebRtc_Word16 streamLen;
|
||||
WebRtc_Word16 totalLenUB;
|
||||
WebRtc_UWord8* ptrEncodedUW8 = (WebRtc_UWord8*)encoded;
|
||||
int16_t streamLenLB;
|
||||
int16_t streamLenUB;
|
||||
int16_t streamLen;
|
||||
int16_t totalLenUB;
|
||||
uint8_t* ptrEncodedUW8 = (uint8_t*)encoded;
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
int k;
|
||||
@ -2122,7 +2122,7 @@ WebRtc_Word16 WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* convert from bytes to WebRtc_Word16. */
|
||||
/* convert from bytes to int16_t. */
|
||||
memcpy(ptrEncodedUW8, iSACBitStreamInst.stream, streamLenLB);
|
||||
streamLen = streamLenLB;
|
||||
if (instISAC->bandwidthKHz == isac8kHz) {
|
||||
@ -2150,18 +2150,18 @@ WebRtc_Word16 WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst,
|
||||
/* Generate CRC if required. */
|
||||
if ((instISAC->bandwidthKHz != isac8kHz) &&
|
||||
(streamLenUB > 0)) {
|
||||
WebRtc_UWord32 crc;
|
||||
uint32_t crc;
|
||||
streamLen += totalLenUB;
|
||||
ptrEncodedUW8[streamLenLB] = (WebRtc_UWord8)totalLenUB;
|
||||
ptrEncodedUW8[streamLenLB] = (uint8_t)totalLenUB;
|
||||
memcpy(&ptrEncodedUW8[streamLenLB + 1], iSACBitStreamInst.stream,
|
||||
streamLenUB);
|
||||
|
||||
WebRtcIsac_GetCrc((WebRtc_Word16*)(&(ptrEncodedUW8[streamLenLB + 1])),
|
||||
WebRtcIsac_GetCrc((int16_t*)(&(ptrEncodedUW8[streamLenLB + 1])),
|
||||
streamLenUB, &crc);
|
||||
#ifndef WEBRTC_BIG_ENDIAN
|
||||
for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) {
|
||||
ptrEncodedUW8[streamLen - LEN_CHECK_SUM_WORD8 + k] =
|
||||
(WebRtc_UWord8)((crc >> (24 - k * 8)) & 0xFF);
|
||||
(uint8_t)((crc >> (24 - k * 8)) & 0xFF);
|
||||
}
|
||||
#else
|
||||
memcpy(&ptrEncodedUW8[streamLenLB + streamLenUB + 1], &crc,
|
||||
@ -2209,8 +2209,8 @@ void WebRtcIsac_version(char* version) {
|
||||
* Return value : 0 if successful
|
||||
* -1 if failed.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_SetEncSampRate(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_UWord16 sample_rate_hz) {
|
||||
int16_t WebRtcIsac_SetEncSampRate(ISACStruct* ISAC_main_inst,
|
||||
uint16_t sample_rate_hz) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
enum IsacSamplingRate encoder_operational_rate;
|
||||
|
||||
@ -2238,9 +2238,9 @@ WebRtc_Word16 WebRtcIsac_SetEncSampRate(ISACStruct* ISAC_main_inst,
|
||||
ISACLBStruct* instLB = &(instISAC->instLB);
|
||||
double bottleneckLB;
|
||||
double bottleneckUB;
|
||||
WebRtc_Word32 bottleneck = instISAC->bottleneck;
|
||||
WebRtc_Word16 codingMode = instISAC->codingMode;
|
||||
WebRtc_Word16 frameSizeMs = instLB->ISACencLB_obj.new_framelength /
|
||||
int32_t bottleneck = instISAC->bottleneck;
|
||||
int16_t codingMode = instISAC->codingMode;
|
||||
int16_t frameSizeMs = instLB->ISACencLB_obj.new_framelength /
|
||||
(FS / 1000);
|
||||
|
||||
if ((encoder_operational_rate == kIsacWideband) &&
|
||||
@ -2269,9 +2269,9 @@ WebRtc_Word16 WebRtcIsac_SetEncSampRate(ISACStruct* ISAC_main_inst,
|
||||
EncoderInitUb(instUB, instISAC->bandwidthKHz);
|
||||
|
||||
memset(instISAC->analysisFBState1, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(WebRtc_Word32));
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
memset(instISAC->analysisFBState2, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(WebRtc_Word32));
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
|
||||
if (codingMode == 1) {
|
||||
instISAC->bottleneck = bottleneck;
|
||||
@ -2306,8 +2306,8 @@ WebRtc_Word16 WebRtcIsac_SetEncSampRate(ISACStruct* ISAC_main_inst,
|
||||
* Return value : 0 if successful
|
||||
* -1 if failed.
|
||||
*/
|
||||
WebRtc_Word16 WebRtcIsac_SetDecSampRate(ISACStruct* ISAC_main_inst,
|
||||
WebRtc_UWord16 sample_rate_hz) {
|
||||
int16_t WebRtcIsac_SetDecSampRate(ISACStruct* ISAC_main_inst,
|
||||
uint16_t sample_rate_hz) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
enum IsacSamplingRate decoder_operational_rate;
|
||||
|
||||
@ -2326,9 +2326,9 @@ WebRtc_Word16 WebRtcIsac_SetDecSampRate(ISACStruct* ISAC_main_inst,
|
||||
/* Switching from wideband to super-wideband at the decoder
|
||||
* we need to reset the filter-bank and initialize upper-band decoder. */
|
||||
memset(instISAC->synthesisFBState1, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(WebRtc_Word32));
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
memset(instISAC->synthesisFBState2, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(WebRtc_Word32));
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
|
||||
if (DecoderInitUb(&(instISAC->instUB)) < 0) {
|
||||
return -1;
|
||||
@ -2349,7 +2349,7 @@ WebRtc_Word16 WebRtcIsac_SetDecSampRate(ISACStruct* ISAC_main_inst,
|
||||
* is expected to be sampled in this rate.
|
||||
*
|
||||
*/
|
||||
WebRtc_UWord16 WebRtcIsac_EncSampRate(ISACStruct* ISAC_main_inst) {
|
||||
uint16_t WebRtcIsac_EncSampRate(ISACStruct* ISAC_main_inst) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
return instISAC->in_sample_rate_hz;
|
||||
}
|
||||
@ -2366,7 +2366,7 @@ WebRtc_UWord16 WebRtcIsac_EncSampRate(ISACStruct* ISAC_main_inst) {
|
||||
* sampled at this rate.
|
||||
*
|
||||
*/
|
||||
WebRtc_UWord16 WebRtcIsac_DecSampRate(ISACStruct* ISAC_main_inst) {
|
||||
uint16_t WebRtcIsac_DecSampRate(ISACStruct* ISAC_main_inst) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
return instISAC->decoderSamplingRateKHz == kIsacWideband ? 16000 : 32000;
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ double WebRtcIsac_LevDurb(double *a, double *k, double *r, int order)
|
||||
|
||||
|
||||
//was static before, but didn't work with MEX file
|
||||
void WebRtcIsac_GetVars(const double *input, const WebRtc_Word16 *pitchGains_Q12,
|
||||
void WebRtcIsac_GetVars(const double *input, const int16_t *pitchGains_Q12,
|
||||
double *oldEnergy, double *varscale)
|
||||
{
|
||||
double nrg[4], chng, pg;
|
||||
@ -206,7 +206,7 @@ WebRtcIsac_GetVarsUB(
|
||||
}
|
||||
|
||||
void WebRtcIsac_GetLpcCoefLb(double *inLo, double *inHi, MaskFiltstr *maskdata,
|
||||
double signal_noise_ratio, const WebRtc_Word16 *pitchGains_Q12,
|
||||
double signal_noise_ratio, const int16_t *pitchGains_Q12,
|
||||
double *lo_coeff, double *hi_coeff)
|
||||
{
|
||||
int k, n, j, pos1, pos2;
|
||||
@ -388,12 +388,12 @@ WebRtcIsac_GetLpcCoefUb(
|
||||
double* lpCoeff,
|
||||
double corrMat[][UB_LPC_ORDER + 1],
|
||||
double* varscale,
|
||||
WebRtc_Word16 bandwidth)
|
||||
int16_t bandwidth)
|
||||
{
|
||||
int frameCntr, activeFrameCntr, n, pos1, pos2;
|
||||
WebRtc_Word16 criterion1;
|
||||
WebRtc_Word16 criterion2;
|
||||
WebRtc_Word16 numSubFrames = SUBFRAMES * (1 + (bandwidth == isac16kHz));
|
||||
int16_t criterion1;
|
||||
int16_t criterion2;
|
||||
int16_t numSubFrames = SUBFRAMES * (1 + (bandwidth == isac16kHz));
|
||||
double data[WINLEN];
|
||||
double corrSubFrame[UB_LPC_ORDER+2];
|
||||
double reflecCoeff[UB_LPC_ORDER];
|
||||
@ -492,8 +492,8 @@ WebRtcIsac_GetLpcGain(
|
||||
double corrMat[][UB_LPC_ORDER + 1],
|
||||
const double* varscale)
|
||||
{
|
||||
WebRtc_Word16 j, n;
|
||||
WebRtc_Word16 subFrameCntr;
|
||||
int16_t j, n;
|
||||
int16_t subFrameCntr;
|
||||
double aPolynom[ORDERLO + 1];
|
||||
double res_nrg;
|
||||
|
||||
|
||||
@ -23,11 +23,11 @@
|
||||
|
||||
double WebRtcIsac_LevDurb(double *a, double *k, double *r, int order);
|
||||
|
||||
void WebRtcIsac_GetVars(const double *input, const WebRtc_Word16 *pitchGains_Q12,
|
||||
void WebRtcIsac_GetVars(const double *input, const int16_t *pitchGains_Q12,
|
||||
double *oldEnergy, double *varscale);
|
||||
|
||||
void WebRtcIsac_GetLpcCoefLb(double *inLo, double *inHi, MaskFiltstr *maskdata,
|
||||
double signal_noise_ratio, const WebRtc_Word16 *pitchGains_Q12,
|
||||
double signal_noise_ratio, const int16_t *pitchGains_Q12,
|
||||
double *lo_coeff, double *hi_coeff);
|
||||
|
||||
|
||||
@ -45,6 +45,6 @@ void WebRtcIsac_GetLpcCoefUb(
|
||||
double* lpCoeff,
|
||||
double corr[][UB_LPC_ORDER + 1],
|
||||
double* varscale,
|
||||
WebRtc_Word16 bandwidth);
|
||||
int16_t bandwidth);
|
||||
|
||||
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_ANALYIS_H_ */
|
||||
|
||||
@ -36,7 +36,7 @@ const double WebRtcIsac_kLeftRecPointLpcGain[SUBFRAMES] =
|
||||
/*
|
||||
* Number of reconstruction points of quantizers for LPC Gains.
|
||||
*/
|
||||
const WebRtc_Word16 WebRtcIsac_kNumQCellLpcGain[SUBFRAMES] =
|
||||
const int16_t WebRtcIsac_kNumQCellLpcGain[SUBFRAMES] =
|
||||
{
|
||||
17, 20, 25, 45, 77, 170
|
||||
};
|
||||
@ -44,7 +44,7 @@ const WebRtc_Word16 WebRtcIsac_kNumQCellLpcGain[SUBFRAMES] =
|
||||
* Starting index for entropy decoder to search for the right interval,
|
||||
* one entry per LAR coefficient
|
||||
*/
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcGainEntropySearch[SUBFRAMES] =
|
||||
const uint16_t WebRtcIsac_kLpcGainEntropySearch[SUBFRAMES] =
|
||||
{
|
||||
8, 10, 12, 22, 38, 85
|
||||
};
|
||||
@ -53,26 +53,26 @@ const WebRtc_UWord16 WebRtcIsac_kLpcGainEntropySearch[SUBFRAMES] =
|
||||
* The following 6 vectors define CDF of 6 decorrelated LPC
|
||||
* gains.
|
||||
*/
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec0[18] =
|
||||
const uint16_t WebRtcIsac_kLpcGainCdfVec0[18] =
|
||||
{
|
||||
0, 10, 27, 83, 234, 568, 1601, 4683, 16830, 57534, 63437,
|
||||
64767, 65229, 65408, 65483, 65514, 65527, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec1[21] =
|
||||
const uint16_t WebRtcIsac_kLpcGainCdfVec1[21] =
|
||||
{
|
||||
0, 15, 33, 84, 185, 385, 807, 1619, 3529, 7850, 19488,
|
||||
51365, 62437, 64548, 65088, 65304, 65409, 65484, 65507, 65522, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec2[26] =
|
||||
const uint16_t WebRtcIsac_kLpcGainCdfVec2[26] =
|
||||
{
|
||||
0, 15, 29, 54, 89, 145, 228, 380, 652, 1493, 4260,
|
||||
12359, 34133, 50749, 57224, 60814, 62927, 64078, 64742, 65103, 65311, 65418,
|
||||
65473, 65509, 65521, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec3[46] =
|
||||
const uint16_t WebRtcIsac_kLpcGainCdfVec3[46] =
|
||||
{
|
||||
0, 8, 12, 16, 26, 42, 56, 76, 111, 164, 247,
|
||||
366, 508, 693, 1000, 1442, 2155, 3188, 4854, 7387, 11249, 17617,
|
||||
@ -81,7 +81,7 @@ const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec3[46] =
|
||||
65523, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec4[78] =
|
||||
const uint16_t WebRtcIsac_kLpcGainCdfVec4[78] =
|
||||
{
|
||||
0, 17, 29, 39, 51, 70, 104, 154, 234, 324, 443,
|
||||
590, 760, 971, 1202, 1494, 1845, 2274, 2797, 3366, 4088, 4905,
|
||||
@ -93,7 +93,7 @@ const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec4[78] =
|
||||
65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec5[171] =
|
||||
const uint16_t WebRtcIsac_kLpcGainCdfVec5[171] =
|
||||
{
|
||||
0, 10, 12, 14, 16, 18, 23, 29, 35, 42, 51,
|
||||
58, 65, 72, 78, 87, 96, 103, 111, 122, 134, 150,
|
||||
@ -116,7 +116,7 @@ const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec5[171] =
|
||||
/*
|
||||
* An array of pointers to CDFs of decorrelated LPC Gains
|
||||
*/
|
||||
const WebRtc_UWord16* WebRtcIsac_kLpcGainCdfMat[SUBFRAMES] =
|
||||
const uint16_t* WebRtcIsac_kLpcGainCdfMat[SUBFRAMES] =
|
||||
{
|
||||
WebRtcIsac_kLpcGainCdfVec0, WebRtcIsac_kLpcGainCdfVec1,
|
||||
WebRtcIsac_kLpcGainCdfVec2, WebRtcIsac_kLpcGainCdfVec3,
|
||||
|
||||
@ -26,23 +26,23 @@ extern const double WebRtcIsac_kQSizeLpcGain;
|
||||
|
||||
extern const double WebRtcIsac_kLeftRecPointLpcGain[SUBFRAMES];
|
||||
|
||||
extern const WebRtc_Word16 WebRtcIsac_kNumQCellLpcGain[SUBFRAMES];
|
||||
extern const int16_t WebRtcIsac_kNumQCellLpcGain[SUBFRAMES];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainEntropySearch[SUBFRAMES];
|
||||
extern const uint16_t WebRtcIsac_kLpcGainEntropySearch[SUBFRAMES];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec0[18];
|
||||
extern const uint16_t WebRtcIsac_kLpcGainCdfVec0[18];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec1[21];
|
||||
extern const uint16_t WebRtcIsac_kLpcGainCdfVec1[21];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec2[26];
|
||||
extern const uint16_t WebRtcIsac_kLpcGainCdfVec2[26];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec3[46];
|
||||
extern const uint16_t WebRtcIsac_kLpcGainCdfVec3[46];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec4[78];
|
||||
extern const uint16_t WebRtcIsac_kLpcGainCdfVec4[78];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec5[171];
|
||||
extern const uint16_t WebRtcIsac_kLpcGainCdfVec5[171];
|
||||
|
||||
extern const WebRtc_UWord16* WebRtcIsac_kLpcGainCdfMat[SUBFRAMES];
|
||||
extern const uint16_t* WebRtcIsac_kLpcGainCdfMat[SUBFRAMES];
|
||||
|
||||
extern const double WebRtcIsac_kLpcGainDecorrMat[SUBFRAMES][SUBFRAMES];
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ const double WebRtcIsac_kLpcShapeLeftRecPointUb12
|
||||
/*
|
||||
* Number of reconstruction points of quantizers for LAR coefficients.
|
||||
*/
|
||||
const WebRtc_Word16 WebRtcIsac_kLpcShapeNumRecPointUb12
|
||||
const int16_t WebRtcIsac_kLpcShapeNumRecPointUb12
|
||||
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME] =
|
||||
{
|
||||
13, 15, 19, 27, 19, 24, 32, 48
|
||||
@ -82,7 +82,7 @@ const WebRtc_Word16 WebRtcIsac_kLpcShapeNumRecPointUb12
|
||||
* Starting index for entropy decoder to search for the right interval,
|
||||
* one entry per LAR coefficient
|
||||
*/
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeEntropySearchUb12
|
||||
const uint16_t WebRtcIsac_kLpcShapeEntropySearchUb12
|
||||
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME] =
|
||||
{
|
||||
6, 7, 9, 13, 9, 12, 16, 24
|
||||
@ -92,52 +92,52 @@ const WebRtc_UWord16 WebRtcIsac_kLpcShapeEntropySearchUb12
|
||||
* The following 8 vectors define CDF of 8 decorrelated LAR
|
||||
* coefficients.
|
||||
*/
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec0Ub12[14] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec0Ub12[14] =
|
||||
{
|
||||
0, 13, 95, 418, 1687, 6498, 21317, 44200, 59029, 63849, 65147,
|
||||
65449, 65525, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec1Ub12[16] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec1Ub12[16] =
|
||||
{
|
||||
0, 10, 59, 255, 858, 2667, 8200, 22609, 42988, 57202, 62947,
|
||||
64743, 65308, 65476, 65522, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec2Ub12[20] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec2Ub12[20] =
|
||||
{
|
||||
0, 18, 40, 118, 332, 857, 2017, 4822, 11321, 24330, 41279,
|
||||
54342, 60637, 63394, 64659, 65184, 65398, 65482, 65518, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec3Ub12[28] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec3Ub12[28] =
|
||||
{
|
||||
0, 21, 38, 90, 196, 398, 770, 1400, 2589, 4650, 8211,
|
||||
14933, 26044, 39592, 50814, 57452, 60971, 62884, 63995, 64621, 65019, 65273,
|
||||
65410, 65480, 65514, 65522, 65531, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec4Ub12[20] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec4Ub12[20] =
|
||||
{
|
||||
0, 7, 46, 141, 403, 969, 2132, 4649, 10633, 24902, 43254,
|
||||
54665, 59928, 62674, 64173, 64938, 65293, 65464, 65523, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec5Ub12[25] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec5Ub12[25] =
|
||||
{
|
||||
0, 7, 22, 72, 174, 411, 854, 1737, 3545, 6774, 13165,
|
||||
25221, 40980, 52821, 58714, 61706, 63472, 64437, 64989, 65287, 65430, 65503,
|
||||
65525, 65529, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec6Ub12[33] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec6Ub12[33] =
|
||||
{
|
||||
0, 11, 21, 36, 65, 128, 228, 401, 707, 1241, 2126,
|
||||
3589, 6060, 10517, 18853, 31114, 42477, 49770, 54271, 57467, 59838, 61569,
|
||||
62831, 63772, 64433, 64833, 65123, 65306, 65419, 65466, 65499, 65519, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec7Ub12[49] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec7Ub12[49] =
|
||||
{
|
||||
0, 14, 34, 67, 107, 167, 245, 326, 449, 645, 861,
|
||||
1155, 1508, 2003, 2669, 3544, 4592, 5961, 7583, 9887, 13256, 18765,
|
||||
@ -149,7 +149,7 @@ const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec7Ub12[49] =
|
||||
/*
|
||||
* An array of pointers to CDFs of decorrelated LARs
|
||||
*/
|
||||
const WebRtc_UWord16* WebRtcIsac_kLpcShapeCdfMatUb12
|
||||
const uint16_t* WebRtcIsac_kLpcShapeCdfMatUb12
|
||||
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME] =
|
||||
{
|
||||
WebRtcIsac_kLpcShapeCdfVec0Ub12, WebRtcIsac_kLpcShapeCdfVec1Ub12,
|
||||
|
||||
@ -37,29 +37,29 @@ extern const double WebRtcIsac_kLpcShapeLeftRecPointUb12
|
||||
[UB_LPC_ORDER*UB_LPC_VEC_PER_FRAME];
|
||||
|
||||
|
||||
extern const WebRtc_Word16 WebRtcIsac_kLpcShapeNumRecPointUb12
|
||||
extern const int16_t WebRtcIsac_kLpcShapeNumRecPointUb12
|
||||
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeEntropySearchUb12
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeEntropySearchUb12
|
||||
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec0Ub12[14];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec0Ub12[14];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec1Ub12[16];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec1Ub12[16];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec2Ub12[20];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec2Ub12[20];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec3Ub12[28];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec3Ub12[28];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec4Ub12[20];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec4Ub12[20];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec5Ub12[25];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec5Ub12[25];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec6Ub12[33];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec6Ub12[33];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec7Ub12[49];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec7Ub12[49];
|
||||
|
||||
extern const WebRtc_UWord16* WebRtcIsac_kLpcShapeCdfMatUb12
|
||||
extern const uint16_t* WebRtcIsac_kLpcShapeCdfMatUb12
|
||||
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB12_TABLES_H_
|
||||
|
||||
@ -60,26 +60,26 @@ const double WebRtcIsac_kInterVecDecorrMatUb16
|
||||
* The following 16 vectors define CDF of 16 decorrelated LAR
|
||||
* coefficients.
|
||||
*/
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub16[14] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub16[14] =
|
||||
{
|
||||
0, 2, 20, 159, 1034, 5688, 20892, 44653,
|
||||
59849, 64485, 65383, 65518, 65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec1Ub16[16] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec1Ub16[16] =
|
||||
{
|
||||
0, 1, 7, 43, 276, 1496, 6681, 21653,
|
||||
43891, 58859, 64022, 65248, 65489, 65529, 65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec2Ub16[18] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec2Ub16[18] =
|
||||
{
|
||||
0, 1, 9, 54, 238, 933, 3192, 9461,
|
||||
23226, 42146, 56138, 62413, 64623, 65300, 65473, 65521,
|
||||
65533, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec3Ub16[30] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec3Ub16[30] =
|
||||
{
|
||||
0, 2, 4, 8, 17, 36, 75, 155,
|
||||
329, 683, 1376, 2662, 5047, 9508, 17526, 29027,
|
||||
@ -87,27 +87,27 @@ const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec3Ub16[30] =
|
||||
65273, 65429, 65497, 65526, 65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec4Ub16[16] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec4Ub16[16] =
|
||||
{
|
||||
0, 1, 10, 63, 361, 1785, 7407, 22242,
|
||||
43337, 58125, 63729, 65181, 65472, 65527, 65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec5Ub16[17] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec5Ub16[17] =
|
||||
{
|
||||
0, 1, 7, 29, 134, 599, 2443, 8590,
|
||||
22962, 42635, 56911, 63060, 64940, 65408, 65513, 65531,
|
||||
65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec6Ub16[21] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec6Ub16[21] =
|
||||
{
|
||||
0, 1, 5, 16, 57, 191, 611, 1808,
|
||||
4847, 11755, 24612, 40910, 53789, 60698, 63729, 64924,
|
||||
65346, 65486, 65523, 65532, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec7Ub16[36] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec7Ub16[36] =
|
||||
{
|
||||
0, 1, 4, 12, 25, 55, 104, 184,
|
||||
314, 539, 926, 1550, 2479, 3861, 5892, 8845,
|
||||
@ -116,21 +116,21 @@ const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec7Ub16[36] =
|
||||
65518, 65530, 65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec8Ub16[21] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec8Ub16[21] =
|
||||
{
|
||||
0, 1, 2, 7, 26, 103, 351, 1149,
|
||||
3583, 10204, 23846, 41711, 55361, 61917, 64382, 65186,
|
||||
65433, 65506, 65528, 65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub160[21] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub160[21] =
|
||||
{
|
||||
0, 6, 19, 63, 205, 638, 1799, 4784,
|
||||
11721, 24494, 40803, 53805, 60886, 63822, 64931, 65333,
|
||||
65472, 65517, 65530, 65533, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub161[28] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub161[28] =
|
||||
{
|
||||
0, 1, 3, 11, 31, 86, 221, 506,
|
||||
1101, 2296, 4486, 8477, 15356, 26079, 38941, 49952,
|
||||
@ -138,7 +138,7 @@ const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub161[28] =
|
||||
65526, 65532, 65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub162[55] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub162[55] =
|
||||
{
|
||||
0, 3, 12, 23, 42, 65, 89, 115,
|
||||
150, 195, 248, 327, 430, 580, 784, 1099,
|
||||
@ -149,7 +149,7 @@ const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub162[55] =
|
||||
65527, 65529, 65531, 65532, 65533, 65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub163[26] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub163[26] =
|
||||
{
|
||||
0, 2, 4, 10, 21, 48, 114, 280,
|
||||
701, 1765, 4555, 11270, 24267, 41213, 54285, 61003,
|
||||
@ -157,7 +157,7 @@ const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub163[26] =
|
||||
65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub164[28] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub164[28] =
|
||||
{
|
||||
0, 1, 3, 6, 15, 36, 82, 196,
|
||||
453, 1087, 2557, 5923, 13016, 25366, 40449, 52582,
|
||||
@ -165,7 +165,7 @@ const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub164[28] =
|
||||
65529, 65533, 65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub165[34] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub165[34] =
|
||||
{
|
||||
0, 2, 4, 8, 18, 35, 73, 146,
|
||||
279, 524, 980, 1789, 3235, 5784, 10040, 16998,
|
||||
@ -174,7 +174,7 @@ const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub165[34] =
|
||||
65534, 65535
|
||||
};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub166[71] =
|
||||
const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub166[71] =
|
||||
{
|
||||
0, 1, 2, 6, 13, 26, 55, 92,
|
||||
141, 191, 242, 296, 355, 429, 522, 636,
|
||||
@ -190,7 +190,7 @@ const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub166[71] =
|
||||
/*
|
||||
* An array of pointers to CDFs of decorrelated LARs
|
||||
*/
|
||||
const WebRtc_UWord16* WebRtcIsac_kLpcShapeCdfMatUb16
|
||||
const uint16_t* WebRtcIsac_kLpcShapeCdfMatUb16
|
||||
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] = {
|
||||
WebRtcIsac_kLpcShapeCdfVec01Ub16,
|
||||
WebRtcIsac_kLpcShapeCdfVec1Ub16,
|
||||
@ -224,7 +224,7 @@ const double WebRtcIsac_kLpcShapeLeftRecPointUb16
|
||||
/*
|
||||
* Number of reconstruction points of quantizers for LAR coefficients.
|
||||
*/
|
||||
const WebRtc_Word16 WebRtcIsac_kLpcShapeNumRecPointUb16
|
||||
const int16_t WebRtcIsac_kLpcShapeNumRecPointUb16
|
||||
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] =
|
||||
{
|
||||
13, 15, 17, 29, 15, 16, 20, 35, 20,
|
||||
@ -235,7 +235,7 @@ const WebRtc_Word16 WebRtcIsac_kLpcShapeNumRecPointUb16
|
||||
* Starting index for entropy decoder to search for the right interval,
|
||||
* one entry per LAR coefficient
|
||||
*/
|
||||
const WebRtc_UWord16 WebRtcIsac_kLpcShapeEntropySearchUb16
|
||||
const uint16_t WebRtcIsac_kLpcShapeEntropySearchUb16
|
||||
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] =
|
||||
{
|
||||
6, 7, 8, 14, 7, 8, 10, 17, 10,
|
||||
|
||||
@ -30,48 +30,48 @@ extern const double WebRtcIsac_kIintraVecDecorrMatUb16[UB_LPC_ORDER][UB_LPC_ORDE
|
||||
extern const double WebRtcIsac_kInterVecDecorrMatUb16
|
||||
[UB16_LPC_VEC_PER_FRAME][UB16_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub16[14];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub16[14];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec1Ub16[16];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec1Ub16[16];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec2Ub16[18];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec2Ub16[18];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec3Ub16[30];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec3Ub16[30];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec4Ub16[16];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec4Ub16[16];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec5Ub16[17];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec5Ub16[17];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec6Ub16[21];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec6Ub16[21];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec7Ub16[36];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec7Ub16[36];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec8Ub16[21];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec8Ub16[21];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub160[21];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub160[21];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub161[28];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub161[28];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub162[55];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub162[55];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub163[26];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub163[26];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub164[28];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub164[28];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub165[34];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub165[34];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub166[71];
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub166[71];
|
||||
|
||||
extern const WebRtc_UWord16* WebRtcIsac_kLpcShapeCdfMatUb16
|
||||
extern const uint16_t* WebRtcIsac_kLpcShapeCdfMatUb16
|
||||
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const double WebRtcIsac_kLpcShapeLeftRecPointUb16
|
||||
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const WebRtc_Word16 WebRtcIsac_kLpcShapeNumRecPointUb16
|
||||
extern const int16_t WebRtcIsac_kLpcShapeNumRecPointUb16
|
||||
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeEntropySearchUb16
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeEntropySearchUb16
|
||||
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const double WebRtcIsac_kLpcShapeQStepSizeUb16;
|
||||
|
||||
@ -14,15 +14,15 @@
|
||||
#include "settings.h"
|
||||
|
||||
/* cdf array for model indicator */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQKltModelCdf[4] = {
|
||||
const uint16_t WebRtcIsac_kQKltModelCdf[4] = {
|
||||
0, 15434, 37548, 65535 };
|
||||
|
||||
/* pointer to cdf array for model indicator */
|
||||
const WebRtc_UWord16 *WebRtcIsac_kQKltModelCdfPtr[1] = {
|
||||
const uint16_t *WebRtcIsac_kQKltModelCdfPtr[1] = {
|
||||
WebRtcIsac_kQKltModelCdf };
|
||||
|
||||
/* initial cdf index for decoder of model indicator */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQKltModelInitIndex[1] = { 1 };
|
||||
const uint16_t WebRtcIsac_kQKltModelInitIndex[1] = { 1 };
|
||||
|
||||
/* offset to go from rounded value to quantization index */
|
||||
const short WebRtcIsac_kQKltQuantMinGain[12] = {
|
||||
@ -43,10 +43,10 @@ const short WebRtcIsac_kQKltQuantMinShape[108] = {
|
||||
5, 6, 7, 11, 9, 13, 12, 26 };
|
||||
|
||||
/* maximum quantization index */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQKltMaxIndGain[12] = {
|
||||
const uint16_t WebRtcIsac_kQKltMaxIndGain[12] = {
|
||||
6, 12, 8, 14, 10, 19, 12, 31, 22, 56, 52, 138 };
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQKltMaxIndShape[108] = {
|
||||
const uint16_t WebRtcIsac_kQKltMaxIndShape[108] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
|
||||
2, 2, 2, 2, 4, 4, 5, 6, 0, 0,
|
||||
0, 0, 1, 0, 0, 0, 0, 1, 2, 2,
|
||||
@ -60,10 +60,10 @@ const WebRtc_UWord16 WebRtcIsac_kQKltMaxIndShape[108] = {
|
||||
9, 10, 13, 19, 17, 23, 25, 49 };
|
||||
|
||||
/* index offset */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQKltOffsetGain[12] = {
|
||||
const uint16_t WebRtcIsac_kQKltOffsetGain[12] = {
|
||||
0, 7, 20, 29, 44, 55, 75, 88, 120, 143, 200, 253 };
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQKltOffsetShape[108] = {
|
||||
const uint16_t WebRtcIsac_kQKltOffsetShape[108] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
11, 14, 17, 20, 23, 28, 33, 39, 46, 47,
|
||||
48, 49, 50, 52, 53, 54, 55, 56, 58, 61,
|
||||
@ -77,10 +77,10 @@ const WebRtc_UWord16 WebRtcIsac_kQKltOffsetShape[108] = {
|
||||
405, 415, 426, 440, 460, 478, 502, 528 };
|
||||
|
||||
/* initial cdf index for KLT coefficients */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQKltInitIndexGain[12] = {
|
||||
const uint16_t WebRtcIsac_kQKltInitIndexGain[12] = {
|
||||
3, 6, 4, 7, 5, 10, 6, 16, 11, 28, 26, 69};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQKltInitIndexShape[108] = {
|
||||
const uint16_t WebRtcIsac_kQKltInitIndexShape[108] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
|
||||
1, 1, 1, 1, 2, 2, 3, 3, 0, 0,
|
||||
0, 0, 1, 0, 0, 0, 0, 1, 1, 1,
|
||||
@ -296,7 +296,7 @@ const double WebRtcIsac_kQKltLevelsShape[578] = {
|
||||
|
||||
|
||||
/* cdf tables for quantizer indices */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQKltCdfGain[404] = {
|
||||
const uint16_t WebRtcIsac_kQKltCdfGain[404] = {
|
||||
0, 13, 301, 3730, 61784, 65167, 65489, 65535, 0, 17,
|
||||
142, 314, 929, 2466, 7678, 56450, 63463, 64740, 65204, 65426,
|
||||
65527, 65535, 0, 8, 100, 724, 6301, 60105, 65125, 65510,
|
||||
@ -340,7 +340,7 @@ const WebRtc_UWord16 WebRtcIsac_kQKltCdfGain[404] = {
|
||||
65514, 65516, 65518, 65522, 65531, 65533, 65535 };
|
||||
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQKltCdfShape[686] = {
|
||||
const uint16_t WebRtcIsac_kQKltCdfShape[686] = {
|
||||
0, 65535, 0, 65535, 0, 65535, 0, 65535, 0, 65535,
|
||||
0, 65535, 0, 65535, 0, 65535, 0, 65535, 0, 4,
|
||||
65535, 0, 8, 65514, 65535, 0, 29, 65481, 65535, 0,
|
||||
@ -413,7 +413,7 @@ const WebRtc_UWord16 WebRtcIsac_kQKltCdfShape[686] = {
|
||||
|
||||
|
||||
/* pointers to cdf tables for quantizer indices */
|
||||
const WebRtc_UWord16 *WebRtcIsac_kQKltCdfPtrGain[12] = {
|
||||
const uint16_t *WebRtcIsac_kQKltCdfPtrGain[12] = {
|
||||
WebRtcIsac_kQKltCdfGain +0 +0, WebRtcIsac_kQKltCdfGain +0 +8,
|
||||
WebRtcIsac_kQKltCdfGain +0 +22, WebRtcIsac_kQKltCdfGain +0 +32,
|
||||
WebRtcIsac_kQKltCdfGain +0 +48, WebRtcIsac_kQKltCdfGain +0 +60,
|
||||
@ -421,7 +421,7 @@ const WebRtc_UWord16 *WebRtcIsac_kQKltCdfPtrGain[12] = {
|
||||
WebRtcIsac_kQKltCdfGain +0 +128, WebRtcIsac_kQKltCdfGain +0 +152,
|
||||
WebRtcIsac_kQKltCdfGain +0 +210, WebRtcIsac_kQKltCdfGain +0 +264 };
|
||||
|
||||
const WebRtc_UWord16 *WebRtcIsac_kQKltCdfPtrShape[108] = {
|
||||
const uint16_t *WebRtcIsac_kQKltCdfPtrShape[108] = {
|
||||
WebRtcIsac_kQKltCdfShape +0 +0, WebRtcIsac_kQKltCdfShape +0 +2,
|
||||
WebRtcIsac_kQKltCdfShape +0 +4, WebRtcIsac_kQKltCdfShape +0 +6,
|
||||
WebRtcIsac_kQKltCdfShape +0 +8, WebRtcIsac_kQKltCdfShape +0 +10,
|
||||
|
||||
@ -39,13 +39,13 @@
|
||||
#define KLT_ORDER_SHAPE (LPC_SHAPE_ORDER * SUBFRAMES)
|
||||
|
||||
/* cdf array for model indicator */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQKltModelCdf[KLT_NUM_MODELS+1];
|
||||
extern const uint16_t WebRtcIsac_kQKltModelCdf[KLT_NUM_MODELS+1];
|
||||
|
||||
/* pointer to cdf array for model indicator */
|
||||
extern const WebRtc_UWord16 *WebRtcIsac_kQKltModelCdfPtr[1];
|
||||
extern const uint16_t *WebRtcIsac_kQKltModelCdfPtr[1];
|
||||
|
||||
/* initial cdf index for decoder of model indicator */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQKltModelInitIndex[1];
|
||||
extern const uint16_t WebRtcIsac_kQKltModelInitIndex[1];
|
||||
|
||||
/* offset to go from rounded value to quantization index */
|
||||
extern const short WebRtcIsac_kQKltQuantMinGain[12];
|
||||
@ -53,19 +53,19 @@ extern const short WebRtcIsac_kQKltQuantMinGain[12];
|
||||
extern const short WebRtcIsac_kQKltQuantMinShape[108];
|
||||
|
||||
/* maximum quantization index */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQKltMaxIndGain[12];
|
||||
extern const uint16_t WebRtcIsac_kQKltMaxIndGain[12];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQKltMaxIndShape[108];
|
||||
extern const uint16_t WebRtcIsac_kQKltMaxIndShape[108];
|
||||
|
||||
/* index offset */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQKltOffsetGain[12];
|
||||
extern const uint16_t WebRtcIsac_kQKltOffsetGain[12];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQKltOffsetShape[108];
|
||||
extern const uint16_t WebRtcIsac_kQKltOffsetShape[108];
|
||||
|
||||
/* initial cdf index for KLT coefficients */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQKltInitIndexGain[12];
|
||||
extern const uint16_t WebRtcIsac_kQKltInitIndexGain[12];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQKltInitIndexShape[108];
|
||||
extern const uint16_t WebRtcIsac_kQKltInitIndexShape[108];
|
||||
|
||||
/* quantizer representation levels */
|
||||
extern const double WebRtcIsac_kQKltLevelsGain[392];
|
||||
@ -73,14 +73,14 @@ extern const double WebRtcIsac_kQKltLevelsGain[392];
|
||||
extern const double WebRtcIsac_kQKltLevelsShape[578];
|
||||
|
||||
/* cdf tables for quantizer indices */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQKltCdfGain[404];
|
||||
extern const uint16_t WebRtcIsac_kQKltCdfGain[404];
|
||||
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQKltCdfShape[686];
|
||||
extern const uint16_t WebRtcIsac_kQKltCdfShape[686];
|
||||
|
||||
/* pointers to cdf tables for quantizer indices */
|
||||
extern const WebRtc_UWord16 *WebRtcIsac_kQKltCdfPtrGain[12];
|
||||
extern const uint16_t *WebRtcIsac_kQKltCdfPtrGain[12];
|
||||
|
||||
extern const WebRtc_UWord16 *WebRtcIsac_kQKltCdfPtrShape[108];
|
||||
extern const uint16_t *WebRtcIsac_kQKltCdfPtrShape[108];
|
||||
|
||||
/* left KLT transforms */
|
||||
extern const double WebRtcIsac_kKltT1Gain[4];
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
/* header file for coding tables for the pitch filter side-info in the entropy coder */
|
||||
/********************* Pitch Filter Gain Coefficient Tables ************************/
|
||||
/* cdf for quantized pitch filter gains */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchGainCdf[255] = {
|
||||
const uint16_t WebRtcIsac_kQPitchGainCdf[255] = {
|
||||
0, 2, 4, 6, 64, 901, 903, 905, 16954, 16956,
|
||||
16961, 17360, 17362, 17364, 17366, 17368, 17370, 17372, 17374, 17411,
|
||||
17514, 17516, 17583, 18790, 18796, 18802, 20760, 20777, 20782, 21722,
|
||||
@ -44,22 +44,22 @@ const WebRtc_UWord16 WebRtcIsac_kQPitchGainCdf[255] = {
|
||||
65535, 65535, 65535, 65535, 65535};
|
||||
|
||||
/* index limits and ranges */
|
||||
const WebRtc_Word16 WebRtcIsac_kIndexLowerLimitGain[3] = {
|
||||
const int16_t WebRtcIsac_kIndexLowerLimitGain[3] = {
|
||||
-7, -2, -1};
|
||||
|
||||
const WebRtc_Word16 WebRtcIsac_kIndexUpperLimitGain[3] = {
|
||||
const int16_t WebRtcIsac_kIndexUpperLimitGain[3] = {
|
||||
0, 3, 1};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kIndexMultsGain[2] = {
|
||||
const uint16_t WebRtcIsac_kIndexMultsGain[2] = {
|
||||
18, 3};
|
||||
|
||||
/* size of cdf table */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQCdfTableSizeGain[1] = {
|
||||
const uint16_t WebRtcIsac_kQCdfTableSizeGain[1] = {
|
||||
256};
|
||||
|
||||
///////////////////////////FIXED POINT
|
||||
/* mean values of pitch filter gains in FIXED point */
|
||||
const WebRtc_Word16 WebRtcIsac_kQMeanGain1Q12[144] = {
|
||||
const int16_t WebRtcIsac_kQMeanGain1Q12[144] = {
|
||||
843, 1092, 1336, 1222, 1405, 1656, 1500, 1815, 1843, 1838, 1839, 1843, 1843, 1843, 1843, 1843,
|
||||
1843, 1843, 814, 846, 1092, 1013, 1174, 1383, 1391, 1511, 1584, 1734, 1753, 1843, 1843, 1843,
|
||||
1843, 1843, 1843, 1843, 524, 689, 777, 845, 947, 1069, 1090, 1263, 1380, 1447, 1559, 1676,
|
||||
@ -70,7 +70,7 @@ const WebRtc_Word16 WebRtcIsac_kQMeanGain1Q12[144] = {
|
||||
112, 120, 190, 283, 442, 343, 526, 809, 684, 935, 1134, 1020, 1265, 1506, 0, 0,
|
||||
0, 0, 0, 0, 0, 111, 256, 87, 373, 597, 430, 684, 935, 770, 1020, 1265};
|
||||
|
||||
const WebRtc_Word16 WebRtcIsac_kQMeanGain2Q12[144] = {
|
||||
const int16_t WebRtcIsac_kQMeanGain2Q12[144] = {
|
||||
1760, 1525, 1285, 1747, 1671, 1393, 1843, 1826, 1555, 1843, 1784, 1606, 1843, 1843, 1711, 1843,
|
||||
1843, 1814, 1389, 1275, 1040, 1564, 1414, 1252, 1610, 1495, 1343, 1753, 1592, 1405, 1804, 1720,
|
||||
1475, 1843, 1814, 1581, 1208, 1061, 856, 1349, 1148, 994, 1390, 1253, 1111, 1495, 1343, 1178,
|
||||
@ -81,7 +81,7 @@ const WebRtc_Word16 WebRtcIsac_kQMeanGain2Q12[144] = {
|
||||
222, 38, 513, 271, 124, 624, 325, 157, 737, 484, 233, 849, 597, 343, 27, 0,
|
||||
0, 141, 0, 0, 256, 69, 0, 370, 87, 0, 484, 229, 0, 597, 343, 87};
|
||||
|
||||
const WebRtc_Word16 WebRtcIsac_kQMeanGain3Q12[144] = {
|
||||
const int16_t WebRtcIsac_kQMeanGain3Q12[144] = {
|
||||
1843, 1843, 1711, 1843, 1818, 1606, 1843, 1827, 1511, 1814, 1639, 1393, 1760, 1525, 1285, 1656,
|
||||
1419, 1176, 1835, 1718, 1475, 1841, 1650, 1387, 1648, 1498, 1287, 1600, 1411, 1176, 1522, 1299,
|
||||
1040, 1419, 1176, 928, 1773, 1461, 1128, 1532, 1355, 1202, 1429, 1260, 1115, 1398, 1151, 1025,
|
||||
@ -93,7 +93,7 @@ const WebRtc_Word16 WebRtcIsac_kQMeanGain3Q12[144] = {
|
||||
0, 370, 57, 0, 256, 43, 0, 141, 0, 0, 27, 0, 0, 0, 0, 0};
|
||||
|
||||
|
||||
const WebRtc_Word16 WebRtcIsac_kQMeanGain4Q12[144] = {
|
||||
const int16_t WebRtcIsac_kQMeanGain4Q12[144] = {
|
||||
1843, 1843, 1843, 1843, 1841, 1843, 1500, 1821, 1843, 1222, 1434, 1656, 843, 1092, 1336, 504,
|
||||
757, 1007, 1843, 1843, 1843, 1838, 1791, 1843, 1265, 1505, 1599, 965, 1219, 1425, 730, 821,
|
||||
1092, 249, 504, 757, 1783, 1819, 1843, 1351, 1567, 1727, 1096, 1268, 1409, 805, 961, 1131,
|
||||
|
||||
@ -23,23 +23,23 @@
|
||||
/* header file for coding tables for the pitch filter side-info in the entropy coder */
|
||||
/********************* Pitch Filter Gain Coefficient Tables ************************/
|
||||
/* cdf for quantized pitch filter gains */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchGainCdf[255];
|
||||
extern const uint16_t WebRtcIsac_kQPitchGainCdf[255];
|
||||
|
||||
/* index limits and ranges */
|
||||
extern const WebRtc_Word16 WebRtcIsac_kIndexLowerLimitGain[3];
|
||||
extern const int16_t WebRtcIsac_kIndexLowerLimitGain[3];
|
||||
|
||||
extern const WebRtc_Word16 WebRtcIsac_kIndexUpperLimitGain[3];
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kIndexMultsGain[2];
|
||||
extern const int16_t WebRtcIsac_kIndexUpperLimitGain[3];
|
||||
extern const uint16_t WebRtcIsac_kIndexMultsGain[2];
|
||||
|
||||
/* mean values of pitch filter gains */
|
||||
//(Y)
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQMeanGain1Q12[144];
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQMeanGain2Q12[144];
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQMeanGain3Q12[144];
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQMeanGain4Q12[144];
|
||||
extern const int16_t WebRtcIsac_kQMeanGain1Q12[144];
|
||||
extern const int16_t WebRtcIsac_kQMeanGain2Q12[144];
|
||||
extern const int16_t WebRtcIsac_kQMeanGain3Q12[144];
|
||||
extern const int16_t WebRtcIsac_kQMeanGain4Q12[144];
|
||||
//(Y)
|
||||
|
||||
/* size of cdf table */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQCdfTableSizeGain[1];
|
||||
extern const uint16_t WebRtcIsac_kQCdfTableSizeGain[1];
|
||||
|
||||
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_GAIN_TABLES_H_ */
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
/* tables for use with small pitch gain */
|
||||
|
||||
/* cdf for quantized pitch filter lags */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf1Lo[127] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf1Lo[127] = {
|
||||
0, 134, 336, 549, 778, 998, 1264, 1512, 1777, 2070,
|
||||
2423, 2794, 3051, 3361, 3708, 3979, 4315, 4610, 4933, 5269,
|
||||
5575, 5896, 6155, 6480, 6816, 7129, 7477, 7764, 8061, 8358,
|
||||
@ -32,30 +32,30 @@ const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf1Lo[127] = {
|
||||
59288, 60179, 61076, 61806, 62474, 63129, 63656, 64160, 64533, 64856,
|
||||
65152, 65535, 65535, 65535, 65535, 65535, 65535};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf2Lo[20] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf2Lo[20] = {
|
||||
0, 429, 3558, 5861, 8558, 11639, 15210, 19502, 24773, 31983,
|
||||
42602, 48567, 52601, 55676, 58160, 60172, 61889, 63235, 65383, 65535};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf3Lo[2] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf3Lo[2] = {
|
||||
0, 65535};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf4Lo[10] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf4Lo[10] = {
|
||||
0, 2966, 6368, 11182, 19431, 37793, 48532, 55353, 60626, 65535};
|
||||
|
||||
const WebRtc_UWord16 *WebRtcIsac_kQPitchLagCdfPtrLo[4] = {WebRtcIsac_kQPitchLagCdf1Lo, WebRtcIsac_kQPitchLagCdf2Lo, WebRtcIsac_kQPitchLagCdf3Lo, WebRtcIsac_kQPitchLagCdf4Lo};
|
||||
const uint16_t *WebRtcIsac_kQPitchLagCdfPtrLo[4] = {WebRtcIsac_kQPitchLagCdf1Lo, WebRtcIsac_kQPitchLagCdf2Lo, WebRtcIsac_kQPitchLagCdf3Lo, WebRtcIsac_kQPitchLagCdf4Lo};
|
||||
|
||||
/* size of first cdf table */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdfSizeLo[1] = {128};
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdfSizeLo[1] = {128};
|
||||
|
||||
/* index limits and ranges */
|
||||
const WebRtc_Word16 WebRtcIsac_kQIndexLowerLimitLagLo[4] = {
|
||||
const int16_t WebRtcIsac_kQIndexLowerLimitLagLo[4] = {
|
||||
-140, -9, 0, -4};
|
||||
|
||||
const WebRtc_Word16 WebRtcIsac_kQIndexUpperLimitLagLo[4] = {
|
||||
const int16_t WebRtcIsac_kQIndexUpperLimitLagLo[4] = {
|
||||
-20, 9, 0, 4};
|
||||
|
||||
/* initial index for arithmetic decoder */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQInitIndexLagLo[3] = {
|
||||
const uint16_t WebRtcIsac_kQInitIndexLagLo[3] = {
|
||||
10, 1, 5};
|
||||
|
||||
/* mean values of pitch filter lags */
|
||||
@ -75,7 +75,7 @@ const double WebRtcIsac_kQPitchLagStepsizeLo = 2.000000;
|
||||
/* tables for use with medium pitch gain */
|
||||
|
||||
/* cdf for quantized pitch filter lags */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf1Mid[255] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf1Mid[255] = {
|
||||
0, 28, 61, 88, 121, 149, 233, 331, 475, 559,
|
||||
624, 661, 689, 712, 745, 791, 815, 843, 866, 922,
|
||||
959, 1024, 1061, 1117, 1178, 1238, 1280, 1350, 1453, 1513,
|
||||
@ -103,33 +103,33 @@ const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf1Mid[255] = {
|
||||
65414, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535,
|
||||
65535, 65535, 65535, 65535, 65535};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf2Mid[36] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf2Mid[36] = {
|
||||
0, 71, 335, 581, 836, 1039, 1323, 1795, 2258, 2608,
|
||||
3005, 3591, 4243, 5344, 7163, 10583, 16848, 28078, 49448, 57007,
|
||||
60357, 61850, 62837, 63437, 63872, 64188, 64377, 64614, 64774, 64949,
|
||||
65039, 65115, 65223, 65360, 65474, 65535};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf3Mid[2] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf3Mid[2] = {
|
||||
0, 65535};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf4Mid[20] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf4Mid[20] = {
|
||||
0, 28, 246, 459, 667, 1045, 1523, 2337, 4337, 11347,
|
||||
44231, 56709, 60781, 62243, 63161, 63969, 64608, 65062, 65502, 65535};
|
||||
|
||||
const WebRtc_UWord16 *WebRtcIsac_kQPitchLagCdfPtrMid[4] = {WebRtcIsac_kQPitchLagCdf1Mid, WebRtcIsac_kQPitchLagCdf2Mid, WebRtcIsac_kQPitchLagCdf3Mid, WebRtcIsac_kQPitchLagCdf4Mid};
|
||||
const uint16_t *WebRtcIsac_kQPitchLagCdfPtrMid[4] = {WebRtcIsac_kQPitchLagCdf1Mid, WebRtcIsac_kQPitchLagCdf2Mid, WebRtcIsac_kQPitchLagCdf3Mid, WebRtcIsac_kQPitchLagCdf4Mid};
|
||||
|
||||
/* size of first cdf table */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdfSizeMid[1] = {256};
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdfSizeMid[1] = {256};
|
||||
|
||||
/* index limits and ranges */
|
||||
const WebRtc_Word16 WebRtcIsac_kQIndexLowerLimitLagMid[4] = {
|
||||
const int16_t WebRtcIsac_kQIndexLowerLimitLagMid[4] = {
|
||||
-280, -17, 0, -9};
|
||||
|
||||
const WebRtc_Word16 WebRtcIsac_kQIndexUpperLimitLagMid[4] = {
|
||||
const int16_t WebRtcIsac_kQIndexUpperLimitLagMid[4] = {
|
||||
-40, 17, 0, 9};
|
||||
|
||||
/* initial index for arithmetic decoder */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQInitIndexLagMid[3] = {
|
||||
const uint16_t WebRtcIsac_kQInitIndexLagMid[3] = {
|
||||
18, 1, 10};
|
||||
|
||||
/* mean values of pitch filter lags */
|
||||
@ -152,7 +152,7 @@ const double WebRtcIsac_kQPitchLagStepsizeMid = 1.000000;
|
||||
/* tables for use with large pitch gain */
|
||||
|
||||
/* cdf for quantized pitch filter lags */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf1Hi[511] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf1Hi[511] = {
|
||||
0, 7, 18, 33, 69, 105, 156, 228, 315, 612,
|
||||
680, 691, 709, 724, 735, 738, 742, 746, 749, 753,
|
||||
756, 760, 764, 774, 782, 785, 789, 796, 800, 803,
|
||||
@ -206,7 +206,7 @@ const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf1Hi[511] = {
|
||||
65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535,
|
||||
65535};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf2Hi[68] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf2Hi[68] = {
|
||||
0, 7, 11, 22, 37, 52, 56, 59, 81, 85,
|
||||
89, 96, 115, 130, 137, 152, 170, 181, 193, 200,
|
||||
207, 233, 237, 259, 289, 318, 363, 433, 592, 992,
|
||||
@ -215,29 +215,29 @@ const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf2Hi[68] = {
|
||||
65413, 65420, 65428, 65435, 65439, 65450, 65454, 65468, 65472, 65476,
|
||||
65483, 65491, 65498, 65505, 65516, 65520, 65528, 65535};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf3Hi[2] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf3Hi[2] = {
|
||||
0, 65535};
|
||||
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf4Hi[35] = {
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdf4Hi[35] = {
|
||||
0, 7, 19, 30, 41, 48, 63, 74, 82, 96,
|
||||
122, 152, 215, 330, 701, 2611, 10931, 48106, 61177, 64341,
|
||||
65112, 65238, 65309, 65338, 65364, 65379, 65401, 65427, 65453, 65465,
|
||||
65476, 65490, 65509, 65528, 65535};
|
||||
|
||||
const WebRtc_UWord16 *WebRtcIsac_kQPitchLagCdfPtrHi[4] = {WebRtcIsac_kQPitchLagCdf1Hi, WebRtcIsac_kQPitchLagCdf2Hi, WebRtcIsac_kQPitchLagCdf3Hi, WebRtcIsac_kQPitchLagCdf4Hi};
|
||||
const uint16_t *WebRtcIsac_kQPitchLagCdfPtrHi[4] = {WebRtcIsac_kQPitchLagCdf1Hi, WebRtcIsac_kQPitchLagCdf2Hi, WebRtcIsac_kQPitchLagCdf3Hi, WebRtcIsac_kQPitchLagCdf4Hi};
|
||||
|
||||
/* size of first cdf table */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdfSizeHi[1] = {512};
|
||||
const uint16_t WebRtcIsac_kQPitchLagCdfSizeHi[1] = {512};
|
||||
|
||||
/* index limits and ranges */
|
||||
const WebRtc_Word16 WebRtcIsac_kQindexLowerLimitLagHi[4] = {
|
||||
const int16_t WebRtcIsac_kQindexLowerLimitLagHi[4] = {
|
||||
-552, -34, 0, -16};
|
||||
|
||||
const WebRtc_Word16 WebRtcIsac_kQindexUpperLimitLagHi[4] = {
|
||||
const int16_t WebRtcIsac_kQindexUpperLimitLagHi[4] = {
|
||||
-80, 32, 0, 17};
|
||||
|
||||
/* initial index for arithmetic decoder */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQInitIndexLagHi[3] = {
|
||||
const uint16_t WebRtcIsac_kQInitIndexLagHi[3] = {
|
||||
34, 1, 18};
|
||||
|
||||
/* mean values of pitch filter lags */
|
||||
|
||||
@ -25,22 +25,22 @@
|
||||
/* tables for use with small pitch gain */
|
||||
|
||||
/* cdfs for quantized pitch lags */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf1Lo[127];
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf2Lo[20];
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf3Lo[2];
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf4Lo[10];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf1Lo[127];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf2Lo[20];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf3Lo[2];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf4Lo[10];
|
||||
|
||||
extern const WebRtc_UWord16 *WebRtcIsac_kQPitchLagCdfPtrLo[4];
|
||||
extern const uint16_t *WebRtcIsac_kQPitchLagCdfPtrLo[4];
|
||||
|
||||
/* size of first cdf table */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdfSizeLo[1];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdfSizeLo[1];
|
||||
|
||||
/* index limits and ranges */
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQIndexLowerLimitLagLo[4];
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQIndexUpperLimitLagLo[4];
|
||||
extern const int16_t WebRtcIsac_kQIndexLowerLimitLagLo[4];
|
||||
extern const int16_t WebRtcIsac_kQIndexUpperLimitLagLo[4];
|
||||
|
||||
/* initial index for arithmetic decoder */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQInitIndexLagLo[3];
|
||||
extern const uint16_t WebRtcIsac_kQInitIndexLagLo[3];
|
||||
|
||||
/* mean values of pitch filter lags */
|
||||
extern const double WebRtcIsac_kQMeanLag2Lo[19];
|
||||
@ -53,22 +53,22 @@ extern const double WebRtcIsac_kQPitchLagStepsizeLo;
|
||||
/* tables for use with medium pitch gain */
|
||||
|
||||
/* cdfs for quantized pitch lags */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf1Mid[255];
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf2Mid[36];
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf3Mid[2];
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf4Mid[20];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf1Mid[255];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf2Mid[36];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf3Mid[2];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf4Mid[20];
|
||||
|
||||
extern const WebRtc_UWord16 *WebRtcIsac_kQPitchLagCdfPtrMid[4];
|
||||
extern const uint16_t *WebRtcIsac_kQPitchLagCdfPtrMid[4];
|
||||
|
||||
/* size of first cdf table */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdfSizeMid[1];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdfSizeMid[1];
|
||||
|
||||
/* index limits and ranges */
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQIndexLowerLimitLagMid[4];
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQIndexUpperLimitLagMid[4];
|
||||
extern const int16_t WebRtcIsac_kQIndexLowerLimitLagMid[4];
|
||||
extern const int16_t WebRtcIsac_kQIndexUpperLimitLagMid[4];
|
||||
|
||||
/* initial index for arithmetic decoder */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQInitIndexLagMid[3];
|
||||
extern const uint16_t WebRtcIsac_kQInitIndexLagMid[3];
|
||||
|
||||
/* mean values of pitch filter lags */
|
||||
extern const double WebRtcIsac_kQMeanLag2Mid[35];
|
||||
@ -81,22 +81,22 @@ extern const double WebRtcIsac_kQPitchLagStepsizeMid;
|
||||
/* tables for use with large pitch gain */
|
||||
|
||||
/* cdfs for quantized pitch lags */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf1Hi[511];
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf2Hi[68];
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf3Hi[2];
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdf4Hi[35];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf1Hi[511];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf2Hi[68];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf3Hi[2];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf4Hi[35];
|
||||
|
||||
extern const WebRtc_UWord16 *WebRtcIsac_kQPitchLagCdfPtrHi[4];
|
||||
extern const uint16_t *WebRtcIsac_kQPitchLagCdfPtrHi[4];
|
||||
|
||||
/* size of first cdf table */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQPitchLagCdfSizeHi[1];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdfSizeHi[1];
|
||||
|
||||
/* index limits and ranges */
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQindexLowerLimitLagHi[4];
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQindexUpperLimitLagHi[4];
|
||||
extern const int16_t WebRtcIsac_kQindexLowerLimitLagHi[4];
|
||||
extern const int16_t WebRtcIsac_kQindexUpperLimitLagHi[4];
|
||||
|
||||
/* initial index for arithmetic decoder */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQInitIndexLagHi[3];
|
||||
extern const uint16_t WebRtcIsac_kQInitIndexLagHi[3];
|
||||
|
||||
/* mean values of pitch filter lags */
|
||||
extern const double WebRtcIsac_kQMeanLag2Hi[67];
|
||||
|
||||
@ -13,82 +13,82 @@
|
||||
|
||||
/********************* AR Coefficient Tables ************************/
|
||||
/* cdf for quantized reflection coefficient 1 */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQArRc1Cdf[12] = {
|
||||
const uint16_t WebRtcIsac_kQArRc1Cdf[12] = {
|
||||
0, 2, 4, 129, 7707, 57485, 65495, 65527, 65529, 65531,
|
||||
65533, 65535};
|
||||
|
||||
/* cdf for quantized reflection coefficient 2 */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQArRc2Cdf[12] = {
|
||||
const uint16_t WebRtcIsac_kQArRc2Cdf[12] = {
|
||||
0, 2, 4, 7, 531, 25298, 64525, 65526, 65529, 65531,
|
||||
65533, 65535};
|
||||
|
||||
/* cdf for quantized reflection coefficient 3 */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQArRc3Cdf[12] = {
|
||||
const uint16_t WebRtcIsac_kQArRc3Cdf[12] = {
|
||||
0, 2, 4, 6, 620, 22898, 64843, 65527, 65529, 65531,
|
||||
65533, 65535};
|
||||
|
||||
/* cdf for quantized reflection coefficient 4 */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQArRc4Cdf[12] = {
|
||||
const uint16_t WebRtcIsac_kQArRc4Cdf[12] = {
|
||||
0, 2, 4, 6, 35, 10034, 60733, 65506, 65529, 65531,
|
||||
65533, 65535};
|
||||
|
||||
/* cdf for quantized reflection coefficient 5 */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQArRc5Cdf[12] = {
|
||||
const uint16_t WebRtcIsac_kQArRc5Cdf[12] = {
|
||||
0, 2, 4, 6, 36, 7567, 56727, 65385, 65529, 65531,
|
||||
65533, 65535};
|
||||
|
||||
/* cdf for quantized reflection coefficient 6 */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQArRc6Cdf[12] = {
|
||||
const uint16_t WebRtcIsac_kQArRc6Cdf[12] = {
|
||||
0, 2, 4, 6, 14, 6579, 57360, 65409, 65529, 65531,
|
||||
65533, 65535};
|
||||
|
||||
/* representation levels for quantized reflection coefficient 1 */
|
||||
const WebRtc_Word16 WebRtcIsac_kQArRc1Levels[11] = {
|
||||
const int16_t WebRtcIsac_kQArRc1Levels[11] = {
|
||||
-32104, -29007, -23202, -15496, -9279, -2577, 5934, 17535, 24512, 29503, 32104
|
||||
};
|
||||
|
||||
/* representation levels for quantized reflection coefficient 2 */
|
||||
const WebRtc_Word16 WebRtcIsac_kQArRc2Levels[11] = {
|
||||
const int16_t WebRtcIsac_kQArRc2Levels[11] = {
|
||||
-32104, -29503, -23494, -15261, -7309, -1399, 6158, 16381, 24512, 29503, 32104
|
||||
};
|
||||
|
||||
/* representation levels for quantized reflection coefficient 3 */
|
||||
const WebRtc_Word16 WebRtcIsac_kQArRc3Levels[11] = {
|
||||
const int16_t WebRtcIsac_kQArRc3Levels[11] = {
|
||||
-32104, -29503, -23157, -15186, -7347, -1359, 5829, 17535, 24512, 29503, 32104
|
||||
};
|
||||
|
||||
/* representation levels for quantized reflection coefficient 4 */
|
||||
const WebRtc_Word16 WebRtcIsac_kQArRc4Levels[11] = {
|
||||
const int16_t WebRtcIsac_kQArRc4Levels[11] = {
|
||||
-32104, -29503, -24512, -15362, -6665, -342, 6596, 14585, 24512, 29503, 32104
|
||||
};
|
||||
|
||||
/* representation levels for quantized reflection coefficient 5 */
|
||||
const WebRtc_Word16 WebRtcIsac_kQArRc5Levels[11] = {
|
||||
const int16_t WebRtcIsac_kQArRc5Levels[11] = {
|
||||
-32104, -29503, -24512, -15005, -6564, -106, 7123, 14920, 24512, 29503, 32104
|
||||
};
|
||||
|
||||
/* representation levels for quantized reflection coefficient 6 */
|
||||
const WebRtc_Word16 WebRtcIsac_kQArRc6Levels[11] = {
|
||||
const int16_t WebRtcIsac_kQArRc6Levels[11] = {
|
||||
-32104, -29503, -24512, -15096, -6656, -37, 7036, 14847, 24512, 29503, 32104
|
||||
};
|
||||
|
||||
/* quantization boundary levels for reflection coefficients */
|
||||
const WebRtc_Word16 WebRtcIsac_kQArBoundaryLevels[12] = {
|
||||
const int16_t WebRtcIsac_kQArBoundaryLevels[12] = {
|
||||
-32768, -31441, -27566, -21458, -13612, -4663, 4663, 13612, 21458, 27566, 31441, 32767
|
||||
};
|
||||
|
||||
/* initial index for AR reflection coefficient quantizer and cdf table search */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQArRcInitIndex[6] = {
|
||||
const uint16_t WebRtcIsac_kQArRcInitIndex[6] = {
|
||||
5, 5, 5, 5, 5, 5};
|
||||
|
||||
/* pointers to AR cdf tables */
|
||||
const WebRtc_UWord16 *WebRtcIsac_kQArRcCdfPtr[AR_ORDER] = {
|
||||
const uint16_t *WebRtcIsac_kQArRcCdfPtr[AR_ORDER] = {
|
||||
WebRtcIsac_kQArRc1Cdf, WebRtcIsac_kQArRc2Cdf, WebRtcIsac_kQArRc3Cdf,
|
||||
WebRtcIsac_kQArRc4Cdf, WebRtcIsac_kQArRc5Cdf, WebRtcIsac_kQArRc6Cdf
|
||||
};
|
||||
|
||||
/* pointers to AR representation levels tables */
|
||||
const WebRtc_Word16 *WebRtcIsac_kQArRcLevelsPtr[AR_ORDER] = {
|
||||
const int16_t *WebRtcIsac_kQArRcLevelsPtr[AR_ORDER] = {
|
||||
WebRtcIsac_kQArRc1Levels, WebRtcIsac_kQArRc2Levels, WebRtcIsac_kQArRc3Levels,
|
||||
WebRtcIsac_kQArRc4Levels, WebRtcIsac_kQArRc5Levels, WebRtcIsac_kQArRc6Levels
|
||||
};
|
||||
@ -96,27 +96,27 @@ const WebRtc_Word16 *WebRtcIsac_kQArRcLevelsPtr[AR_ORDER] = {
|
||||
|
||||
/******************** GAIN Coefficient Tables ***********************/
|
||||
/* cdf for Gain coefficient */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQGainCdf[19] = {
|
||||
const uint16_t WebRtcIsac_kQGainCdf[19] = {
|
||||
0, 2, 4, 6, 8, 10, 12, 14, 16, 1172,
|
||||
11119, 29411, 51699, 64445, 65527, 65529, 65531, 65533, 65535};
|
||||
|
||||
/* representation levels for quantized squared Gain coefficient */
|
||||
const WebRtc_Word32 WebRtcIsac_kQGain2Levels[18] = {
|
||||
const int32_t WebRtcIsac_kQGain2Levels[18] = {
|
||||
// 17, 28, 46, 76, 128, 215, 364, 709, 1268, 1960, 3405, 6078, 11286, 17827, 51918, 134498, 487432, 2048000};
|
||||
128, 128, 128, 128, 128, 215, 364, 709, 1268, 1960, 3405, 6078, 11286, 17827, 51918, 134498, 487432, 2048000};
|
||||
/* quantization boundary levels for squared Gain coefficient */
|
||||
const WebRtc_Word32 WebRtcIsac_kQGain2BoundaryLevels[19] = {
|
||||
const int32_t WebRtcIsac_kQGain2BoundaryLevels[19] = {
|
||||
0, 21, 35, 59, 99, 166, 280, 475, 815, 1414, 2495, 4505, 8397, 16405, 34431, 81359, 240497, 921600, 0x7FFFFFFF};
|
||||
|
||||
/* pointers to Gain cdf table */
|
||||
const WebRtc_UWord16 *WebRtcIsac_kQGainCdf_ptr[1] = {WebRtcIsac_kQGainCdf};
|
||||
const uint16_t *WebRtcIsac_kQGainCdf_ptr[1] = {WebRtcIsac_kQGainCdf};
|
||||
|
||||
/* Gain initial index for gain quantizer and cdf table search */
|
||||
const WebRtc_UWord16 WebRtcIsac_kQGainInitIndex[1] = {11};
|
||||
const uint16_t WebRtcIsac_kQGainInitIndex[1] = {11};
|
||||
|
||||
/************************* Cosine Tables ****************************/
|
||||
/* Cosine table */
|
||||
const WebRtc_Word16 WebRtcIsac_kCos[6][60] = {
|
||||
const int16_t WebRtcIsac_kCos[6][60] = {
|
||||
{512, 512, 511, 510, 508, 507, 505, 502, 499, 496, 493, 489, 485, 480, 476, 470, 465, 459, 453, 447,
|
||||
440, 433, 426, 418, 410, 402, 394, 385, 376, 367, 357, 348, 338, 327, 317, 306, 295, 284, 273, 262,
|
||||
250, 238, 226, 214, 202, 190, 177, 165, 152, 139, 126, 113, 100, 87, 73, 60, 47, 33, 20, 7},
|
||||
|
||||
@ -23,54 +23,54 @@
|
||||
|
||||
/********************* AR Coefficient Tables ************************/
|
||||
/* cdf for quantized reflection coefficient 1 */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQArRc1Cdf[12];
|
||||
extern const uint16_t WebRtcIsac_kQArRc1Cdf[12];
|
||||
|
||||
/* cdf for quantized reflection coefficient 2 */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQArRc2Cdf[12];
|
||||
extern const uint16_t WebRtcIsac_kQArRc2Cdf[12];
|
||||
|
||||
/* cdf for quantized reflection coefficient 3 */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQArRc3Cdf[12];
|
||||
extern const uint16_t WebRtcIsac_kQArRc3Cdf[12];
|
||||
|
||||
/* cdf for quantized reflection coefficient 4 */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQArRc4Cdf[12];
|
||||
extern const uint16_t WebRtcIsac_kQArRc4Cdf[12];
|
||||
|
||||
/* cdf for quantized reflection coefficient 5 */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQArRc5Cdf[12];
|
||||
extern const uint16_t WebRtcIsac_kQArRc5Cdf[12];
|
||||
|
||||
/* cdf for quantized reflection coefficient 6 */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQArRc6Cdf[12];
|
||||
extern const uint16_t WebRtcIsac_kQArRc6Cdf[12];
|
||||
|
||||
/* quantization boundary levels for reflection coefficients */
|
||||
extern const WebRtc_Word16 WebRtcIsac_kQArBoundaryLevels[12];
|
||||
extern const int16_t WebRtcIsac_kQArBoundaryLevels[12];
|
||||
|
||||
/* initial indices for AR reflection coefficient quantizer and cdf table search */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQArRcInitIndex[AR_ORDER];
|
||||
extern const uint16_t WebRtcIsac_kQArRcInitIndex[AR_ORDER];
|
||||
|
||||
/* pointers to AR cdf tables */
|
||||
extern const WebRtc_UWord16 *WebRtcIsac_kQArRcCdfPtr[AR_ORDER];
|
||||
extern const uint16_t *WebRtcIsac_kQArRcCdfPtr[AR_ORDER];
|
||||
|
||||
/* pointers to AR representation levels tables */
|
||||
extern const WebRtc_Word16 *WebRtcIsac_kQArRcLevelsPtr[AR_ORDER];
|
||||
extern const int16_t *WebRtcIsac_kQArRcLevelsPtr[AR_ORDER];
|
||||
|
||||
|
||||
/******************** GAIN Coefficient Tables ***********************/
|
||||
/* cdf for Gain coefficient */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQGainCdf[19];
|
||||
extern const uint16_t WebRtcIsac_kQGainCdf[19];
|
||||
|
||||
/* representation levels for quantized Gain coefficient */
|
||||
extern const WebRtc_Word32 WebRtcIsac_kQGain2Levels[18];
|
||||
extern const int32_t WebRtcIsac_kQGain2Levels[18];
|
||||
|
||||
/* squared quantization boundary levels for Gain coefficient */
|
||||
extern const WebRtc_Word32 WebRtcIsac_kQGain2BoundaryLevels[19];
|
||||
extern const int32_t WebRtcIsac_kQGain2BoundaryLevels[19];
|
||||
|
||||
/* pointer to Gain cdf table */
|
||||
extern const WebRtc_UWord16 *WebRtcIsac_kQGainCdf_ptr[1];
|
||||
extern const uint16_t *WebRtcIsac_kQGainCdf_ptr[1];
|
||||
|
||||
/* Gain initial index for gain quantizer and cdf table search */
|
||||
extern const WebRtc_UWord16 WebRtcIsac_kQGainInitIndex[1];
|
||||
extern const uint16_t WebRtcIsac_kQGainInitIndex[1];
|
||||
|
||||
/************************* Cosine Tables ****************************/
|
||||
/* Cosine table */
|
||||
extern const WebRtc_Word16 WebRtcIsac_kCos[6][60];
|
||||
extern const int16_t WebRtcIsac_kCos[6][60];
|
||||
|
||||
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SPECTRUM_AR_MODEL_TABLES_H_ */
|
||||
|
||||
@ -25,10 +25,10 @@
|
||||
|
||||
typedef struct Bitstreamstruct {
|
||||
|
||||
WebRtc_UWord8 stream[STREAM_SIZE_MAX];
|
||||
WebRtc_UWord32 W_upper;
|
||||
WebRtc_UWord32 streamval;
|
||||
WebRtc_UWord32 stream_index;
|
||||
uint8_t stream[STREAM_SIZE_MAX];
|
||||
uint32_t W_upper;
|
||||
uint32_t streamval;
|
||||
uint32_t stream_index;
|
||||
|
||||
} Bitstr;
|
||||
|
||||
@ -149,32 +149,32 @@ typedef struct {
|
||||
typedef struct {
|
||||
|
||||
/* Previous frame length (in ms) */
|
||||
WebRtc_Word32 prev_frame_length;
|
||||
int32_t prev_frame_length;
|
||||
|
||||
/* Previous RTP timestamp from received
|
||||
packet (in samples relative beginning) */
|
||||
WebRtc_Word32 prev_rec_rtp_number;
|
||||
int32_t prev_rec_rtp_number;
|
||||
|
||||
/* Send timestamp for previous packet (in ms using timeGetTime()) */
|
||||
WebRtc_UWord32 prev_rec_send_ts;
|
||||
uint32_t prev_rec_send_ts;
|
||||
|
||||
/* Arrival time for previous packet (in ms using timeGetTime()) */
|
||||
WebRtc_UWord32 prev_rec_arr_ts;
|
||||
uint32_t prev_rec_arr_ts;
|
||||
|
||||
/* rate of previous packet, derived from RTP timestamps (in bits/s) */
|
||||
float prev_rec_rtp_rate;
|
||||
|
||||
/* Time sinse the last update of the BN estimate (in ms) */
|
||||
WebRtc_UWord32 last_update_ts;
|
||||
uint32_t last_update_ts;
|
||||
|
||||
/* Time sinse the last reduction (in ms) */
|
||||
WebRtc_UWord32 last_reduction_ts;
|
||||
uint32_t last_reduction_ts;
|
||||
|
||||
/* How many times the estimate was update in the beginning */
|
||||
WebRtc_Word32 count_tot_updates_rec;
|
||||
int32_t count_tot_updates_rec;
|
||||
|
||||
/* The estimated bottle neck rate from there to here (in bits/s) */
|
||||
WebRtc_Word32 rec_bw;
|
||||
int32_t rec_bw;
|
||||
float rec_bw_inv;
|
||||
float rec_bw_avg;
|
||||
float rec_bw_avg_Q;
|
||||
@ -212,18 +212,18 @@ typedef struct {
|
||||
// been detected upstream
|
||||
int hsn_detect_snd;
|
||||
|
||||
WebRtc_UWord32 start_wait_period;
|
||||
uint32_t start_wait_period;
|
||||
|
||||
int in_wait_period;
|
||||
|
||||
int change_to_WB;
|
||||
|
||||
WebRtc_UWord32 senderTimestamp;
|
||||
WebRtc_UWord32 receiverTimestamp;
|
||||
uint32_t senderTimestamp;
|
||||
uint32_t receiverTimestamp;
|
||||
//enum IsacSamplingRate incomingStreamSampFreq;
|
||||
WebRtc_UWord16 numConsecLatePkts;
|
||||
uint16_t numConsecLatePkts;
|
||||
float consecLatency;
|
||||
WebRtc_Word16 inWaitLatePkts;
|
||||
int16_t inWaitLatePkts;
|
||||
} BwEstimatorstr;
|
||||
|
||||
|
||||
@ -268,7 +268,7 @@ typedef struct {
|
||||
int startIdx;
|
||||
|
||||
/* Frame length in samples */
|
||||
WebRtc_Word16 framelength;
|
||||
int16_t framelength;
|
||||
|
||||
/* Pitch Gain */
|
||||
int pitchGain_index[2];
|
||||
@ -284,9 +284,9 @@ typedef struct {
|
||||
double LPCcoeffs_hi[(ORDERHI+1)*SUBFRAMES*2];
|
||||
|
||||
/* Encode Spec */
|
||||
WebRtc_Word16 fre[FRAMESAMPLES];
|
||||
WebRtc_Word16 fim[FRAMESAMPLES];
|
||||
WebRtc_Word16 AvgPitchGain[2];
|
||||
int16_t fre[FRAMESAMPLES];
|
||||
int16_t fim[FRAMESAMPLES];
|
||||
int16_t AvgPitchGain[2];
|
||||
|
||||
/* Used in adaptive mode only */
|
||||
int minBytes;
|
||||
@ -302,8 +302,8 @@ typedef struct {
|
||||
|
||||
Bitstr bitStreamObj;
|
||||
|
||||
WebRtc_Word16 realFFT[FRAMESAMPLES_HALF];
|
||||
WebRtc_Word16 imagFFT[FRAMESAMPLES_HALF];
|
||||
int16_t realFFT[FRAMESAMPLES_HALF];
|
||||
int16_t imagFFT[FRAMESAMPLES_HALF];
|
||||
} ISACUBSaveEncDataStruct;
|
||||
|
||||
|
||||
@ -319,29 +319,29 @@ typedef struct {
|
||||
ISAC_SaveEncData_t SaveEnc_obj;
|
||||
|
||||
int buffer_index;
|
||||
WebRtc_Word16 current_framesamples;
|
||||
int16_t current_framesamples;
|
||||
|
||||
float data_buffer_float[FRAMESAMPLES_30ms];
|
||||
|
||||
int frame_nb;
|
||||
double bottleneck;
|
||||
WebRtc_Word16 new_framelength;
|
||||
int16_t new_framelength;
|
||||
double s2nr;
|
||||
|
||||
/* Maximum allowed number of bits for a 30 msec packet */
|
||||
WebRtc_Word16 payloadLimitBytes30;
|
||||
int16_t payloadLimitBytes30;
|
||||
/* Maximum allowed number of bits for a 30 msec packet */
|
||||
WebRtc_Word16 payloadLimitBytes60;
|
||||
int16_t payloadLimitBytes60;
|
||||
/* Maximum allowed number of bits for both 30 and 60 msec packet */
|
||||
WebRtc_Word16 maxPayloadBytes;
|
||||
int16_t maxPayloadBytes;
|
||||
/* Maximum allowed rate in bytes per 30 msec packet */
|
||||
WebRtc_Word16 maxRateInBytes;
|
||||
int16_t maxRateInBytes;
|
||||
|
||||
/*---
|
||||
If set to 1 iSAC will not addapt the frame-size, if used in
|
||||
channel-adaptive mode. The initial value will be used for all rates.
|
||||
---*/
|
||||
WebRtc_Word16 enforceFrameSize;
|
||||
int16_t enforceFrameSize;
|
||||
|
||||
/*-----
|
||||
This records the BWE index the encoder injected into the bit-stream.
|
||||
@ -350,7 +350,7 @@ typedef struct {
|
||||
a recursive procedure (WebRtcIsac_GetDownlinkBwJitIndexImpl) and has to be
|
||||
called only once per each encode.
|
||||
-----*/
|
||||
WebRtc_Word16 lastBWIdx;
|
||||
int16_t lastBWIdx;
|
||||
} ISACLBEncStruct;
|
||||
|
||||
typedef struct {
|
||||
@ -366,14 +366,14 @@ typedef struct {
|
||||
LB_TOTAL_DELAY_SAMPLES];
|
||||
double bottleneck;
|
||||
/* Maximum allowed number of bits for a 30 msec packet */
|
||||
//WebRtc_Word16 payloadLimitBytes30;
|
||||
//int16_t payloadLimitBytes30;
|
||||
/* Maximum allowed number of bits for both 30 and 60 msec packet */
|
||||
//WebRtc_Word16 maxPayloadBytes;
|
||||
WebRtc_Word16 maxPayloadSizeBytes;
|
||||
//int16_t maxPayloadBytes;
|
||||
int16_t maxPayloadSizeBytes;
|
||||
|
||||
double lastLPCVec[UB_LPC_ORDER];
|
||||
WebRtc_Word16 numBytesUsed;
|
||||
WebRtc_Word16 lastJitterInfo;
|
||||
int16_t numBytesUsed;
|
||||
int16_t lastJitterInfo;
|
||||
} ISACUBEncStruct;
|
||||
|
||||
|
||||
@ -422,11 +422,11 @@ typedef struct {
|
||||
double loFiltGain[SUBFRAMES];
|
||||
double hiFiltGain[SUBFRAMES];
|
||||
/* Upper boundary of interval W */
|
||||
WebRtc_UWord32 W_upper;
|
||||
WebRtc_UWord32 streamval;
|
||||
uint32_t W_upper;
|
||||
uint32_t streamval;
|
||||
/* Index to the current position in bytestream */
|
||||
WebRtc_UWord32 stream_index;
|
||||
WebRtc_UWord8 stream[3];
|
||||
uint32_t stream_index;
|
||||
uint8_t stream[3];
|
||||
} transcode_obj;
|
||||
|
||||
|
||||
@ -442,19 +442,19 @@ typedef struct {
|
||||
double MaxDelay;
|
||||
|
||||
/* 0 = adaptive; 1 = instantaneous */
|
||||
WebRtc_Word16 codingMode;
|
||||
int16_t codingMode;
|
||||
|
||||
// overall bottleneck of the codec
|
||||
WebRtc_Word32 bottleneck;
|
||||
int32_t bottleneck;
|
||||
|
||||
// QMF Filter state
|
||||
WebRtc_Word32 analysisFBState1[FB_STATE_SIZE_WORD32];
|
||||
WebRtc_Word32 analysisFBState2[FB_STATE_SIZE_WORD32];
|
||||
WebRtc_Word32 synthesisFBState1[FB_STATE_SIZE_WORD32];
|
||||
WebRtc_Word32 synthesisFBState2[FB_STATE_SIZE_WORD32];
|
||||
int32_t analysisFBState1[FB_STATE_SIZE_WORD32];
|
||||
int32_t analysisFBState2[FB_STATE_SIZE_WORD32];
|
||||
int32_t synthesisFBState1[FB_STATE_SIZE_WORD32];
|
||||
int32_t synthesisFBState2[FB_STATE_SIZE_WORD32];
|
||||
|
||||
// Error Code
|
||||
WebRtc_Word16 errorCode;
|
||||
int16_t errorCode;
|
||||
|
||||
// bandwidth of the encoded audio 8, 12 or 16 kHz
|
||||
enum ISACBandwidth bandwidthKHz;
|
||||
@ -463,19 +463,19 @@ typedef struct {
|
||||
enum IsacSamplingRate decoderSamplingRateKHz;
|
||||
// Flag to keep track of initializations, lower & upper-band
|
||||
// encoder and decoder.
|
||||
WebRtc_Word16 initFlag;
|
||||
int16_t initFlag;
|
||||
|
||||
// Flag to to indicate signal bandwidth switch
|
||||
WebRtc_Word16 resetFlag_8kHz;
|
||||
int16_t resetFlag_8kHz;
|
||||
|
||||
// Maximum allowed rate, measured in Bytes per 30 ms.
|
||||
WebRtc_Word16 maxRateBytesPer30Ms;
|
||||
int16_t maxRateBytesPer30Ms;
|
||||
// Maximum allowed payload-size, measured in Bytes.
|
||||
WebRtc_Word16 maxPayloadSizeBytes;
|
||||
int16_t maxPayloadSizeBytes;
|
||||
/* The expected sampling rate of the input signal. Valid values are 16000,
|
||||
* 32000 and 48000. This is not the operation sampling rate of the codec.
|
||||
* Input signals at 48 kHz are resampled to 32 kHz, then encoded. */
|
||||
WebRtc_UWord16 in_sample_rate_hz;
|
||||
uint16_t in_sample_rate_hz;
|
||||
/* State for the input-resampler. It is only used for 48 kHz input signals. */
|
||||
int16_t state_in_resampler[SIZE_RESAMPLER_STATE];
|
||||
} ISACMainStruct;
|
||||
|
||||
@ -44,8 +44,8 @@ void WebRtcIsac_InitTransform()
|
||||
|
||||
void WebRtcIsac_Time2Spec(double *inre1,
|
||||
double *inre2,
|
||||
WebRtc_Word16 *outreQ7,
|
||||
WebRtc_Word16 *outimQ7,
|
||||
int16_t *outreQ7,
|
||||
int16_t *outimQ7,
|
||||
FFTstr *fftstr_obj)
|
||||
{
|
||||
|
||||
@ -80,10 +80,10 @@ void WebRtcIsac_Time2Spec(double *inre1,
|
||||
|
||||
tmp1r = costab2[k];
|
||||
tmp1i = sintab2[k];
|
||||
outreQ7[k] = (WebRtc_Word16)WebRtcIsac_lrint((xr * tmp1r - xi * tmp1i) * 128.0);
|
||||
outimQ7[k] = (WebRtc_Word16)WebRtcIsac_lrint((xr * tmp1i + xi * tmp1r) * 128.0);
|
||||
outreQ7[FRAMESAMPLES_HALF - 1 - k] = (WebRtc_Word16)WebRtcIsac_lrint((-yr * tmp1i - yi * tmp1r) * 128.0);
|
||||
outimQ7[FRAMESAMPLES_HALF - 1 - k] = (WebRtc_Word16)WebRtcIsac_lrint((-yr * tmp1r + yi * tmp1i) * 128.0);
|
||||
outreQ7[k] = (int16_t)WebRtcIsac_lrint((xr * tmp1r - xi * tmp1i) * 128.0);
|
||||
outimQ7[k] = (int16_t)WebRtcIsac_lrint((xr * tmp1i + xi * tmp1r) * 128.0);
|
||||
outreQ7[FRAMESAMPLES_HALF - 1 - k] = (int16_t)WebRtcIsac_lrint((-yr * tmp1i - yi * tmp1r) * 128.0);
|
||||
outimQ7[FRAMESAMPLES_HALF - 1 - k] = (int16_t)WebRtcIsac_lrint((-yr * tmp1r + yi * tmp1i) * 128.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user