Reformat the WebRTC code base

Running clang-format with chromium's style guide.

The goal is n-fold:
 * providing consistency and readability (that's what code guidelines are for)
 * preventing noise with presubmit checks and git cl format
 * building on the previous point: making it easier to automatically fix format issues
 * you name it

Please consider using git-hyper-blame to ignore this commit.

Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
Yves Gerey
2018-06-19 15:03:05 +02:00
parent b602123a5a
commit 665174fdbb
1569 changed files with 30495 additions and 30309 deletions

View File

@ -35,12 +35,10 @@
* Return value : 0 if ok,
* <0 otherwise.
*/
int WebRtcIsacfix_EncLogisticMulti2(
Bitstr_enc *streamData,
int16_t *dataQ7,
const uint16_t *env,
const int16_t lenData);
int WebRtcIsacfix_EncLogisticMulti2(Bitstr_enc* streamData,
int16_t* dataQ7,
const uint16_t* env,
const int16_t lenData);
/****************************************************************************
* WebRtcIsacfix_EncTerminate(...)
@ -53,8 +51,7 @@ int WebRtcIsacfix_EncLogisticMulti2(
*
* Return value : number of bytes in the stream
*/
int16_t WebRtcIsacfix_EncTerminate(Bitstr_enc *streamData);
int16_t WebRtcIsacfix_EncTerminate(Bitstr_enc* streamData);
/****************************************************************************
* WebRtcIsacfix_DecLogisticMulti2(...)
@ -73,12 +70,10 @@ int16_t WebRtcIsacfix_EncTerminate(Bitstr_enc *streamData);
* Return value : number of bytes in the stream so far
* <0 if error detected
*/
int WebRtcIsacfix_DecLogisticMulti2(
int16_t *data,
Bitstr_dec *streamData,
const int32_t *env,
const int16_t lenData);
int WebRtcIsacfix_DecLogisticMulti2(int16_t* data,
Bitstr_dec* streamData,
const int32_t* env,
const int16_t lenData);
/****************************************************************************
* WebRtcIsacfix_EncHistMulti(...)
@ -94,12 +89,10 @@ int WebRtcIsacfix_DecLogisticMulti2(
* Return value : 0 if ok
* <0 if error detected
*/
int WebRtcIsacfix_EncHistMulti(
Bitstr_enc *streamData,
const int16_t *data,
const uint16_t *const *cdf,
const int16_t lenData);
int WebRtcIsacfix_EncHistMulti(Bitstr_enc* streamData,
const int16_t* data,
const uint16_t* const* cdf,
const int16_t lenData);
/****************************************************************************
* WebRtcIsacfix_DecHistBisectMulti(...)
@ -121,13 +114,11 @@ int WebRtcIsacfix_EncHistMulti(
* Return value : number of bytes in the stream
* <0 if error detected
*/
int16_t WebRtcIsacfix_DecHistBisectMulti(
int16_t *data,
Bitstr_dec *streamData,
const uint16_t *const *cdf,
const uint16_t *cdfSize,
const int16_t lenData);
int16_t WebRtcIsacfix_DecHistBisectMulti(int16_t* data,
Bitstr_dec* streamData,
const uint16_t* const* cdf,
const uint16_t* cdfSize,
const int16_t lenData);
/****************************************************************************
* WebRtcIsacfix_DecHistOneStepMulti(...)
@ -149,11 +140,10 @@ int16_t WebRtcIsacfix_DecHistBisectMulti(
* Return value : number of bytes in original stream
* <0 if error detected
*/
int16_t WebRtcIsacfix_DecHistOneStepMulti(
int16_t *data,
Bitstr_dec *streamData,
const uint16_t *const *cdf,
const uint16_t *initIndex,
const int16_t lenData);
int16_t WebRtcIsacfix_DecHistOneStepMulti(int16_t* data,
Bitstr_dec* streamData,
const uint16_t* const* cdf,
const uint16_t* initIndex,
const int16_t lenData);
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_ARITH_ROUTINS_H_ */

View File

@ -32,8 +32,7 @@
* Return value : 0
*/
int32_t WebRtcIsacfix_InitBandwidthEstimator(BwEstimatorstr *bwest_str);
int32_t WebRtcIsacfix_InitBandwidthEstimator(BwEstimatorstr* bwest_str);
/****************************************************************************
* WebRtcIsacfix_UpdateUplinkBwImpl(...)
@ -56,16 +55,17 @@ int32_t WebRtcIsacfix_InitBandwidthEstimator(BwEstimatorstr *bwest_str);
* -1 otherwise
*/
int32_t WebRtcIsacfix_UpdateUplinkBwImpl(BwEstimatorstr *bwest_str,
const uint16_t rtp_number,
const int16_t frameSize,
const uint32_t send_ts,
const uint32_t arr_ts,
const size_t pksize,
const uint16_t Index);
int32_t WebRtcIsacfix_UpdateUplinkBwImpl(BwEstimatorstr* bwest_str,
const uint16_t rtp_number,
const int16_t frameSize,
const uint32_t send_ts,
const uint32_t arr_ts,
const size_t pksize,
const uint16_t Index);
/* Update receiving estimates. Used when we only receive BWE index, no iSAC data packet. */
int16_t WebRtcIsacfix_UpdateUplinkBwRec(BwEstimatorstr *bwest_str,
/* Update receiving estimates. Used when we only receive BWE index, no iSAC data
* packet. */
int16_t WebRtcIsacfix_UpdateUplinkBwRec(BwEstimatorstr* bwest_str,
const int16_t Index);
/****************************************************************************
@ -80,19 +80,19 @@ int16_t WebRtcIsacfix_UpdateUplinkBwRec(BwEstimatorstr *bwest_str,
* Return:
* bandwith and jitter index (0..23)
*/
uint16_t WebRtcIsacfix_GetDownlinkBwIndexImpl(BwEstimatorstr *bwest_str);
uint16_t WebRtcIsacfix_GetDownlinkBwIndexImpl(BwEstimatorstr* bwest_str);
/* Returns the bandwidth estimation (in bps) */
uint16_t WebRtcIsacfix_GetDownlinkBandwidth(const BwEstimatorstr *bwest_str);
uint16_t WebRtcIsacfix_GetDownlinkBandwidth(const BwEstimatorstr* bwest_str);
/* Returns the bandwidth that iSAC should send with in bps */
int16_t WebRtcIsacfix_GetUplinkBandwidth(const BwEstimatorstr *bwest_str);
int16_t WebRtcIsacfix_GetUplinkBandwidth(const BwEstimatorstr* bwest_str);
/* Returns the max delay (in ms) */
int16_t WebRtcIsacfix_GetDownlinkMaxDelay(const BwEstimatorstr *bwest_str);
int16_t WebRtcIsacfix_GetDownlinkMaxDelay(const BwEstimatorstr* bwest_str);
/* Returns the max delay value from the other side in ms */
int16_t WebRtcIsacfix_GetUplinkMaxDelay(const BwEstimatorstr *bwest_str);
int16_t WebRtcIsacfix_GetUplinkMaxDelay(const BwEstimatorstr* bwest_str);
/* Fills in an IsacExternalBandwidthInfo struct. */
void WebRtcIsacfixBw_GetBandwidthInfo(BwEstimatorstr* bwest_str,
@ -106,29 +106,31 @@ void WebRtcIsacfixBw_SetBandwidthInfo(BwEstimatorstr* bwest_str,
* update amount of data in bottle neck buffer and burst handling
* returns minimum payload size (bytes)
*/
uint16_t WebRtcIsacfix_GetMinBytes(RateModel *State,
int16_t StreamSize, /* bytes in bitstream */
const int16_t FrameLen, /* ms per frame */
const int16_t BottleNeck, /* bottle neck rate; excl headers (bps) */
const int16_t DelayBuildUp); /* max delay from bottle neck buffering (ms) */
uint16_t WebRtcIsacfix_GetMinBytes(
RateModel* State,
int16_t StreamSize, /* bytes in bitstream */
const int16_t FrameLen, /* ms per frame */
const int16_t BottleNeck, /* bottle neck rate; excl headers (bps) */
const int16_t DelayBuildUp); /* max delay from bottle neck buffering (ms) */
/*
* update long-term average bitrate and amount of data in buffer
*/
void WebRtcIsacfix_UpdateRateModel(RateModel *State,
int16_t StreamSize, /* bytes in bitstream */
const int16_t FrameSamples, /* samples per frame */
const int16_t BottleNeck); /* bottle neck rate; excl headers (bps) */
void WebRtcIsacfix_UpdateRateModel(
RateModel* State,
int16_t StreamSize, /* bytes in bitstream */
const int16_t FrameSamples, /* samples per frame */
const int16_t BottleNeck); /* bottle neck rate; excl headers (bps) */
void WebRtcIsacfix_InitRateModel(RateModel *State);
void WebRtcIsacfix_InitRateModel(RateModel* State);
/* Returns the new framelength value (input argument: bottle_neck) */
int16_t WebRtcIsacfix_GetNewFrameLength(int16_t bottle_neck, int16_t current_framelength);
int16_t WebRtcIsacfix_GetNewFrameLength(int16_t bottle_neck,
int16_t current_framelength);
/* Returns the new SNR value (input argument: bottle_neck) */
//returns snr in Q10
// returns snr in Q10
int16_t WebRtcIsacfix_GetSnr(int16_t bottle_neck, int16_t framesamples);
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_BANDWIDTH_ESTIMATOR_H_ */
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_BANDWIDTH_ESTIMATOR_H_ \
*/

View File

@ -38,7 +38,7 @@ int WebRtcIsacfix_DecodeImpl(int16_t* signal_out16,
void WebRtcIsacfix_DecodePlcImpl(int16_t* decoded,
IsacFixDecoderInstance* ISACdec_obj,
size_t* current_framesample );
size_t* current_framesample);
int WebRtcIsacfix_EncodeImpl(int16_t* in,
IsacFixEncoderInstance* ISACenc_obj,
@ -64,7 +64,6 @@ void WebRtcIsacfix_InitPitchAnalysis(PitchAnalysisStruct* State);
void WebRtcIsacfix_InitPlc(PLCstr* State);
/* transform functions */
void WebRtcIsacfix_InitTransform(void);

View File

@ -22,91 +22,79 @@
#include "modules/audio_coding/codecs/isac/fix/source/structs.h"
/* decode complex spectrum (return number of bytes in stream) */
int WebRtcIsacfix_DecodeSpec(Bitstr_dec *streamdata,
int16_t *frQ7,
int16_t *fiQ7,
int WebRtcIsacfix_DecodeSpec(Bitstr_dec* streamdata,
int16_t* frQ7,
int16_t* fiQ7,
int16_t AvgPitchGain_Q12);
/* encode complex spectrum */
int WebRtcIsacfix_EncodeSpec(const int16_t *fr,
const int16_t *fi,
Bitstr_enc *streamdata,
int WebRtcIsacfix_EncodeSpec(const int16_t* fr,
const int16_t* fi,
Bitstr_enc* streamdata,
int16_t AvgPitchGain_Q12);
/* decode & dequantize LPC Coef */
int WebRtcIsacfix_DecodeLpcCoef(Bitstr_dec *streamdata,
int32_t *LPCCoefQ17,
int32_t *gain_lo_hiQ17,
int16_t *outmodel);
int WebRtcIsacfix_DecodeLpcCoef(Bitstr_dec* streamdata,
int32_t* LPCCoefQ17,
int32_t* gain_lo_hiQ17,
int16_t* outmodel);
int WebRtcIsacfix_DecodeLpc(int32_t *gain_lo_hiQ17,
int16_t *LPCCoef_loQ15,
int16_t *LPCCoef_hiQ15,
Bitstr_dec *streamdata,
int16_t *outmodel);
int WebRtcIsacfix_DecodeLpc(int32_t* gain_lo_hiQ17,
int16_t* LPCCoef_loQ15,
int16_t* LPCCoef_hiQ15,
Bitstr_dec* streamdata,
int16_t* outmodel);
/* quantize & code LPC Coef */
int WebRtcIsacfix_EncodeLpc(int32_t *gain_lo_hiQ17,
int16_t *LPCCoef_loQ15,
int16_t *LPCCoef_hiQ15,
int16_t *model,
int32_t *sizeQ11,
Bitstr_enc *streamdata,
int WebRtcIsacfix_EncodeLpc(int32_t* gain_lo_hiQ17,
int16_t* LPCCoef_loQ15,
int16_t* LPCCoef_hiQ15,
int16_t* model,
int32_t* sizeQ11,
Bitstr_enc* streamdata,
IsacSaveEncoderData* encData,
transcode_obj *transcodeParam);
transcode_obj* transcodeParam);
int WebRtcIsacfix_EstCodeLpcGain(int32_t *gain_lo_hiQ17,
Bitstr_enc *streamdata,
int WebRtcIsacfix_EstCodeLpcGain(int32_t* gain_lo_hiQ17,
Bitstr_enc* streamdata,
IsacSaveEncoderData* encData);
/* decode & dequantize RC */
int WebRtcIsacfix_DecodeRcCoef(Bitstr_dec *streamdata,
int16_t *RCQ15);
int WebRtcIsacfix_DecodeRcCoef(Bitstr_dec* streamdata, int16_t* RCQ15);
/* quantize & code RC */
int WebRtcIsacfix_EncodeRcCoef(int16_t *RCQ15,
Bitstr_enc *streamdata);
int WebRtcIsacfix_EncodeRcCoef(int16_t* RCQ15, Bitstr_enc* streamdata);
/* decode & dequantize squared Gain */
int WebRtcIsacfix_DecodeGain2(Bitstr_dec *streamdata,
int32_t *Gain2);
int WebRtcIsacfix_DecodeGain2(Bitstr_dec* streamdata, int32_t* Gain2);
/* quantize & code squared Gain (input is squared gain) */
int WebRtcIsacfix_EncodeGain2(int32_t *gain2,
Bitstr_enc *streamdata);
int WebRtcIsacfix_EncodeGain2(int32_t* gain2, Bitstr_enc* streamdata);
int WebRtcIsacfix_EncodePitchGain(int16_t *PitchGains_Q12,
Bitstr_enc *streamdata,
int WebRtcIsacfix_EncodePitchGain(int16_t* PitchGains_Q12,
Bitstr_enc* streamdata,
IsacSaveEncoderData* encData);
int WebRtcIsacfix_EncodePitchLag(int16_t *PitchLagQ7,
int16_t *PitchGain_Q12,
Bitstr_enc *streamdata,
int WebRtcIsacfix_EncodePitchLag(int16_t* PitchLagQ7,
int16_t* PitchGain_Q12,
Bitstr_enc* streamdata,
IsacSaveEncoderData* encData);
int WebRtcIsacfix_DecodePitchGain(Bitstr_dec *streamdata,
int16_t *PitchGain_Q12);
int WebRtcIsacfix_DecodePitchGain(Bitstr_dec* streamdata,
int16_t* PitchGain_Q12);
int WebRtcIsacfix_DecodePitchLag(Bitstr_dec *streamdata,
int16_t *PitchGain_Q12,
int16_t *PitchLagQ7);
int WebRtcIsacfix_DecodePitchLag(Bitstr_dec* streamdata,
int16_t* PitchGain_Q12,
int16_t* PitchLagQ7);
int WebRtcIsacfix_DecodeFrameLen(Bitstr_dec *streamdata,
size_t *framelength);
int WebRtcIsacfix_DecodeFrameLen(Bitstr_dec* streamdata, size_t* framelength);
int WebRtcIsacfix_EncodeFrameLen(int16_t framelength, Bitstr_enc* streamdata);
int WebRtcIsacfix_EncodeFrameLen(int16_t framelength,
Bitstr_enc *streamdata);
int WebRtcIsacfix_DecodeSendBandwidth(Bitstr_dec* streamdata, int16_t* BWno);
int WebRtcIsacfix_DecodeSendBandwidth(Bitstr_dec *streamdata,
int16_t *BWno);
int WebRtcIsacfix_EncodeReceiveBandwidth(int16_t* BWno, Bitstr_enc* streamdata);
int WebRtcIsacfix_EncodeReceiveBandwidth(int16_t *BWno,
Bitstr_enc *streamdata);
void WebRtcIsacfix_TranscodeLpcCoef(int32_t *tmpcoeffs_gQ6,
int16_t *index_gQQ);
void WebRtcIsacfix_TranscodeLpcCoef(int32_t* tmpcoeffs_gQ6, int16_t* index_gQQ);
// Pointer functions for LPC transforms.

View File

@ -32,8 +32,8 @@
#include "modules/audio_coding/codecs/isac/fix/source/structs.h"
int16_t WebRtcIsacfix_FftRadix16Fastest(int16_t RexQx[], int16_t ImxQx[], int16_t iSign);
int16_t WebRtcIsacfix_FftRadix16Fastest(int16_t RexQx[],
int16_t ImxQx[],
int16_t iSign);
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_FFT_H_ */

View File

@ -42,44 +42,41 @@ void WebRtcIsacfix_HighpassFilterFixDec32MIPS(int16_t* io,
#endif
typedef void (*AllpassFilter2FixDec16)(
int16_t *data_ch1, // Input and output in channel 1, in Q0
int16_t *data_ch2, // Input and output in channel 2, in Q0
const int16_t *factor_ch1, // Scaling factor for channel 1, in Q15
const int16_t *factor_ch2, // Scaling factor for channel 2, in Q15
int16_t* data_ch1, // Input and output in channel 1, in Q0
int16_t* data_ch2, // Input and output in channel 2, in Q0
const int16_t* factor_ch1, // Scaling factor for channel 1, in Q15
const int16_t* factor_ch2, // Scaling factor for channel 2, in Q15
const int length, // Length of the data buffers
int32_t *filter_state_ch1, // Filter state for channel 1, in Q16
int32_t *filter_state_ch2); // Filter state for channel 2, in Q16
int32_t* filter_state_ch1, // Filter state for channel 1, in Q16
int32_t* filter_state_ch2); // Filter state for channel 2, in Q16
extern AllpassFilter2FixDec16 WebRtcIsacfix_AllpassFilter2FixDec16;
void WebRtcIsacfix_AllpassFilter2FixDec16C(
int16_t *data_ch1,
int16_t *data_ch2,
const int16_t *factor_ch1,
const int16_t *factor_ch2,
const int length,
int32_t *filter_state_ch1,
int32_t *filter_state_ch2);
void WebRtcIsacfix_AllpassFilter2FixDec16C(int16_t* data_ch1,
int16_t* data_ch2,
const int16_t* factor_ch1,
const int16_t* factor_ch2,
const int length,
int32_t* filter_state_ch1,
int32_t* filter_state_ch2);
#if defined(WEBRTC_HAS_NEON)
void WebRtcIsacfix_AllpassFilter2FixDec16Neon(
int16_t *data_ch1,
int16_t *data_ch2,
const int16_t *factor_ch1,
const int16_t *factor_ch2,
const int length,
int32_t *filter_state_ch1,
int32_t *filter_state_ch2);
void WebRtcIsacfix_AllpassFilter2FixDec16Neon(int16_t* data_ch1,
int16_t* data_ch2,
const int16_t* factor_ch1,
const int16_t* factor_ch2,
const int length,
int32_t* filter_state_ch1,
int32_t* filter_state_ch2);
#endif
#if defined(MIPS_DSP_R1_LE)
void WebRtcIsacfix_AllpassFilter2FixDec16MIPS(
int16_t *data_ch1,
int16_t *data_ch2,
const int16_t *factor_ch1,
const int16_t *factor_ch2,
const int length,
int32_t *filter_state_ch1,
int32_t *filter_state_ch2);
void WebRtcIsacfix_AllpassFilter2FixDec16MIPS(int16_t* data_ch1,
int16_t* data_ch2,
const int16_t* factor_ch1,
const int16_t* factor_ch2,
const int length,
int32_t* filter_state_ch1,
int32_t* filter_state_ch2);
#endif
#if defined(__cplusplus) || defined(c_plusplus)

View File

@ -21,8 +21,8 @@ class FilterBanksTest : public testing::Test {
protected:
// Pass a function pointer to the Tester function.
void RTC_NO_SANITIZE("signed-integer-overflow") // bugs.webrtc.org/5513
CalculateResidualEnergyTester(AllpassFilter2FixDec16
AllpassFilter2FixDec16Function) {
CalculateResidualEnergyTester(
AllpassFilter2FixDec16 AllpassFilter2FixDec16Function) {
const int kSamples = QLOOKAHEAD;
const int kState = 2;
int16_t data_ch1[kSamples] = {0};
@ -31,12 +31,14 @@ class FilterBanksTest : public testing::Test {
int32_t state_ch2[kState] = {0};
const int32_t out_state_ch1[kState] = {-809122714, 1645972152};
const int32_t out_state_ch2[kState] = {428019288, 1057309936};
const int32_t out_data_ch1[kSamples] = {0, 0, 347, 10618, 16718, -7089,
32767, 16913, 27042, 8377, -22973, -28372, -27603, -14804, 398, -25332,
-11200, 18044, 25223, -6839, 1116, -23984, 32717, 7364};
const int32_t out_data_ch2[kSamples] = {0, 0, 3010, 22351, 21106, 16969,
-2095, -664, 3513, -30980, 32767, -23839, 13335, 20289, -6831, 339,
-17207, 32767, 4959, 6177, 32767, 16599, -4747, 20504};
const int32_t out_data_ch1[kSamples] = {
0, 0, 347, 10618, 16718, -7089, 32767, 16913,
27042, 8377, -22973, -28372, -27603, -14804, 398, -25332,
-11200, 18044, 25223, -6839, 1116, -23984, 32717, 7364};
const int32_t out_data_ch2[kSamples] = {
0, 0, 3010, 22351, 21106, 16969, -2095, -664,
3513, -30980, 32767, -23839, 13335, 20289, -6831, 339,
-17207, 32767, 4959, 6177, 32767, 16599, -4747, 20504};
int sign = 1;
for (int i = 0; i < kSamples; i++) {
@ -46,13 +48,9 @@ class FilterBanksTest : public testing::Test {
// UBSan: -1 * -2147483648 cannot be represented in type 'int'
};
AllpassFilter2FixDec16Function(data_ch1,
data_ch2,
WebRtcIsacfix_kUpperApFactorsQ15,
WebRtcIsacfix_kLowerApFactorsQ15,
kSamples,
state_ch1,
state_ch2);
AllpassFilter2FixDec16Function(
data_ch1, data_ch2, WebRtcIsacfix_kUpperApFactorsQ15,
WebRtcIsacfix_kLowerApFactorsQ15, kSamples, state_ch1, state_ch2);
for (int i = 0; i < kSamples; i++) {
EXPECT_EQ(out_data_ch1[i], data_ch1[i]);
@ -77,13 +75,13 @@ TEST_F(FilterBanksTest, HighpassFilterFixDec32Test) {
int16_t in[kSamples];
int32_t state[2] = {12345, 987654};
#ifdef WEBRTC_ARCH_ARM_V7
int32_t out[kSamples] = {-1040, -1035, -22875, -1397, -27604, 20018, 7917,
-1279, -8552, -14494, -7558, -23537, -27258, -30554, -32768, -3432, -32768,
25215, -27536, 22436};
int32_t out[kSamples] = {-1040, -1035, -22875, -1397, -27604, 20018, 7917,
-1279, -8552, -14494, -7558, -23537, -27258, -30554,
-32768, -3432, -32768, 25215, -27536, 22436};
#else
int32_t out[kSamples] = {-1040, -1035, -22875, -1397, -27604, 20017, 7915,
-1280, -8554, -14496, -7561, -23541, -27263, -30560, -32768, -3441, -32768,
25203, -27550, 22419};
int32_t out[kSamples] = {-1040, -1035, -22875, -1397, -27604, 20017, 7915,
-1280, -8554, -14496, -7561, -23541, -27263, -30560,
-32768, -3441, -32768, 25203, -27550, 22419};
#endif
HighpassFilterFixDec32 WebRtcIsacfix_HighpassFilterFixDec32;
#if defined(MIPS_DSP_R1_LE)
@ -98,7 +96,7 @@ TEST_F(FilterBanksTest, HighpassFilterFixDec32Test) {
}
WebRtcIsacfix_HighpassFilterFixDec32(in, kSamples,
WebRtcIsacfix_kHPStCoeffOut1Q30, state);
WebRtcIsacfix_kHPStCoeffOut1Q30, state);
for (int i = 0; i < kSamples; i++) {
EXPECT_EQ(out[i], in[i]);

View File

@ -23,34 +23,37 @@ class FiltersTest : public testing::Test {
int32_t r_buffer[kOrder + 2] = {0};
// Test an overflow case.
const int16_t x_buffer_0[kBuffer] = {0, 0, 3010, 22351, 21106, 16969, -2095,
-664, 3513, -30980, 32767, -23839, 13335, 20289, -6831, 339, -17207,
32767, 4959, 6177, 32767, 16599, -4747, 20504, 3513, -30980, 32767,
-23839, 13335, 20289, 0, -16969, -2095, -664, 3513, 31981, 32767,
-13839, 23336, 30281};
const int32_t r_expected_0[kOrder + 2] = {1872498461, -224288754, 203789985,
483400487, -208272635, 2436500, 137785322, 266600814, -208486262,
329510080, 137949184, -161738972, -26894267, 237630192};
const int16_t x_buffer_0[kBuffer] = {
0, 0, 3010, 22351, 21106, 16969, -2095, -664,
3513, -30980, 32767, -23839, 13335, 20289, -6831, 339,
-17207, 32767, 4959, 6177, 32767, 16599, -4747, 20504,
3513, -30980, 32767, -23839, 13335, 20289, 0, -16969,
-2095, -664, 3513, 31981, 32767, -13839, 23336, 30281};
const int32_t r_expected_0[kOrder + 2] = {
1872498461, -224288754, 203789985, 483400487, -208272635,
2436500, 137785322, 266600814, -208486262, 329510080,
137949184, -161738972, -26894267, 237630192};
WebRtcIsacfix_AutocorrFixFunction(r_buffer, x_buffer_0,
kBuffer, kOrder + 1, &scale);
WebRtcIsacfix_AutocorrFixFunction(r_buffer, x_buffer_0, kBuffer, kOrder + 1,
&scale);
for (int i = 0; i < kOrder + 2; i++) {
EXPECT_EQ(r_expected_0[i], r_buffer[i]);
}
EXPECT_EQ(3, scale);
// Test a no-overflow case.
const int16_t x_buffer_1[kBuffer] = {0, 0, 300, 21, 206, 169, -295,
-664, 3513, -300, 327, -29, 15, 289, -6831, 339, -107,
37, 59, 6177, 327, 169, -4747, 204, 313, -980, 767,
-9, 135, 289, 0, -6969, -2095, -664, 0, 1, 7,
-39, 236, 281};
const int32_t r_expected_1[kOrder + 2] = {176253864, 8126617, 1983287,
-26196788, -3487363, -42839676, -24644043, 3469813, 30559879, 31905045,
5101567, 29328896, -55787438, -13163978};
const int16_t x_buffer_1[kBuffer] = {
0, 0, 300, 21, 206, 169, -295, -664, 3513, -300,
327, -29, 15, 289, -6831, 339, -107, 37, 59, 6177,
327, 169, -4747, 204, 313, -980, 767, -9, 135, 289,
0, -6969, -2095, -664, 0, 1, 7, -39, 236, 281};
const int32_t r_expected_1[kOrder + 2] = {
176253864, 8126617, 1983287, -26196788, -3487363,
-42839676, -24644043, 3469813, 30559879, 31905045,
5101567, 29328896, -55787438, -13163978};
WebRtcIsacfix_AutocorrFixFunction(r_buffer, x_buffer_1,
kBuffer, kOrder + 1, &scale);
WebRtcIsacfix_AutocorrFixFunction(r_buffer, x_buffer_1, kBuffer, kOrder + 1,
&scale);
for (int i = 0; i < kOrder + 2; i++) {
EXPECT_EQ(r_expected_1[i], r_buffer[i]);
}

View File

@ -24,19 +24,19 @@ extern "C" {
#include "modules/audio_coding/codecs/isac/fix/source/structs.h"
void WebRtcIsacfix_GetVars(const int16_t *input,
const int16_t *pitchGains_Q12,
uint32_t *oldEnergy,
int16_t *varscale);
void WebRtcIsacfix_GetVars(const int16_t* input,
const int16_t* pitchGains_Q12,
uint32_t* oldEnergy,
int16_t* varscale);
void WebRtcIsacfix_GetLpcCoef(int16_t *inLoQ0,
int16_t *inHiQ0,
MaskFiltstr_enc *maskdata,
void WebRtcIsacfix_GetLpcCoef(int16_t* inLoQ0,
int16_t* inHiQ0,
MaskFiltstr_enc* maskdata,
int16_t snrQ10,
const int16_t *pitchGains_Q12,
int32_t *gain_lo_hiQ17,
int16_t *lo_coeffQ15,
int16_t *hi_coeffQ15);
const int16_t* pitchGains_Q12,
int32_t* gain_lo_hiQ17,
int16_t* lo_coeffQ15,
int16_t* hi_coeffQ15);
typedef int32_t (*CalculateResidualEnergy)(int lpc_order,
int32_t q_val_corr,

View File

@ -16,21 +16,21 @@
class LpcMaskingModelTest : public testing::Test {
protected:
// Pass a function pointer to the Tester function.
void CalculateResidualEnergyTester(CalculateResidualEnergy
CalculateResidualEnergyFunction) {
void CalculateResidualEnergyTester(
CalculateResidualEnergy CalculateResidualEnergyFunction) {
const int kIntOrder = 10;
const int32_t kInt32QDomain = 5;
const int kIntShift = 11;
int16_t a[kIntOrder + 1] = {32760, 122, 7, 0, -32760, -3958,
-48, 18745, 498, 9, 23456};
int32_t corr[kIntOrder + 1] = {11443647, -27495, 0,
98745, -11443600, 1, 1, 498, 9, 888, 23456};
int16_t a[kIntOrder + 1] = {32760, 122, 7, 0, -32760, -3958,
-48, 18745, 498, 9, 23456};
int32_t corr[kIntOrder + 1] = {11443647, -27495, 0, 98745, -11443600, 1,
1, 498, 9, 888, 23456};
int q_shift_residual = 0;
int32_t residual_energy = 0;
// Test the code path where (residual_energy >= 0x10000).
residual_energy = CalculateResidualEnergyFunction(kIntOrder,
kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
residual_energy = CalculateResidualEnergyFunction(
kIntOrder, kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
EXPECT_EQ(1789023310, residual_energy);
EXPECT_EQ(2, q_shift_residual);
@ -40,8 +40,8 @@ class LpcMaskingModelTest : public testing::Test {
a[i] = 24575 >> i;
corr[i] = i;
}
residual_energy = CalculateResidualEnergyFunction(kIntOrder,
kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
residual_energy = CalculateResidualEnergyFunction(
kIntOrder, kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
EXPECT_EQ(1595279092, residual_energy);
EXPECT_EQ(26, q_shift_residual);
@ -49,8 +49,8 @@ class LpcMaskingModelTest : public testing::Test {
for (int i = 0; i < kIntOrder + 1; i++) {
a[i] = 2457 >> i;
}
residual_energy = CalculateResidualEnergyFunction(kIntOrder,
kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
residual_energy = CalculateResidualEnergyFunction(
kIntOrder, kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
EXPECT_EQ(2029266944, residual_energy);
EXPECT_EQ(33, q_shift_residual);
}

View File

@ -26,10 +26,10 @@ extern const uint16_t WebRtcIsacfix_kSelIndGain[12];
extern const uint16_t WebRtcIsacfix_kSelIndShape[108];
/* cdf array for model indicator */
extern const uint16_t WebRtcIsacfix_kModelCdf[KLT_NUM_MODELS+1];
extern const uint16_t WebRtcIsacfix_kModelCdf[KLT_NUM_MODELS + 1];
/* pointer to cdf array for model indicator */
extern const uint16_t *WebRtcIsacfix_kModelCdfPtr[1];
extern const uint16_t* WebRtcIsacfix_kModelCdfPtr[1];
/* initial cdf index for decoder of model indicator */
extern const uint16_t WebRtcIsacfix_kModelInitIndex[1];
@ -70,9 +70,9 @@ extern const uint16_t WebRtcIsacfix_kCdfGain[1212];
extern const uint16_t WebRtcIsacfix_kCdfShape[2059];
/* pointers to cdf tables for quantizer indices */
extern const uint16_t *WebRtcIsacfix_kCdfGainPtr[KLT_NUM_MODELS][12];
extern const uint16_t* WebRtcIsacfix_kCdfGainPtr[KLT_NUM_MODELS][12];
extern const uint16_t *WebRtcIsacfix_kCdfShapePtr[KLT_NUM_MODELS][108];
extern const uint16_t* WebRtcIsacfix_kCdfShapePtr[KLT_NUM_MODELS][108];
/* code length for all coefficients using different models */
extern const int16_t WebRtcIsacfix_kCodeLenGainQ11[392];

View File

@ -20,21 +20,22 @@
#include "modules/audio_coding/codecs/isac/fix/source/structs.h"
void WebRtcIsacfix_PitchAnalysis(const int16_t *in, /* PITCH_FRAME_LEN samples */
int16_t *outQ0, /* PITCH_FRAME_LEN+QLOOKAHEAD samples */
PitchAnalysisStruct *State,
int16_t *lagsQ7,
int16_t *PitchGains_Q12);
void WebRtcIsacfix_PitchAnalysis(
const int16_t* in, /* PITCH_FRAME_LEN samples */
int16_t* outQ0, /* PITCH_FRAME_LEN+QLOOKAHEAD samples */
PitchAnalysisStruct* State,
int16_t* lagsQ7,
int16_t* PitchGains_Q12);
void WebRtcIsacfix_InitialPitch(const int16_t *in,
PitchAnalysisStruct *State,
int16_t *qlags);
void WebRtcIsacfix_InitialPitch(const int16_t* in,
PitchAnalysisStruct* State,
int16_t* qlags);
void WebRtcIsacfix_PitchFilter(int16_t *indatFix,
int16_t *outdatQQ,
PitchFiltstr *pfp,
int16_t *lagsQ7,
int16_t *gainsQ12,
void WebRtcIsacfix_PitchFilter(int16_t* indatFix,
int16_t* outdatQQ,
PitchFiltstr* pfp,
int16_t* lagsQ7,
int16_t* gainsQ12,
int16_t type);
void WebRtcIsacfix_PitchFilterCore(int loopNumber,
@ -48,17 +49,18 @@ void WebRtcIsacfix_PitchFilterCore(int loopNumber,
int16_t* outputBuf,
int* index2);
void WebRtcIsacfix_PitchFilterGains(const int16_t *indatQ0,
PitchFiltstr *pfp,
int16_t *lagsQ7,
int16_t *gainsQ12);
void WebRtcIsacfix_PitchFilterGains(const int16_t* indatQ0,
PitchFiltstr* pfp,
int16_t* lagsQ7,
int16_t* gainsQ12);
void WebRtcIsacfix_DecimateAllpass32(const int16_t *in,
int32_t *state_in, /* array of size: 2*ALLPASSSECTIONS+1 */
int16_t N, /* number of input samples */
int16_t *out); /* array of size N/2 */
void WebRtcIsacfix_DecimateAllpass32(
const int16_t* in,
int32_t* state_in, /* array of size: 2*ALLPASSSECTIONS+1 */
int16_t N, /* number of input samples */
int16_t* out); /* array of size N/2 */
int32_t WebRtcIsacfix_Log2Q8( uint32_t x );
int32_t WebRtcIsacfix_Log2Q8(uint32_t x);
void WebRtcIsacfix_PCorr2Q32(const int16_t* in, int32_t* logcorQ8);

View File

@ -11,7 +11,8 @@
/*
* pitch_gain_tables.h
*
* This file contains tables for the pitch filter side-info in the entropy coder.
* This file contains tables for the pitch filter side-info in the entropy
* coder.
*
*/
@ -20,7 +21,8 @@
#include "typedefs.h" // NOLINT(build/include)
/********************* Pitch Filter Gain Coefficient Tables ************************/
/********************* Pitch Filter Gain Coefficient Tables
* ************************/
/* cdf for quantized pitch filter gains */
extern const uint16_t WebRtcIsacfix_kPitchGainCdf[255];

View File

@ -11,7 +11,8 @@
/*
* pitch_lag_tables.h
*
* This file contains tables for the pitch filter side-info in the entropy coder.
* This file contains tables for the pitch filter side-info in the entropy
* coder.
*
*/
@ -20,7 +21,8 @@
#include "typedefs.h" // NOLINT(build/include)
/********************* Pitch Filter Lag Coefficient Tables ************************/
/********************* Pitch Filter Lag Coefficient Tables
* ************************/
/* tables for use with small pitch gain */
@ -30,7 +32,7 @@ extern const uint16_t WebRtcIsacfix_kPitchLagCdf2Lo[20];
extern const uint16_t WebRtcIsacfix_kPitchLagCdf3Lo[2];
extern const uint16_t WebRtcIsacfix_kPitchLagCdf4Lo[10];
extern const uint16_t *WebRtcIsacfix_kPitchLagPtrLo[4];
extern const uint16_t* WebRtcIsacfix_kPitchLagPtrLo[4];
/* size of first cdf table */
extern const uint16_t WebRtcIsacfix_kPitchLagSizeLo[1];
@ -46,8 +48,6 @@ extern const uint16_t WebRtcIsacfix_kInitIndLo[3];
extern const int16_t WebRtcIsacfix_kMeanLag2Lo[19];
extern const int16_t WebRtcIsacfix_kMeanLag4Lo[9];
/* tables for use with medium pitch gain */
/* cdfs for quantized pitch lags */
@ -56,7 +56,7 @@ extern const uint16_t WebRtcIsacfix_kPitchLagCdf2Mid[36];
extern const uint16_t WebRtcIsacfix_kPitchLagCdf3Mid[2];
extern const uint16_t WebRtcIsacfix_kPitchLagCdf4Mid[20];
extern const uint16_t *WebRtcIsacfix_kPitchLagPtrMid[4];
extern const uint16_t* WebRtcIsacfix_kPitchLagPtrMid[4];
/* size of first cdf table */
extern const uint16_t WebRtcIsacfix_kPitchLagSizeMid[1];
@ -72,7 +72,6 @@ extern const uint16_t WebRtcIsacfix_kInitIndMid[3];
extern const int16_t WebRtcIsacfix_kMeanLag2Mid[35];
extern const int16_t WebRtcIsacfix_kMeanLag4Mid[19];
/* tables for use with large pitch gain */
/* cdfs for quantized pitch lags */
@ -81,7 +80,7 @@ extern const uint16_t WebRtcIsacfix_kPitchLagCdf2Hi[68];
extern const uint16_t WebRtcIsacfix_kPitchLagCdf3Hi[2];
extern const uint16_t WebRtcIsacfix_kPitchLagCdf4Hi[35];
extern const uint16_t *WebRtcIsacfix_kPitchLagPtrHi[4];
extern const uint16_t* WebRtcIsacfix_kPitchLagPtrHi[4];
/* size of first cdf table */
extern const uint16_t WebRtcIsacfix_kPitchLagSizeHi[1];
@ -97,5 +96,4 @@ extern const uint16_t WebRtcIsacfix_kInitIndHi[3];
extern const int16_t WebRtcIsacfix_kMeanLag2Hi[67];
extern const int16_t WebRtcIsacfix_kMeanLag4Hi[34];
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_PITCH_LAG_TABLES_H_ */

View File

@ -18,84 +18,82 @@
#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_SETTINGS_H_
#define MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_SETTINGS_H_
/* sampling frequency (Hz) */
#define FS 16000
#define FS 16000
/* 1.5 times Sampling frequency */
#define FS_1_HALF (uint32_t) 24000
#define FS_1_HALF (uint32_t)24000
/* Three times Sampling frequency */
#define FS3 (uint32_t) 48000
#define FS3 (uint32_t)48000
/* Eight times Sampling frequency */
#define FS8 (uint32_t) 128000
#define FS8 (uint32_t)128000
/* number of samples per frame (either 480 (30ms) or 960 (60ms)) */
#define INITIAL_FRAMESAMPLES 960
#define INITIAL_FRAMESAMPLES 960
/* miliseconds */
#define FRAMESIZE 30
#define FRAMESIZE 30
/* number of samples per frame processed in the encoder (30ms) */
#define FRAMESAMPLES 480 /* ((FRAMESIZE*FS)/1000) */
#define FRAMESAMPLES_HALF 240
#define FRAMESAMPLES 480 /* ((FRAMESIZE*FS)/1000) */
#define FRAMESAMPLES_HALF 240
/* max number of samples per frame (= 60 ms frame) */
#define MAX_FRAMESAMPLES 960
#define MAX_FRAMESAMPLES 960
/* number of samples per 10ms frame */
#define FRAMESAMPLES_10ms 160 /* ((10*FS)/1000) */
#define FRAMESAMPLES_10ms 160 /* ((10*FS)/1000) */
/* Number of samples per 1 ms */
#define SAMPLES_PER_MSEC 16
#define SAMPLES_PER_MSEC 16
/* number of subframes */
#define SUBFRAMES 6
#define SUBFRAMES 6
/* length of a subframe */
#define UPDATE 80
#define UPDATE 80
/* length of half a subframe (low/high band) */
#define HALF_SUBFRAMELEN 40 /* (UPDATE/2) */
/* samples of look ahead (in a half-band, so actually half the samples of look ahead @ FS) */
#define QLOOKAHEAD 24 /* 3 ms */
#define HALF_SUBFRAMELEN 40 /* (UPDATE/2) */
/* samples of look ahead (in a half-band, so actually half the samples of look
* ahead @ FS) */
#define QLOOKAHEAD 24 /* 3 ms */
/* order of AR model in spectral entropy coder */
#define AR_ORDER 6
#define MAX_ORDER 13
#define LEVINSON_MAX_ORDER 12
#define AR_ORDER 6
#define MAX_ORDER 13
#define LEVINSON_MAX_ORDER 12
/* window length (masking analysis) */
#define WINLEN 256
#define WINLEN 256
/* order of low-band pole filter used to approximate masking curve */
#define ORDERLO 12
#define ORDERLO 12
/* order of hi-band pole filter used to approximate masking curve */
#define ORDERHI 6
#define KLT_NUM_AVG_GAIN 0
#define KLT_NUM_AVG_SHAPE 0
#define KLT_NUM_MODELS 3
#define LPC_SHAPE_ORDER 18 /* (ORDERLO + ORDERHI) */
#define KLT_ORDER_GAIN 12 /* (2 * SUBFRAMES) */
#define KLT_ORDER_SHAPE 108 /* (LPC_SHAPE_ORDER * SUBFRAMES) */
#define ORDERHI 6
#define KLT_NUM_AVG_GAIN 0
#define KLT_NUM_AVG_SHAPE 0
#define KLT_NUM_MODELS 3
#define LPC_SHAPE_ORDER 18 /* (ORDERLO + ORDERHI) */
#define KLT_ORDER_GAIN 12 /* (2 * SUBFRAMES) */
#define KLT_ORDER_SHAPE 108 /* (LPC_SHAPE_ORDER * SUBFRAMES) */
/* order for post_filter_bank */
#define POSTQORDER 3
#define POSTQORDER 3
/* order for pre-filterbank */
#define QORDER 3
#define QORDER 3
/* for decimator */
#define ALLPASSSECTIONS 2
#define ALLPASSSECTIONS 2
/* The number of composite all-pass filter factors */
#define NUMBEROFCOMPOSITEAPSECTIONS 4
#define NUMBEROFCOMPOSITEAPSECTIONS 4
/* The number of all-pass filter factors in an upper or lower channel*/
#define NUMBEROFCHANNELAPSECTIONS 2
#define DPMIN_Q10 -10240 /* -10.00 in Q10 */
#define DPMAX_Q10 10240 /* 10.00 in Q10 */
#define MINBITS_Q10 10240 /* 10.0 in Q10 */
#define NUMBEROFCHANNELAPSECTIONS 2
#define DPMIN_Q10 -10240 /* -10.00 in Q10 */
#define DPMAX_Q10 10240 /* 10.00 in Q10 */
#define MINBITS_Q10 10240 /* 10.0 in Q10 */
/* array size for byte stream in number of Word16. */
#define STREAM_MAXW16 300 /* The old maximum size still needed for the decoding */
#define STREAM_MAXW16_30MS 100 /* 100 Word16 = 200 bytes = 53.4 kbit/s @ 30 ms.framelength */
#define STREAM_MAXW16_60MS 200 /* 200 Word16 = 400 bytes = 53.4 kbit/s @ 60 ms.framelength */
#define STREAM_MAXW16 \
300 /* The old maximum size still needed for the decoding */
#define STREAM_MAXW16_30MS \
100 /* 100 Word16 = 200 bytes = 53.4 kbit/s @ 30 ms.framelength */
#define STREAM_MAXW16_60MS \
200 /* 200 Word16 = 400 bytes = 53.4 kbit/s @ 60 ms.framelength */
/* This is used only at the decoder bit-stream struct.
* - The encoder and decoder bitstream containers are of different size because
* old iSAC limited the encoded bitstream to 600 bytes. But newer versions
@ -110,106 +108,104 @@
/* storage size for bit counts */
//#define BIT_COUNTER_SIZE 30
/* maximum order of any AR model or filter */
#define MAX_AR_MODEL_ORDER 12
#define MAX_AR_MODEL_ORDER 12
/* Maximum number of iterations allowed to limit payload size */
#define MAX_PAYLOAD_LIMIT_ITERATION 1
#define MAX_PAYLOAD_LIMIT_ITERATION 1
/* Bandwidth estimator */
#define MIN_ISAC_BW 10000 /* Minimum bandwidth in bits per sec */
#define MAX_ISAC_BW 32000 /* Maxmum bandwidth in bits per sec */
#define MIN_ISAC_MD 5 /* Minimum Max Delay in ?? */
#define MAX_ISAC_MD 25 /* Maxmum Max Delay in ?? */
#define DELAY_CORRECTION_MAX 717
#define DELAY_CORRECTION_MED 819
#define Thld_30_60 18000
#define Thld_60_30 27000
#define MIN_ISAC_BW 10000 /* Minimum bandwidth in bits per sec */
#define MAX_ISAC_BW 32000 /* Maxmum bandwidth in bits per sec */
#define MIN_ISAC_MD 5 /* Minimum Max Delay in ?? */
#define MAX_ISAC_MD 25 /* Maxmum Max Delay in ?? */
#define DELAY_CORRECTION_MAX 717
#define DELAY_CORRECTION_MED 819
#define Thld_30_60 18000
#define Thld_60_30 27000
/* assumed header size; we don't know the exact number (header compression may be used) */
#define HEADER_SIZE 35 /* bytes */
#define INIT_FRAME_LEN 60
#define INIT_BN_EST 20000
#define INIT_BN_EST_Q7 2560000 /* 20 kbps in Q7 */
#define INIT_REC_BN_EST_Q5 789312 /* INIT_BN_EST + INIT_HDR_RATE in Q5 */
/* assumed header size; we don't know the exact number (header compression may
* be used) */
#define HEADER_SIZE 35 /* bytes */
#define INIT_FRAME_LEN 60
#define INIT_BN_EST 20000
#define INIT_BN_EST_Q7 2560000 /* 20 kbps in Q7 */
#define INIT_REC_BN_EST_Q5 789312 /* INIT_BN_EST + INIT_HDR_RATE in Q5 */
/* 8738 in Q18 is ~ 1/30 */
/* #define INIT_HDR_RATE (((HEADER_SIZE * 8 * 1000) * 8738) >> NUM_BITS_TO_SHIFT (INIT_FRAME_LEN)) */
#define INIT_HDR_RATE 4666
/* #define INIT_HDR_RATE (((HEADER_SIZE * 8 * 1000) * 8738) >> NUM_BITS_TO_SHIFT
* (INIT_FRAME_LEN)) */
#define INIT_HDR_RATE 4666
/* number of packets in a row for a high rate burst */
#define BURST_LEN 3
#define BURST_LEN 3
/* ms, max time between two full bursts */
#define BURST_INTERVAL 800
#define BURST_INTERVAL 800
/* number of packets in a row for initial high rate burst */
#define INIT_BURST_LEN 5
#define INIT_BURST_LEN 5
/* bits/s, rate for the first BURST_LEN packets */
#define INIT_RATE 10240000 /* INIT_BN_EST in Q9 */
#define INIT_RATE 10240000 /* INIT_BN_EST in Q9 */
/* For pitch analysis */
#define PITCH_FRAME_LEN 240 /* (FRAMESAMPLES/2) 30 ms */
#define PITCH_MAX_LAG 140 /* 57 Hz */
#define PITCH_MIN_LAG 20 /* 400 Hz */
#define PITCH_MIN_LAG_Q8 5120 /* 256 * PITCH_MIN_LAG */
#define OFFSET_Q8 768 /* 256 * 3 */
#define PITCH_FRAME_LEN 240 /* (FRAMESAMPLES/2) 30 ms */
#define PITCH_MAX_LAG 140 /* 57 Hz */
#define PITCH_MIN_LAG 20 /* 400 Hz */
#define PITCH_MIN_LAG_Q8 5120 /* 256 * PITCH_MIN_LAG */
#define OFFSET_Q8 768 /* 256 * 3 */
#define PITCH_MAX_GAIN_Q12 1843 /* 0.45 */
#define PITCH_LAG_SPAN2 65 /* (PITCH_MAX_LAG/2-PITCH_MIN_LAG/2+5) */
#define PITCH_CORR_LEN2 60 /* 15 ms */
#define PITCH_CORR_STEP2 60 /* (PITCH_FRAME_LEN/4) */
#define PITCH_SUBFRAMES 4
#define PITCH_SUBFRAME_LEN 60 /* (PITCH_FRAME_LEN/PITCH_SUBFRAMES) */
#define PITCH_MAX_GAIN_Q12 1843 /* 0.45 */
#define PITCH_LAG_SPAN2 65 /* (PITCH_MAX_LAG/2-PITCH_MIN_LAG/2+5) */
#define PITCH_CORR_LEN2 60 /* 15 ms */
#define PITCH_CORR_STEP2 60 /* (PITCH_FRAME_LEN/4) */
#define PITCH_SUBFRAMES 4
#define PITCH_SUBFRAME_LEN 60 /* (PITCH_FRAME_LEN/PITCH_SUBFRAMES) */
/* For pitch filter */
#define PITCH_BUFFSIZE 190 /* (PITCH_MAX_LAG + 50) Extra 50 for fraction and LP filters */
#define PITCH_INTBUFFSIZE 430 /* (PITCH_FRAME_LEN+PITCH_BUFFSIZE) */
#define PITCH_FRACS 8
#define PITCH_FRACORDER 9
#define PITCH_DAMPORDER 5
#define PITCH_BUFFSIZE \
190 /* (PITCH_MAX_LAG + 50) Extra 50 for fraction and LP filters */
#define PITCH_INTBUFFSIZE 430 /* (PITCH_FRAME_LEN+PITCH_BUFFSIZE) */
#define PITCH_FRACS 8
#define PITCH_FRACORDER 9
#define PITCH_DAMPORDER 5
/* Order of high pass filter */
#define HPORDER 2
#define HPORDER 2
/* PLC */
#define DECAY_RATE 10 /* Q15, 20% of decay every lost frame apllied linearly sample by sample*/
#define PLC_WAS_USED 1
#define PLC_NOT_USED 3
#define RECOVERY_OVERLAP 80
#define RESAMP_RES 256
#define RESAMP_RES_BIT 8
#define DECAY_RATE \
10 /* Q15, 20% of decay every lost frame apllied linearly sample by sample*/
#define PLC_WAS_USED 1
#define PLC_NOT_USED 3
#define RECOVERY_OVERLAP 80
#define RESAMP_RES 256
#define RESAMP_RES_BIT 8
/* Define Error codes */
/* 6000 General */
#define ISAC_MEMORY_ALLOCATION_FAILED 6010
#define ISAC_MODE_MISMATCH 6020
#define ISAC_DISALLOWED_BOTTLENECK 6030
#define ISAC_DISALLOWED_FRAME_LENGTH 6040
#define ISAC_MEMORY_ALLOCATION_FAILED 6010
#define ISAC_MODE_MISMATCH 6020
#define ISAC_DISALLOWED_BOTTLENECK 6030
#define ISAC_DISALLOWED_FRAME_LENGTH 6040
/* 6200 Bandwidth estimator */
#define ISAC_RANGE_ERROR_BW_ESTIMATOR 6240
#define ISAC_RANGE_ERROR_BW_ESTIMATOR 6240
/* 6400 Encoder */
#define ISAC_ENCODER_NOT_INITIATED 6410
#define ISAC_DISALLOWED_CODING_MODE 6420
#define ISAC_DISALLOWED_FRAME_MODE_ENCODER 6430
#define ISAC_DISALLOWED_BITSTREAM_LENGTH 6440
#define ISAC_PAYLOAD_LARGER_THAN_LIMIT 6450
#define ISAC_ENCODER_NOT_INITIATED 6410
#define ISAC_DISALLOWED_CODING_MODE 6420
#define ISAC_DISALLOWED_FRAME_MODE_ENCODER 6430
#define ISAC_DISALLOWED_BITSTREAM_LENGTH 6440
#define ISAC_PAYLOAD_LARGER_THAN_LIMIT 6450
/* 6600 Decoder */
#define ISAC_DECODER_NOT_INITIATED 6610
#define ISAC_EMPTY_PACKET 6620
#define ISAC_DECODER_NOT_INITIATED 6610
#define ISAC_EMPTY_PACKET 6620
#define ISAC_PACKET_TOO_SHORT 6625
#define ISAC_DISALLOWED_FRAME_MODE_DECODER 6630
#define ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH 6640
#define ISAC_RANGE_ERROR_DECODE_BANDWIDTH 6650
#define ISAC_RANGE_ERROR_DECODE_PITCH_GAIN 6660
#define ISAC_RANGE_ERROR_DECODE_PITCH_LAG 6670
#define ISAC_RANGE_ERROR_DECODE_LPC 6680
#define ISAC_RANGE_ERROR_DECODE_SPECTRUM 6690
#define ISAC_LENGTH_MISMATCH 6730
#define ISAC_DISALLOWED_FRAME_MODE_DECODER 6630
#define ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH 6640
#define ISAC_RANGE_ERROR_DECODE_BANDWIDTH 6650
#define ISAC_RANGE_ERROR_DECODE_PITCH_GAIN 6660
#define ISAC_RANGE_ERROR_DECODE_PITCH_LAG 6670
#define ISAC_RANGE_ERROR_DECODE_LPC 6680
#define ISAC_RANGE_ERROR_DECODE_SPECTRUM 6690
#define ISAC_LENGTH_MISMATCH 6730
/* 6800 Call setup formats */
#define ISAC_INCOMPATIBLE_FORMATS 6810
#define ISAC_INCOMPATIBLE_FORMATS 6810
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_SETTINGS_H_ */

View File

@ -62,15 +62,15 @@ extern const int16_t WebRtcIsacfix_kRc6Levels[11];
/* quantization boundary levels for reflection coefficients */
extern const int16_t WebRtcIsacfix_kRcBound[12];
/* initial indices for AR reflection coefficient quantizer and cdf table search */
/* initial indices for AR reflection coefficient quantizer and cdf table search
*/
extern const uint16_t WebRtcIsacfix_kRcInitInd[AR_ORDER];
/* pointers to AR cdf tables */
extern const uint16_t *WebRtcIsacfix_kRcCdfPtr[AR_ORDER];
extern const uint16_t* WebRtcIsacfix_kRcCdfPtr[AR_ORDER];
/* pointers to AR representation levels tables */
extern const int16_t *WebRtcIsacfix_kRcLevPtr[AR_ORDER];
extern const int16_t* WebRtcIsacfix_kRcLevPtr[AR_ORDER];
/******************** GAIN Coefficient Tables ***********************/
/* cdf for Gain coefficient */
@ -83,7 +83,7 @@ extern const int32_t WebRtcIsacfix_kGain2Lev[18];
extern const int32_t WebRtcIsacfix_kGain2Bound[19];
/* pointer to Gain cdf table */
extern const uint16_t *WebRtcIsacfix_kGainPtr[1];
extern const uint16_t* WebRtcIsacfix_kGainPtr[1];
/* Gain initial index for gain quantizer and cdf table search */
extern const uint16_t WebRtcIsacfix_kGainInitInd[1];
@ -92,4 +92,5 @@ extern const uint16_t WebRtcIsacfix_kGainInitInd[1];
/* Cosine table */
extern const int16_t WebRtcIsacfix_kCos[6][60];
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_SPECTRUM_AR_MODEL_TABLES_H_ */
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_SPECTRUM_AR_MODEL_TABLES_H_ \
*/

View File

@ -18,7 +18,6 @@
#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_STRUCTS_H_
#define MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_STRUCTS_H_
#include "common_audio/signal_processing/include/signal_processing_library.h"
#include "modules/audio_coding/codecs/isac/bandwidth_info.h"
#include "modules/audio_coding/codecs/isac/fix/source/settings.h"
@ -26,72 +25,58 @@
/* Bitstream struct for decoder */
typedef struct Bitstreamstruct_dec {
uint16_t stream[INTERNAL_STREAM_SIZE_W16]; /* Array bytestream to decode */
uint32_t W_upper; /* Upper boundary of interval W */
uint32_t streamval;
uint16_t stream_index; /* Index to the current position in bytestream */
int16_t full; /* 0 - first byte in memory filled, second empty*/
uint16_t stream[INTERNAL_STREAM_SIZE_W16]; /* Array bytestream to decode */
uint32_t W_upper; /* Upper boundary of interval W */
uint32_t streamval;
uint16_t stream_index; /* Index to the current position in bytestream */
int16_t full; /* 0 - first byte in memory filled, second empty*/
/* 1 - both bytes are empty (we just filled the previous memory */
size_t stream_size; /* The size of stream in bytes. */
size_t stream_size; /* The size of stream in bytes. */
} Bitstr_dec;
/* Bitstream struct for encoder */
typedef struct Bitstreamstruct_enc {
uint16_t stream[STREAM_MAXW16_60MS]; /* Vector for adding encoded bytestream */
uint32_t W_upper; /* Upper boundary of interval W */
uint32_t streamval;
uint16_t stream_index; /* Index to the current position in bytestream */
int16_t full; /* 0 - first byte in memory filled, second empty*/
uint16_t
stream[STREAM_MAXW16_60MS]; /* Vector for adding encoded bytestream */
uint32_t W_upper; /* Upper boundary of interval W */
uint32_t streamval;
uint16_t stream_index; /* Index to the current position in bytestream */
int16_t full; /* 0 - first byte in memory filled, second empty*/
/* 1 - both bytes are empty (we just filled the previous memory */
} Bitstr_enc;
typedef struct {
int16_t DataBufferLoQ0[WINLEN];
int16_t DataBufferHiQ0[WINLEN];
int32_t CorrBufLoQQ[ORDERLO+1];
int32_t CorrBufHiQQ[ORDERHI+1];
int32_t CorrBufLoQQ[ORDERLO + 1];
int32_t CorrBufHiQQ[ORDERHI + 1];
int16_t CorrBufLoQdom[ORDERLO+1];
int16_t CorrBufHiQdom[ORDERHI+1];
int16_t CorrBufLoQdom[ORDERLO + 1];
int16_t CorrBufHiQdom[ORDERHI + 1];
int32_t PreStateLoGQ15[ORDERLO+1];
int32_t PreStateHiGQ15[ORDERHI+1];
int32_t PreStateLoGQ15[ORDERLO + 1];
int32_t PreStateHiGQ15[ORDERHI + 1];
uint32_t OldEnergy;
} MaskFiltstr_enc;
typedef struct {
int16_t PostStateLoGQ0[ORDERLO+1];
int16_t PostStateHiGQ0[ORDERHI+1];
int16_t PostStateLoGQ0[ORDERLO + 1];
int16_t PostStateHiGQ0[ORDERHI + 1];
uint32_t OldEnergy;
} MaskFiltstr_dec;
typedef struct {
// state vectors for each of the two analysis filters
//state vectors for each of the two analysis filters
int32_t INSTAT1_fix[2*(QORDER-1)];
int32_t INSTAT2_fix[2*(QORDER-1)];
int32_t INSTAT1_fix[2 * (QORDER - 1)];
int32_t INSTAT2_fix[2 * (QORDER - 1)];
int16_t INLABUF1_fix[QLOOKAHEAD];
int16_t INLABUF2_fix[QLOOKAHEAD];
@ -100,12 +85,10 @@ typedef struct {
} PreFiltBankstr;
typedef struct {
//state vectors for each of the two analysis filters
int32_t STATE_0_LOWER_fix[2*POSTQORDER];
int32_t STATE_0_UPPER_fix[2*POSTQORDER];
// state vectors for each of the two analysis filters
int32_t STATE_0_LOWER_fix[2 * POSTQORDER];
int32_t STATE_0_UPPER_fix[2 * POSTQORDER];
/* High pass filter */
@ -115,8 +98,6 @@ typedef struct {
} PostFiltBankstr;
typedef struct {
/* data buffer for pitch filter */
int16_t ubufQQ[PITCH_BUFFSIZE];
@ -129,42 +110,35 @@ typedef struct {
} PitchFiltstr;
typedef struct {
// for inital estimator
int16_t dec_buffer16[PITCH_CORR_LEN2 + PITCH_CORR_STEP2 + PITCH_MAX_LAG / 2 -
PITCH_FRAME_LEN / 2 + 2];
int32_t decimator_state32[2 * ALLPASSSECTIONS + 1];
int16_t inbuf[QLOOKAHEAD];
//for inital estimator
int16_t dec_buffer16[PITCH_CORR_LEN2+PITCH_CORR_STEP2+PITCH_MAX_LAG/2-PITCH_FRAME_LEN/2+2];
int32_t decimator_state32[2*ALLPASSSECTIONS+1];
int16_t inbuf[QLOOKAHEAD];
PitchFiltstr PFstr_wght;
PitchFiltstr PFstr;
PitchFiltstr PFstr_wght;
PitchFiltstr PFstr;
} PitchAnalysisStruct;
typedef struct {
/* Parameters used in PLC to avoid re-computation */
/* --- residual signals --- */
int16_t prevPitchInvIn[FRAMESAMPLES/2];
int16_t prevPitchInvOut[PITCH_MAX_LAG + 10]; // [FRAMESAMPLES/2]; save 90
int32_t prevHP[PITCH_MAX_LAG + 10]; // [FRAMESAMPLES/2]; save 90
int16_t prevPitchInvIn[FRAMESAMPLES / 2];
int16_t prevPitchInvOut[PITCH_MAX_LAG + 10]; // [FRAMESAMPLES/2]; save 90
int32_t prevHP[PITCH_MAX_LAG + 10]; // [FRAMESAMPLES/2]; save 90
int16_t decayCoeffPriodic; /* how much to supress a sample */
int16_t decayCoeffNoise;
int16_t used; /* if PLC is used */
int16_t *lastPitchLP; // [FRAMESAMPLES/2]; saved 240;
int16_t used; /* if PLC is used */
int16_t* lastPitchLP; // [FRAMESAMPLES/2]; saved 240;
/* --- LPC side info --- */
int16_t lofilt_coefQ15[ ORDERLO ];
int16_t hifilt_coefQ15[ ORDERHI ];
int16_t lofilt_coefQ15[ORDERLO];
int16_t hifilt_coefQ15[ORDERHI];
int32_t gain_lo_hiQ17[2];
/* --- LTP side info --- */
@ -173,95 +147,101 @@ typedef struct {
int16_t lastPitchLag_Q7;
/* --- Add-overlap in recovery packet --- */
int16_t overlapLP[ RECOVERY_OVERLAP ]; // [FRAMESAMPLES/2]; saved 160
int16_t overlapLP[RECOVERY_OVERLAP]; // [FRAMESAMPLES/2]; saved 160
int16_t pitchCycles;
int16_t A;
int16_t B;
size_t pitchIndex;
size_t stretchLag;
int16_t *prevPitchLP; // [ FRAMESAMPLES/2 ]; saved 240
int16_t* prevPitchLP; // [ FRAMESAMPLES/2 ]; saved 240
int16_t seed;
int16_t std;
} PLCstr;
/* Have instance of struct together with other iSAC structs */
typedef struct {
int16_t prevFrameSizeMs; /* Previous frame size (in ms) */
uint16_t prevRtpNumber; /* Previous RTP timestamp from received packet */
int16_t prevFrameSizeMs; /* Previous frame size (in ms) */
uint16_t prevRtpNumber; /* Previous RTP timestamp from received packet */
/* (in samples relative beginning) */
uint32_t prevSendTime; /* Send time for previous packet, from RTP header */
uint32_t prevArrivalTime; /* Arrival time for previous packet (in ms using timeGetTime()) */
uint16_t prevRtpRate; /* rate of previous packet, derived from RTP timestamps (in bits/s) */
uint32_t lastUpdate; /* Time since the last update of the Bottle Neck estimate (in samples) */
uint32_t lastReduction; /* Time sinse the last reduction (in samples) */
int32_t countUpdates; /* How many times the estimate was update in the beginning */
uint32_t prevSendTime; /* Send time for previous packet, from RTP header */
uint32_t prevArrivalTime; /* Arrival time for previous packet (in ms using
timeGetTime()) */
uint16_t
prevRtpRate; /* rate of previous packet, derived from RTP timestamps (in
bits/s) */
uint32_t
lastUpdate; /* Time since the last update of the Bottle Neck estimate (in
samples) */
uint32_t lastReduction; /* Time sinse the last reduction (in samples) */
int32_t countUpdates; /* How many times the estimate was update in the
beginning */
/* The estimated bottle neck rate from there to here (in bits/s) */
uint32_t recBw;
uint32_t recBwInv;
uint32_t recBwAvg;
uint32_t recBwAvgQ;
/* The estimated bottle neck rate from there to here (in bits/s) */
uint32_t recBw;
uint32_t recBwInv;
uint32_t recBwAvg;
uint32_t recBwAvgQ;
uint32_t minBwInv;
uint32_t maxBwInv;
uint32_t minBwInv;
uint32_t maxBwInv;
/* The estimated mean absolute jitter value, as seen on this side (in ms) */
int32_t recJitter;
int32_t recJitterShortTerm;
int32_t recJitterShortTermAbs;
int32_t recMaxDelay;
int32_t recMaxDelayAvgQ;
/* The estimated mean absolute jitter value, as seen on this side (in ms) */
int32_t recJitter;
int32_t recJitterShortTerm;
int32_t recJitterShortTermAbs;
int32_t recMaxDelay;
int32_t recMaxDelayAvgQ;
int16_t recHeaderRate; /* (assumed) bitrate for headers (bps) */
int16_t recHeaderRate; /* (assumed) bitrate for headers (bps) */
uint32_t sendBwAvg; /* The estimated bottle neck rate from here to there (in
bits/s) */
int32_t
sendMaxDelayAvg; /* The estimated mean absolute jitter value, as seen on
the other siee (in ms) */
uint32_t sendBwAvg; /* The estimated bottle neck rate from here to there (in bits/s) */
int32_t sendMaxDelayAvg; /* The estimated mean absolute jitter value, as seen on the other siee (in ms) */
int16_t countRecPkts; /* number of packets received since last update */
int16_t highSpeedRec; /* flag for marking that a high speed network has been detected downstream */
int16_t countRecPkts; /* number of packets received since last update */
int16_t highSpeedRec; /* flag for marking that a high speed network has been
detected downstream */
/* number of consecutive pkts sent during which the bwe estimate has
remained at a value greater than the downstream threshold for determining highspeed network */
int16_t countHighSpeedRec;
remained at a value greater than the downstream threshold for determining
highspeed network */
int16_t countHighSpeedRec;
/* flag indicating bwe should not adjust down immediately for very late pckts */
int16_t inWaitPeriod;
/* flag indicating bwe should not adjust down immediately for very late pckts
*/
int16_t inWaitPeriod;
/* variable holding the time of the start of a window of time when
bwe should not adjust down immediately for very late pckts */
uint32_t startWaitPeriod;
uint32_t startWaitPeriod;
/* number of consecutive pkts sent during which the bwe estimate has
remained at a value greater than the upstream threshold for determining highspeed network */
int16_t countHighSpeedSent;
remained at a value greater than the upstream threshold for determining
highspeed network */
int16_t countHighSpeedSent;
/* flag indicated the desired number of packets over threshold rate have been sent and
bwe will assume the connection is over broadband network */
int16_t highSpeedSend;
/* flag indicated the desired number of packets over threshold rate have been
sent and bwe will assume the connection is over broadband network */
int16_t highSpeedSend;
IsacBandwidthInfo external_bw_info;
} BwEstimatorstr;
typedef struct {
/* boolean, flags if previous packet exceeded B.N. */
int16_t PrevExceed;
int16_t PrevExceed;
/* ms */
int16_t ExceedAgo;
int16_t ExceedAgo;
/* packets left to send in current burst */
int16_t BurstCounter;
int16_t BurstCounter;
/* packets */
int16_t InitCounter;
int16_t InitCounter;
/* ms remaining in buffer when next packet will be sent */
int16_t StillBuffered;
int16_t StillBuffered;
} RateModel;
@ -271,112 +251,107 @@ typedef struct {
handle 60 ms of data.
*/
typedef struct {
/* Used to keep track of if it is first or second part of 60 msec packet */
int startIdx;
int startIdx;
/* Frame length in samples */
int16_t framelength;
int16_t framelength;
/* Pitch Gain */
int16_t pitchGain_index[2];
int16_t pitchGain_index[2];
/* Pitch Lag */
int32_t meanGain[2];
int16_t pitchIndex[PITCH_SUBFRAMES*2];
int32_t meanGain[2];
int16_t pitchIndex[PITCH_SUBFRAMES * 2];
/* LPC */
int32_t LPCcoeffs_g[12*2]; /* KLT_ORDER_GAIN = 12 */
int16_t LPCindex_s[108*2]; /* KLT_ORDER_SHAPE = 108 */
int16_t LPCindex_g[12*2]; /* KLT_ORDER_GAIN = 12 */
int32_t LPCcoeffs_g[12 * 2]; /* KLT_ORDER_GAIN = 12 */
int16_t LPCindex_s[108 * 2]; /* KLT_ORDER_SHAPE = 108 */
int16_t LPCindex_g[12 * 2]; /* KLT_ORDER_GAIN = 12 */
/* Encode Spec */
int16_t fre[FRAMESAMPLES];
int16_t fim[FRAMESAMPLES];
int16_t AvgPitchGain[2];
int16_t fre[FRAMESAMPLES];
int16_t fim[FRAMESAMPLES];
int16_t AvgPitchGain[2];
/* Used in adaptive mode only */
int minBytes;
int minBytes;
} IsacSaveEncoderData;
typedef struct {
Bitstr_enc bitstr_obj;
MaskFiltstr_enc maskfiltstr_obj;
PreFiltBankstr prefiltbankstr_obj;
PitchFiltstr pitchfiltstr_obj;
Bitstr_enc bitstr_obj;
MaskFiltstr_enc maskfiltstr_obj;
PreFiltBankstr prefiltbankstr_obj;
PitchFiltstr pitchfiltstr_obj;
PitchAnalysisStruct pitchanalysisstr_obj;
RateModel rate_data_obj;
RateModel rate_data_obj;
int16_t buffer_index;
int16_t current_framesamples;
int16_t buffer_index;
int16_t current_framesamples;
int16_t data_buffer_fix[FRAMESAMPLES]; // the size was MAX_FRAMESAMPLES
int16_t data_buffer_fix[FRAMESAMPLES]; // the size was MAX_FRAMESAMPLES
int16_t frame_nb;
int16_t BottleNeck;
int16_t MaxDelay;
int16_t new_framelength;
int16_t s2nr;
uint16_t MaxBits;
int16_t frame_nb;
int16_t BottleNeck;
int16_t MaxDelay;
int16_t new_framelength;
int16_t s2nr;
uint16_t MaxBits;
int16_t bitstr_seed;
int16_t bitstr_seed;
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
PostFiltBankstr interpolatorstr_obj;
PostFiltBankstr interpolatorstr_obj;
#endif
IsacSaveEncoderData *SaveEnc_ptr;
int16_t payloadLimitBytes30; /* Maximum allowed number of bits for a 30 msec packet */
int16_t payloadLimitBytes60; /* Maximum allowed number of bits for a 30 msec packet */
int16_t maxPayloadBytes; /* Maximum allowed number of bits for both 30 and 60 msec packet */
int16_t maxRateInBytes; /* Maximum allowed rate in bytes per 30 msec packet */
int16_t enforceFrameSize; /* If set iSAC will never change packet size */
IsacSaveEncoderData* SaveEnc_ptr;
int16_t payloadLimitBytes30; /* Maximum allowed number of bits for a 30 msec
packet */
int16_t payloadLimitBytes60; /* Maximum allowed number of bits for a 30 msec
packet */
int16_t maxPayloadBytes; /* Maximum allowed number of bits for both 30 and 60
msec packet */
int16_t maxRateInBytes; /* Maximum allowed rate in bytes per 30 msec packet */
int16_t enforceFrameSize; /* If set iSAC will never change packet size */
} IsacFixEncoderInstance;
typedef struct {
Bitstr_dec bitstr_obj;
MaskFiltstr_dec maskfiltstr_obj;
PostFiltBankstr postfiltbankstr_obj;
PitchFiltstr pitchfiltstr_obj;
PLCstr plcstr_obj; /* TS; for packet loss concealment */
Bitstr_dec bitstr_obj;
MaskFiltstr_dec maskfiltstr_obj;
PostFiltBankstr postfiltbankstr_obj;
PitchFiltstr pitchfiltstr_obj;
PLCstr plcstr_obj; /* TS; for packet loss concealment */
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
PreFiltBankstr decimatorstr_obj;
PreFiltBankstr decimatorstr_obj;
#endif
} IsacFixDecoderInstance;
typedef struct {
IsacFixEncoderInstance ISACenc_obj;
IsacFixDecoderInstance ISACdec_obj;
BwEstimatorstr bwestimator_obj;
int16_t CodingMode; /* 0 = adaptive; 1 = instantaneous */
int16_t errorcode;
int16_t initflag; /* 0 = nothing initiated; 1 = encoder or decoder */
BwEstimatorstr bwestimator_obj;
int16_t CodingMode; /* 0 = adaptive; 1 = instantaneous */
int16_t errorcode;
int16_t initflag; /* 0 = nothing initiated; 1 = encoder or decoder */
/* not initiated; 2 = all initiated */
} ISACFIX_SubStruct;
typedef struct {
int32_t lpcGains[12]; /* 6 lower-band & 6 upper-band we may need to double it for 60*/
int32_t lpcGains
[12]; /* 6 lower-band & 6 upper-band we may need to double it for 60*/
/* */
uint32_t W_upper; /* Upper boundary of interval W */
uint32_t streamval;
uint16_t stream_index; /* Index to the current position in bytestream */
int16_t full; /* 0 - first byte in memory filled, second empty*/
uint32_t W_upper; /* Upper boundary of interval W */
uint32_t streamval;
uint16_t stream_index; /* Index to the current position in bytestream */
int16_t full; /* 0 - first byte in memory filled, second empty*/
/* 1 - both bytes are empty (we just filled the previous memory */
uint16_t beforeLastWord;
uint16_t lastWord;
uint16_t beforeLastWord;
uint16_t lastWord;
} transcode_obj;
// Bitstr_enc myBitStr;
//Bitstr_enc myBitStr;
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_STRUCTS_H_ */
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_STRUCTS_H_ */

View File

@ -12,147 +12,156 @@
#include "system_wrappers/include/cpu_features_wrapper.h"
#include "test/gtest.h"
static const int kSamples = FRAMESAMPLES/2;
static const int kSamples = FRAMESAMPLES / 2;
static const int32_t spec2time_out_expected_1[kSamples] = {
-3366470, -2285227,
-3415765, -2310215, -3118030, -2222470, -3030254, -2192091, -3423170,
-2216041, -3305541, -2171936, -3195767, -2095779, -3153304, -2157560,
-3071167, -2032108, -3101190, -1972016, -3103824, -2089118, -3139811,
-1898337, -3102801, -2055082, -3029665, -1854140, -2962586, -1966454,
-3071167, -1894588, -2851743, -1917315, -2848087, -1594932, -2799242,
-1462184, -2845887, -1437599, -2691776, -1329637, -2770659, -1268491,
-2625161, -1578991, -2460299, -1186385, -2365613, -1039354, -2322608,
-958518, -2271749, -789860, -2254538, -850308, -2384436, -850959, -2133734,
-587678, -2093316, -495115, -1973364, -475177, -1801282, -173507,
-1848516, -158015, -1792018, -62648, -1643313, 214746, -1500758, 267077,
-1450193, 560521, -1521579, 675283, -1345408, 857559, -1300822, 1116332,
-1294533, 1241117, -1070027, 1263503, -983816, 1529821, -1019586,
1910421, -955420, 2073688, -836459, 2401105, -653905, 2690474, -731425,
2930131, -935234, 3299500, -875978, 3523432, -878906, 3924822, -1081630,
4561267, -1203023, 5105274, -1510983, 6052762, -2294646, 7021597,
-3108053, 8826736, -4935222, 11678789, -8442713, 18725700, -21526692,
25420577, 19589811, -28108666, 12634054, -14483066, 6263217, -9979706,
3665661, -7909736, 2531530, -6434896, 1700772, -5525393, 1479473,
-4894262, 1231760, -4353044, 1032940, -3786590, 941152, -3331614,
665090, -2851619, 830696, -2762201, 958007, -2483118, 788233, -2184965,
804825, -1967306, 1007255, -1862474, 920889, -1457506, 755406, -1405841,
890230, -1302124, 1161599, -701867, 1154163, -1083366, 1204743, -513581,
1547264, -650636, 1493384, -285543, 1771863, -277906, 1841343, -9078,
1751863, 230222, 1819578, 207170, 1978972, 398137, 2106468, 552155,
1997624, 685213, 2129520, 601078, 2238736, 944591, 2441879, 1194178,
2355280, 986124, 2393328, 1049005, 2417944, 1208368, 2489516, 1352023,
2572118, 1445283, 2856081, 1532997, 2742279, 1615877, 2915274, 1808036,
2856871, 1806936, 3241747, 1622461, 2978558, 1841297, 3010378, 1923666,
3271367, 2126700, 3070935, 1956958, 3107588, 2128405, 3288872, 2114911,
3315952, 2406651, 3344038, 2370199, 3368980, 2144361, 3305030, 2183803,
3401450, 2523102, 3405463, 2452475, 3463355, 2421678, 3551968, 2431949,
3477251, 2148125, 3244489, 2174090};
-3366470, -2285227, -3415765, -2310215, -3118030, -2222470, -3030254,
-2192091, -3423170, -2216041, -3305541, -2171936, -3195767, -2095779,
-3153304, -2157560, -3071167, -2032108, -3101190, -1972016, -3103824,
-2089118, -3139811, -1898337, -3102801, -2055082, -3029665, -1854140,
-2962586, -1966454, -3071167, -1894588, -2851743, -1917315, -2848087,
-1594932, -2799242, -1462184, -2845887, -1437599, -2691776, -1329637,
-2770659, -1268491, -2625161, -1578991, -2460299, -1186385, -2365613,
-1039354, -2322608, -958518, -2271749, -789860, -2254538, -850308,
-2384436, -850959, -2133734, -587678, -2093316, -495115, -1973364,
-475177, -1801282, -173507, -1848516, -158015, -1792018, -62648,
-1643313, 214746, -1500758, 267077, -1450193, 560521, -1521579,
675283, -1345408, 857559, -1300822, 1116332, -1294533, 1241117,
-1070027, 1263503, -983816, 1529821, -1019586, 1910421, -955420,
2073688, -836459, 2401105, -653905, 2690474, -731425, 2930131,
-935234, 3299500, -875978, 3523432, -878906, 3924822, -1081630,
4561267, -1203023, 5105274, -1510983, 6052762, -2294646, 7021597,
-3108053, 8826736, -4935222, 11678789, -8442713, 18725700, -21526692,
25420577, 19589811, -28108666, 12634054, -14483066, 6263217, -9979706,
3665661, -7909736, 2531530, -6434896, 1700772, -5525393, 1479473,
-4894262, 1231760, -4353044, 1032940, -3786590, 941152, -3331614,
665090, -2851619, 830696, -2762201, 958007, -2483118, 788233,
-2184965, 804825, -1967306, 1007255, -1862474, 920889, -1457506,
755406, -1405841, 890230, -1302124, 1161599, -701867, 1154163,
-1083366, 1204743, -513581, 1547264, -650636, 1493384, -285543,
1771863, -277906, 1841343, -9078, 1751863, 230222, 1819578,
207170, 1978972, 398137, 2106468, 552155, 1997624, 685213,
2129520, 601078, 2238736, 944591, 2441879, 1194178, 2355280,
986124, 2393328, 1049005, 2417944, 1208368, 2489516, 1352023,
2572118, 1445283, 2856081, 1532997, 2742279, 1615877, 2915274,
1808036, 2856871, 1806936, 3241747, 1622461, 2978558, 1841297,
3010378, 1923666, 3271367, 2126700, 3070935, 1956958, 3107588,
2128405, 3288872, 2114911, 3315952, 2406651, 3344038, 2370199,
3368980, 2144361, 3305030, 2183803, 3401450, 2523102, 3405463,
2452475, 3463355, 2421678, 3551968, 2431949, 3477251, 2148125,
3244489, 2174090};
static const int32_t spec2time_out_expected_2[kSamples] = {
1691694, -2499988, -2035547,
1060469, 988634, -2044502, -306271, 2041000, 201454, -2289456, 93694,
2129427, -369152, -1887834, 860796, 2089102, -929424, -1673956, 1395291,
1785651, -1619673, -1380109, 1963449, 1093311, -2111007, -840456,
2372786, 578119, -2242702, 89774, 2463304, -132717, -2121480, 643634,
2277636, -1125999, -1995858, 1543748, 2227861, -1483779, -1495491,
2102642, 1833876, -1920568, -958378, 2485101, 772261, -2454257, -24942,
2918714, 136838, -2500453, 816118, 3039735, -746560, -2365815, 1586396,
2714951, -1511696, -1942334, 2571792, 2182827, -2325335, -1311543,
3055970, 1367220, -2737182, -110626, 3889222, 631008, -3280879, 853066,
4122279, -706638, -3334449, 2148311, 3993512, -1846301, -3004894,
3426779, 3329522, -3165264, -2242423, 4756866, 2557711, -4131280,
-805259, 5702711, 1120592, -4852821, 743664, 6476444, -621186, -5465828,
2815787, 6768835, -3017442, -5338409, 5658126, 6838454, -5492288,
-4682382, 8874947, 6153814, -8832561, -2649251, 12817398, 4237692,
-13000247, 1190661, 18986363, -115738, -19693978, 9908367, 30660381,
-10632635, -37962068, 47022884, 89744622, -42087632, 40279224,
-88869341, -47542383, 38572364, 10441576, -30339718, -9926740, 19896578,
28009, -18886612, -1124047, 13232498, -4150304, -12770551, 2637074,
9051831, -6162211, -8713972, 4557937, 5489716, -6862312, -5532349,
5415449, 2791310, -6999367, -2790102, 5375806, 546222, -6486452,
-821261, 4994973, -1278840, -5645501, 1060484, 3996285, -2503954,
-4653629, 2220549, 3036977, -3282133, -3318585, 2780636, 1789880,
-4004589, -2041031, 3105373, 574819, -3992722, -971004, 3001703,
-676739, -3841508, 417284, 2897970, -1427018, -3058480, 1189948,
2210960, -2268992, -2603272, 1949785, 1576172, -2720404, -1891738,
2309456, 769178, -2975646, -707150, 2424652, -88039, -2966660, -65452,
2320780, -957557, -2798978, 744640, 1879794, -1672081, -2365319,
1253309, 1366383, -2204082, -1544367, 1801452, 613828, -2531994,
-983847, 2064842, 118326, -2613790, -203220, 2219635, -730341, -2641861,
563557, 1765434, -1329916, -2272927, 1037138, 1266725, -1939220,
-1588643, 1754528, 816552, -2376303, -1099167, 1864999, 122477,
-2422762, -400027, 1889228, -579916, -2490353, 287139, 2011318,
-1176657, -2502978, 812896, 1116502, -1940211};
1691694, -2499988, -2035547, 1060469, 988634, -2044502, -306271,
2041000, 201454, -2289456, 93694, 2129427, -369152, -1887834,
860796, 2089102, -929424, -1673956, 1395291, 1785651, -1619673,
-1380109, 1963449, 1093311, -2111007, -840456, 2372786, 578119,
-2242702, 89774, 2463304, -132717, -2121480, 643634, 2277636,
-1125999, -1995858, 1543748, 2227861, -1483779, -1495491, 2102642,
1833876, -1920568, -958378, 2485101, 772261, -2454257, -24942,
2918714, 136838, -2500453, 816118, 3039735, -746560, -2365815,
1586396, 2714951, -1511696, -1942334, 2571792, 2182827, -2325335,
-1311543, 3055970, 1367220, -2737182, -110626, 3889222, 631008,
-3280879, 853066, 4122279, -706638, -3334449, 2148311, 3993512,
-1846301, -3004894, 3426779, 3329522, -3165264, -2242423, 4756866,
2557711, -4131280, -805259, 5702711, 1120592, -4852821, 743664,
6476444, -621186, -5465828, 2815787, 6768835, -3017442, -5338409,
5658126, 6838454, -5492288, -4682382, 8874947, 6153814, -8832561,
-2649251, 12817398, 4237692, -13000247, 1190661, 18986363, -115738,
-19693978, 9908367, 30660381, -10632635, -37962068, 47022884, 89744622,
-42087632, 40279224, -88869341, -47542383, 38572364, 10441576, -30339718,
-9926740, 19896578, 28009, -18886612, -1124047, 13232498, -4150304,
-12770551, 2637074, 9051831, -6162211, -8713972, 4557937, 5489716,
-6862312, -5532349, 5415449, 2791310, -6999367, -2790102, 5375806,
546222, -6486452, -821261, 4994973, -1278840, -5645501, 1060484,
3996285, -2503954, -4653629, 2220549, 3036977, -3282133, -3318585,
2780636, 1789880, -4004589, -2041031, 3105373, 574819, -3992722,
-971004, 3001703, -676739, -3841508, 417284, 2897970, -1427018,
-3058480, 1189948, 2210960, -2268992, -2603272, 1949785, 1576172,
-2720404, -1891738, 2309456, 769178, -2975646, -707150, 2424652,
-88039, -2966660, -65452, 2320780, -957557, -2798978, 744640,
1879794, -1672081, -2365319, 1253309, 1366383, -2204082, -1544367,
1801452, 613828, -2531994, -983847, 2064842, 118326, -2613790,
-203220, 2219635, -730341, -2641861, 563557, 1765434, -1329916,
-2272927, 1037138, 1266725, -1939220, -1588643, 1754528, 816552,
-2376303, -1099167, 1864999, 122477, -2422762, -400027, 1889228,
-579916, -2490353, 287139, 2011318, -1176657, -2502978, 812896,
1116502, -1940211};
static const int16_t time2spec_out_expected_1[kSamples] = {
20342, 23889, -10063, -9419,
3242, 7280, -2012, -5029, 332, 4478, -97, -3244, -891, 3117, 773, -2204,
-1335, 2009, 1236, -1469, -1562, 1277, 1366, -815, -1619, 599, 1449, -177,
-1507, 116, 1294, 263, -1338, -244, 1059, 553, -1045, -549, 829, 826,
-731, -755, 516, 909, -427, -853, 189, 1004, -184, -828, -108, 888, 72,
-700, -280, 717, 342, -611, -534, 601, 534, -374, -646, 399, 567, -171,
-720, 234, 645, -11, -712, -26, 593, 215, -643, -172, 536, 361, -527,
-403, 388, 550, -361, -480, 208, 623, -206, -585, 41, 578, 12, -504,
-182, 583, 218, -437, -339, 499, 263, -354, -450, 347, 456, -193, -524,
212, 475, -74, -566, 94, 511, 112, -577, -201, 408, 217, -546, -295, 338,
387, -13, 4, -46, 2, -76, 103, -83, 108, -55, 100, -150, 131, -156, 141,
-171, 179, -190, 128, -227, 172, -214, 215, -189, 265, -244, 322, -335,
337, -352, 358, -368, 362, -355, 366, -381, 403, -395, 411, -392, 446,
-458, 504, -449, 507, -464, 452, -491, 481, -534, 486, -516, 560, -535,
525, -537, 559, -554, 570, -616, 591, -585, 627, -509, 588, -584, 547,
-610, 580, -614, 635, -620, 655, -554, 546, -591, 642, -590, 660, -656,
629, -604, 620, -580, 617, -645, 648, -573, 612, -604, 584, -571, 597,
-562, 627, -550, 560, -606, 529, -584, 568, -503, 532, -463, 512, -440,
399, -457, 437, -349, 278, -317, 257, -220, 163, -8, -61, 18, -161, 367,
-1306};
20342, 23889, -10063, -9419, 3242, 7280, -2012, -5029, 332, 4478,
-97, -3244, -891, 3117, 773, -2204, -1335, 2009, 1236, -1469,
-1562, 1277, 1366, -815, -1619, 599, 1449, -177, -1507, 116,
1294, 263, -1338, -244, 1059, 553, -1045, -549, 829, 826,
-731, -755, 516, 909, -427, -853, 189, 1004, -184, -828,
-108, 888, 72, -700, -280, 717, 342, -611, -534, 601,
534, -374, -646, 399, 567, -171, -720, 234, 645, -11,
-712, -26, 593, 215, -643, -172, 536, 361, -527, -403,
388, 550, -361, -480, 208, 623, -206, -585, 41, 578,
12, -504, -182, 583, 218, -437, -339, 499, 263, -354,
-450, 347, 456, -193, -524, 212, 475, -74, -566, 94,
511, 112, -577, -201, 408, 217, -546, -295, 338, 387,
-13, 4, -46, 2, -76, 103, -83, 108, -55, 100,
-150, 131, -156, 141, -171, 179, -190, 128, -227, 172,
-214, 215, -189, 265, -244, 322, -335, 337, -352, 358,
-368, 362, -355, 366, -381, 403, -395, 411, -392, 446,
-458, 504, -449, 507, -464, 452, -491, 481, -534, 486,
-516, 560, -535, 525, -537, 559, -554, 570, -616, 591,
-585, 627, -509, 588, -584, 547, -610, 580, -614, 635,
-620, 655, -554, 546, -591, 642, -590, 660, -656, 629,
-604, 620, -580, 617, -645, 648, -573, 612, -604, 584,
-571, 597, -562, 627, -550, 560, -606, 529, -584, 568,
-503, 532, -463, 512, -440, 399, -457, 437, -349, 278,
-317, 257, -220, 163, -8, -61, 18, -161, 367, -1306};
static const int16_t time2spec_out_expected_2[kSamples] = {
14283, -11552, -15335, 6626,
7554, -2150, -6309, 1307, 4523, -4, -3908, -314, 3001, 914, -2715, -1042,
2094, 1272, -1715, -1399, 1263, 1508, -1021, -1534, 735, 1595, -439, -1447,
155, 1433, 22, -1325, -268, 1205, 424, -1030, -608, 950, 643, -733, -787,
661, 861, -502, -888, 331, 852, -144, -849, 19, 833, 99, -826, -154,
771, 368, -735, -459, 645, 513, -491, -604, 431, 630, -314, -598, 183,
622, -78, -612, -48, 641, 154, -645, -257, 610, 281, -529, -444, 450,
441, -327, -506, 274, 476, -232, -570, 117, 554, -86, -531, -21, 572,
151, -606, -221, 496, 322, -407, -388, 407, 394, -268, -428, 280, 505,
-115, -588, 19, 513, -29, -539, -109, 468, 173, -501, -242, 442, 278,
-478, -680, 656, -659, 656, -669, 602, -688, 612, -667, 612, -642, 627,
-648, 653, -676, 596, -680, 655, -649, 678, -672, 587, -608, 637, -645,
637, -620, 556, -580, 553, -635, 518, -599, 583, -501, 536, -544, 473,
-552, 583, -511, 541, -532, 563, -486, 461, -453, 486, -388, 424, -416,
432, -374, 399, -462, 364, -346, 293, -329, 331, -313, 281, -247, 309,
-337, 241, -190, 207, -194, 179, -163, 155, -156, 117, -135, 107, -126,
29, -22, 81, -8, 17, -61, -10, 8, -37, 80, -44, 72, -88, 65, -89, 130,
-114, 181, -215, 189, -245, 260, -288, 294, -339, 344, -396, 407, -429,
438, -439, 485, -556, 629, -612, 637, -645, 661, -737, 829, -830, 831,
-1041};
14283, -11552, -15335, 6626, 7554, -2150, -6309, 1307, 4523, -4,
-3908, -314, 3001, 914, -2715, -1042, 2094, 1272, -1715, -1399,
1263, 1508, -1021, -1534, 735, 1595, -439, -1447, 155, 1433,
22, -1325, -268, 1205, 424, -1030, -608, 950, 643, -733,
-787, 661, 861, -502, -888, 331, 852, -144, -849, 19,
833, 99, -826, -154, 771, 368, -735, -459, 645, 513,
-491, -604, 431, 630, -314, -598, 183, 622, -78, -612,
-48, 641, 154, -645, -257, 610, 281, -529, -444, 450,
441, -327, -506, 274, 476, -232, -570, 117, 554, -86,
-531, -21, 572, 151, -606, -221, 496, 322, -407, -388,
407, 394, -268, -428, 280, 505, -115, -588, 19, 513,
-29, -539, -109, 468, 173, -501, -242, 442, 278, -478,
-680, 656, -659, 656, -669, 602, -688, 612, -667, 612,
-642, 627, -648, 653, -676, 596, -680, 655, -649, 678,
-672, 587, -608, 637, -645, 637, -620, 556, -580, 553,
-635, 518, -599, 583, -501, 536, -544, 473, -552, 583,
-511, 541, -532, 563, -486, 461, -453, 486, -388, 424,
-416, 432, -374, 399, -462, 364, -346, 293, -329, 331,
-313, 281, -247, 309, -337, 241, -190, 207, -194, 179,
-163, 155, -156, 117, -135, 107, -126, 29, -22, 81,
-8, 17, -61, -10, 8, -37, 80, -44, 72, -88,
65, -89, 130, -114, 181, -215, 189, -245, 260, -288,
294, -339, 344, -396, 407, -429, 438, -439, 485, -556,
629, -612, 637, -645, 661, -737, 829, -830, 831, -1041};
class TransformTest : public testing::Test {
protected:
TransformTest() {
WebRtcSpl_Init();
}
TransformTest() { WebRtcSpl_Init(); }
// Pass a function pointer to the Tester function.
void Time2SpecTester(Time2Spec Time2SpecFunction) {
// WebRtcIsacfix_Time2Spec functions hard coded the buffer lengths. It's a
// large buffer but we have to test it here.
int16_t data_in_1[kSamples] = {0};
int16_t data_in_2[kSamples] = {0};
int16_t data_out_1[kSamples] = {0};
int16_t data_out_2[kSamples] = {0};
// Pass a function pointer to the Tester function.
void Time2SpecTester(Time2Spec Time2SpecFunction) {
// WebRtcIsacfix_Time2Spec functions hard coded the buffer lengths. It's a
// large buffer but we have to test it here.
int16_t data_in_1[kSamples] = {0};
int16_t data_in_2[kSamples] = {0};
int16_t data_out_1[kSamples] = {0};
int16_t data_out_2[kSamples] = {0};
for(int i = 0; i < kSamples; i++) {
data_in_1[i] = i * i + 1777;
data_in_2[i] = WEBRTC_SPL_WORD16_MAX / (i + 1) + 17;
}
for (int i = 0; i < kSamples; i++) {
data_in_1[i] = i * i + 1777;
data_in_2[i] = WEBRTC_SPL_WORD16_MAX / (i + 1) + 17;
}
Time2SpecFunction(data_in_1, data_in_2, data_out_1, data_out_2);
Time2SpecFunction(data_in_1, data_in_2, data_out_1, data_out_2);
for (int i = 0; i < kSamples; i++) {
// We don't require bit-exact for ARM assembly code.
EXPECT_LE(abs(time2spec_out_expected_1[i] - data_out_1[i]), 1);
EXPECT_LE(abs(time2spec_out_expected_2[i] - data_out_2[i]), 1);
}
}
for (int i = 0; i < kSamples; i++) {
// We don't require bit-exact for ARM assembly code.
EXPECT_LE(abs(time2spec_out_expected_1[i] - data_out_1[i]), 1);
EXPECT_LE(abs(time2spec_out_expected_2[i] - data_out_2[i]), 1);
}
}
// Pass a function pointer to the Tester function.
void Spec2TimeTester(Spec2Time Spec2TimeFunction) {
@ -162,7 +171,7 @@ class TransformTest : public testing::Test {
int16_t data_in_2[kSamples] = {0};
int32_t data_out_1[kSamples] = {0};
int32_t data_out_2[kSamples] = {0};
for(int i = 0; i < kSamples; i++) {
for (int i = 0; i < kSamples; i++) {
data_in_1[i] = i * i + 1777;
data_in_2[i] = WEBRTC_SPL_WORD16_MAX / (i + 1) + 17;
}
@ -175,7 +184,6 @@ class TransformTest : public testing::Test {
EXPECT_LE(abs(spec2time_out_expected_2[i] - data_out_2[i]), 16);
}
}
};
TEST_F(TransformTest, Time2SpecTest) {