[pulseaudio-commits] r2139 - in /branches/prepare-0.9.10/src: Makefile.am pulsecore/speex/arch.h pulsecore/speex/resample.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Mar 27 14:21:25 PDT 2008


Author: lennart
Date: Thu Mar 27 22:21:24 2008
New Revision: 2139

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2139&root=pulseaudio&view=rev
Log:
merge r2073 from trunk

Modified:
    branches/prepare-0.9.10/src/Makefile.am
    branches/prepare-0.9.10/src/pulsecore/speex/arch.h
    branches/prepare-0.9.10/src/pulsecore/speex/resample.c

Modified: branches/prepare-0.9.10/src/Makefile.am
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/prepare-0.9.10/src/Makefile.am?rev=2139&root=pulseaudio&r1=2138&r2=2139&view=diff
==============================================================================
--- branches/prepare-0.9.10/src/Makefile.am (original)
+++ branches/prepare-0.9.10/src/Makefile.am Thu Mar 27 22:21:24 2008
@@ -604,7 +604,7 @@
 libspeex_resampler_fixed_la_CPPFLAGS = $(AM_CPPFLAGS) -DRANDOM_PREFIX=paspfx -DOUTSIDE_SPEEX -DFIXED_POINT
 libspeex_resampler_fixed_la_SOURCES = pulsecore/speex/resample.c pulsecore/speex/speex_resampler.h pulsecore/speex/arch.h pulsecore/speex/fixed_generic.h pulsecore/speexwrap.h
 
-libspeex_resampler_float_la_CPPFLAGS = $(AM_CPPFLAGS) -DRANDOM_PREFIX=paspfl -DOUTSIDE_SPEEX
+libspeex_resampler_float_la_CPPFLAGS = $(AM_CPPFLAGS) -DRANDOM_PREFIX=paspfl -DOUTSIDE_SPEEX -DFLOATING_POINT
 libspeex_resampler_float_la_SOURCES = pulsecore/speex/resample.c pulsecore/speex/speex_resampler.h pulsecore/speex/arch.h
 
 libffmpeg_resampler_la_CPPFLAGS = $(AM_CPPFLAGS)

Modified: branches/prepare-0.9.10/src/pulsecore/speex/arch.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/prepare-0.9.10/src/pulsecore/speex/arch.h?rev=2139&root=pulseaudio&r1=2138&r2=2139&view=diff
==============================================================================
--- branches/prepare-0.9.10/src/pulsecore/speex/arch.h (original)
+++ branches/prepare-0.9.10/src/pulsecore/speex/arch.h Thu Mar 27 22:21:24 2008
@@ -35,6 +35,45 @@
 #ifndef ARCH_H
 #define ARCH_H
 
+#ifndef SPEEX_VERSION
+#define SPEEX_MAJOR_VERSION 1         /**< Major Speex version. */
+#define SPEEX_MINOR_VERSION 1         /**< Minor Speex version. */
+#define SPEEX_MICRO_VERSION 15        /**< Micro Speex version. */
+#define SPEEX_EXTRA_VERSION ""        /**< Extra Speex version. */
+#define SPEEX_VERSION "speex-1.2beta3"  /**< Speex version string. */
+#endif
+
+/* A couple test to catch stupid option combinations */
+#ifdef FIXED_POINT
+
+#ifdef FLOATING_POINT
+#error You cannot compile as floating point and fixed point at the same time
+#endif
+#ifdef _USE_SSE
+#error SSE is only for floating-point
+#endif
+#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM))
+#error Make up your mind. What CPU do you have?
+#endif
+#ifdef VORBIS_PSYCHO
+#error Vorbis-psy model currently not implemented in fixed-point
+#endif
+
+#else
+
+#ifndef FLOATING_POINT
+#error You now need to define either FIXED_POINT or FLOATING_POINT
+#endif
+#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
+#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
+#endif
+#ifdef FIXED_POINT_DEBUG
+#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?"
+#endif
+
+
+#endif
+
 #ifndef OUTSIDE_SPEEX
 #include "speex/speex_types.h"
 #endif
@@ -68,6 +107,7 @@
 #define LPC_SHIFT    13
 #define LSP_SHIFT    13
 #define SIG_SHIFT    14
+#define GAIN_SHIFT   6
 
 #define VERY_SMALL 0
 #define VERY_LARGE32 ((spx_word32_t)2147483647)
@@ -111,9 +151,6 @@
 #define GAIN_SCALING 1.f
 #define GAIN_SCALING_1 1.f
 
-#define LPC_SHIFT    0
-#define LSP_SHIFT    0
-#define SIG_SHIFT    0
 
 #define VERY_SMALL 1e-15f
 #define VERY_LARGE32 1e15f
@@ -194,4 +231,11 @@
 
 #endif
 
-#endif
+
+
+#ifdef FIXED_DEBUG
+long long spx_mips=0;
+#endif
+
+
+#endif

Modified: branches/prepare-0.9.10/src/pulsecore/speex/resample.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/prepare-0.9.10/src/pulsecore/speex/resample.c?rev=2139&root=pulseaudio&r1=2138&r2=2139&view=diff
==============================================================================
--- branches/prepare-0.9.10/src/pulsecore/speex/resample.c (original)
+++ branches/prepare-0.9.10/src/pulsecore/speex/resample.c Thu Mar 27 22:21:24 2008
@@ -37,17 +37,23 @@
       - Low memory requirement
       - Good *perceptual* quality (and not best SNR)
 
-   The code is working, but it's in a very early stage, so it may have
-   artifacts, noise or subliminal messages from satan. Also, the API
-   isn't stable and I can actually promise that I *will* change the API
-   some time in the future.
-
-TODO list:
-      - Variable calculation resolution depending on quality setting
-         - Single vs double in float mode
-         - 16-bit vs 32-bit (sinc only) in fixed-point mode
-      - Make sure the filter update works even when changing params
-             after only a few samples procesed
+   Warning: This resampler is relatively new. Although I think I got rid of
+   all the major bugs and I don't expect the API to change anymore, there
+   may be something I've missed. So use with caution.
+
+   This algorithm is based on this original resampling algorithm:
+   Smith, Julius O. Digital Audio Resampling Home Page
+   Center for Computer Research in Music and Acoustics (CCRMA),
+   Stanford University, 2007.
+   Web published at http://www-ccrma.stanford.edu/~jos/resample/.
+
+   There is one main difference, though. This resampler uses cubic
+   interpolation instead of linear interpolation in the above paper. This
+   makes the table much smaller and makes it possible to compute that table
+   on a per-stream basis. In turn, being able to tweak the table for each
+   stream makes it possible to both reduce complexity on simple ratios
+   (e.g. 2/3), and get rid of the rounding operations in the inner loop.
+   The latter both reduces CPU time and makes the algorithm more SIMD-friendly.
 */
 
 #ifdef HAVE_CONFIG_H
@@ -64,7 +70,8 @@
 #else /* OUTSIDE_SPEEX */
 
 #include "speex/speex_resampler.h"
-#include "misc.h"
+#include "arch.h"
+#include "os_support.h"
 #endif /* OUTSIDE_SPEEX */
 
 #include <math.h>




More information about the pulseaudio-commits mailing list