[Speex-dev] [PATCH 1/5] resample: Calculate full sinc table (e.g. no sinc interpolation)

Jyri Sarha
Thu, 01 Sep 2011 12:30:27 -0000

On many systems taking couple of kilo-bytes for full sinc table is not
a problem. With a straight filter table the number of MAC operations
needed drops to one quarter. Also the inner loop of the filter becomes
more simple and easier to optimize. So the full sinc table version
runs much faster in most cases. The trade off is some kilo-bytes
bigger memory usage and more CPU needed when initializing the
resampler.
---
 libspeex/resample.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libspeex/resample.c b/libspeex/resample.c
index 7b5a308..3829715 100644
--- a/libspeex/resample.c
+++ b/libspeex/resample.c
@@ -585,7 +585,11 @@ static void update_filter(SpeexResamplerState *st)
    }

    /* Choose the resampling type that requires the least amount of memory */
+#ifdef RESAMPLE_FULL_SINC_TABLE
+   if (1)
+#else
    if (st->den_rate <= st->oversample)
+#endif
    {
       spx_uint32_t i;
       if (!st->sinc_table)
--
1.7.4.1