1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-16 16:20:50 +02:00

Upgrade to libsoxr 0.0.3.

This commit is contained in:
v.audacity 2012-10-18 23:19:58 +00:00
parent 52e607f51e
commit cda544a119
8 changed files with 32 additions and 23 deletions

View File

@ -85,7 +85,7 @@ Upstream Version: 1.1.3
libresample libresample
----------- -----------
Audio sample rate conversion library. Maintained by Audacity project. Audio sample rate conversion library. Maintained by Audacity project.
(Not currently used, in favor of libsoxr.) (Currently used only for Time Tracks, in favor of libsoxr elsewhere.)
libsamplerate libsamplerate
------------- -------------
@ -118,11 +118,10 @@ libsoxr
------- -------
The SoX Resampler library performs one-dimensional sample-rate conversion, The SoX Resampler library performs one-dimensional sample-rate conversion,
by Rob Sykes. by Rob Sykes.
Version in Audacity SVN: 0.0.2 Version in Audacity SVN: 0.0.3
Patches: Patches:
* "libsoxr/configure" file: modified cmake params * "libsoxr/configure" file: modified cmake params
* modified .vcproj file in win\Projects\libsoxr * modified .vcproj file in win\Projects\libsoxr
* modified src/samplerate.h (hopefully only until this change is made in master libsoxr source)
libvamp libvamp

View File

@ -12,7 +12,7 @@ set (DESCRIPTION_SUMMARY "One-dimensional sample-rate conversion library")
set (PROJECT_VERSION_MAJOR 0) set (PROJECT_VERSION_MAJOR 0)
set (PROJECT_VERSION_MINOR 0) set (PROJECT_VERSION_MINOR 0)
set (PROJECT_VERSION_PATCH 2) set (PROJECT_VERSION_PATCH 3)
# For shared-object; if, since the last public release: # For shared-object; if, since the last public release:
# * library code changed at all: ++revision # * library code changed at all: ++revision
@ -103,6 +103,10 @@ if (WITH_AVFFT)
endif () endif ()
endif () endif ()
if (EXISTS ${PROJECT_SOURCE_DIR}/src/vr32.c)
set (HAVE_VR 1)
endif ()
check_function_exists (lrint HAVE_LRINT) check_function_exists (lrint HAVE_LRINT)
check_include_files (fenv.h HAVE_FENV_H) check_include_files (fenv.h HAVE_FENV_H)
test_big_endian (WORDS_BIGENDIAN) test_big_endian (WORDS_BIGENDIAN)
@ -115,7 +119,7 @@ macro (make_exist)
endforeach () endforeach ()
endmacro () endmacro ()
make_exist (HAVE_LRINT HAVE_FENV_H WORDS_BIGENDIAN HAVE_SIMD) make_exist (HAVE_LRINT HAVE_FENV_H WORDS_BIGENDIAN HAVE_SIMD HAVE_VR)
make_exist (HAVE_SINGLE_PRECISION HAVE_DOUBLE_PRECISION HAVE_AVFFT) make_exist (HAVE_SINGLE_PRECISION HAVE_DOUBLE_PRECISION HAVE_AVFFT)
@ -246,7 +250,7 @@ if (UNIX)
set (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") set (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set (CPACK_SOURCE_GENERATOR "TBZ2") set (CPACK_SOURCE_GENERATOR "TBZ2")
set (CPACK_SOURCE_IGNORE_FILES "/Debug/;/Release/;/cpack/;\\\\.swp$;\\\\.gitignore") set (CPACK_SOURCE_IGNORE_FILES "/Debug/;/Release/;/cpack/;\\\\.swp$;\\\\.gitignore;.*vr32\\\\.c")
include (CPack) include (CPack)

View File

@ -38,6 +38,8 @@
#endif #endif
#undef min #undef min
#undef max
#define min(x,y) ((x)<(y)?(x):(y)) #define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)>(y)?(x):(y))
#define AL(a) (sizeof(a)/sizeof((a)[0])) /* Array Length */ #define AL(a) (sizeof(a)/sizeof((a)[0])) /* Array Length */

View File

@ -7,6 +7,7 @@
#define SOXR_VERSION "@PROJECT_VERSION@" #define SOXR_VERSION "@PROJECT_VERSION@"
#define HAVE_SINGLE_PRECISION @HAVE_SINGLE_PRECISION@ #define HAVE_SINGLE_PRECISION @HAVE_SINGLE_PRECISION@
#define HAVE_DOUBLE_PRECISION @HAVE_DOUBLE_PRECISION@ #define HAVE_DOUBLE_PRECISION @HAVE_DOUBLE_PRECISION@
#define HAVE_VR @HAVE_VR@
#define HAVE_AVFFT @HAVE_AVFFT@ #define HAVE_AVFFT @HAVE_AVFFT@
#define HAVE_SIMD @HAVE_SIMD@ #define HAVE_SIMD @HAVE_SIMD@
#define HAVE_FENV_H @HAVE_FENV_H@ #define HAVE_FENV_H @HAVE_FENV_H@

View File

@ -24,6 +24,10 @@ if (WITH_SINGLE_PRECISION)
set (SP_SOURCES rate32 ${RDFT32}) set (SP_SOURCES rate32 ${RDFT32})
endif () endif ()
if (HAVE_VR)
set (VR_SOURCES vr32)
endif ()
if (HAVE_SIMD) if (HAVE_SIMD)
set (SIMD_SOURCES rate32s ${RDFT32S} simd) set (SIMD_SOURCES rate32s ${RDFT32S} simd)
foreach (source ${SIMD_SOURCES}) foreach (source ${SIMD_SOURCES})
@ -36,7 +40,7 @@ endif ()
# Libsoxr: # Libsoxr:
add_library (${PROJECT_NAME} ${LIB_TYPE} ${PROJECT_NAME}.c data-io dbesi0 filter fft4g64 add_library (${PROJECT_NAME} ${LIB_TYPE} ${PROJECT_NAME}.c data-io dbesi0 filter fft4g64
${SP_SOURCES} ${DP_SOURCES} ${SIMD_SOURCES}) ${SP_SOURCES} ${VR_SOURCES} ${DP_SOURCES} ${SIMD_SOURCES})
set_target_properties (${PROJECT_NAME} PROPERTIES set_target_properties (${PROJECT_NAME} PROPERTIES
VERSION "${SO_VERSION}" VERSION "${SO_VERSION}"
SOVERSION ${SO_VERSION_MAJOR} SOVERSION ${SO_VERSION_MAJOR}

View File

@ -23,7 +23,7 @@ typedef void sample_t; /* float or double */
typedef struct { typedef struct {
sample_t * (* input)(void *, sample_t * samples, size_t n); sample_t * (* input)(void *, sample_t * samples, size_t n);
void (* process)(void *); void (* process)(void *, size_t);
sample_t const * (* output)(void *, sample_t * samples, size_t * n); sample_t const * (* output)(void *, sample_t * samples, size_t * n);
void (* flush)(void *); void (* flush)(void *);
void (* close)(void *); void (* close)(void *);
@ -205,7 +205,7 @@ static bool cpu_has_simd(void)
} }
#endif #endif
extern control_block_t _soxr_rate32s_cb, _soxr_rate32_cb, _soxr_rate64_cb; extern control_block_t _soxr_rate32s_cb, _soxr_rate32_cb, _soxr_rate64_cb, _soxr_vr32_cb;
@ -243,10 +243,17 @@ soxr_t soxr_create(
p->seed = (unsigned long)time(0) ^ (unsigned long)p; p->seed = (unsigned long)time(0) ^ (unsigned long)p;
#if HAVE_SINGLE_PRECISION #if HAVE_SINGLE_PRECISION
if (!HAVE_DOUBLE_PRECISION || (p->q_spec.bits <= 20 && !(p->q_spec.flags & SOXR_DOUBLE_PRECISION))) { if (!HAVE_DOUBLE_PRECISION || (p->q_spec.bits <= 20 && !(p->q_spec.flags & SOXR_DOUBLE_PRECISION))
#if HAVE_VR
|| (p->q_spec.flags & SOXR_VR)
#endif
) {
p->deinterleave = (deinterleave_t)_soxr_deinterleave_f; p->deinterleave = (deinterleave_t)_soxr_deinterleave_f;
p->interleave = (interleave_t)_soxr_interleave_f; p->interleave = (interleave_t)_soxr_interleave_f;
memcpy(&p->control_block, memcpy(&p->control_block,
#if HAVE_VR
(p->q_spec.flags & SOXR_VR)? &_soxr_vr32_cb :
#endif
#if HAVE_SIMD #if HAVE_SIMD
cpu_has_simd()? &_soxr_rate32s_cb : cpu_has_simd()? &_soxr_rate32s_cb :
#endif #endif
@ -385,15 +392,6 @@ soxr_error_t soxr_set_oi_ratio(soxr_t p, double oi_ratio)
#if 0
soxr_error_t soxr_set_pitch(soxr_t p, long pitch)
{
return soxr_set_oi_ratio(p, pow(2, -(double)pitch / OCTAVE_MULT));
}
#endif
void soxr_delete(soxr_t p) void soxr_delete(soxr_t p)
{ {
if (p) if (p)
@ -432,7 +430,8 @@ static void soxr_input_1ch(soxr_t p, unsigned i, soxr_cbuf_t src, size_t len)
static size_t soxr_input(soxr_t p, void const * in, size_t len) size_t soxr_input(soxr_t p, void const * in, size_t len);
size_t soxr_input(soxr_t p, void const * in, size_t len)
{ {
bool separated = !!(p->io_spec.itype & SOXR_SPLIT); bool separated = !!(p->io_spec.itype & SOXR_SPLIT);
unsigned i; unsigned i;
@ -461,7 +460,7 @@ static size_t soxr_output_1ch(soxr_t p, unsigned i, soxr_buf_t dest, size_t len,
sample_t const * src; sample_t const * src;
if (p->flushing) if (p->flushing)
resampler_flush(p->resamplers[i]); resampler_flush(p->resamplers[i]);
resampler_process(p->resamplers[i]); resampler_process(p->resamplers[i], len);
src = resampler_output(p->resamplers[i], NULL, &len); src = resampler_output(p->resamplers[i], NULL, &len);
if (separated) if (separated)
p->clips += (p->interleave)(p->io_spec.otype, &dest, &src, p->clips += (p->interleave)(p->io_spec.otype, &dest, &src,

View File

@ -226,6 +226,7 @@ struct soxr_quality_spec { /* Typically */
#define SOXR_MAINTAIN_3DB_PT 4u /* Reserved for internal use. */ #define SOXR_MAINTAIN_3DB_PT 4u /* Reserved for internal use. */
#define SOXR_HI_PREC_CLOCK 8u /* Increase `irrational' ratio accuracy. */ #define SOXR_HI_PREC_CLOCK 8u /* Increase `irrational' ratio accuracy. */
#define SOXR_DOUBLE_PRECISION 16u /* Use double prec. even @ bitdepths <= 20.*/ #define SOXR_DOUBLE_PRECISION 16u /* Use double prec. even @ bitdepths <= 20.*/
#define SOXR_VR 32u /* Reserved for future use. */
@ -298,7 +299,6 @@ SOXR soxr_io_spec_t soxr_io_spec(
SOXR soxr_error_t soxr_set_error(soxr_t, soxr_error_t); SOXR soxr_error_t soxr_set_error(soxr_t, soxr_error_t);
SOXR soxr_error_t soxr_set_num_channels(soxr_t, unsigned); SOXR soxr_error_t soxr_set_num_channels(soxr_t, unsigned);
SOXR soxr_error_t soxr_set_oi_ratio(soxr_t, double); SOXR soxr_error_t soxr_set_oi_ratio(soxr_t, double);
SOXR soxr_error_t soxr_set_pitch(soxr_t, long);