Adding const to a number of constant tables. Setting some tables to static.
Patch set 2: Renaming static const tables. They no longer need the prefix WebRtc_Isac... Review URL: http://webrtc-codereview.appspot.com/301001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1073 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
bedabb25bf
commit
f64162c335
@ -24,13 +24,13 @@
|
||||
|
||||
/* array of quantization levels for bottle neck info; Matlab code: */
|
||||
/* sprintf('%4.1ff, ', logspace(log10(5000), log10(40000), 12)) */
|
||||
const float WebRtcIsac_kQRateTableWb[12] =
|
||||
static const float kQRateTableWb[12] =
|
||||
{
|
||||
10000.0f, 11115.3f, 12355.1f, 13733.1f, 15264.8f, 16967.3f,
|
||||
18859.8f, 20963.3f, 23301.4f, 25900.3f, 28789.0f, 32000.0f};
|
||||
|
||||
|
||||
const float WebRtcIsac_kQRateTableSwb[24] =
|
||||
static const float kQRateTableSwb[24] =
|
||||
{
|
||||
10000.0f, 11115.3f, 12355.1f, 13733.1f, 15264.8f, 16967.3f,
|
||||
18859.8f, 20963.3f, 23153.1f, 25342.9f, 27532.7f, 29722.5f,
|
||||
@ -536,13 +536,13 @@ WebRtc_Word16 WebRtcIsac_UpdateUplinkBwImpl(
|
||||
|
||||
/* compute the BN estimate as decoded on the other side */
|
||||
bwest_str->send_bw_avg = 0.9f * bwest_str->send_bw_avg +
|
||||
0.1f * WebRtcIsac_kQRateTableWb[index];
|
||||
0.1f * kQRateTableWb[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* compute the BN estimate as decoded on the other side */
|
||||
bwest_str->send_bw_avg = 0.9f * bwest_str->send_bw_avg +
|
||||
0.1f * WebRtcIsac_kQRateTableSwb[index];
|
||||
0.1f * kQRateTableSwb[index];
|
||||
}
|
||||
|
||||
if (bwest_str->send_bw_avg > (float) 28000 && !bwest_str->hsn_detect_snd)
|
||||
@ -642,13 +642,13 @@ WebRtcIsac_GetDownlinkBwJitIndexImpl(
|
||||
/* Get Rate Index */
|
||||
if(decoderSamplingFreq == kIsacWideband)
|
||||
{
|
||||
ptrQuantizationTable = WebRtcIsac_kQRateTableWb;
|
||||
ptrQuantizationTable = kQRateTableWb;
|
||||
addJitterInfo = 1;
|
||||
maxInd = 11;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptrQuantizationTable = WebRtcIsac_kQRateTableSwb;
|
||||
ptrQuantizationTable = kQRateTableSwb;
|
||||
addJitterInfo = 0;
|
||||
maxInd = 23;
|
||||
}
|
||||
|
@ -169,9 +169,6 @@ extern "C" {
|
||||
BwEstimatorstr* bwest_str,
|
||||
WebRtc_Word32 index);
|
||||
|
||||
extern const float WebRtcIsac_kQRateTableWb[12];
|
||||
extern const float WebRtcIsac_kQRateTableSwb[24];
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
#define POLYNOMIAL 0x04c11db7L
|
||||
|
||||
|
||||
static WebRtc_UWord32 kCrcTable[256] = {
|
||||
static const WebRtc_UWord32 kCrcTable[256] = {
|
||||
0, 0x4c11db7, 0x9823b6e, 0xd4326d9, 0x130476dc, 0x17c56b6b,
|
||||
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
|
||||
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
|
||||
|
@ -48,7 +48,7 @@
|
||||
considered 7 enteries, uniformly distributed in this interval, i.e. 38,
|
||||
39.17, 40.33, 41.5, 42.67, 43.83 and 45. For every entery, the lower-band
|
||||
and the upper-band bottlenecks are specified in
|
||||
'WebRtcIsac_kLowerBandBitRate12' and 'WebRtcIsac_kUpperBandBitRate12'
|
||||
'kLowerBandBitRate12' and 'kUpperBandBitRate12'
|
||||
tables, respectively. E.g. the overall rate of 41.5 kbps corresponts to a
|
||||
bottleneck of 31 kbps for lower-band and 27 kbps for upper-band. Given an
|
||||
overall bottleneck of the codec, we use linear interpolation to get
|
||||
@ -56,11 +56,11 @@
|
||||
|
||||
16 kHz bandwidth
|
||||
-----------------
|
||||
The overall bottleneck of the coder is between 38 kbps and 45 kbps. We have
|
||||
The overall bottleneck of the coder is between 50 kbps and 56 kbps. We have
|
||||
considered 7 enteries, uniformly distributed in this interval, i.e. 50, 51.2,
|
||||
52.4, 53.6, 54.8 and 56. For every entery, the lower-band and the upper-band
|
||||
bottlenecks are specified in 'WebRtcIsac_kLowerBandBitRate12' and
|
||||
'WebRtcIsac_kUpperBandBitRate12' tables, respectively. E.g. the overall rate
|
||||
bottlenecks are specified in 'kLowerBandBitRate16' and
|
||||
'kUpperBandBitRate16' tables, respectively. E.g. the overall rate
|
||||
of 53.6 kbps corresponts to a bottleneck of 32 kbps for lower-band and 30
|
||||
kbps for upper-band. Given an overall bottleneck of the codec, we use linear
|
||||
interpolation to get lower-band and upper-band bottlenecks.
|
||||
@ -68,15 +68,15 @@
|
||||
*/
|
||||
|
||||
// 38 39.17 40.33 41.5 42.67 43.83 45
|
||||
static const WebRtc_Word16 WebRtcIsac_kLowerBandBitRate12[7] = {
|
||||
static const WebRtc_Word16 kLowerBandBitRate12[7] = {
|
||||
29000, 30000, 30000, 31000, 31000, 32000, 32000};
|
||||
static const WebRtc_Word16 WebRtcIsac_kUpperBandBitRate12[7] = {
|
||||
static const WebRtc_Word16 kUpperBandBitRate12[7] = {
|
||||
25000, 25000, 27000, 27000, 29000, 29000, 32000};
|
||||
|
||||
// 50 51.2 52.4 53.6 54.8 56
|
||||
static const WebRtc_Word16 WebRtcIsac_kLowerBandBitRate16[6] = {
|
||||
static const WebRtc_Word16 kLowerBandBitRate16[6] = {
|
||||
31000, 31000, 32000, 32000, 32000, 32000};
|
||||
static const WebRtc_Word16 WebRtcIsac_kUpperBandBitRate16[6] = {
|
||||
static const WebRtc_Word16 kUpperBandBitRate16[6] = {
|
||||
28000, 29000, 29000, 30000, 31000, 32000};
|
||||
|
||||
/******************************************************************************
|
||||
@ -129,17 +129,17 @@ WebRtcIsac_RateAllocation(
|
||||
idxD = (inRateBitPerSec - 38000) * stepSizeInv;
|
||||
idx = (idxD >= 6)? 6:((WebRtc_Word16)idxD);
|
||||
idxErr = idxD - idx;
|
||||
*rateLBBitPerSec = WebRtcIsac_kLowerBandBitRate12[idx];
|
||||
*rateUBBitPerSec = WebRtcIsac_kUpperBandBitRate12[idx];
|
||||
*rateLBBitPerSec = kLowerBandBitRate12[idx];
|
||||
*rateUBBitPerSec = kUpperBandBitRate12[idx];
|
||||
|
||||
if(idx < 6)
|
||||
{
|
||||
*rateLBBitPerSec += (WebRtc_Word16)(idxErr *
|
||||
(WebRtcIsac_kLowerBandBitRate12[idx + 1] -
|
||||
WebRtcIsac_kLowerBandBitRate12[idx]));
|
||||
(kLowerBandBitRate12[idx + 1] -
|
||||
kLowerBandBitRate12[idx]));
|
||||
*rateUBBitPerSec += (WebRtc_Word16)(idxErr *
|
||||
(WebRtcIsac_kUpperBandBitRate12[idx + 1] -
|
||||
WebRtcIsac_kUpperBandBitRate12[idx]));
|
||||
(kUpperBandBitRate12[idx + 1] -
|
||||
kUpperBandBitRate12[idx]));
|
||||
}
|
||||
|
||||
*bandwidthKHz = isac12kHz;
|
||||
@ -156,18 +156,18 @@ WebRtcIsac_RateAllocation(
|
||||
idxD = (inRateBitPerSec - 50000) * stepSizeInv;
|
||||
idx = (idxD >= 5)? 5:((WebRtc_Word16)idxD);
|
||||
idxErr = idxD - idx;
|
||||
*rateLBBitPerSec = WebRtcIsac_kLowerBandBitRate16[idx];
|
||||
*rateUBBitPerSec = WebRtcIsac_kUpperBandBitRate16[idx];
|
||||
*rateLBBitPerSec = kLowerBandBitRate16[idx];
|
||||
*rateUBBitPerSec = kUpperBandBitRate16[idx];
|
||||
|
||||
if(idx < 5)
|
||||
{
|
||||
*rateLBBitPerSec += (WebRtc_Word16)(idxErr *
|
||||
(WebRtcIsac_kLowerBandBitRate16[idx + 1] -
|
||||
WebRtcIsac_kLowerBandBitRate16[idx]));
|
||||
(kLowerBandBitRate16[idx + 1] -
|
||||
kLowerBandBitRate16[idx]));
|
||||
|
||||
*rateUBBitPerSec += (WebRtc_Word16)(idxErr *
|
||||
(WebRtcIsac_kUpperBandBitRate16[idx + 1] -
|
||||
WebRtcIsac_kUpperBandBitRate16[idx]));
|
||||
(kUpperBandBitRate16[idx + 1] -
|
||||
kUpperBandBitRate16[idx]));
|
||||
}
|
||||
|
||||
*bandwidthKHz = isac16kHz;
|
||||
@ -566,7 +566,6 @@ WebRtcIsac_EncodeLb(
|
||||
return stream_length;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WebRtcIsac_EncodeUb16(
|
||||
float* in,
|
||||
@ -595,7 +594,6 @@ WebRtcIsac_EncodeUb16(
|
||||
WebRtc_UWord16 iterCntr;
|
||||
double s2nr;
|
||||
|
||||
|
||||
/* buffer speech samples (by 10ms packet) until the framelength is */
|
||||
/* reached (30 or 60 ms) */
|
||||
/*********************************************************************/
|
||||
|
@ -34,11 +34,11 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
static const WebRtc_UWord16 WebRtcIsac_kLpcVecPerSegmentUb12 = 5;
|
||||
static const WebRtc_UWord16 WebRtcIsac_kLpcVecPerSegmentUb16 = 4;
|
||||
static const WebRtc_UWord16 kLpcVecPerSegmentUb12 = 5;
|
||||
static const WebRtc_UWord16 kLpcVecPerSegmentUb16 = 4;
|
||||
|
||||
/* coefficients for the stepwise rate estimation */
|
||||
const WebRtc_Word32 WebRtcIsac_kRPointsQ10[100] = {
|
||||
static const WebRtc_Word32 kRPointsQ10[100] = {
|
||||
14495, 14295, 14112, 13944, 13788, 13643, 13459, 13276, 13195, 13239,
|
||||
13243, 13191, 13133, 13216, 13263, 13330, 13316, 13242, 13191, 13106,
|
||||
12942, 12669, 12291, 11840, 11361, 10795, 10192, 9561, 8934, 8335,
|
||||
@ -52,23 +52,24 @@ const WebRtc_Word32 WebRtcIsac_kRPointsQ10[100] = {
|
||||
|
||||
|
||||
/* cdf array for encoder bandwidth (12 vs 16 kHz) indicator */
|
||||
static const WebRtc_UWord16 WebRtcIsac_kOneBitEqualProbCdf[3] = {
|
||||
0, 32768, 65535};
|
||||
static const WebRtc_UWord16 kOneBitEqualProbCdf[3] = {
|
||||
0, 32768, 65535 };
|
||||
|
||||
/* pointer to cdf array for encoder bandwidth (12 vs 16 kHz) indicator */
|
||||
static const WebRtc_UWord16 *WebRtcIsac_kOneBitEqualProbCdf_ptr[1] = {WebRtcIsac_kOneBitEqualProbCdf};
|
||||
static const WebRtc_UWord16 *kOneBitEqualProbCdf_ptr[1] = {
|
||||
kOneBitEqualProbCdf };
|
||||
|
||||
/* initial cdf index for decoder of encoded bandwidth (12 vs 16 kHz) indicator */
|
||||
static const WebRtc_UWord16 WebRtcIsac_kOneBitEqualProbInitIndex[1] = {1};
|
||||
static const WebRtc_UWord16 kOneBitEqualProbInitIndex[1] = {1};
|
||||
|
||||
|
||||
/* coefficients for the stepwise rate estimation */
|
||||
|
||||
|
||||
const WebRtc_Word32 acnQ10 = 426;
|
||||
const WebRtc_Word32 bcnQ10 = -581224;
|
||||
const WebRtc_Word32 ccnQ10 = 722631;
|
||||
const WebRtc_Word32 lbcnQ10 = -402874;
|
||||
static const WebRtc_Word32 acnQ10 = 426;
|
||||
static const WebRtc_Word32 bcnQ10 = -581224;
|
||||
static const WebRtc_Word32 ccnQ10 = 722631;
|
||||
static const WebRtc_Word32 lbcnQ10 = -402874;
|
||||
#define DPMIN_Q10 -10240 // -10.00 in Q10
|
||||
#define DPMAX_Q10 10240 // 10.00 in Q10
|
||||
#define MINBITS_Q10 10240 /* 10.0 in Q10 */
|
||||
@ -124,8 +125,7 @@ __inline WebRtc_UWord32 stepwise(WebRtc_Word32 dinQ10) {
|
||||
ind = (dtQ10 * 5) >> 10; /* 2^10 / 5 = 0.2 in Q10 */
|
||||
/* Q10 -> Q0 */
|
||||
|
||||
return WebRtcIsac_kRPointsQ10[ind];
|
||||
|
||||
return kRPointsQ10[ind];
|
||||
}
|
||||
|
||||
|
||||
@ -1387,14 +1387,14 @@ WebRtcIsac_DecodeInterpolLpcUb(
|
||||
{
|
||||
numGains = SUBFRAMES;
|
||||
numSegments = UB_LPC_VEC_PER_FRAME - 1;
|
||||
numVecPerSegment = WebRtcIsac_kLpcVecPerSegmentUb12;
|
||||
numVecPerSegment = kLpcVecPerSegmentUb12;
|
||||
break;
|
||||
}
|
||||
case isac16kHz:
|
||||
{
|
||||
numGains = SUBFRAMES << 1;
|
||||
numSegments = UB16_LPC_VEC_PER_FRAME - 1;
|
||||
numVecPerSegment = WebRtcIsac_kLpcVecPerSegmentUb16;
|
||||
numVecPerSegment = kLpcVecPerSegmentUb16;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1843,9 +1843,9 @@ WebRtcIsac_EncodeLpcUB(
|
||||
for(interpolCntr = 0; interpolCntr < UB_INTERPOL_SEGMENTS; interpolCntr++)
|
||||
{
|
||||
WebRtcIsac_Lar2PolyInterpolUB(lpcVecs,
|
||||
interpolLPCCoeff, WebRtcIsac_kLpcVecPerSegmentUb12 + 1);
|
||||
interpolLPCCoeff, kLpcVecPerSegmentUb12 + 1);
|
||||
lpcVecs += UB_LPC_ORDER;
|
||||
interpolLPCCoeff += (WebRtcIsac_kLpcVecPerSegmentUb12 * (UB_LPC_ORDER + 1));
|
||||
interpolLPCCoeff += (kLpcVecPerSegmentUb12 * (UB_LPC_ORDER + 1));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1859,9 +1859,9 @@ WebRtcIsac_EncodeLpcUB(
|
||||
for(interpolCntr = 0; interpolCntr < UB16_INTERPOL_SEGMENTS; interpolCntr++)
|
||||
{
|
||||
WebRtcIsac_Lar2PolyInterpolUB(lpcVecs,
|
||||
interpolLPCCoeff, WebRtcIsac_kLpcVecPerSegmentUb16 + 1);
|
||||
interpolLPCCoeff, kLpcVecPerSegmentUb16 + 1);
|
||||
lpcVecs += UB_LPC_ORDER;
|
||||
interpolLPCCoeff += (WebRtcIsac_kLpcVecPerSegmentUb16 * (UB_LPC_ORDER + 1));
|
||||
interpolLPCCoeff += (kLpcVecPerSegmentUb16 * (UB_LPC_ORDER + 1));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2509,16 +2509,16 @@ int WebRtcIsac_EncodeFrameLen(WebRtc_Word16 framesamples, Bitstr *streamdata) {
|
||||
}
|
||||
|
||||
/* cdf array for estimated bandwidth */
|
||||
const WebRtc_UWord16 WebRtcIsac_kBwCdf[25] = {
|
||||
static const WebRtc_UWord16 kBwCdf[25] = {
|
||||
0, 2731, 5461, 8192, 10923, 13653, 16384, 19114, 21845, 24576, 27306, 30037,
|
||||
32768, 35498, 38229, 40959, 43690, 46421, 49151, 51882, 54613, 57343, 60074,
|
||||
62804, 65535};
|
||||
|
||||
/* pointer to cdf array for estimated bandwidth */
|
||||
const WebRtc_UWord16 *WebRtcIsac_kBwCdfPtr[1] = {WebRtcIsac_kBwCdf};
|
||||
static const WebRtc_UWord16 *kBwCdfPtr[1] = { kBwCdf };
|
||||
|
||||
/* initial cdf index for decoder of estimated bandwidth*/
|
||||
const WebRtc_UWord16 WebRtcIsac_kBwInitIndex[1] = {7};
|
||||
static const WebRtc_UWord16 kBwInitIndex[1] = { 7 };
|
||||
|
||||
|
||||
int WebRtcIsac_DecodeSendBW(Bitstr *streamdata, WebRtc_Word16 *BWno) {
|
||||
@ -2526,7 +2526,7 @@ int WebRtcIsac_DecodeSendBW(Bitstr *streamdata, WebRtc_Word16 *BWno) {
|
||||
int BWno32, err;
|
||||
|
||||
/* entropy decoding of sender's BW estimation [0..23] */
|
||||
err = WebRtcIsac_DecHistOneStepMulti(&BWno32, streamdata, WebRtcIsac_kBwCdfPtr, WebRtcIsac_kBwInitIndex, 1);
|
||||
err = WebRtcIsac_DecHistOneStepMulti(&BWno32, streamdata, kBwCdfPtr, kBwInitIndex, 1);
|
||||
if (err<0) // error check
|
||||
return -ISAC_RANGE_ERROR_DECODE_BANDWIDTH;
|
||||
*BWno = (WebRtc_Word16)BWno32;
|
||||
@ -2537,7 +2537,7 @@ int WebRtcIsac_DecodeSendBW(Bitstr *streamdata, WebRtc_Word16 *BWno) {
|
||||
void WebRtcIsac_EncodeReceiveBw(int *BWno, Bitstr *streamdata) {
|
||||
|
||||
/* entropy encoding of receiver's BW estimation [0..23] */
|
||||
WebRtcIsac_EncHistMulti(streamdata, BWno, WebRtcIsac_kBwCdfPtr, 1);
|
||||
WebRtcIsac_EncHistMulti(streamdata, BWno, kBwCdfPtr, 1);
|
||||
|
||||
}
|
||||
|
||||
@ -2704,7 +2704,7 @@ WebRtcIsac_EncodeBandwidth(
|
||||
}
|
||||
|
||||
WebRtcIsac_EncHistMulti(streamData, &bandwidthMode,
|
||||
WebRtcIsac_kOneBitEqualProbCdf_ptr, 1);
|
||||
kOneBitEqualProbCdf_ptr, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2716,8 +2716,8 @@ WebRtcIsac_DecodeBandwidth(
|
||||
int bandwidthMode;
|
||||
|
||||
if(WebRtcIsac_DecHistOneStepMulti(&bandwidthMode, streamData,
|
||||
WebRtcIsac_kOneBitEqualProbCdf_ptr,
|
||||
WebRtcIsac_kOneBitEqualProbInitIndex, 1) < 0)
|
||||
kOneBitEqualProbCdf_ptr,
|
||||
kOneBitEqualProbInitIndex, 1) < 0)
|
||||
{
|
||||
// error check
|
||||
return -ISAC_RANGE_ERROR_DECODE_BANDWITH;
|
||||
@ -2758,7 +2758,7 @@ WebRtcIsac_EncodeJitterInfo(
|
||||
// Use the same CDF table as for bandwidth
|
||||
// both take two values with equal probability
|
||||
WebRtcIsac_EncHistMulti(streamData, &intVar,
|
||||
WebRtcIsac_kOneBitEqualProbCdf_ptr, 1);
|
||||
kOneBitEqualProbCdf_ptr, 1);
|
||||
return 0;
|
||||
|
||||
}
|
||||
@ -2773,8 +2773,8 @@ WebRtcIsac_DecodeJitterInfo(
|
||||
// Use the same CDF table as for bandwidth
|
||||
// both take two values with equal probability
|
||||
if(WebRtcIsac_DecHistOneStepMulti(&intVar, streamData,
|
||||
WebRtcIsac_kOneBitEqualProbCdf_ptr,
|
||||
WebRtcIsac_kOneBitEqualProbInitIndex, 1) < 0)
|
||||
kOneBitEqualProbCdf_ptr,
|
||||
kOneBitEqualProbInitIndex, 1) < 0)
|
||||
{
|
||||
// error check
|
||||
return -ISAC_RANGE_ERROR_DECODE_BANDWITH;
|
||||
|
@ -15,23 +15,23 @@
|
||||
#include "settings.h"
|
||||
|
||||
/* The composite all-pass filter factors */
|
||||
float WebRtcIsac_kCompositeApFactorsFloat[4] = {
|
||||
const float WebRtcIsac_kCompositeApFactorsFloat[4] = {
|
||||
0.03470000000000f, 0.15440000000000f, 0.38260000000000f, 0.74400000000000f};
|
||||
|
||||
/* The upper channel all-pass filter factors */
|
||||
float WebRtcIsac_kUpperApFactorsFloat[2] = {
|
||||
const float WebRtcIsac_kUpperApFactorsFloat[2] = {
|
||||
0.03470000000000f, 0.38260000000000f};
|
||||
|
||||
/* The lower channel all-pass filter factors */
|
||||
float WebRtcIsac_kLowerApFactorsFloat[2] = {
|
||||
const float WebRtcIsac_kLowerApFactorsFloat[2] = {
|
||||
0.15440000000000f, 0.74400000000000f};
|
||||
|
||||
/* The matrix for transforming the backward composite state to upper channel state */
|
||||
float WebRtcIsac_kTransform1Float[8] = {
|
||||
const float WebRtcIsac_kTransform1Float[8] = {
|
||||
-0.00158678506084f, 0.00127157815343f, -0.00104805672709f, 0.00084837248079f,
|
||||
0.00134467983258f, -0.00107756549387f, 0.00088814793277f, -0.00071893072525f};
|
||||
|
||||
/* The matrix for transforming the backward composite state to lower channel state */
|
||||
float WebRtcIsac_kTransform2Float[8] = {
|
||||
const float WebRtcIsac_kTransform2Float[8] = {
|
||||
-0.00170686041697f, 0.00136780109829f, -0.00112736532350f, 0.00091257055385f,
|
||||
0.00103094281812f, -0.00082615076557f, 0.00068092756088f, -0.00055119165484f};
|
||||
|
@ -29,18 +29,18 @@
|
||||
#define NUMBEROFCHANNELAPSECTIONS 2
|
||||
|
||||
/* The composite all-pass filter factors */
|
||||
extern float WebRtcIsac_kCompositeApFactorsFloat[4];
|
||||
extern const float WebRtcIsac_kCompositeApFactorsFloat[4];
|
||||
|
||||
/* The upper channel all-pass filter factors */
|
||||
extern float WebRtcIsac_kUpperApFactorsFloat[2];
|
||||
extern const float WebRtcIsac_kUpperApFactorsFloat[2];
|
||||
|
||||
/* The lower channel all-pass filter factors */
|
||||
extern float WebRtcIsac_kLowerApFactorsFloat[2];
|
||||
extern const float WebRtcIsac_kLowerApFactorsFloat[2];
|
||||
|
||||
/* The matrix for transforming the backward composite state to upper channel state */
|
||||
extern float WebRtcIsac_kTransform1Float[8];
|
||||
extern const float WebRtcIsac_kTransform1Float[8];
|
||||
|
||||
/* The matrix for transforming the backward composite state to lower channel state */
|
||||
extern float WebRtcIsac_kTransform2Float[8];
|
||||
extern const float WebRtcIsac_kTransform2Float[8];
|
||||
|
||||
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FILTERBANK_TABLES_H_ */
|
||||
|
@ -26,7 +26,7 @@
|
||||
* sections are used to filter the input in a cascade manner.
|
||||
* The input is overwritten!!
|
||||
*/
|
||||
static void WebRtcIsac_AllPassFilter2Float(float *InOut, float *APSectionFactors,
|
||||
static void WebRtcIsac_AllPassFilter2Float(float *InOut, const float *APSectionFactors,
|
||||
int lengthInOut, int NumberOfSections,
|
||||
float *FilterState)
|
||||
{
|
||||
|
@ -24,23 +24,55 @@
|
||||
* t = (1:256)/257; r = 1-(1-t).^.45; w = sin(r*pi).^3; w = w/sum(w); plot((1:256)/8, w); grid;
|
||||
* for k=1:16, fprintf(1, '%.8f, ', w(k*16 + (-15:0))); fprintf(1, '\n'); end
|
||||
*/
|
||||
const double WebRtcIsac_kLpcCorrWindow[WINLEN] = {
|
||||
0.00000000, 0.00000001, 0.00000004, 0.00000010, 0.00000020, 0.00000035, 0.00000055, 0.00000083, 0.00000118, 0.00000163, 0.00000218, 0.00000283, 0.00000361, 0.00000453, 0.00000558, 0.00000679,
|
||||
0.00000817, 0.00000973, 0.00001147, 0.00001342, 0.00001558, 0.00001796, 0.00002058, 0.00002344, 0.00002657, 0.00002997, 0.00003365, 0.00003762, 0.00004190, 0.00004651, 0.00005144, 0.00005673,
|
||||
0.00006236, 0.00006837, 0.00007476, 0.00008155, 0.00008875, 0.00009636, 0.00010441, 0.00011290, 0.00012186, 0.00013128, 0.00014119, 0.00015160, 0.00016252, 0.00017396, 0.00018594, 0.00019846,
|
||||
0.00021155, 0.00022521, 0.00023946, 0.00025432, 0.00026978, 0.00028587, 0.00030260, 0.00031998, 0.00033802, 0.00035674, 0.00037615, 0.00039626, 0.00041708, 0.00043863, 0.00046092, 0.00048396,
|
||||
0.00050775, 0.00053233, 0.00055768, 0.00058384, 0.00061080, 0.00063858, 0.00066720, 0.00069665, 0.00072696, 0.00075813, 0.00079017, 0.00082310, 0.00085692, 0.00089164, 0.00092728, 0.00096384,
|
||||
0.00100133, 0.00103976, 0.00107914, 0.00111947, 0.00116077, 0.00120304, 0.00124630, 0.00129053, 0.00133577, 0.00138200, 0.00142924, 0.00147749, 0.00152676, 0.00157705, 0.00162836, 0.00168070,
|
||||
0.00173408, 0.00178850, 0.00184395, 0.00190045, 0.00195799, 0.00201658, 0.00207621, 0.00213688, 0.00219860, 0.00226137, 0.00232518, 0.00239003, 0.00245591, 0.00252284, 0.00259079, 0.00265977,
|
||||
0.00272977, 0.00280078, 0.00287280, 0.00294582, 0.00301984, 0.00309484, 0.00317081, 0.00324774, 0.00332563, 0.00340446, 0.00348421, 0.00356488, 0.00364644, 0.00372889, 0.00381220, 0.00389636,
|
||||
0.00398135, 0.00406715, 0.00415374, 0.00424109, 0.00432920, 0.00441802, 0.00450754, 0.00459773, 0.00468857, 0.00478001, 0.00487205, 0.00496464, 0.00505775, 0.00515136, 0.00524542, 0.00533990,
|
||||
0.00543476, 0.00552997, 0.00562548, 0.00572125, 0.00581725, 0.00591342, 0.00600973, 0.00610612, 0.00620254, 0.00629895, 0.00639530, 0.00649153, 0.00658758, 0.00668341, 0.00677894, 0.00687413,
|
||||
0.00696891, 0.00706322, 0.00715699, 0.00725016, 0.00734266, 0.00743441, 0.00752535, 0.00761540, 0.00770449, 0.00779254, 0.00787947, 0.00796519, 0.00804963, 0.00813270, 0.00821431, 0.00829437,
|
||||
0.00837280, 0.00844949, 0.00852436, 0.00859730, 0.00866822, 0.00873701, 0.00880358, 0.00886781, 0.00892960, 0.00898884, 0.00904542, 0.00909923, 0.00915014, 0.00919805, 0.00924283, 0.00928436,
|
||||
0.00932252, 0.00935718, 0.00938821, 0.00941550, 0.00943890, 0.00945828, 0.00947351, 0.00948446, 0.00949098, 0.00949294, 0.00949020, 0.00948262, 0.00947005, 0.00945235, 0.00942938, 0.00940099,
|
||||
0.00936704, 0.00932738, 0.00928186, 0.00923034, 0.00917268, 0.00910872, 0.00903832, 0.00896134, 0.00887763, 0.00878706, 0.00868949, 0.00858478, 0.00847280, 0.00835343, 0.00822653, 0.00809199,
|
||||
0.00794970, 0.00779956, 0.00764145, 0.00747530, 0.00730103, 0.00711857, 0.00692787, 0.00672888, 0.00652158, 0.00630597, 0.00608208, 0.00584994, 0.00560962, 0.00536124, 0.00510493, 0.00484089,
|
||||
0.00456935, 0.00429062, 0.00400505, 0.00371310, 0.00341532, 0.00311238, 0.00280511, 0.00249452, 0.00218184, 0.00186864, 0.00155690, 0.00124918, 0.00094895, 0.00066112, 0.00039320, 0.00015881
|
||||
static const double kLpcCorrWindow[WINLEN] = {
|
||||
0.00000000, 0.00000001, 0.00000004, 0.00000010, 0.00000020,
|
||||
0.00000035, 0.00000055, 0.00000083, 0.00000118, 0.00000163,
|
||||
0.00000218, 0.00000283, 0.00000361, 0.00000453, 0.00000558, 0.00000679,
|
||||
0.00000817, 0.00000973, 0.00001147, 0.00001342, 0.00001558,
|
||||
0.00001796, 0.00002058, 0.00002344, 0.00002657, 0.00002997,
|
||||
0.00003365, 0.00003762, 0.00004190, 0.00004651, 0.00005144, 0.00005673,
|
||||
0.00006236, 0.00006837, 0.00007476, 0.00008155, 0.00008875,
|
||||
0.00009636, 0.00010441, 0.00011290, 0.00012186, 0.00013128,
|
||||
0.00014119, 0.00015160, 0.00016252, 0.00017396, 0.00018594, 0.00019846,
|
||||
0.00021155, 0.00022521, 0.00023946, 0.00025432, 0.00026978,
|
||||
0.00028587, 0.00030260, 0.00031998, 0.00033802, 0.00035674,
|
||||
0.00037615, 0.00039626, 0.00041708, 0.00043863, 0.00046092, 0.00048396,
|
||||
0.00050775, 0.00053233, 0.00055768, 0.00058384, 0.00061080,
|
||||
0.00063858, 0.00066720, 0.00069665, 0.00072696, 0.00075813,
|
||||
0.00079017, 0.00082310, 0.00085692, 0.00089164, 0.00092728, 0.00096384,
|
||||
0.00100133, 0.00103976, 0.00107914, 0.00111947, 0.00116077,
|
||||
0.00120304, 0.00124630, 0.00129053, 0.00133577, 0.00138200,
|
||||
0.00142924, 0.00147749, 0.00152676, 0.00157705, 0.00162836, 0.00168070,
|
||||
0.00173408, 0.00178850, 0.00184395, 0.00190045, 0.00195799,
|
||||
0.00201658, 0.00207621, 0.00213688, 0.00219860, 0.00226137,
|
||||
0.00232518, 0.00239003, 0.00245591, 0.00252284, 0.00259079, 0.00265977,
|
||||
0.00272977, 0.00280078, 0.00287280, 0.00294582, 0.00301984,
|
||||
0.00309484, 0.00317081, 0.00324774, 0.00332563, 0.00340446,
|
||||
0.00348421, 0.00356488, 0.00364644, 0.00372889, 0.00381220, 0.00389636,
|
||||
0.00398135, 0.00406715, 0.00415374, 0.00424109, 0.00432920,
|
||||
0.00441802, 0.00450754, 0.00459773, 0.00468857, 0.00478001,
|
||||
0.00487205, 0.00496464, 0.00505775, 0.00515136, 0.00524542, 0.00533990,
|
||||
0.00543476, 0.00552997, 0.00562548, 0.00572125, 0.00581725,
|
||||
0.00591342, 0.00600973, 0.00610612, 0.00620254, 0.00629895,
|
||||
0.00639530, 0.00649153, 0.00658758, 0.00668341, 0.00677894, 0.00687413,
|
||||
0.00696891, 0.00706322, 0.00715699, 0.00725016, 0.00734266,
|
||||
0.00743441, 0.00752535, 0.00761540, 0.00770449, 0.00779254,
|
||||
0.00787947, 0.00796519, 0.00804963, 0.00813270, 0.00821431, 0.00829437,
|
||||
0.00837280, 0.00844949, 0.00852436, 0.00859730, 0.00866822,
|
||||
0.00873701, 0.00880358, 0.00886781, 0.00892960, 0.00898884,
|
||||
0.00904542, 0.00909923, 0.00915014, 0.00919805, 0.00924283, 0.00928436,
|
||||
0.00932252, 0.00935718, 0.00938821, 0.00941550, 0.00943890,
|
||||
0.00945828, 0.00947351, 0.00948446, 0.00949098, 0.00949294,
|
||||
0.00949020, 0.00948262, 0.00947005, 0.00945235, 0.00942938, 0.00940099,
|
||||
0.00936704, 0.00932738, 0.00928186, 0.00923034, 0.00917268,
|
||||
0.00910872, 0.00903832, 0.00896134, 0.00887763, 0.00878706,
|
||||
0.00868949, 0.00858478, 0.00847280, 0.00835343, 0.00822653, 0.00809199,
|
||||
0.00794970, 0.00779956, 0.00764145, 0.00747530, 0.00730103,
|
||||
0.00711857, 0.00692787, 0.00672888, 0.00652158, 0.00630597,
|
||||
0.00608208, 0.00584994, 0.00560962, 0.00536124, 0.00510493, 0.00484089,
|
||||
0.00456935, 0.00429062, 0.00400505, 0.00371310, 0.00341532,
|
||||
0.00311238, 0.00280511, 0.00249452, 0.00218184, 0.00186864,
|
||||
0.00155690, 0.00124918, 0.00094895, 0.00066112, 0.00039320, 0.00015881
|
||||
};
|
||||
|
||||
double WebRtcIsac_LevDurb(double *a, double *k, double *r, int order)
|
||||
@ -221,15 +253,15 @@ void WebRtcIsac_GetLpcCoefLb(double *inLo, double *inHi, MaskFiltstr *maskdata,
|
||||
for (pos1 = 0; pos1 < WINLEN - UPDATE/2; pos1++) {
|
||||
maskdata->DataBufferLo[pos1] = maskdata->DataBufferLo[pos1 + UPDATE/2];
|
||||
maskdata->DataBufferHi[pos1] = maskdata->DataBufferHi[pos1 + UPDATE/2];
|
||||
DataLo[pos1] = maskdata->DataBufferLo[pos1] * WebRtcIsac_kLpcCorrWindow[pos1];
|
||||
DataHi[pos1] = maskdata->DataBufferHi[pos1] * WebRtcIsac_kLpcCorrWindow[pos1];
|
||||
DataLo[pos1] = maskdata->DataBufferLo[pos1] * kLpcCorrWindow[pos1];
|
||||
DataHi[pos1] = maskdata->DataBufferHi[pos1] * kLpcCorrWindow[pos1];
|
||||
}
|
||||
pos2 = k * UPDATE/2;
|
||||
for (n = 0; n < UPDATE/2; n++, pos1++) {
|
||||
maskdata->DataBufferLo[pos1] = inLo[QLOOKAHEAD + pos2];
|
||||
maskdata->DataBufferHi[pos1] = inHi[pos2++];
|
||||
DataLo[pos1] = maskdata->DataBufferLo[pos1] * WebRtcIsac_kLpcCorrWindow[pos1];
|
||||
DataHi[pos1] = maskdata->DataBufferHi[pos1] * WebRtcIsac_kLpcCorrWindow[pos1];
|
||||
DataLo[pos1] = maskdata->DataBufferLo[pos1] * kLpcCorrWindow[pos1];
|
||||
DataHi[pos1] = maskdata->DataBufferHi[pos1] * kLpcCorrWindow[pos1];
|
||||
}
|
||||
|
||||
/* Get correlation coefficients */
|
||||
@ -391,13 +423,13 @@ WebRtcIsac_GetLpcCoefUb(
|
||||
{
|
||||
maskdata->DataBufferLo[pos1] = maskdata->DataBufferLo[pos1 +
|
||||
UPDATE/2];
|
||||
data[pos1] = maskdata->DataBufferLo[pos1] * WebRtcIsac_kLpcCorrWindow[pos1];
|
||||
data[pos1] = maskdata->DataBufferLo[pos1] * kLpcCorrWindow[pos1];
|
||||
}
|
||||
pos2 = frameCntr * UPDATE/2;
|
||||
for(n = 0; n < UPDATE/2; n++, pos1++, pos2++)
|
||||
{
|
||||
maskdata->DataBufferLo[pos1] = inSignal[pos2];
|
||||
data[pos1] = maskdata->DataBufferLo[pos1] * WebRtcIsac_kLpcCorrWindow[pos1];
|
||||
data[pos1] = maskdata->DataBufferLo[pos1] * kLpcCorrWindow[pos1];
|
||||
}
|
||||
|
||||
/* Get correlation coefficients */
|
||||
|
@ -21,9 +21,6 @@
|
||||
#include "settings.h"
|
||||
#include "structs.h"
|
||||
|
||||
/* window */
|
||||
extern const double WebRtcIsac_kLpcCorrWindow[256];
|
||||
|
||||
double WebRtcIsac_LevDurb(double *a, double *k, double *r, int order);
|
||||
|
||||
void WebRtcIsac_GetVars(const double *input, const WebRtc_Word16 *pitchGains_Q12,
|
||||
|
@ -13,10 +13,10 @@
|
||||
#include <memory.h>
|
||||
#include <math.h>
|
||||
|
||||
static double kDampFilter[PITCH_DAMPORDER] = {-0.07, 0.25, 0.64, 0.25, -0.07};
|
||||
static const double kDampFilter[PITCH_DAMPORDER] = {-0.07, 0.25, 0.64, 0.25, -0.07};
|
||||
|
||||
/* interpolation coefficients; generated by design_pitch_filter.m */
|
||||
static double kIntrpCoef[PITCH_FRACS][PITCH_FRACORDER] = {
|
||||
static const double kIntrpCoef[PITCH_FRACS][PITCH_FRACORDER] = {
|
||||
{-0.02239172458614, 0.06653315052934, -0.16515880017569, 0.60701333734125, 0.64671399919202, -0.20249000396417, 0.09926548334755, -0.04765933793109, 0.01754159521746},
|
||||
{-0.01985640750434, 0.05816126837866, -0.13991265473714, 0.44560418147643, 0.79117042386876, -0.20266133815188, 0.09585268418555, -0.04533310458084, 0.01654127246314},
|
||||
{-0.01463300534216, 0.04229888475060, -0.09897034715253, 0.28284326017787, 0.90385267956632, -0.16976950138649, 0.07704272393639, -0.03584218578311, 0.01295781500709},
|
||||
@ -71,7 +71,7 @@ void WebRtcIsac_PitchfilterPre(double *indat,
|
||||
{
|
||||
|
||||
double ubuf[PITCH_INTBUFFSIZE];
|
||||
double *fracoeff = NULL;
|
||||
const double *fracoeff = NULL;
|
||||
double curgain, curlag, gaindelta, lagdelta;
|
||||
double sum, inystate[PITCH_DAMPORDER];
|
||||
double ftmp, oldlag, oldgain;
|
||||
@ -153,7 +153,7 @@ void WebRtcIsac_PitchfilterPre_la(double *indat,
|
||||
double *gains)
|
||||
{
|
||||
double ubuf[PITCH_INTBUFFSIZE+QLOOKAHEAD];
|
||||
double *fracoeff = NULL;
|
||||
const double *fracoeff = NULL;
|
||||
double curgain, curlag, gaindelta, lagdelta;
|
||||
double sum, inystate[PITCH_DAMPORDER];
|
||||
double ftmp;
|
||||
@ -265,7 +265,7 @@ void WebRtcIsac_PitchfilterPre_gains(double *indat,
|
||||
double ubuf[PITCH_INTBUFFSIZE+QLOOKAHEAD];
|
||||
double inystate_dG[4][PITCH_DAMPORDER];
|
||||
double gain_mult[4];
|
||||
double *fracoeff = NULL;
|
||||
const double *fracoeff = NULL;
|
||||
double curgain, curlag, gaindelta, lagdelta;
|
||||
double sum, sum2, inystate[PITCH_DAMPORDER];
|
||||
double ftmp, oldlag, oldgain;
|
||||
@ -421,7 +421,7 @@ void WebRtcIsac_PitchfilterPost(double *indat,
|
||||
{
|
||||
|
||||
double ubuf[PITCH_INTBUFFSIZE];
|
||||
double *fracoeff = NULL;
|
||||
const double *fracoeff = NULL;
|
||||
double curgain, curlag, gaindelta, lagdelta;
|
||||
double sum, inystate[PITCH_DAMPORDER];
|
||||
double ftmp, oldlag, oldgain;
|
||||
|
Loading…
Reference in New Issue
Block a user