shithub: libsamplerate

Download patch

ref: e00161c954c73c20357b839052ee235d11d88200
parent: 1c4bee3ebee86d85148564d9bd4deaf91760b2a7
author: Erik de Castro Lopo <erikd@miles>
date: Thu Nov 4 15:47:31 EST 2004

Minor optimisation. Makes a difference on x86 but no difference on powerpc.

--- a/src/src_sinc.c
+++ b/src/src_sinc.c
@@ -430,7 +430,7 @@
 	filter_index = start_filter_index ;
 	coeff_count = (max_filter_index - filter_index) / increment ;
 	filter_index = filter_index + coeff_count * increment ;
-	data_index = filter->b_current - filter->channels * coeff_count ;
+	data_index = filter->b_current - filter->channels * coeff_count + ch ;
 
 	left = 0.0 ;
 	do
@@ -439,7 +439,7 @@
 
 		icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
 
-		left += icoeff * filter->buffer [data_index + ch] ;
+		left += icoeff * filter->buffer [data_index] ;
 
 		filter_index -= increment ;
 		data_index = data_index + filter->channels ;
@@ -450,7 +450,7 @@
 	filter_index = increment - start_filter_index ;
 	coeff_count = (max_filter_index - filter_index) / increment ;
 	filter_index = filter_index + coeff_count * increment ;
-	data_index = filter->b_current + filter->channels * (1 + coeff_count) ;
+	data_index = filter->b_current + filter->channels * (1 + coeff_count) + ch ;
 
 	right = 0.0 ;
 	do
@@ -459,7 +459,7 @@
 
 		icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
 
-		right += icoeff * filter->buffer [data_index + ch] ;
+		right += icoeff * filter->buffer [data_index] ;
 
 		filter_index -= increment ;
 		data_index = data_index - filter->channels ;