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:
@ -21,42 +21,47 @@
|
||||
#include "modules/audio_coding/codecs/isac/main/source/structs.h"
|
||||
|
||||
int WebRtcIsac_EncLogisticMulti2(
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
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 */
|
||||
Bitstr* streamdata, /* in-/output struct containing bitstream */
|
||||
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 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 */
|
||||
int WebRtcIsac_EncTerminate(
|
||||
Bitstr* streamdata); /* in-/output struct containing bitstream */
|
||||
|
||||
/* returns the number of bytes in the stream so far */
|
||||
int WebRtcIsac_DecLogisticMulti2(
|
||||
int16_t *data, /* output: data vector */
|
||||
Bitstr *streamdata, /* in-/output struct containing bitstream */
|
||||
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 */
|
||||
int16_t* data, /* output: data vector */
|
||||
Bitstr* streamdata, /* in-/output struct containing bitstream */
|
||||
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 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 uint16_t *const *cdf, /* input: array of cdf arrays */
|
||||
Bitstr* streamdata, /* in-/output struct containing bitstream */
|
||||
const int* data, /* input: data vector */
|
||||
const uint16_t* const* 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 uint16_t *const *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* data, /* output: data vector */
|
||||
Bitstr* streamdata, /* in-/output struct containing bitstream */
|
||||
const uint16_t* const* 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 uint16_t *const *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 */
|
||||
int* data, /* output: data vector */
|
||||
Bitstr* streamdata, /* in-/output struct containing bitstream */
|
||||
const uint16_t* const* 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 /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_ */
|
||||
|
||||
@ -29,7 +29,11 @@ void TestGoodConfig(const AudioEncoderIsacFloatImpl::Config& config) {
|
||||
// Wrap subroutine calls that test things in this, so that the error messages
|
||||
// will be accompanied by stack traces that make it possible to tell which
|
||||
// subroutine invocation caused the failure.
|
||||
#define S(x) do { SCOPED_TRACE(#x); x; } while (0)
|
||||
#define S(x) \
|
||||
do { \
|
||||
SCOPED_TRACE(#x); \
|
||||
x; \
|
||||
} while (0)
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -24,162 +24,151 @@
|
||||
#include "modules/audio_coding/codecs/isac/main/source/settings.h"
|
||||
#include "modules/audio_coding/codecs/isac/main/source/structs.h"
|
||||
|
||||
#define MIN_ISAC_BW 10000
|
||||
#define MIN_ISAC_BW_LB 10000
|
||||
#define MIN_ISAC_BW_UB 25000
|
||||
#define MIN_ISAC_BW 10000
|
||||
#define MIN_ISAC_BW_LB 10000
|
||||
#define MIN_ISAC_BW_UB 25000
|
||||
|
||||
#define MAX_ISAC_BW 56000
|
||||
#define MAX_ISAC_BW_UB 32000
|
||||
#define MAX_ISAC_BW_LB 32000
|
||||
#define MAX_ISAC_BW 56000
|
||||
#define MAX_ISAC_BW_UB 32000
|
||||
#define MAX_ISAC_BW_LB 32000
|
||||
|
||||
#define MIN_ISAC_MD 5
|
||||
#define MAX_ISAC_MD 25
|
||||
#define MIN_ISAC_MD 5
|
||||
#define MAX_ISAC_MD 25
|
||||
|
||||
// assumed header size, in bytes; we don't know the exact number
|
||||
// (header compression may be used)
|
||||
#define HEADER_SIZE 35
|
||||
#define HEADER_SIZE 35
|
||||
|
||||
// Initial Frame-Size, in ms, for Wideband & Super-Wideband Mode
|
||||
#define INIT_FRAME_LEN_WB 60
|
||||
#define INIT_FRAME_LEN_WB 60
|
||||
#define INIT_FRAME_LEN_SWB 30
|
||||
|
||||
// Initial Bottleneck Estimate, in bits/sec, for
|
||||
// Wideband & Super-wideband mode
|
||||
#define INIT_BN_EST_WB 20e3f
|
||||
#define INIT_BN_EST_SWB 56e3f
|
||||
#define INIT_BN_EST_WB 20e3f
|
||||
#define INIT_BN_EST_SWB 56e3f
|
||||
|
||||
// Initial Header rate (header rate depends on frame-size),
|
||||
// in bits/sec, for Wideband & Super-Wideband mode.
|
||||
#define INIT_HDR_RATE_WB \
|
||||
#define INIT_HDR_RATE_WB \
|
||||
((float)HEADER_SIZE * 8.0f * 1000.0f / (float)INIT_FRAME_LEN_WB)
|
||||
#define INIT_HDR_RATE_SWB \
|
||||
#define INIT_HDR_RATE_SWB \
|
||||
((float)HEADER_SIZE * 8.0f * 1000.0f / (float)INIT_FRAME_LEN_SWB)
|
||||
|
||||
// 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 500
|
||||
#define BURST_INTERVAL 500
|
||||
|
||||
// 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_WB INIT_BN_EST_WB
|
||||
#define INIT_RATE_SWB INIT_BN_EST_SWB
|
||||
|
||||
#define INIT_RATE_WB INIT_BN_EST_WB
|
||||
#define INIT_RATE_SWB INIT_BN_EST_SWB
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This function initializes the struct */
|
||||
/* to be called before using the struct for anything else */
|
||||
/* returns 0 if everything went fine, -1 otherwise */
|
||||
int32_t WebRtcIsac_InitBandwidthEstimator(
|
||||
BwEstimatorstr* bwest_str,
|
||||
enum IsacSamplingRate encoderSampRate,
|
||||
enum IsacSamplingRate decoderSampRate);
|
||||
/* This function initializes the struct */
|
||||
/* to be called before using the struct for anything else */
|
||||
/* returns 0 if everything went fine, -1 otherwise */
|
||||
int32_t WebRtcIsac_InitBandwidthEstimator(
|
||||
BwEstimatorstr* bwest_str,
|
||||
enum IsacSamplingRate encoderSampRate,
|
||||
enum IsacSamplingRate decoderSampRate);
|
||||
|
||||
/* This function updates the receiving estimate */
|
||||
/* Parameters: */
|
||||
/* rtp_number - value from RTP packet, from NetEq */
|
||||
/* frame length - length of signal frame in ms, from iSAC decoder */
|
||||
/* send_ts - value in RTP header giving send time in samples */
|
||||
/* arr_ts - value given by timeGetTime() time of arrival in samples of packet from NetEq */
|
||||
/* 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 */
|
||||
int16_t WebRtcIsac_UpdateBandwidthEstimator(
|
||||
BwEstimatorstr* bwest_str,
|
||||
const uint16_t rtp_number,
|
||||
const int32_t frame_length,
|
||||
const uint32_t send_ts,
|
||||
const uint32_t arr_ts,
|
||||
const size_t pksize);
|
||||
/* This function updates the receiving estimate */
|
||||
/* Parameters: */
|
||||
/* rtp_number - value from RTP packet, from NetEq */
|
||||
/* frame length - length of signal frame in ms, from iSAC decoder */
|
||||
/* send_ts - value in RTP header giving send time in samples */
|
||||
/* arr_ts - value given by timeGetTime() time of arrival in samples of
|
||||
* packet from NetEq */
|
||||
/* 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 */
|
||||
int16_t WebRtcIsac_UpdateBandwidthEstimator(BwEstimatorstr* bwest_str,
|
||||
const uint16_t rtp_number,
|
||||
const int32_t frame_length,
|
||||
const uint32_t send_ts,
|
||||
const uint32_t arr_ts,
|
||||
const size_t pksize);
|
||||
|
||||
/* Update receiving estimates. Used when we only receive BWE index, no iSAC data packet. */
|
||||
int16_t WebRtcIsac_UpdateUplinkBwImpl(
|
||||
BwEstimatorstr* bwest_str,
|
||||
int16_t Index,
|
||||
enum IsacSamplingRate encoderSamplingFreq);
|
||||
/* Update receiving estimates. Used when we only receive BWE index, no iSAC data
|
||||
* packet. */
|
||||
int16_t WebRtcIsac_UpdateUplinkBwImpl(
|
||||
BwEstimatorstr* bwest_str,
|
||||
int16_t Index,
|
||||
enum IsacSamplingRate encoderSamplingFreq);
|
||||
|
||||
/* Returns the bandwidth/jitter estimation code (integer 0...23) to put in the sending iSAC payload */
|
||||
void WebRtcIsac_GetDownlinkBwJitIndexImpl(
|
||||
BwEstimatorstr* bwest_str,
|
||||
int16_t* bottleneckIndex,
|
||||
int16_t* jitterInfo,
|
||||
enum IsacSamplingRate decoderSamplingFreq);
|
||||
/* Returns the bandwidth/jitter estimation code (integer 0...23) to put in the
|
||||
* sending iSAC payload */
|
||||
void WebRtcIsac_GetDownlinkBwJitIndexImpl(
|
||||
BwEstimatorstr* bwest_str,
|
||||
int16_t* bottleneckIndex,
|
||||
int16_t* jitterInfo,
|
||||
enum IsacSamplingRate decoderSamplingFreq);
|
||||
|
||||
/* Returns the bandwidth estimation (in bps) */
|
||||
int32_t WebRtcIsac_GetDownlinkBandwidth(
|
||||
const BwEstimatorstr *bwest_str);
|
||||
/* Returns the bandwidth estimation (in bps) */
|
||||
int32_t WebRtcIsac_GetDownlinkBandwidth(const BwEstimatorstr* bwest_str);
|
||||
|
||||
/* Returns the max delay (in ms) */
|
||||
int32_t WebRtcIsac_GetDownlinkMaxDelay(
|
||||
const BwEstimatorstr *bwest_str);
|
||||
/* Returns the max delay (in ms) */
|
||||
int32_t WebRtcIsac_GetDownlinkMaxDelay(const BwEstimatorstr* bwest_str);
|
||||
|
||||
/* Returns the bandwidth that iSAC should send with in bps */
|
||||
int32_t WebRtcIsac_GetUplinkBandwidth(const BwEstimatorstr* bwest_str);
|
||||
/* Returns the bandwidth that iSAC should send with in bps */
|
||||
int32_t WebRtcIsac_GetUplinkBandwidth(const BwEstimatorstr* bwest_str);
|
||||
|
||||
/* Returns the max delay value from the other side in ms */
|
||||
int32_t WebRtcIsac_GetUplinkMaxDelay(
|
||||
const BwEstimatorstr *bwest_str);
|
||||
/* Returns the max delay value from the other side in ms */
|
||||
int32_t WebRtcIsac_GetUplinkMaxDelay(const BwEstimatorstr* bwest_str);
|
||||
|
||||
/* Fills in an IsacExternalBandwidthInfo struct. */
|
||||
void WebRtcIsacBw_GetBandwidthInfo(
|
||||
BwEstimatorstr* bwest_str,
|
||||
enum IsacSamplingRate decoder_sample_rate_hz,
|
||||
IsacBandwidthInfo* bwinfo);
|
||||
/* Fills in an IsacExternalBandwidthInfo struct. */
|
||||
void WebRtcIsacBw_GetBandwidthInfo(BwEstimatorstr* bwest_str,
|
||||
enum IsacSamplingRate decoder_sample_rate_hz,
|
||||
IsacBandwidthInfo* bwinfo);
|
||||
|
||||
/* Uses the values from an IsacExternalBandwidthInfo struct. */
|
||||
void WebRtcIsacBw_SetBandwidthInfo(BwEstimatorstr* bwest_str,
|
||||
const IsacBandwidthInfo* bwinfo);
|
||||
/* Uses the values from an IsacExternalBandwidthInfo struct. */
|
||||
void WebRtcIsacBw_SetBandwidthInfo(BwEstimatorstr* bwest_str,
|
||||
const IsacBandwidthInfo* bwinfo);
|
||||
|
||||
/*
|
||||
* update amount of data in bottle neck buffer and burst handling
|
||||
* returns minimum payload size (bytes)
|
||||
*/
|
||||
int WebRtcIsac_GetMinBytes(
|
||||
RateModel* State,
|
||||
int StreamSize, /* bytes in bitstream */
|
||||
const int FrameLen, /* ms per frame */
|
||||
const double BottleNeck, /* bottle neck rate; excl headers (bps) */
|
||||
const double DelayBuildUp, /* max delay from bottleneck buffering (ms) */
|
||||
enum ISACBandwidth bandwidth
|
||||
/*,int16_t frequentLargePackets*/);
|
||||
/*
|
||||
* update amount of data in bottle neck buffer and burst handling
|
||||
* returns minimum payload size (bytes)
|
||||
*/
|
||||
int WebRtcIsac_GetMinBytes(
|
||||
RateModel* State,
|
||||
int StreamSize, /* bytes in bitstream */
|
||||
const int FrameLen, /* ms per frame */
|
||||
const double BottleNeck, /* bottle neck rate; excl headers (bps) */
|
||||
const double DelayBuildUp, /* max delay from bottleneck buffering (ms) */
|
||||
enum ISACBandwidth bandwidth
|
||||
/*,int16_t frequentLargePackets*/);
|
||||
|
||||
/*
|
||||
* update long-term average bitrate and amount of data in buffer
|
||||
*/
|
||||
void WebRtcIsac_UpdateRateModel(
|
||||
RateModel* State,
|
||||
int StreamSize, /* bytes in bitstream */
|
||||
const int FrameSamples, /* samples per frame */
|
||||
const double BottleNeck); /* bottle neck rate; excl headers (bps) */
|
||||
/*
|
||||
* update long-term average bitrate and amount of data in buffer
|
||||
*/
|
||||
void WebRtcIsac_UpdateRateModel(
|
||||
RateModel* State,
|
||||
int StreamSize, /* bytes in bitstream */
|
||||
const int FrameSamples, /* samples per frame */
|
||||
const double BottleNeck); /* bottle neck rate; excl headers (bps) */
|
||||
|
||||
void WebRtcIsac_InitRateModel(RateModel* State);
|
||||
|
||||
void WebRtcIsac_InitRateModel(
|
||||
RateModel *State);
|
||||
/* Returns the new framelength value (input argument: bottle_neck) */
|
||||
int WebRtcIsac_GetNewFrameLength(double bottle_neck, int current_framelength);
|
||||
|
||||
/* Returns the new framelength value (input argument: bottle_neck) */
|
||||
int WebRtcIsac_GetNewFrameLength(
|
||||
double bottle_neck,
|
||||
int current_framelength);
|
||||
/* Returns the new SNR value (input argument: bottle_neck) */
|
||||
double WebRtcIsac_GetSnr(double bottle_neck, int new_framelength);
|
||||
|
||||
/* Returns the new SNR value (input argument: bottle_neck) */
|
||||
double WebRtcIsac_GetSnr(
|
||||
double bottle_neck,
|
||||
int new_framelength);
|
||||
|
||||
|
||||
int16_t WebRtcIsac_UpdateUplinkJitter(
|
||||
BwEstimatorstr* bwest_str,
|
||||
int32_t index);
|
||||
int16_t WebRtcIsac_UpdateUplinkJitter(BwEstimatorstr* bwest_str, int32_t index);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_ */
|
||||
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_ \
|
||||
*/
|
||||
|
||||
@ -25,10 +25,12 @@
|
||||
|
||||
void WebRtcIsac_ResetBitstream(Bitstr* bit_stream);
|
||||
|
||||
int WebRtcIsac_EstimateBandwidth(BwEstimatorstr* bwest_str, Bitstr* streamdata,
|
||||
int WebRtcIsac_EstimateBandwidth(BwEstimatorstr* bwest_str,
|
||||
Bitstr* streamdata,
|
||||
size_t packet_size,
|
||||
uint16_t rtp_seq_number,
|
||||
uint32_t send_ts, uint32_t arr_ts,
|
||||
uint32_t send_ts,
|
||||
uint32_t arr_ts,
|
||||
enum IsacSamplingRate encoderSampRate,
|
||||
enum IsacSamplingRate decoderSampRate);
|
||||
|
||||
@ -38,7 +40,8 @@ int WebRtcIsac_DecodeLb(const TransformTables* transform_tables,
|
||||
int16_t* current_framesamples,
|
||||
int16_t isRCUPayload);
|
||||
|
||||
int WebRtcIsac_DecodeRcuLb(float* signal_out, ISACLBDecStruct* ISACdec_obj,
|
||||
int WebRtcIsac_DecodeRcuLb(float* signal_out,
|
||||
ISACLBDecStruct* ISACdec_obj,
|
||||
int16_t* current_framesamples);
|
||||
|
||||
int WebRtcIsac_EncodeLb(const TransformTables* transform_tables,
|
||||
@ -48,15 +51,20 @@ int WebRtcIsac_EncodeLb(const TransformTables* transform_tables,
|
||||
int16_t bottleneckIndex);
|
||||
|
||||
int WebRtcIsac_EncodeStoredDataLb(const IsacSaveEncoderData* ISACSavedEnc_obj,
|
||||
Bitstr* ISACBitStr_obj, int BWnumber,
|
||||
Bitstr* ISACBitStr_obj,
|
||||
int BWnumber,
|
||||
float scale);
|
||||
|
||||
int WebRtcIsac_EncodeStoredDataUb(
|
||||
const ISACUBSaveEncDataStruct* ISACSavedEnc_obj, Bitstr* bitStream,
|
||||
int32_t jitterInfo, float scale, enum ISACBandwidth bandwidth);
|
||||
const ISACUBSaveEncDataStruct* ISACSavedEnc_obj,
|
||||
Bitstr* bitStream,
|
||||
int32_t jitterInfo,
|
||||
float scale,
|
||||
enum ISACBandwidth bandwidth);
|
||||
|
||||
int16_t WebRtcIsac_GetRedPayloadUb(
|
||||
const ISACUBSaveEncDataStruct* ISACSavedEncObj, Bitstr* bitStreamObj,
|
||||
const ISACUBSaveEncDataStruct* ISACSavedEncObj,
|
||||
Bitstr* bitStreamObj,
|
||||
enum ISACBandwidth bandwidth);
|
||||
|
||||
/******************************************************************************
|
||||
@ -82,7 +90,6 @@ int16_t WebRtcIsac_RateAllocation(int32_t inRateBitPerSec,
|
||||
double* rateUBBitPerSec,
|
||||
enum ISACBandwidth* bandwidthKHz);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DecodeUb16()
|
||||
*
|
||||
@ -169,7 +176,6 @@ void WebRtcIsac_InitMasking(MaskFiltstr* maskdata);
|
||||
|
||||
void WebRtcIsac_InitPostFilterbank(PostFiltBankstr* postfiltdata);
|
||||
|
||||
|
||||
/**************************** transform functions ****************************/
|
||||
|
||||
void WebRtcIsac_InitTransform(TransformTables* tables);
|
||||
@ -190,18 +196,25 @@ void WebRtcIsac_Spec2time(const TransformTables* tables,
|
||||
|
||||
/***************************** filterbank functions **************************/
|
||||
|
||||
void WebRtcIsac_FilterAndCombineFloat(float* InLP, float* InHP, float* Out,
|
||||
void WebRtcIsac_FilterAndCombineFloat(float* InLP,
|
||||
float* InHP,
|
||||
float* Out,
|
||||
PostFiltBankstr* postfiltdata);
|
||||
|
||||
|
||||
/************************* normalized lattice filters ************************/
|
||||
|
||||
void WebRtcIsac_NormLatticeFilterMa(int orderCoef, float* stateF, float* stateG,
|
||||
float* lat_in, double* filtcoeflo,
|
||||
void WebRtcIsac_NormLatticeFilterMa(int orderCoef,
|
||||
float* stateF,
|
||||
float* stateG,
|
||||
float* lat_in,
|
||||
double* filtcoeflo,
|
||||
double* lat_out);
|
||||
|
||||
void WebRtcIsac_NormLatticeFilterAr(int orderCoef, float* stateF, float* stateG,
|
||||
double* lat_in, double* lo_filt_coef,
|
||||
void WebRtcIsac_NormLatticeFilterAr(int orderCoef,
|
||||
float* stateF,
|
||||
float* stateG,
|
||||
double* lat_in,
|
||||
double* lo_filt_coef,
|
||||
float* lat_out);
|
||||
|
||||
void WebRtcIsac_Dir2Lat(double* a, int orderCoef, float* sth, float* cth);
|
||||
|
||||
@ -36,11 +36,6 @@
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int WebRtcIsac_GetCrc(
|
||||
const int16_t* encoded,
|
||||
int no_of_word8s,
|
||||
uint32_t* crc);
|
||||
|
||||
|
||||
int WebRtcIsac_GetCrc(const int16_t* encoded, int no_of_word8s, uint32_t* crc);
|
||||
|
||||
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CRC_H_ */
|
||||
|
||||
@ -39,9 +39,7 @@
|
||||
*
|
||||
*
|
||||
*/
|
||||
int16_t WebRtcIsac_RemoveLarMean(
|
||||
double* lar,
|
||||
int16_t bandwidth);
|
||||
int16_t WebRtcIsac_RemoveLarMean(double* lar, int16_t bandwidth);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DecorrelateIntraVec()
|
||||
@ -59,11 +57,9 @@ int16_t WebRtcIsac_RemoveLarMean(
|
||||
* Output:
|
||||
* -out : decorrelated LAR vectors.
|
||||
*/
|
||||
int16_t WebRtcIsac_DecorrelateIntraVec(
|
||||
const double* inLAR,
|
||||
double* out,
|
||||
int16_t bandwidth);
|
||||
|
||||
int16_t WebRtcIsac_DecorrelateIntraVec(const double* inLAR,
|
||||
double* out,
|
||||
int16_t bandwidth);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DecorrelateInterVec()
|
||||
@ -82,11 +78,9 @@ int16_t WebRtcIsac_DecorrelateIntraVec(
|
||||
* Output:
|
||||
* -out : decorrelated LAR vectors.
|
||||
*/
|
||||
int16_t WebRtcIsac_DecorrelateInterVec(
|
||||
const double* data,
|
||||
double* out,
|
||||
int16_t bandwidth);
|
||||
|
||||
int16_t WebRtcIsac_DecorrelateInterVec(const double* data,
|
||||
double* out,
|
||||
int16_t bandwidth);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_QuantizeUncorrLar()
|
||||
@ -102,11 +96,7 @@ int16_t WebRtcIsac_DecorrelateInterVec(
|
||||
* -data : quantized version of the input.
|
||||
* -idx : pointer to quantization indices.
|
||||
*/
|
||||
double WebRtcIsac_QuantizeUncorrLar(
|
||||
double* data,
|
||||
int* idx,
|
||||
int16_t bandwidth);
|
||||
|
||||
double WebRtcIsac_QuantizeUncorrLar(double* data, int* idx, int16_t bandwidth);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_CorrelateIntraVec()
|
||||
@ -121,11 +111,9 @@ double WebRtcIsac_QuantizeUncorrLar(
|
||||
* Output:
|
||||
* -out : correlated parametrs.
|
||||
*/
|
||||
int16_t WebRtcIsac_CorrelateIntraVec(
|
||||
const double* data,
|
||||
double* out,
|
||||
int16_t bandwidth);
|
||||
|
||||
int16_t WebRtcIsac_CorrelateIntraVec(const double* data,
|
||||
double* out,
|
||||
int16_t bandwidth);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_CorrelateInterVec()
|
||||
@ -140,17 +128,15 @@ int16_t WebRtcIsac_CorrelateIntraVec(
|
||||
* Output:
|
||||
* -out : correlated parametrs.
|
||||
*/
|
||||
int16_t WebRtcIsac_CorrelateInterVec(
|
||||
const double* data,
|
||||
double* out,
|
||||
int16_t bandwidth);
|
||||
|
||||
int16_t WebRtcIsac_CorrelateInterVec(const double* data,
|
||||
double* out,
|
||||
int16_t bandwidth);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_AddLarMean()
|
||||
*
|
||||
* This is the inverse of WebRtcIsac_RemoveLarMean()
|
||||
*
|
||||
*
|
||||
* Input:
|
||||
* -data : pointer to mean-removed LAR:s.
|
||||
* -bandwidth : indicates if the given LAR vectors belong
|
||||
@ -159,10 +145,7 @@ int16_t WebRtcIsac_CorrelateInterVec(
|
||||
* Output:
|
||||
* -data : pointer to LARs.
|
||||
*/
|
||||
int16_t WebRtcIsac_AddLarMean(
|
||||
double* data,
|
||||
int16_t bandwidth);
|
||||
|
||||
int16_t WebRtcIsac_AddLarMean(double* data, int16_t bandwidth);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DequantizeLpcParam()
|
||||
@ -177,11 +160,9 @@ int16_t WebRtcIsac_AddLarMean(
|
||||
* Output:
|
||||
* -out : pointer to quantized values.
|
||||
*/
|
||||
int16_t WebRtcIsac_DequantizeLpcParam(
|
||||
const int* idx,
|
||||
double* out,
|
||||
int16_t bandwidth);
|
||||
|
||||
int16_t WebRtcIsac_DequantizeLpcParam(const int* idx,
|
||||
double* out,
|
||||
int16_t bandwidth);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_ToLogDomainRemoveMean()
|
||||
@ -194,9 +175,7 @@ int16_t WebRtcIsac_DequantizeLpcParam(
|
||||
* Output:
|
||||
* -lpcGain : mean-removed in log domain.
|
||||
*/
|
||||
int16_t WebRtcIsac_ToLogDomainRemoveMean(
|
||||
double* lpGains);
|
||||
|
||||
int16_t WebRtcIsac_ToLogDomainRemoveMean(double* lpGains);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DecorrelateLPGain()
|
||||
@ -210,16 +189,13 @@ int16_t WebRtcIsac_ToLogDomainRemoveMean(
|
||||
* Output:
|
||||
* -out : decorrelated parameters.
|
||||
*/
|
||||
int16_t WebRtcIsac_DecorrelateLPGain(
|
||||
const double* data,
|
||||
double* out);
|
||||
|
||||
int16_t WebRtcIsac_DecorrelateLPGain(const double* data, double* out);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_QuantizeLpcGain()
|
||||
*
|
||||
* Quantize the decorrelated log-domain gains.
|
||||
*
|
||||
*
|
||||
* Input:
|
||||
* -lpcGain : uncorrelated LPC gains.
|
||||
*
|
||||
@ -227,10 +203,7 @@ int16_t WebRtcIsac_DecorrelateLPGain(
|
||||
* -idx : quantization indices
|
||||
* -lpcGain : quantized value of the inpt.
|
||||
*/
|
||||
double WebRtcIsac_QuantizeLpcGain(
|
||||
double* lpGains,
|
||||
int* idx);
|
||||
|
||||
double WebRtcIsac_QuantizeLpcGain(double* lpGains, int* idx);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DequantizeLpcGain()
|
||||
@ -243,10 +216,7 @@ double WebRtcIsac_QuantizeLpcGain(
|
||||
* Output:
|
||||
* -lpcGains : quantized values of the given parametes.
|
||||
*/
|
||||
int16_t WebRtcIsac_DequantizeLpcGain(
|
||||
const int* idx,
|
||||
double* lpGains);
|
||||
|
||||
int16_t WebRtcIsac_DequantizeLpcGain(const int* idx, double* lpGains);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_CorrelateLpcGain()
|
||||
@ -259,10 +229,7 @@ int16_t WebRtcIsac_DequantizeLpcGain(
|
||||
* Output:
|
||||
* -out : correlated parameters.
|
||||
*/
|
||||
int16_t WebRtcIsac_CorrelateLpcGain(
|
||||
const double* data,
|
||||
double* out);
|
||||
|
||||
int16_t WebRtcIsac_CorrelateLpcGain(const double* data, double* out);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_AddMeanToLinearDomain()
|
||||
@ -275,8 +242,6 @@ int16_t WebRtcIsac_CorrelateLpcGain(
|
||||
* Output:
|
||||
* -lpcGain : LPC gain in normal domain.
|
||||
*/
|
||||
int16_t WebRtcIsac_AddMeanToLinearDomain(
|
||||
double* lpcGains);
|
||||
|
||||
int16_t WebRtcIsac_AddMeanToLinearDomain(double* lpcGains);
|
||||
|
||||
#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENCODE_LPC_SWB_H_
|
||||
|
||||
@ -46,8 +46,11 @@
|
||||
* Return value : < 0 if an error occures
|
||||
* 0 if succeeded.
|
||||
*/
|
||||
int WebRtcIsac_DecodeSpec(Bitstr* streamdata, int16_t AvgPitchGain_Q12,
|
||||
enum ISACBand band, double* fr, double* fi);
|
||||
int WebRtcIsac_DecodeSpec(Bitstr* streamdata,
|
||||
int16_t AvgPitchGain_Q12,
|
||||
enum ISACBand band,
|
||||
double* fr,
|
||||
double* fi);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_EncodeSpec()
|
||||
@ -72,24 +75,31 @@ int WebRtcIsac_DecodeSpec(Bitstr* streamdata, int16_t AvgPitchGain_Q12,
|
||||
* Return value : < 0 if an error occures
|
||||
* 0 if succeeded.
|
||||
*/
|
||||
int WebRtcIsac_EncodeSpec(const int16_t* fr, const int16_t* fi,
|
||||
int16_t 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,
|
||||
int WebRtcIsac_DecodeLpcCoefUB(Bitstr* streamdata,
|
||||
double* lpcVecs,
|
||||
double* percepFilterGains,
|
||||
int16_t bandwidth);
|
||||
|
||||
int WebRtcIsac_DecodeLpc(Bitstr* streamdata, double* LPCCoef_lo,
|
||||
int WebRtcIsac_DecodeLpc(Bitstr* streamdata,
|
||||
double* LPCCoef_lo,
|
||||
double* LPCCoef_hi);
|
||||
|
||||
/* quantize & code LPC Coef */
|
||||
void WebRtcIsac_EncodeLpcLb(double* LPCCoef_lo, double* LPCCoef_hi,
|
||||
Bitstr* streamdata, IsacSaveEncoderData* encData);
|
||||
void WebRtcIsac_EncodeLpcLb(double* LPCCoef_lo,
|
||||
double* LPCCoef_hi,
|
||||
Bitstr* streamdata,
|
||||
IsacSaveEncoderData* encData);
|
||||
|
||||
void WebRtcIsac_EncodeLpcGainLb(double* LPCCoef_lo, double* LPCCoef_hi,
|
||||
void WebRtcIsac_EncodeLpcGainLb(double* LPCCoef_lo,
|
||||
double* LPCCoef_hi,
|
||||
Bitstr* streamdata,
|
||||
IsacSaveEncoderData* encData);
|
||||
|
||||
@ -126,7 +136,8 @@ void WebRtcIsac_EncodeLpcGainLb(double* LPCCoef_lo, double* LPCCoef_hi,
|
||||
* Return value : 0 if encoding is successful,
|
||||
* <0 if failed to encode.
|
||||
*/
|
||||
int16_t WebRtcIsac_EncodeLpcUB(double* lpcCoeff, Bitstr* streamdata,
|
||||
int16_t WebRtcIsac_EncodeLpcUB(double* lpcCoeff,
|
||||
Bitstr* streamdata,
|
||||
double* interpolLPCCoeff,
|
||||
int16_t bandwidth,
|
||||
ISACUBSaveEncDataStruct* encData);
|
||||
@ -184,9 +195,9 @@ void WebRtcIsac_EncodePitchLag(double* PitchLags,
|
||||
Bitstr* streamdata,
|
||||
IsacSaveEncoderData* encData);
|
||||
|
||||
int WebRtcIsac_DecodePitchGain(Bitstr* streamdata,
|
||||
int16_t* PitchGain_Q12);
|
||||
int WebRtcIsac_DecodePitchLag(Bitstr* streamdata, int16_t* PitchGain_Q12,
|
||||
int WebRtcIsac_DecodePitchGain(Bitstr* streamdata, int16_t* PitchGain_Q12);
|
||||
int WebRtcIsac_DecodePitchLag(Bitstr* streamdata,
|
||||
int16_t* PitchGain_Q12,
|
||||
double* PitchLag);
|
||||
|
||||
int WebRtcIsac_DecodeFrameLen(Bitstr* streamdata, int16_t* framelength);
|
||||
@ -200,10 +211,10 @@ void WebRtcIsac_Poly2Rc(double* a, int N, double* RC);
|
||||
/* Step-up */
|
||||
void WebRtcIsac_Rc2Poly(double* RC, int N, double* a);
|
||||
|
||||
void WebRtcIsac_TranscodeLPCCoef(double* LPCCoef_lo, double* LPCCoef_hi,
|
||||
void WebRtcIsac_TranscodeLPCCoef(double* LPCCoef_lo,
|
||||
double* LPCCoef_hi,
|
||||
int* index_g);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_EncodeLpcGainUb()
|
||||
* Encode LPC gains of sub-Frames.
|
||||
@ -220,10 +231,10 @@ void WebRtcIsac_TranscodeLPCCoef(double* LPCCoef_lo, double* LPCCoef_hi,
|
||||
* - lpcGainIndex : quantization indices for lpc gains, these will
|
||||
* be stored to be used for FEC.
|
||||
*/
|
||||
void WebRtcIsac_EncodeLpcGainUb(double* lpGains, Bitstr* streamdata,
|
||||
void WebRtcIsac_EncodeLpcGainUb(double* lpGains,
|
||||
Bitstr* streamdata,
|
||||
int* lpcGainIndex);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_EncodeLpcGainUb()
|
||||
* Store LPC gains of sub-Frames in 'streamdata'.
|
||||
@ -239,7 +250,6 @@ void WebRtcIsac_EncodeLpcGainUb(double* lpGains, Bitstr* streamdata,
|
||||
*/
|
||||
void WebRtcIsac_StoreLpcGainUb(double* lpGains, Bitstr* streamdata);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DecodeLpcGainUb()
|
||||
* Decode the LPC gain of sub-frames.
|
||||
@ -257,7 +267,6 @@ void WebRtcIsac_StoreLpcGainUb(double* lpGains, Bitstr* streamdata);
|
||||
*/
|
||||
int16_t WebRtcIsac_DecodeLpcGainUb(double* lpGains, Bitstr* streamdata);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_EncodeBandwidth()
|
||||
* Encode if the bandwidth of encoded audio is 0-12 kHz or 0-16 kHz.
|
||||
@ -277,7 +286,6 @@ int16_t WebRtcIsac_DecodeLpcGainUb(double* lpGains, Bitstr* streamdata);
|
||||
int16_t WebRtcIsac_EncodeBandwidth(enum ISACBandwidth bandwidth,
|
||||
Bitstr* streamData);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DecodeBandwidth()
|
||||
* Decode the bandwidth of the encoded audio, i.e. if the bandwidth is 0-12 kHz
|
||||
@ -298,7 +306,6 @@ int16_t WebRtcIsac_EncodeBandwidth(enum ISACBandwidth bandwidth,
|
||||
int16_t WebRtcIsac_DecodeBandwidth(Bitstr* streamData,
|
||||
enum ISACBandwidth* bandwidth);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_EncodeJitterInfo()
|
||||
* Decode the jitter information.
|
||||
@ -316,9 +323,7 @@ int16_t WebRtcIsac_DecodeBandwidth(Bitstr* streamData,
|
||||
* Return value : 0 if succeeded.
|
||||
* <0 if failed.
|
||||
*/
|
||||
int16_t WebRtcIsac_EncodeJitterInfo(int32_t jitterIndex,
|
||||
Bitstr* streamData);
|
||||
|
||||
int16_t WebRtcIsac_EncodeJitterInfo(int32_t jitterIndex, Bitstr* streamData);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_DecodeJitterInfo()
|
||||
@ -337,7 +342,6 @@ int16_t WebRtcIsac_EncodeJitterInfo(int32_t jitterIndex,
|
||||
* Return value : 0 if succeeded.
|
||||
* <0 if failed.
|
||||
*/
|
||||
int16_t WebRtcIsac_DecodeJitterInfo(Bitstr* streamData,
|
||||
int32_t* jitterInfo);
|
||||
int16_t WebRtcIsac_DecodeJitterInfo(Bitstr* streamData, int32_t* jitterInfo);
|
||||
|
||||
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENTROPY_CODING_H_ */
|
||||
|
||||
@ -34,10 +34,12 @@
|
||||
|
||||
/* double precision routine */
|
||||
|
||||
|
||||
int WebRtcIsac_Fftns (unsigned int ndim, const int dims[], double Re[], double Im[],
|
||||
int isign, double scaling, FFTstr *fftstate);
|
||||
|
||||
|
||||
int WebRtcIsac_Fftns(unsigned int ndim,
|
||||
const int dims[],
|
||||
double Re[],
|
||||
double Im[],
|
||||
int isign,
|
||||
double scaling,
|
||||
FFTstr* fftstate);
|
||||
|
||||
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FFT_H_ */
|
||||
|
||||
@ -35,15 +35,13 @@ class IsacTest : public ::testing::Test {
|
||||
uint8_t bitstream_small_[7]; // Simulate sync packets.
|
||||
};
|
||||
|
||||
IsacTest::IsacTest()
|
||||
: isac_codec_(NULL) {
|
||||
}
|
||||
IsacTest::IsacTest() : isac_codec_(NULL) {}
|
||||
|
||||
void IsacTest::SetUp() {
|
||||
// Read some samples from a speech file, to be used in the encode test.
|
||||
FILE* input_file;
|
||||
const std::string file_name =
|
||||
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
|
||||
input_file = fopen(file_name.c_str(), "rb");
|
||||
ASSERT_TRUE(input_file != NULL);
|
||||
ASSERT_EQ(kIsacNumberOfSamples,
|
||||
@ -69,7 +67,8 @@ TEST_F(IsacTest, IsacFreeFail) {
|
||||
TEST_F(IsacTest, IsacCreateFree) {
|
||||
EXPECT_EQ(0, WebRtcIsac_Create(&isac_codec_));
|
||||
EXPECT_TRUE(isac_codec_ != NULL);
|
||||
EXPECT_EQ(0, WebRtcIsac_Free(isac_codec_));}
|
||||
EXPECT_EQ(0, WebRtcIsac_Free(isac_codec_));
|
||||
}
|
||||
|
||||
TEST_F(IsacTest, IsacUpdateBWE) {
|
||||
// Create encoder memory.
|
||||
@ -86,17 +85,17 @@ TEST_F(IsacTest, IsacUpdateBWE) {
|
||||
12345, 56789));
|
||||
|
||||
// Encode 60 ms of data (needed to create a first packet).
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
EXPECT_EQ(0, encoded_bytes);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
EXPECT_EQ(0, encoded_bytes);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
EXPECT_EQ(0, encoded_bytes);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
EXPECT_EQ(0, encoded_bytes);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
EXPECT_EQ(0, encoded_bytes);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
|
||||
EXPECT_GT(encoded_bytes, 0);
|
||||
|
||||
// Call to update bandwidth estimator with real data.
|
||||
|
||||
@ -21,24 +21,26 @@
|
||||
#include "modules/audio_coding/codecs/isac/main/source/settings.h"
|
||||
#include "modules/audio_coding/codecs/isac/main/source/structs.h"
|
||||
|
||||
void WebRtcIsac_GetLpcCoefLb(double *inLo, double *inHi, MaskFiltstr *maskdata,
|
||||
double signal_noise_ratio, const int16_t *pitchGains_Q12,
|
||||
double *lo_coeff, double *hi_coeff);
|
||||
void WebRtcIsac_GetLpcCoefLb(double* inLo,
|
||||
double* inHi,
|
||||
MaskFiltstr* maskdata,
|
||||
double signal_noise_ratio,
|
||||
const int16_t* pitchGains_Q12,
|
||||
double* lo_coeff,
|
||||
double* hi_coeff);
|
||||
|
||||
void WebRtcIsac_GetLpcGain(
|
||||
double signal_noise_ratio,
|
||||
const double* filtCoeffVecs,
|
||||
int numVecs,
|
||||
double* gain,
|
||||
double corrLo[][UB_LPC_ORDER + 1],
|
||||
const double* varscale);
|
||||
void WebRtcIsac_GetLpcGain(double signal_noise_ratio,
|
||||
const double* filtCoeffVecs,
|
||||
int numVecs,
|
||||
double* gain,
|
||||
double corrLo[][UB_LPC_ORDER + 1],
|
||||
const double* varscale);
|
||||
|
||||
void WebRtcIsac_GetLpcCoefUb(
|
||||
double* inSignal,
|
||||
MaskFiltstr* maskdata,
|
||||
double* lpCoeff,
|
||||
double corr[][UB_LPC_ORDER + 1],
|
||||
double* varscale,
|
||||
int16_t bandwidth);
|
||||
void WebRtcIsac_GetLpcCoefUb(double* inSignal,
|
||||
MaskFiltstr* maskdata,
|
||||
double* lpCoeff,
|
||||
double corr[][UB_LPC_ORDER + 1],
|
||||
double* varscale,
|
||||
int16_t bandwidth);
|
||||
|
||||
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_ANALYIS_H_ */
|
||||
|
||||
@ -46,4 +46,4 @@ extern const uint16_t* WebRtcIsac_kLpcGainCdfMat[SUBFRAMES];
|
||||
|
||||
extern const double WebRtcIsac_kLpcGainDecorrMat[SUBFRAMES][SUBFRAMES];
|
||||
|
||||
#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_GAIN_SWB_TABLES_H_
|
||||
#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_GAIN_SWB_TABLES_H_
|
||||
|
||||
@ -26,22 +26,22 @@ extern const double WebRtcIsac_kMeanLarUb12[UB_LPC_ORDER];
|
||||
|
||||
extern const double WebRtcIsac_kMeanLpcGain;
|
||||
|
||||
extern const double WebRtcIsac_kIntraVecDecorrMatUb12[UB_LPC_ORDER][UB_LPC_ORDER];
|
||||
extern const double WebRtcIsac_kIntraVecDecorrMatUb12[UB_LPC_ORDER]
|
||||
[UB_LPC_ORDER];
|
||||
|
||||
extern const double WebRtcIsac_kInterVecDecorrMatUb12
|
||||
[UB_LPC_VEC_PER_FRAME][UB_LPC_VEC_PER_FRAME];
|
||||
extern const double WebRtcIsac_kInterVecDecorrMatUb12[UB_LPC_VEC_PER_FRAME]
|
||||
[UB_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const double WebRtcIsac_kLpcShapeQStepSizeUb12;
|
||||
|
||||
extern const double WebRtcIsac_kLpcShapeLeftRecPointUb12
|
||||
[UB_LPC_ORDER*UB_LPC_VEC_PER_FRAME];
|
||||
extern const double
|
||||
WebRtcIsac_kLpcShapeLeftRecPointUb12[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const int16_t
|
||||
WebRtcIsac_kLpcShapeNumRecPointUb12[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const int16_t WebRtcIsac_kLpcShapeNumRecPointUb12
|
||||
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeEntropySearchUb12
|
||||
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
|
||||
extern const uint16_t
|
||||
WebRtcIsac_kLpcShapeEntropySearchUb12[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec0Ub12[14];
|
||||
|
||||
@ -59,7 +59,7 @@ extern const uint16_t WebRtcIsac_kLpcShapeCdfVec6Ub12[33];
|
||||
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec7Ub12[49];
|
||||
|
||||
extern const uint16_t* WebRtcIsac_kLpcShapeCdfMatUb12
|
||||
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
|
||||
extern const uint16_t*
|
||||
WebRtcIsac_kLpcShapeCdfMatUb12[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
|
||||
|
||||
#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB12_TABLES_H_
|
||||
#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB12_TABLES_H_
|
||||
|
||||
@ -24,10 +24,11 @@
|
||||
|
||||
extern const double WebRtcIsac_kMeanLarUb16[UB_LPC_ORDER];
|
||||
|
||||
extern const double WebRtcIsac_kIintraVecDecorrMatUb16[UB_LPC_ORDER][UB_LPC_ORDER];
|
||||
extern const double WebRtcIsac_kIintraVecDecorrMatUb16[UB_LPC_ORDER]
|
||||
[UB_LPC_ORDER];
|
||||
|
||||
extern const double WebRtcIsac_kInterVecDecorrMatUb16
|
||||
[UB16_LPC_VEC_PER_FRAME][UB16_LPC_VEC_PER_FRAME];
|
||||
extern const double WebRtcIsac_kInterVecDecorrMatUb16[UB16_LPC_VEC_PER_FRAME]
|
||||
[UB16_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub16[14];
|
||||
|
||||
@ -61,18 +62,19 @@ extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub165[34];
|
||||
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub166[71];
|
||||
|
||||
extern const uint16_t* WebRtcIsac_kLpcShapeCdfMatUb16
|
||||
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
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 double
|
||||
WebRtcIsac_kLpcShapeLeftRecPointUb16[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const int16_t WebRtcIsac_kLpcShapeNumRecPointUb16
|
||||
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
extern const int16_t
|
||||
WebRtcIsac_kLpcShapeNumRecPointUb16[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const uint16_t WebRtcIsac_kLpcShapeEntropySearchUb16
|
||||
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
extern const uint16_t
|
||||
WebRtcIsac_kLpcShapeEntropySearchUb16[UB_LPC_ORDER *
|
||||
UB16_LPC_VEC_PER_FRAME];
|
||||
|
||||
extern const double WebRtcIsac_kLpcShapeQStepSizeUb16;
|
||||
|
||||
#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB16_TABLES_H_
|
||||
#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB16_TABLES_H_
|
||||
|
||||
@ -22,27 +22,27 @@
|
||||
|
||||
#include "modules/audio_coding/codecs/isac/main/source/settings.h"
|
||||
|
||||
#define KLT_STEPSIZE 1.00000000
|
||||
#define KLT_NUM_AVG_GAIN 0
|
||||
#define KLT_NUM_AVG_SHAPE 0
|
||||
#define KLT_NUM_MODELS 3
|
||||
#define LPC_GAIN_SCALE 4.000f
|
||||
#define LPC_LOBAND_SCALE 2.100f
|
||||
#define LPC_LOBAND_ORDER ORDERLO
|
||||
#define LPC_HIBAND_SCALE 0.450f
|
||||
#define LPC_HIBAND_ORDER ORDERHI
|
||||
#define LPC_GAIN_ORDER 2
|
||||
#define KLT_STEPSIZE 1.00000000
|
||||
#define KLT_NUM_AVG_GAIN 0
|
||||
#define KLT_NUM_AVG_SHAPE 0
|
||||
#define KLT_NUM_MODELS 3
|
||||
#define LPC_GAIN_SCALE 4.000f
|
||||
#define LPC_LOBAND_SCALE 2.100f
|
||||
#define LPC_LOBAND_ORDER ORDERLO
|
||||
#define LPC_HIBAND_SCALE 0.450f
|
||||
#define LPC_HIBAND_ORDER ORDERHI
|
||||
#define LPC_GAIN_ORDER 2
|
||||
|
||||
#define LPC_SHAPE_ORDER (LPC_LOBAND_ORDER + LPC_HIBAND_ORDER)
|
||||
#define LPC_SHAPE_ORDER (LPC_LOBAND_ORDER + LPC_HIBAND_ORDER)
|
||||
|
||||
#define KLT_ORDER_GAIN (LPC_GAIN_ORDER * SUBFRAMES)
|
||||
#define KLT_ORDER_SHAPE (LPC_SHAPE_ORDER * SUBFRAMES)
|
||||
#define KLT_ORDER_GAIN (LPC_GAIN_ORDER * SUBFRAMES)
|
||||
#define KLT_ORDER_SHAPE (LPC_SHAPE_ORDER * SUBFRAMES)
|
||||
|
||||
/* cdf array for model indicator */
|
||||
extern const uint16_t 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 uint16_t *WebRtcIsac_kQKltModelCdfPtr[1];
|
||||
extern const uint16_t* WebRtcIsac_kQKltModelCdfPtr[1];
|
||||
|
||||
/* initial cdf index for decoder of model indicator */
|
||||
extern const uint16_t WebRtcIsac_kQKltModelInitIndex[1];
|
||||
@ -78,9 +78,9 @@ extern const uint16_t WebRtcIsac_kQKltCdfGain[404];
|
||||
extern const uint16_t WebRtcIsac_kQKltCdfShape[686];
|
||||
|
||||
/* pointers to cdf tables for quantizer indices */
|
||||
extern const uint16_t *WebRtcIsac_kQKltCdfPtrGain[12];
|
||||
extern const uint16_t* WebRtcIsac_kQKltCdfPtrGain[12];
|
||||
|
||||
extern const uint16_t *WebRtcIsac_kQKltCdfPtrShape[108];
|
||||
extern const uint16_t* WebRtcIsac_kQKltCdfPtrShape[108];
|
||||
|
||||
/* left KLT transforms */
|
||||
extern const double WebRtcIsac_kKltT1Gain[4];
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_OS_SPECIFIC_INLINE_H_
|
||||
#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_OS_SPECIFIC_INLINE_H_
|
||||
|
||||
@ -24,11 +23,12 @@ static __inline long int WebRtcIsac_lrint(double x_dbl) {
|
||||
__asm {
|
||||
fld x_dbl
|
||||
fistp x_int
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
return x_int;
|
||||
}
|
||||
#else // Do a slow but correct implementation of lrint
|
||||
#else // Do a slow but correct implementation of lrint
|
||||
|
||||
static __inline long int WebRtcIsac_lrint(double x_dbl) {
|
||||
long int x_int;
|
||||
|
||||
@ -22,10 +22,11 @@
|
||||
|
||||
#include "modules/audio_coding/codecs/isac/main/source/structs.h"
|
||||
|
||||
void WebRtcIsac_PitchAnalysis(const double *in, /* PITCH_FRAME_LEN samples */
|
||||
double *out, /* PITCH_FRAME_LEN+QLOOKAHEAD samples */
|
||||
PitchAnalysisStruct *State,
|
||||
double *lags,
|
||||
double *gains);
|
||||
void WebRtcIsac_PitchAnalysis(
|
||||
const double* in, /* PITCH_FRAME_LEN samples */
|
||||
double* out, /* PITCH_FRAME_LEN+QLOOKAHEAD samples */
|
||||
PitchAnalysisStruct* State,
|
||||
double* lags,
|
||||
double* gains);
|
||||
|
||||
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_ESTIMATOR_H_ */
|
||||
|
||||
@ -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,8 +21,10 @@
|
||||
|
||||
#include "typedefs.h" // NOLINT(build/include)
|
||||
|
||||
/* header file for coding tables for the pitch filter side-info in the entropy coder */
|
||||
/********************* Pitch Filter Gain Coefficient Tables ************************/
|
||||
/* 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 uint16_t WebRtcIsac_kQPitchGainCdf[255];
|
||||
|
||||
|
||||
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -19,8 +20,10 @@
|
||||
#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_LAG_TABLES_H_
|
||||
|
||||
#include "typedefs.h" // NOLINT(build/include)
|
||||
/* header file for coding tables for the pitch filter side-info in the entropy coder */
|
||||
/********************* Pitch Filter Lag Coefficient Tables ************************/
|
||||
/* header file for coding tables for the pitch filter side-info in the entropy
|
||||
* coder */
|
||||
/********************* Pitch Filter Lag Coefficient Tables
|
||||
* ************************/
|
||||
|
||||
/* tables for use with small pitch gain */
|
||||
|
||||
@ -30,7 +33,7 @@ extern const uint16_t WebRtcIsac_kQPitchLagCdf2Lo[20];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf3Lo[2];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf4Lo[10];
|
||||
|
||||
extern const uint16_t *WebRtcIsac_kQPitchLagCdfPtrLo[4];
|
||||
extern const uint16_t* WebRtcIsac_kQPitchLagCdfPtrLo[4];
|
||||
|
||||
/* size of first cdf table */
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdfSizeLo[1];
|
||||
@ -49,7 +52,6 @@ extern const double WebRtcIsac_kQMeanLag4Lo[9];
|
||||
|
||||
extern const double WebRtcIsac_kQPitchLagStepsizeLo;
|
||||
|
||||
|
||||
/* tables for use with medium pitch gain */
|
||||
|
||||
/* cdfs for quantized pitch lags */
|
||||
@ -58,7 +60,7 @@ extern const uint16_t WebRtcIsac_kQPitchLagCdf2Mid[36];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf3Mid[2];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf4Mid[20];
|
||||
|
||||
extern const uint16_t *WebRtcIsac_kQPitchLagCdfPtrMid[4];
|
||||
extern const uint16_t* WebRtcIsac_kQPitchLagCdfPtrMid[4];
|
||||
|
||||
/* size of first cdf table */
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdfSizeMid[1];
|
||||
@ -77,7 +79,6 @@ extern const double WebRtcIsac_kQMeanLag4Mid[19];
|
||||
|
||||
extern const double WebRtcIsac_kQPitchLagStepsizeMid;
|
||||
|
||||
|
||||
/* tables for use with large pitch gain */
|
||||
|
||||
/* cdfs for quantized pitch lags */
|
||||
@ -86,7 +87,7 @@ extern const uint16_t WebRtcIsac_kQPitchLagCdf2Hi[68];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf3Hi[2];
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdf4Hi[35];
|
||||
|
||||
extern const uint16_t *WebRtcIsac_kQPitchLagCdfPtrHi[4];
|
||||
extern const uint16_t* WebRtcIsac_kQPitchLagCdfPtrHi[4];
|
||||
|
||||
/* size of first cdf table */
|
||||
extern const uint16_t WebRtcIsac_kQPitchLagCdfSizeHi[1];
|
||||
|
||||
@ -19,187 +19,181 @@
|
||||
#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SETTINGS_H_
|
||||
|
||||
/* sampling frequency (Hz) */
|
||||
#define FS 16000
|
||||
#define FS 16000
|
||||
|
||||
/* number of samples per frame (either 320 (20ms), 480 (30ms) or 960 (60ms)) */
|
||||
#define INITIAL_FRAMESAMPLES 960
|
||||
|
||||
#define INITIAL_FRAMESAMPLES 960
|
||||
|
||||
#define MAXFFTSIZE 2048
|
||||
#define NFACTOR 11
|
||||
|
||||
|
||||
|
||||
/* do not modify the following; this will have to be modified if we
|
||||
* have a 20ms framesize option */
|
||||
/**********************************************************************/
|
||||
/* miliseconds */
|
||||
#define FRAMESIZE 30
|
||||
#define FRAMESIZE 30
|
||||
/* number of samples per frame processed in the encoder, 480 */
|
||||
#define FRAMESAMPLES 480 /* ((FRAMESIZE*FS)/1000) */
|
||||
#define FRAMESAMPLES_HALF 240
|
||||
#define FRAMESAMPLES_QUARTER 120
|
||||
#define FRAMESAMPLES 480 /* ((FRAMESIZE*FS)/1000) */
|
||||
#define FRAMESAMPLES_HALF 240
|
||||
#define FRAMESAMPLES_QUARTER 120
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
|
||||
/* max number of samples per frame (= 60 ms frame) */
|
||||
#define MAX_FRAMESAMPLES 960
|
||||
#define MAX_SWBFRAMESAMPLES (MAX_FRAMESAMPLES * 2)
|
||||
#define MAX_FRAMESAMPLES 960
|
||||
#define MAX_SWBFRAMESAMPLES (MAX_FRAMESAMPLES * 2)
|
||||
/* number of samples per 10ms frame */
|
||||
#define FRAMESAMPLES_10ms ((10*FS)/1000)
|
||||
#define SWBFRAMESAMPLES_10ms (FRAMESAMPLES_10ms * 2)
|
||||
#define FRAMESAMPLES_10ms ((10 * FS) / 1000)
|
||||
#define SWBFRAMESAMPLES_10ms (FRAMESAMPLES_10ms * 2)
|
||||
/* number of samples in 30 ms frame */
|
||||
#define FRAMESAMPLES_30ms 480
|
||||
#define FRAMESAMPLES_30ms 480
|
||||
/* 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 (UPDATE/2)
|
||||
#define HALF_SUBFRAMELEN (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 QLOOKAHEAD 24 /* 3 ms */
|
||||
/* order of AR model in spectral entropy coder */
|
||||
#define AR_ORDER 6
|
||||
#define AR_ORDER 6
|
||||
/* order of LP model in spectral entropy coder */
|
||||
#define LP_ORDER 0
|
||||
#define LP_ORDER 0
|
||||
|
||||
/* 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 UB_LPC_ORDER 4
|
||||
#define UB_LPC_VEC_PER_FRAME 2
|
||||
#define UB16_LPC_VEC_PER_FRAME 4
|
||||
#define UB_ACTIVE_SUBFRAMES 2
|
||||
#define UB_MAX_LPC_ORDER 6
|
||||
#define UB_INTERPOL_SEGMENTS 1
|
||||
#define UB16_INTERPOL_SEGMENTS 3
|
||||
#define LB_TOTAL_DELAY_SAMPLES 48
|
||||
enum ISACBandwidth {isac8kHz = 8, isac12kHz = 12, isac16kHz = 16};
|
||||
enum ISACBand {kIsacLowerBand = 0, kIsacUpperBand12 = 1, kIsacUpperBand16 = 2};
|
||||
enum IsacSamplingRate {kIsacWideband = 16, kIsacSuperWideband = 32};
|
||||
#define UB_LPC_GAIN_DIM SUBFRAMES
|
||||
#define FB_STATE_SIZE_WORD32 6
|
||||
#define ORDERHI 6
|
||||
|
||||
#define UB_LPC_ORDER 4
|
||||
#define UB_LPC_VEC_PER_FRAME 2
|
||||
#define UB16_LPC_VEC_PER_FRAME 4
|
||||
#define UB_ACTIVE_SUBFRAMES 2
|
||||
#define UB_MAX_LPC_ORDER 6
|
||||
#define UB_INTERPOL_SEGMENTS 1
|
||||
#define UB16_INTERPOL_SEGMENTS 3
|
||||
#define LB_TOTAL_DELAY_SAMPLES 48
|
||||
enum ISACBandwidth { isac8kHz = 8, isac12kHz = 12, isac16kHz = 16 };
|
||||
enum ISACBand {
|
||||
kIsacLowerBand = 0,
|
||||
kIsacUpperBand12 = 1,
|
||||
kIsacUpperBand16 = 2
|
||||
};
|
||||
enum IsacSamplingRate { kIsacWideband = 16, kIsacSuperWideband = 32 };
|
||||
#define UB_LPC_GAIN_DIM SUBFRAMES
|
||||
#define FB_STATE_SIZE_WORD32 6
|
||||
|
||||
/* order for post_filter_bank */
|
||||
#define POSTQORDER 3
|
||||
#define POSTQORDER 3
|
||||
/* order for pre-filterbank */
|
||||
#define QORDER 3
|
||||
#define QORDER 3
|
||||
/* another order */
|
||||
#define QORDER_ALL (POSTQORDER+QORDER-1)
|
||||
#define QORDER_ALL (POSTQORDER + QORDER - 1)
|
||||
/* for decimator */
|
||||
#define ALLPASSSECTIONS 2
|
||||
|
||||
#define ALLPASSSECTIONS 2
|
||||
|
||||
/* array size for byte stream in number of bytes. */
|
||||
/* The old maximum size still needed for the decoding */
|
||||
#define STREAM_SIZE_MAX 600
|
||||
#define STREAM_SIZE_MAX_30 200 /* 200 bytes=53.4 kbps @ 30 ms.framelength */
|
||||
#define STREAM_SIZE_MAX_60 400 /* 400 bytes=53.4 kbps @ 60 ms.framelength */
|
||||
#define STREAM_SIZE_MAX 600
|
||||
#define STREAM_SIZE_MAX_30 200 /* 200 bytes=53.4 kbps @ 30 ms.framelength */
|
||||
#define STREAM_SIZE_MAX_60 400 /* 400 bytes=53.4 kbps @ 60 ms.framelength */
|
||||
|
||||
/* storage size for bit counts */
|
||||
#define BIT_COUNTER_SIZE 30
|
||||
#define BIT_COUNTER_SIZE 30
|
||||
/* maximum order of any AR model or filter */
|
||||
#define MAX_AR_MODEL_ORDER 12//50
|
||||
|
||||
#define MAX_AR_MODEL_ORDER 12 // 50
|
||||
|
||||
/* For pitch analysis */
|
||||
#define PITCH_FRAME_LEN (FRAMESAMPLES_HALF) /* 30 ms */
|
||||
#define PITCH_MAX_LAG 140 /* 57 Hz */
|
||||
#define PITCH_MIN_LAG 20 /* 400 Hz */
|
||||
#define PITCH_MAX_GAIN 0.45
|
||||
#define PITCH_MAX_GAIN_06 0.27 /* PITCH_MAX_GAIN*0.6 */
|
||||
#define PITCH_MAX_GAIN_Q12 1843
|
||||
#define PITCH_LAG_SPAN2 (PITCH_MAX_LAG/2-PITCH_MIN_LAG/2+5)
|
||||
#define PITCH_CORR_LEN2 60 /* 15 ms */
|
||||
#define PITCH_CORR_STEP2 (PITCH_FRAME_LEN/4)
|
||||
#define PITCH_BW 11 /* half the band width of correlation surface */
|
||||
#define PITCH_SUBFRAMES 4
|
||||
#define PITCH_GRAN_PER_SUBFRAME 5
|
||||
#define PITCH_SUBFRAME_LEN (PITCH_FRAME_LEN/PITCH_SUBFRAMES)
|
||||
#define PITCH_UPDATE (PITCH_SUBFRAME_LEN/PITCH_GRAN_PER_SUBFRAME)
|
||||
#define PITCH_FRAME_LEN (FRAMESAMPLES_HALF) /* 30 ms */
|
||||
#define PITCH_MAX_LAG 140 /* 57 Hz */
|
||||
#define PITCH_MIN_LAG 20 /* 400 Hz */
|
||||
#define PITCH_MAX_GAIN 0.45
|
||||
#define PITCH_MAX_GAIN_06 0.27 /* PITCH_MAX_GAIN*0.6 */
|
||||
#define PITCH_MAX_GAIN_Q12 1843
|
||||
#define PITCH_LAG_SPAN2 (PITCH_MAX_LAG / 2 - PITCH_MIN_LAG / 2 + 5)
|
||||
#define PITCH_CORR_LEN2 60 /* 15 ms */
|
||||
#define PITCH_CORR_STEP2 (PITCH_FRAME_LEN / 4)
|
||||
#define PITCH_BW 11 /* half the band width of correlation surface */
|
||||
#define PITCH_SUBFRAMES 4
|
||||
#define PITCH_GRAN_PER_SUBFRAME 5
|
||||
#define PITCH_SUBFRAME_LEN (PITCH_FRAME_LEN / PITCH_SUBFRAMES)
|
||||
#define PITCH_UPDATE (PITCH_SUBFRAME_LEN / PITCH_GRAN_PER_SUBFRAME)
|
||||
/* maximum number of peaks to be examined in correlation surface */
|
||||
#define PITCH_MAX_NUM_PEAKS 10
|
||||
#define PITCH_PEAK_DECAY 0.85
|
||||
#define PITCH_MAX_NUM_PEAKS 10
|
||||
#define PITCH_PEAK_DECAY 0.85
|
||||
/* For weighting filter */
|
||||
#define PITCH_WLPCORDER 6
|
||||
#define PITCH_WLPCWINLEN PITCH_FRAME_LEN
|
||||
#define PITCH_WLPCASYM 0.3 /* asymmetry parameter */
|
||||
#define PITCH_WLPCBUFLEN PITCH_WLPCWINLEN
|
||||
#define PITCH_WLPCORDER 6
|
||||
#define PITCH_WLPCWINLEN PITCH_FRAME_LEN
|
||||
#define PITCH_WLPCASYM 0.3 /* asymmetry parameter */
|
||||
#define PITCH_WLPCBUFLEN PITCH_WLPCWINLEN
|
||||
/* For pitch filter */
|
||||
/* Extra 50 for fraction and LP filters */
|
||||
#define PITCH_BUFFSIZE (PITCH_MAX_LAG + 50)
|
||||
#define PITCH_INTBUFFSIZE (PITCH_FRAME_LEN+PITCH_BUFFSIZE)
|
||||
#define PITCH_BUFFSIZE (PITCH_MAX_LAG + 50)
|
||||
#define PITCH_INTBUFFSIZE (PITCH_FRAME_LEN + PITCH_BUFFSIZE)
|
||||
/* Max rel. step for interpolation */
|
||||
#define PITCH_UPSTEP 1.5
|
||||
#define PITCH_UPSTEP 1.5
|
||||
/* Max rel. step for interpolation */
|
||||
#define PITCH_DOWNSTEP 0.67
|
||||
#define PITCH_FRACS 8
|
||||
#define PITCH_FRACORDER 9
|
||||
#define PITCH_DAMPORDER 5
|
||||
#define PITCH_FILTDELAY 1.5f
|
||||
#define PITCH_DOWNSTEP 0.67
|
||||
#define PITCH_FRACS 8
|
||||
#define PITCH_FRACORDER 9
|
||||
#define PITCH_DAMPORDER 5
|
||||
#define PITCH_FILTDELAY 1.5f
|
||||
/* stepsize for quantization of the pitch Gain */
|
||||
#define PITCH_GAIN_STEPSIZE 0.125
|
||||
|
||||
|
||||
#define PITCH_GAIN_STEPSIZE 0.125
|
||||
|
||||
/* Order of high pass filter */
|
||||
#define HPORDER 2
|
||||
#define HPORDER 2
|
||||
|
||||
/* some mathematical constants */
|
||||
/* log2(exp) */
|
||||
#define LOG2EXP 1.44269504088896
|
||||
#define PI 3.14159265358979
|
||||
#define LOG2EXP 1.44269504088896
|
||||
#define PI 3.14159265358979
|
||||
|
||||
/* Maximum number of iterations allowed to limit payload size */
|
||||
#define MAX_PAYLOAD_LIMIT_ITERATION 5
|
||||
#define MAX_PAYLOAD_LIMIT_ITERATION 5
|
||||
|
||||
/* Redundant Coding */
|
||||
#define RCU_BOTTLENECK_BPS 16000
|
||||
#define RCU_TRANSCODING_SCALE 0.40f
|
||||
#define RCU_TRANSCODING_SCALE_INVERSE 2.5f
|
||||
#define RCU_BOTTLENECK_BPS 16000
|
||||
#define RCU_TRANSCODING_SCALE 0.40f
|
||||
#define RCU_TRANSCODING_SCALE_INVERSE 2.5f
|
||||
|
||||
#define RCU_TRANSCODING_SCALE_UB 0.50f
|
||||
#define RCU_TRANSCODING_SCALE_UB_INVERSE 2.0f
|
||||
#define RCU_TRANSCODING_SCALE_UB 0.50f
|
||||
#define RCU_TRANSCODING_SCALE_UB_INVERSE 2.0f
|
||||
|
||||
/* 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_UNSUPPORTED_SAMPLING_FREQUENCY 6050
|
||||
#define ISAC_MEMORY_ALLOCATION_FAILED 6010
|
||||
#define ISAC_MODE_MISMATCH 6020
|
||||
#define ISAC_DISALLOWED_BOTTLENECK 6030
|
||||
#define ISAC_DISALLOWED_FRAME_LENGTH 6040
|
||||
#define ISAC_UNSUPPORTED_SAMPLING_FREQUENCY 6050
|
||||
|
||||
/* 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_DISALLOWED_ENCODER_BANDWIDTH 6460
|
||||
#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_DISALLOWED_ENCODER_BANDWIDTH 6460
|
||||
/* 6600 Decoder */
|
||||
#define ISAC_DECODER_NOT_INITIATED 6610
|
||||
#define ISAC_EMPTY_PACKET 6620
|
||||
#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_RANGE_ERROR_DECODE_BANDWITH 6740
|
||||
#define ISAC_DISALLOWED_BANDWIDTH_MODE_DECODER 6750
|
||||
#define ISAC_DISALLOWED_LPC_MODEL 6760
|
||||
#define ISAC_DECODER_NOT_INITIATED 6610
|
||||
#define ISAC_EMPTY_PACKET 6620
|
||||
#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_RANGE_ERROR_DECODE_BANDWITH 6740
|
||||
#define ISAC_DISALLOWED_BANDWIDTH_MODE_DECODER 6750
|
||||
#define ISAC_DISALLOWED_LPC_MODEL 6760
|
||||
/* 6800 Call setup formats */
|
||||
#define ISAC_INCOMPATIBLE_FORMATS 6810
|
||||
#define ISAC_INCOMPATIBLE_FORMATS 6810
|
||||
|
||||
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SETTINGS_H_ */
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
/*
|
||||
* spectrum_ar_model_tables.h
|
||||
*
|
||||
* This file contains definitions of tables with AR coefficients,
|
||||
* This file contains definitions of tables with AR coefficients,
|
||||
* Gain coefficients and cosine tables.
|
||||
*
|
||||
*/
|
||||
@ -45,15 +45,15 @@ extern const uint16_t WebRtcIsac_kQArRc6Cdf[NUM_AR_RC_QUANT_BAUNDARY];
|
||||
/* quantization boundary levels for reflection coefficients */
|
||||
extern const int16_t WebRtcIsac_kQArBoundaryLevels[NUM_AR_RC_QUANT_BAUNDARY];
|
||||
|
||||
/* 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 WebRtcIsac_kQArRcInitIndex[AR_ORDER];
|
||||
|
||||
/* pointers to AR cdf tables */
|
||||
extern const uint16_t *WebRtcIsac_kQArRcCdfPtr[AR_ORDER];
|
||||
extern const uint16_t* WebRtcIsac_kQArRcCdfPtr[AR_ORDER];
|
||||
|
||||
/* pointers to AR representation levels tables */
|
||||
extern const int16_t *WebRtcIsac_kQArRcLevelsPtr[AR_ORDER];
|
||||
|
||||
extern const int16_t* WebRtcIsac_kQArRcLevelsPtr[AR_ORDER];
|
||||
|
||||
/******************** GAIN Coefficient Tables ***********************/
|
||||
/* cdf for Gain coefficient */
|
||||
@ -66,7 +66,7 @@ extern const int32_t WebRtcIsac_kQGain2Levels[18];
|
||||
extern const int32_t WebRtcIsac_kQGain2BoundaryLevels[19];
|
||||
|
||||
/* pointer to Gain cdf table */
|
||||
extern const uint16_t *WebRtcIsac_kQGainCdf_ptr[1];
|
||||
extern const uint16_t* WebRtcIsac_kQGainCdf_ptr[1];
|
||||
|
||||
/* Gain initial index for gain quantizer and cdf table search */
|
||||
extern const uint16_t WebRtcIsac_kQGainInitIndex[1];
|
||||
@ -75,4 +75,5 @@ extern const uint16_t WebRtcIsac_kQGainInitIndex[1];
|
||||
/* Cosine table */
|
||||
extern const int16_t WebRtcIsac_kCos[6][60];
|
||||
|
||||
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SPECTRUM_AR_MODEL_TABLES_H_ */
|
||||
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SPECTRUM_AR_MODEL_TABLES_H_ \
|
||||
*/
|
||||
|
||||
@ -23,178 +23,166 @@
|
||||
#include "typedefs.h" // NOLINT(build/include)
|
||||
|
||||
typedef struct Bitstreamstruct {
|
||||
|
||||
uint8_t stream[STREAM_SIZE_MAX];
|
||||
uint32_t W_upper;
|
||||
uint32_t streamval;
|
||||
uint32_t stream_index;
|
||||
uint8_t stream[STREAM_SIZE_MAX];
|
||||
uint32_t W_upper;
|
||||
uint32_t streamval;
|
||||
uint32_t stream_index;
|
||||
|
||||
} Bitstr;
|
||||
|
||||
typedef struct {
|
||||
double DataBufferLo[WINLEN];
|
||||
double DataBufferHi[WINLEN];
|
||||
|
||||
double DataBufferLo[WINLEN];
|
||||
double DataBufferHi[WINLEN];
|
||||
double CorrBufLo[ORDERLO + 1];
|
||||
double CorrBufHi[ORDERHI + 1];
|
||||
|
||||
double CorrBufLo[ORDERLO+1];
|
||||
double CorrBufHi[ORDERHI+1];
|
||||
float PreStateLoF[ORDERLO + 1];
|
||||
float PreStateLoG[ORDERLO + 1];
|
||||
float PreStateHiF[ORDERHI + 1];
|
||||
float PreStateHiG[ORDERHI + 1];
|
||||
float PostStateLoF[ORDERLO + 1];
|
||||
float PostStateLoG[ORDERLO + 1];
|
||||
float PostStateHiF[ORDERHI + 1];
|
||||
float PostStateHiG[ORDERHI + 1];
|
||||
|
||||
float PreStateLoF[ORDERLO+1];
|
||||
float PreStateLoG[ORDERLO+1];
|
||||
float PreStateHiF[ORDERHI+1];
|
||||
float PreStateHiG[ORDERHI+1];
|
||||
float PostStateLoF[ORDERLO+1];
|
||||
float PostStateLoG[ORDERLO+1];
|
||||
float PostStateHiF[ORDERHI+1];
|
||||
float PostStateHiG[ORDERHI+1];
|
||||
|
||||
double OldEnergy;
|
||||
double OldEnergy;
|
||||
|
||||
} MaskFiltstr;
|
||||
|
||||
|
||||
typedef struct {
|
||||
// state vectors for each of the two analysis filters
|
||||
double INSTAT1[2 * (QORDER - 1)];
|
||||
double INSTAT2[2 * (QORDER - 1)];
|
||||
double INSTATLA1[2 * (QORDER - 1)];
|
||||
double INSTATLA2[2 * (QORDER - 1)];
|
||||
double INLABUF1[QLOOKAHEAD];
|
||||
double INLABUF2[QLOOKAHEAD];
|
||||
|
||||
//state vectors for each of the two analysis filters
|
||||
double INSTAT1[2*(QORDER-1)];
|
||||
double INSTAT2[2*(QORDER-1)];
|
||||
double INSTATLA1[2*(QORDER-1)];
|
||||
double INSTATLA2[2*(QORDER-1)];
|
||||
double INLABUF1[QLOOKAHEAD];
|
||||
double INLABUF2[QLOOKAHEAD];
|
||||
|
||||
float INSTAT1_float[2*(QORDER-1)];
|
||||
float INSTAT2_float[2*(QORDER-1)];
|
||||
float INSTATLA1_float[2*(QORDER-1)];
|
||||
float INSTATLA2_float[2*(QORDER-1)];
|
||||
float INLABUF1_float[QLOOKAHEAD];
|
||||
float INLABUF2_float[QLOOKAHEAD];
|
||||
float INSTAT1_float[2 * (QORDER - 1)];
|
||||
float INSTAT2_float[2 * (QORDER - 1)];
|
||||
float INSTATLA1_float[2 * (QORDER - 1)];
|
||||
float INSTATLA2_float[2 * (QORDER - 1)];
|
||||
float INLABUF1_float[QLOOKAHEAD];
|
||||
float INLABUF2_float[QLOOKAHEAD];
|
||||
|
||||
/* High pass filter */
|
||||
double HPstates[HPORDER];
|
||||
float HPstates_float[HPORDER];
|
||||
double HPstates[HPORDER];
|
||||
float HPstates_float[HPORDER];
|
||||
|
||||
} PreFiltBankstr;
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
//state vectors for each of the two analysis filters
|
||||
double STATE_0_LOWER[2*POSTQORDER];
|
||||
double STATE_0_UPPER[2*POSTQORDER];
|
||||
// state vectors for each of the two analysis filters
|
||||
double STATE_0_LOWER[2 * POSTQORDER];
|
||||
double STATE_0_UPPER[2 * POSTQORDER];
|
||||
|
||||
/* High pass filter */
|
||||
double HPstates1[HPORDER];
|
||||
double HPstates2[HPORDER];
|
||||
double HPstates1[HPORDER];
|
||||
double HPstates2[HPORDER];
|
||||
|
||||
float STATE_0_LOWER_float[2*POSTQORDER];
|
||||
float STATE_0_UPPER_float[2*POSTQORDER];
|
||||
float STATE_0_LOWER_float[2 * POSTQORDER];
|
||||
float STATE_0_UPPER_float[2 * POSTQORDER];
|
||||
|
||||
float HPstates1_float[HPORDER];
|
||||
float HPstates2_float[HPORDER];
|
||||
float HPstates1_float[HPORDER];
|
||||
float HPstates2_float[HPORDER];
|
||||
|
||||
} PostFiltBankstr;
|
||||
|
||||
typedef struct {
|
||||
// data buffer for pitch filter
|
||||
double ubuf[PITCH_BUFFSIZE];
|
||||
|
||||
//data buffer for pitch filter
|
||||
double ubuf[PITCH_BUFFSIZE];
|
||||
// low pass state vector
|
||||
double ystate[PITCH_DAMPORDER];
|
||||
|
||||
//low pass state vector
|
||||
double ystate[PITCH_DAMPORDER];
|
||||
|
||||
//old lag and gain
|
||||
double oldlagp[1];
|
||||
double oldgainp[1];
|
||||
// old lag and gain
|
||||
double oldlagp[1];
|
||||
double oldgainp[1];
|
||||
|
||||
} PitchFiltstr;
|
||||
|
||||
typedef struct {
|
||||
// data buffer
|
||||
double buffer[PITCH_WLPCBUFLEN];
|
||||
|
||||
//data buffer
|
||||
double buffer[PITCH_WLPCBUFLEN];
|
||||
// state vectors
|
||||
double istate[PITCH_WLPCORDER];
|
||||
double weostate[PITCH_WLPCORDER];
|
||||
double whostate[PITCH_WLPCORDER];
|
||||
|
||||
//state vectors
|
||||
double istate[PITCH_WLPCORDER];
|
||||
double weostate[PITCH_WLPCORDER];
|
||||
double whostate[PITCH_WLPCORDER];
|
||||
|
||||
//LPC window -> should be a global array because constant
|
||||
double window[PITCH_WLPCWINLEN];
|
||||
// LPC window -> should be a global array because constant
|
||||
double window[PITCH_WLPCWINLEN];
|
||||
|
||||
} WeightFiltstr;
|
||||
|
||||
typedef struct {
|
||||
// for inital estimator
|
||||
double dec_buffer[PITCH_CORR_LEN2 + PITCH_CORR_STEP2 + PITCH_MAX_LAG / 2 -
|
||||
PITCH_FRAME_LEN / 2 + 2];
|
||||
double decimator_state[2 * ALLPASSSECTIONS + 1];
|
||||
double hp_state[2];
|
||||
|
||||
//for inital estimator
|
||||
double dec_buffer[PITCH_CORR_LEN2 + PITCH_CORR_STEP2 +
|
||||
PITCH_MAX_LAG/2 - PITCH_FRAME_LEN/2+2];
|
||||
double decimator_state[2*ALLPASSSECTIONS+1];
|
||||
double hp_state[2];
|
||||
double whitened_buf[QLOOKAHEAD];
|
||||
|
||||
double whitened_buf[QLOOKAHEAD];
|
||||
double inbuf[QLOOKAHEAD];
|
||||
|
||||
double inbuf[QLOOKAHEAD];
|
||||
|
||||
PitchFiltstr PFstr_wght;
|
||||
PitchFiltstr PFstr;
|
||||
PitchFiltstr PFstr_wght;
|
||||
PitchFiltstr PFstr;
|
||||
WeightFiltstr Wghtstr;
|
||||
|
||||
} PitchAnalysisStruct;
|
||||
|
||||
|
||||
|
||||
/* Have instance of struct together with other iSAC structs */
|
||||
typedef struct {
|
||||
|
||||
/* Previous frame length (in ms) */
|
||||
int32_t prev_frame_length;
|
||||
int32_t prev_frame_length;
|
||||
|
||||
/* Previous RTP timestamp from received
|
||||
packet (in samples relative beginning) */
|
||||
int32_t prev_rec_rtp_number;
|
||||
int32_t prev_rec_rtp_number;
|
||||
|
||||
/* Send timestamp for previous packet (in ms using timeGetTime()) */
|
||||
uint32_t prev_rec_send_ts;
|
||||
uint32_t prev_rec_send_ts;
|
||||
|
||||
/* Arrival time for previous packet (in ms using timeGetTime()) */
|
||||
uint32_t 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;
|
||||
float prev_rec_rtp_rate;
|
||||
|
||||
/* Time sinse the last update of the BN estimate (in ms) */
|
||||
uint32_t last_update_ts;
|
||||
uint32_t last_update_ts;
|
||||
|
||||
/* Time sinse the last reduction (in ms) */
|
||||
uint32_t last_reduction_ts;
|
||||
uint32_t last_reduction_ts;
|
||||
|
||||
/* How many times the estimate was update in the beginning */
|
||||
int32_t count_tot_updates_rec;
|
||||
int32_t count_tot_updates_rec;
|
||||
|
||||
/* The estimated bottle neck rate from there to here (in bits/s) */
|
||||
int32_t rec_bw;
|
||||
float rec_bw_inv;
|
||||
float rec_bw_avg;
|
||||
float rec_bw_avg_Q;
|
||||
int32_t rec_bw;
|
||||
float rec_bw_inv;
|
||||
float rec_bw_avg;
|
||||
float rec_bw_avg_Q;
|
||||
|
||||
/* The estimated mean absolute jitter value,
|
||||
as seen on this side (in ms) */
|
||||
float rec_jitter;
|
||||
float rec_jitter_short_term;
|
||||
float rec_jitter_short_term_abs;
|
||||
float rec_max_delay;
|
||||
float rec_max_delay_avg_Q;
|
||||
float rec_jitter;
|
||||
float rec_jitter_short_term;
|
||||
float rec_jitter_short_term_abs;
|
||||
float rec_max_delay;
|
||||
float rec_max_delay_avg_Q;
|
||||
|
||||
/* (assumed) bitrate for headers (bps) */
|
||||
float rec_header_rate;
|
||||
float rec_header_rate;
|
||||
|
||||
/* The estimated bottle neck rate from here to there (in bits/s) */
|
||||
float send_bw_avg;
|
||||
float send_bw_avg;
|
||||
|
||||
/* The estimated mean absolute jitter value, as seen on
|
||||
the other siee (in ms) */
|
||||
float send_max_delay_avg;
|
||||
float send_max_delay_avg;
|
||||
|
||||
// number of packets received since last update
|
||||
int num_pkts_rec;
|
||||
@ -217,35 +205,31 @@ typedef struct {
|
||||
|
||||
int change_to_WB;
|
||||
|
||||
uint32_t senderTimestamp;
|
||||
uint32_t receiverTimestamp;
|
||||
//enum IsacSamplingRate incomingStreamSampFreq;
|
||||
uint16_t numConsecLatePkts;
|
||||
float consecLatency;
|
||||
int16_t inWaitLatePkts;
|
||||
uint32_t senderTimestamp;
|
||||
uint32_t receiverTimestamp;
|
||||
// enum IsacSamplingRate incomingStreamSampFreq;
|
||||
uint16_t numConsecLatePkts;
|
||||
float consecLatency;
|
||||
int16_t inWaitLatePkts;
|
||||
|
||||
IsacBandwidthInfo external_bw_info;
|
||||
} BwEstimatorstr;
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
/* boolean, flags if previous packet exceeded B.N. */
|
||||
int PrevExceed;
|
||||
int PrevExceed;
|
||||
/* ms */
|
||||
int ExceedAgo;
|
||||
int ExceedAgo;
|
||||
/* packets left to send in current burst */
|
||||
int BurstCounter;
|
||||
int BurstCounter;
|
||||
/* packets */
|
||||
int InitCounter;
|
||||
int InitCounter;
|
||||
/* ms remaining in buffer when next packet will be sent */
|
||||
double StillBuffered;
|
||||
|
||||
} RateModel;
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned int SpaceAlloced;
|
||||
unsigned int MaxPermAlloced;
|
||||
double Tmp0[MAXFFTSIZE];
|
||||
@ -253,36 +237,34 @@ typedef struct {
|
||||
double Tmp2[MAXFFTSIZE];
|
||||
double Tmp3[MAXFFTSIZE];
|
||||
int Perm[MAXFFTSIZE];
|
||||
int factor [NFACTOR];
|
||||
int factor[NFACTOR];
|
||||
|
||||
} FFTstr;
|
||||
|
||||
|
||||
/* The following strutc is used to store data from encoding, to make it
|
||||
fast and easy to construct a new bitstream with a different Bandwidth
|
||||
estimate. All values (except framelength and minBytes) is double size to
|
||||
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;
|
||||
|
||||
/* Pitch Gain */
|
||||
int pitchGain_index[2];
|
||||
int pitchGain_index[2];
|
||||
|
||||
/* Pitch Lag */
|
||||
double meanGain[2];
|
||||
int pitchIndex[PITCH_SUBFRAMES*2];
|
||||
double meanGain[2];
|
||||
int pitchIndex[PITCH_SUBFRAMES * 2];
|
||||
|
||||
/* LPC */
|
||||
int LPCindex_s[108*2]; /* KLT_ORDER_SHAPE = 108 */
|
||||
int LPCindex_g[12*2]; /* KLT_ORDER_GAIN = 12 */
|
||||
double LPCcoeffs_lo[(ORDERLO+1)*SUBFRAMES*2];
|
||||
double LPCcoeffs_hi[(ORDERHI+1)*SUBFRAMES*2];
|
||||
int LPCindex_s[108 * 2]; /* KLT_ORDER_SHAPE = 108 */
|
||||
int LPCindex_g[12 * 2]; /* KLT_ORDER_GAIN = 12 */
|
||||
double LPCcoeffs_lo[(ORDERLO + 1) * SUBFRAMES * 2];
|
||||
double LPCcoeffs_hi[(ORDERHI + 1) * SUBFRAMES * 2];
|
||||
|
||||
/* Encode Spec */
|
||||
int16_t fre[FRAMESAMPLES];
|
||||
@ -290,59 +272,54 @@ typedef struct {
|
||||
int16_t AvgPitchGain[2];
|
||||
|
||||
/* Used in adaptive mode only */
|
||||
int minBytes;
|
||||
int minBytes;
|
||||
|
||||
} IsacSaveEncoderData;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int indexLPCShape[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
double lpcGain[SUBFRAMES << 1];
|
||||
int lpcGainIndex[SUBFRAMES << 1];
|
||||
|
||||
int indexLPCShape[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
|
||||
double lpcGain[SUBFRAMES<<1];
|
||||
int lpcGainIndex[SUBFRAMES<<1];
|
||||
|
||||
Bitstr bitStreamObj;
|
||||
Bitstr bitStreamObj;
|
||||
|
||||
int16_t realFFT[FRAMESAMPLES_HALF];
|
||||
int16_t imagFFT[FRAMESAMPLES_HALF];
|
||||
} ISACUBSaveEncDataStruct;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
Bitstr bitstr_obj;
|
||||
MaskFiltstr maskfiltstr_obj;
|
||||
PreFiltBankstr prefiltbankstr_obj;
|
||||
PitchFiltstr pitchfiltstr_obj;
|
||||
Bitstr bitstr_obj;
|
||||
MaskFiltstr maskfiltstr_obj;
|
||||
PreFiltBankstr prefiltbankstr_obj;
|
||||
PitchFiltstr pitchfiltstr_obj;
|
||||
PitchAnalysisStruct pitchanalysisstr_obj;
|
||||
FFTstr fftstr_obj;
|
||||
FFTstr fftstr_obj;
|
||||
IsacSaveEncoderData SaveEnc_obj;
|
||||
|
||||
int buffer_index;
|
||||
int16_t current_framesamples;
|
||||
int buffer_index;
|
||||
int16_t current_framesamples;
|
||||
|
||||
float data_buffer_float[FRAMESAMPLES_30ms];
|
||||
float data_buffer_float[FRAMESAMPLES_30ms];
|
||||
|
||||
int frame_nb;
|
||||
double bottleneck;
|
||||
int16_t new_framelength;
|
||||
double s2nr;
|
||||
int frame_nb;
|
||||
double bottleneck;
|
||||
int16_t new_framelength;
|
||||
double s2nr;
|
||||
|
||||
/* Maximum allowed number of bits for a 30 msec packet */
|
||||
int16_t payloadLimitBytes30;
|
||||
int16_t payloadLimitBytes30;
|
||||
/* Maximum allowed number of bits for a 30 msec packet */
|
||||
int16_t payloadLimitBytes60;
|
||||
int16_t payloadLimitBytes60;
|
||||
/* Maximum allowed number of bits for both 30 and 60 msec packet */
|
||||
int16_t maxPayloadBytes;
|
||||
int16_t maxPayloadBytes;
|
||||
/* Maximum allowed rate in bytes per 30 msec packet */
|
||||
int16_t 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.
|
||||
---*/
|
||||
int16_t enforceFrameSize;
|
||||
int16_t enforceFrameSize;
|
||||
|
||||
/*-----
|
||||
This records the BWE index the encoder injected into the bit-stream.
|
||||
@ -351,64 +328,53 @@ typedef struct {
|
||||
a recursive procedure (WebRtcIsac_GetDownlinkBwJitIndexImpl) and has to be
|
||||
called only once per each encode.
|
||||
-----*/
|
||||
int16_t lastBWIdx;
|
||||
int16_t lastBWIdx;
|
||||
} ISACLBEncStruct;
|
||||
|
||||
typedef struct {
|
||||
|
||||
Bitstr bitstr_obj;
|
||||
MaskFiltstr maskfiltstr_obj;
|
||||
PreFiltBankstr prefiltbankstr_obj;
|
||||
FFTstr fftstr_obj;
|
||||
Bitstr bitstr_obj;
|
||||
MaskFiltstr maskfiltstr_obj;
|
||||
PreFiltBankstr prefiltbankstr_obj;
|
||||
FFTstr fftstr_obj;
|
||||
ISACUBSaveEncDataStruct SaveEnc_obj;
|
||||
|
||||
int buffer_index;
|
||||
float data_buffer_float[MAX_FRAMESAMPLES +
|
||||
LB_TOTAL_DELAY_SAMPLES];
|
||||
double bottleneck;
|
||||
int buffer_index;
|
||||
float data_buffer_float[MAX_FRAMESAMPLES + LB_TOTAL_DELAY_SAMPLES];
|
||||
double bottleneck;
|
||||
/* Maximum allowed number of bits for a 30 msec packet */
|
||||
//int16_t payloadLimitBytes30;
|
||||
// int16_t payloadLimitBytes30;
|
||||
/* Maximum allowed number of bits for both 30 and 60 msec packet */
|
||||
//int16_t maxPayloadBytes;
|
||||
int16_t maxPayloadSizeBytes;
|
||||
// int16_t maxPayloadBytes;
|
||||
int16_t maxPayloadSizeBytes;
|
||||
|
||||
double lastLPCVec[UB_LPC_ORDER];
|
||||
int16_t numBytesUsed;
|
||||
int16_t lastJitterInfo;
|
||||
double lastLPCVec[UB_LPC_ORDER];
|
||||
int16_t numBytesUsed;
|
||||
int16_t lastJitterInfo;
|
||||
} ISACUBEncStruct;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
Bitstr bitstr_obj;
|
||||
MaskFiltstr maskfiltstr_obj;
|
||||
Bitstr bitstr_obj;
|
||||
MaskFiltstr maskfiltstr_obj;
|
||||
PostFiltBankstr postfiltbankstr_obj;
|
||||
PitchFiltstr pitchfiltstr_obj;
|
||||
FFTstr fftstr_obj;
|
||||
PitchFiltstr pitchfiltstr_obj;
|
||||
FFTstr fftstr_obj;
|
||||
|
||||
} ISACLBDecStruct;
|
||||
|
||||
typedef struct {
|
||||
|
||||
Bitstr bitstr_obj;
|
||||
MaskFiltstr maskfiltstr_obj;
|
||||
Bitstr bitstr_obj;
|
||||
MaskFiltstr maskfiltstr_obj;
|
||||
PostFiltBankstr postfiltbankstr_obj;
|
||||
FFTstr fftstr_obj;
|
||||
FFTstr fftstr_obj;
|
||||
|
||||
} ISACUBDecStruct;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
ISACLBEncStruct ISACencLB_obj;
|
||||
ISACLBDecStruct ISACdecLB_obj;
|
||||
} ISACLBStruct;
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
ISACUBEncStruct ISACencUB_obj;
|
||||
ISACUBDecStruct ISACdecUB_obj;
|
||||
} ISACUBStruct;
|
||||
@ -420,14 +386,14 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
/* 6 lower-band & 6 upper-band */
|
||||
double loFiltGain[SUBFRAMES];
|
||||
double hiFiltGain[SUBFRAMES];
|
||||
double loFiltGain[SUBFRAMES];
|
||||
double hiFiltGain[SUBFRAMES];
|
||||
/* Upper boundary of interval W */
|
||||
uint32_t W_upper;
|
||||
uint32_t streamval;
|
||||
/* Index to the current position in bytestream */
|
||||
uint32_t stream_index;
|
||||
uint8_t stream[3];
|
||||
uint8_t stream[3];
|
||||
} transcode_obj;
|
||||
|
||||
typedef struct {
|
||||
@ -443,46 +409,46 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
// lower-band codec instance
|
||||
ISACLBStruct instLB;
|
||||
ISACLBStruct instLB;
|
||||
// upper-band codec instance
|
||||
ISACUBStruct instUB;
|
||||
ISACUBStruct instUB;
|
||||
|
||||
// Bandwidth Estimator and model for the rate.
|
||||
BwEstimatorstr bwestimator_obj;
|
||||
RateModel rate_data_obj;
|
||||
double MaxDelay;
|
||||
BwEstimatorstr bwestimator_obj;
|
||||
RateModel rate_data_obj;
|
||||
double MaxDelay;
|
||||
|
||||
/* 0 = adaptive; 1 = instantaneous */
|
||||
int16_t codingMode;
|
||||
int16_t codingMode;
|
||||
|
||||
// overall bottleneck of the codec
|
||||
int32_t bottleneck;
|
||||
int32_t bottleneck;
|
||||
|
||||
// QMF Filter state
|
||||
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];
|
||||
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
|
||||
int16_t errorCode;
|
||||
int16_t errorCode;
|
||||
|
||||
// bandwidth of the encoded audio 8, 12 or 16 kHz
|
||||
enum ISACBandwidth bandwidthKHz;
|
||||
enum ISACBandwidth bandwidthKHz;
|
||||
// Sampling rate of audio, encoder and decode, 8 or 16 kHz
|
||||
enum IsacSamplingRate encoderSamplingRateKHz;
|
||||
enum IsacSamplingRate decoderSamplingRateKHz;
|
||||
// Flag to keep track of initializations, lower & upper-band
|
||||
// encoder and decoder.
|
||||
int16_t initFlag;
|
||||
int16_t initFlag;
|
||||
|
||||
// Flag to to indicate signal bandwidth switch
|
||||
int16_t resetFlag_8kHz;
|
||||
int16_t resetFlag_8kHz;
|
||||
|
||||
// Maximum allowed rate, measured in Bytes per 30 ms.
|
||||
int16_t maxRateBytesPer30Ms;
|
||||
int16_t maxRateBytesPer30Ms;
|
||||
// Maximum allowed payload-size, measured in Bytes.
|
||||
int16_t maxPayloadSizeBytes;
|
||||
int16_t maxPayloadSizeBytes;
|
||||
/* The expected sampling rate of the input signal. Valid values are 16000
|
||||
* and 32000. This is not the operation sampling rate of the codec. */
|
||||
uint16_t in_sample_rate_hz;
|
||||
|
||||
Reference in New Issue
Block a user