Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1378)

Unified Diff: webrtc/modules/audio_coding/codecs/isac/main/source/filter_functions.c

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/isac/main/source/filter_functions.c
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/filter_functions.c b/webrtc/modules/audio_coding/codecs/isac/main/source/filter_functions.c
index 089f26ec039150b46ab510713e04e7d969b671c6..d47eb1fa6649513d4f4ba5e4a7ff0ae4668bf609 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/source/filter_functions.c
+++ b/webrtc/modules/audio_coding/codecs/isac/main/source/filter_functions.c
@@ -19,12 +19,15 @@
-void WebRtcIsac_AllPoleFilter(double *InOut, double *Coef, int lengthInOut, int orderCoef){
-
+void WebRtcIsac_AllPoleFilter(double* InOut,
+ double* Coef,
+ size_t lengthInOut,
+ int orderCoef) {
/* the state of filter is assumed to be in InOut[-1] to InOut[-orderCoef] */
double scal;
double sum;
- int n,k;
+ size_t n;
+ int k;
//if (fabs(Coef[0]-1.0)<0.001) {
if ( (Coef[0] > 0.9999) && (Coef[0] < 1.0001) )
@@ -53,11 +56,15 @@ void WebRtcIsac_AllPoleFilter(double *InOut, double *Coef, int lengthInOut, int
}
-void WebRtcIsac_AllZeroFilter(double *In, double *Coef, int lengthInOut, int orderCoef, double *Out){
-
+void WebRtcIsac_AllZeroFilter(double* In,
+ double* Coef,
+ size_t lengthInOut,
+ int orderCoef,
+ double* Out) {
/* the state of filter is assumed to be in In[-1] to In[-orderCoef] */
- int n, k;
+ size_t n;
+ int k;
double tmp;
for(n = 0; n < lengthInOut; n++)
@@ -74,9 +81,12 @@ void WebRtcIsac_AllZeroFilter(double *In, double *Coef, int lengthInOut, int ord
}
-
-void WebRtcIsac_ZeroPoleFilter(double *In, double *ZeroCoef, double *PoleCoef, int lengthInOut, int orderCoef, double *Out){
-
+void WebRtcIsac_ZeroPoleFilter(double* In,
+ double* ZeroCoef,
+ double* PoleCoef,
+ size_t lengthInOut,
+ int orderCoef,
+ double* Out) {
/* the state of the zero section is assumed to be in In[-1] to In[-orderCoef] */
/* the state of the pole section is assumed to be in Out[-1] to Out[-orderCoef] */
@@ -85,14 +95,8 @@ void WebRtcIsac_ZeroPoleFilter(double *In, double *ZeroCoef, double *PoleCoef, i
}
-void WebRtcIsac_AutoCorr(
- double *r,
- const double *x,
- int N,
- int order
- )
-{
- int lag, n;
+void WebRtcIsac_AutoCorr(double* r, const double* x, size_t N, size_t order) {
+ size_t lag, n;
double sum, prod;
const double *x_lag;
@@ -112,8 +116,8 @@ void WebRtcIsac_AutoCorr(
}
-void WebRtcIsac_BwExpand(double *out, double *in, double coef, short length) {
- int i;
+void WebRtcIsac_BwExpand(double* out, double* in, double coef, size_t length) {
+ size_t i;
double chirp;
chirp = coef;
@@ -125,8 +129,10 @@ void WebRtcIsac_BwExpand(double *out, double *in, double coef, short length) {
}
}
-void WebRtcIsac_WeightingFilter(const double *in, double *weiout, double *whiout, WeightFiltstr *wfdata) {
-
+void WebRtcIsac_WeightingFilter(const double* in,
+ double* weiout,
+ double* whiout,
+ WeightFiltstr* wfdata) {
double tmpbuffer[PITCH_FRAME_LEN + PITCH_WLPCBUFLEN];
double corr[PITCH_WLPCORDER+1], rc[PITCH_WLPCORDER+1];
double apol[PITCH_WLPCORDER+1], apolr[PITCH_WLPCORDER+1];
@@ -195,15 +201,13 @@ static const double APupper[ALLPASSSECTIONS] = {0.0347, 0.3826};
static const double APlower[ALLPASSSECTIONS] = {0.1544, 0.744};
-
-void WebRtcIsac_AllpassFilterForDec(double *InOut,
- const double *APSectionFactors,
- int lengthInOut,
- double *FilterState)
-{
+void WebRtcIsac_AllpassFilterForDec(double* InOut,
+ const double* APSectionFactors,
+ size_t lengthInOut,
+ double* FilterState) {
//This performs all-pass filtering--a series of first order all-pass sections are used
//to filter the input in a cascade manner.
- int n,j;
+ size_t n,j;
double temp;
for (j=0; j<ALLPASSSECTIONS; j++){
for (n=0;n<lengthInOut;n+=2){
@@ -214,12 +218,11 @@ void WebRtcIsac_AllpassFilterForDec(double *InOut,
}
}
-void WebRtcIsac_DecimateAllpass(const double *in,
- double *state_in, /* array of size: 2*ALLPASSSECTIONS+1 */
- int N, /* number of input samples */
- double *out) /* array of size N/2 */
-{
- int n;
+void WebRtcIsac_DecimateAllpass(const double* in,
+ double* state_in,
+ size_t N,
+ double* out) {
+ size_t n;
double data_vec[PITCH_FRAME_LEN];
/* copy input */
@@ -237,7 +240,6 @@ void WebRtcIsac_DecimateAllpass(const double *in,
}
-
/* create high-pass filter ocefficients
* z = 0.998 * exp(j*2*pi*35/8000);
* p = 0.94 * exp(j*2*pi*140/8000);
@@ -247,9 +249,11 @@ static const double a_coef[2] = { 1.86864659625574, -0.88360000000000};
static const double b_coef[2] = {-1.99524591718270, 0.99600400000000};
/* second order high-pass filter */
-void WebRtcIsac_Highpass(const double *in, double *out, double *state, int N)
-{
- int k;
+void WebRtcIsac_Highpass(const double* in,
+ double* out,
+ double* state,
+ size_t N) {
+ size_t k;
for (k=0; k<N; k++) {
*out = *in + state[1];

Powered by Google App Engine
This is Rietveld 408576698