ref: 3e36e65d36431635e42f9a5910171a86b9816e77
parent: a80207556e53a7f6875c72558585c9aece2b1211
author: Erik de Castro Lopo <erikd@mingus>
date: Mon May 22 23:02:49 EDT 2006
Remove remaining uses of floor() function in src_*.c.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-05-23 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+
+ * src/Makefile.am
+ Update check-asm rule to check src_linear.c and src_zoh.c.
+
+ * src/src_linear.c
+ Remove all uses of floor() function.
+
2006-04-18 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/samplerate.[ch] src/Version_script.in
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,15 +21,17 @@
#-------------------------------------------------------------------------------
# An extra check for bad asm.
-check-asm : check_asm.sh src_sinc.s
+check-asm : check_asm.sh src_sinc.s src_linear.s src_zoh.s
@echo
@echo
$(srcdir)/check_asm.sh src_sinc.s
+ $(srcdir)/check_asm.sh src_linear.s
+ $(srcdir)/check_asm.sh src_zoh.s
@echo
@echo
-src_sinc.s : $(srcdir)/src_sinc.c
- $(CC) -S $(CFLAGS) $(DEFAULT_INCLUDES) $(srcdir)/src_sinc.c -o src_sinc.s
+%.s : $(srcdir)/%.c
+ $(CC) -S $(CFLAGS) $(DEFAULT_INCLUDES) $(srcdir)/$+ -o $@
# Disable autoheader.
AUTOHEADER=echo
--- a/src/src_linear.c
+++ b/src/src_linear.c
@@ -30,7 +30,6 @@
#include "float_cast.h"
#include "common.h"
-static int linear_const_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
static int linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
static void linear_reset (SRC_PRIVATE *psrc) ;
@@ -97,8 +96,9 @@
input_index += 1.0 / src_ratio ;
} ;
- linear->in_used += linear->channels * lrint (floor (input_index)) ;
- input_index -= floor (input_index) ;
+ rem = fmod (input_index, 1.0) ;
+ linear->in_used += linear->channels * lrint (input_index - rem) ;
+ input_index = fmod (input_index, 1.0) ;
/* Main processing loop. */
while (linear->out_gen < linear->out_count && linear->in_used + linear->channels * input_index <= linear->in_count)