mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
update speex resampler with newer snapshot from Speex SVN
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2073 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
23e3d7cb4c
commit
3e4f820f22
3 changed files with 66 additions and 15 deletions
|
|
@ -604,7 +604,7 @@ noinst_LTLIBRARIES = libspeex-resampler-fixed.la libspeex-resampler-float.la lib
|
||||||
libspeex_resampler_fixed_la_CPPFLAGS = $(AM_CPPFLAGS) -DRANDOM_PREFIX=paspfx -DOUTSIDE_SPEEX -DFIXED_POINT
|
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_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
|
libspeex_resampler_float_la_SOURCES = pulsecore/speex/resample.c pulsecore/speex/speex_resampler.h pulsecore/speex/arch.h
|
||||||
|
|
||||||
libffmpeg_resampler_la_CPPFLAGS = $(AM_CPPFLAGS)
|
libffmpeg_resampler_la_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,45 @@
|
||||||
#ifndef ARCH_H
|
#ifndef ARCH_H
|
||||||
#define 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
|
#ifndef OUTSIDE_SPEEX
|
||||||
#include "speex/speex_types.h"
|
#include "speex/speex_types.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -68,6 +107,7 @@ typedef spx_word32_t spx_sig_t;
|
||||||
#define LPC_SHIFT 13
|
#define LPC_SHIFT 13
|
||||||
#define LSP_SHIFT 13
|
#define LSP_SHIFT 13
|
||||||
#define SIG_SHIFT 14
|
#define SIG_SHIFT 14
|
||||||
|
#define GAIN_SHIFT 6
|
||||||
|
|
||||||
#define VERY_SMALL 0
|
#define VERY_SMALL 0
|
||||||
#define VERY_LARGE32 ((spx_word32_t)2147483647)
|
#define VERY_LARGE32 ((spx_word32_t)2147483647)
|
||||||
|
|
@ -111,9 +151,6 @@ typedef float spx_word32_t;
|
||||||
#define GAIN_SCALING 1.f
|
#define GAIN_SCALING 1.f
|
||||||
#define GAIN_SCALING_1 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_SMALL 1e-15f
|
||||||
#define VERY_LARGE32 1e15f
|
#define VERY_LARGE32 1e15f
|
||||||
|
|
@ -194,4 +231,11 @@ typedef float spx_word32_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef FIXED_DEBUG
|
||||||
|
long long spx_mips=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -37,17 +37,23 @@
|
||||||
- Low memory requirement
|
- Low memory requirement
|
||||||
- Good *perceptual* quality (and not best SNR)
|
- Good *perceptual* quality (and not best SNR)
|
||||||
|
|
||||||
The code is working, but it's in a very early stage, so it may have
|
Warning: This resampler is relatively new. Although I think I got rid of
|
||||||
artifacts, noise or subliminal messages from satan. Also, the API
|
all the major bugs and I don't expect the API to change anymore, there
|
||||||
isn't stable and I can actually promise that I *will* change the API
|
may be something I've missed. So use with caution.
|
||||||
some time in the future.
|
|
||||||
|
|
||||||
TODO list:
|
This algorithm is based on this original resampling algorithm:
|
||||||
- Variable calculation resolution depending on quality setting
|
Smith, Julius O. Digital Audio Resampling Home Page
|
||||||
- Single vs double in float mode
|
Center for Computer Research in Music and Acoustics (CCRMA),
|
||||||
- 16-bit vs 32-bit (sinc only) in fixed-point mode
|
Stanford University, 2007.
|
||||||
- Make sure the filter update works even when changing params
|
Web published at http://www-ccrma.stanford.edu/~jos/resample/.
|
||||||
after only a few samples procesed
|
|
||||||
|
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
|
#ifdef HAVE_CONFIG_H
|
||||||
|
|
@ -64,7 +70,8 @@ static void speex_free (void *ptr) {free(ptr);}
|
||||||
#else /* OUTSIDE_SPEEX */
|
#else /* OUTSIDE_SPEEX */
|
||||||
|
|
||||||
#include "speex/speex_resampler.h"
|
#include "speex/speex_resampler.h"
|
||||||
#include "misc.h"
|
#include "arch.h"
|
||||||
|
#include "os_support.h"
|
||||||
#endif /* OUTSIDE_SPEEX */
|
#endif /* OUTSIDE_SPEEX */
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue