changeset 7580:255039c14525

Changing to 32 bit aritmetics for counters
author anders
date Wed, 02 Oct 2002 10:47:18 +0000
parents 24860f7c716f
children 31d0ea35c66b
files libaf/af_resample.c
diffstat 1 files changed, 25 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af_resample.c	Wed Oct 02 09:24:34 2002 +0000
+++ b/libaf/af_resample.c	Wed Oct 02 10:47:18 2002 +0000
@@ -68,11 +68,11 @@
 {
   int16_t*  	w;	// Current filter weights
   int16_t** 	xq; 	// Circular buffers
-  int16_t	xi; 	// Index for circular buffers
-  int16_t	wi;	// Index for w
-  uint16_t	i; 	// Number of new samples to put in x queue
-  uint16_t  	dn;     // Down sampling factor
-  uint16_t	up;	// Up sampling factor 
+  uint32_t	xi; 	// Index for circular buffers
+  uint32_t	wi;	// Index for w
+  uint32_t	i; 	// Number of new samples to put in x queue
+  uint32_t  	dn;     // Down sampling factor
+  uint32_t	up;	// Up sampling factor 
 } af_resample_t;
 
 // Euclids algorithm for calculating Greatest Common Divisor GCD(a,b)
@@ -93,17 +93,17 @@
 
 static int upsample(af_data_t* c,af_data_t* l, af_resample_t* s)
 {
-  uint16_t		ci    = l->nch; 	// Index for channels
-  uint16_t		len   = 0; 		// Number of input samples
-  uint16_t		nch   = l->nch;   	// Number of channels
-  uint16_t		inc   = s->up/s->dn; 
-  uint16_t		level = s->up%s->dn; 
-  uint16_t		up    = s->up;
-  uint16_t		dn    = s->dn;
+  uint32_t		ci    = l->nch; 	// Index for channels
+  uint32_t		len   = 0; 		// Number of input samples
+  uint32_t		nch   = l->nch;   	// Number of channels
+  uint32_t		inc   = s->up/s->dn; 
+  uint32_t		level = s->up%s->dn; 
+  uint32_t		up    = s->up;
+  uint32_t		dn    = s->dn;
 
   register int16_t*	w     = s->w;
-  register uint16_t	wi    = 0;
-  register uint16_t	xi    = 0; 
+  register uint32_t	wi    = 0;
+  register uint32_t	xi    = 0; 
 
   // Index current channel
   while(ci--){
@@ -115,7 +115,7 @@
     wi = s->wi; xi = s->xi;
 
     while(in < end){
-      register uint16_t	i = inc;
+      register uint32_t	i = inc;
       if(wi<level) i++;
 
       ADDQUE(xi,x,in);
@@ -137,17 +137,17 @@
 
 static int downsample(af_data_t* c,af_data_t* l, af_resample_t* s)
 {
-  uint16_t		ci    = l->nch; 	// Index for channels
-  uint16_t		len   = 0; 		// Number of output samples
-  uint16_t		nch   = l->nch;   	// Number of channels
-  uint16_t		inc   = s->dn/s->up; 
-  uint16_t		level = s->dn%s->up; 
-  uint16_t		up    = s->up;
-  uint16_t		dn    = s->dn;
+  uint32_t		ci    = l->nch; 	// Index for channels
+  uint32_t		len   = 0; 		// Number of output samples
+  uint32_t		nch   = l->nch;   	// Number of channels
+  uint32_t		inc   = s->dn/s->up; 
+  uint32_t		level = s->dn%s->up; 
+  uint32_t		up    = s->up;
+  uint32_t		dn    = s->dn;
 
-  register uint16_t	i     = 0;
-  register uint16_t	wi    = 0;
-  register uint16_t	xi    = 0;
+  register uint32_t	i     = 0;
+  register uint32_t	wi    = 0;
+  register uint32_t	xi    = 0;
   
   // Index current channel
   while(ci--){