clean-up
parent
384936b256
commit
e47d6560af
|
@ -16,11 +16,10 @@ set (PROJECT_VERSION_MINOR 1)
|
||||||
set (PROJECT_VERSION_PATCH 2)
|
set (PROJECT_VERSION_PATCH 2)
|
||||||
|
|
||||||
# For shared-object; if, since the last public release:
|
# For shared-object; if, since the last public release:
|
||||||
#
|
# 1) library code changed at all: ++revision
|
||||||
# 1) library code changed at all: ++revision
|
# 2) interfaces changed at all: ++current, revision = 0
|
||||||
# 2) interfaces changed at all: ++current, revision = 0
|
# 3) interfaces added: ++age
|
||||||
# 3) interfaces added: ++age
|
# 4) interfaces removed: age = 0
|
||||||
# 4) interfaces removed: age = 0
|
|
||||||
|
|
||||||
set (SO_VERSION_CURRENT 1)
|
set (SO_VERSION_CURRENT 1)
|
||||||
set (SO_VERSION_REVISION 1)
|
set (SO_VERSION_REVISION 1)
|
||||||
|
@ -97,15 +96,20 @@ if (NEED_LIBM)
|
||||||
set (LIBM_LIBRARIES m)
|
set (LIBM_LIBRARIES m)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (${BUILD_EXAMPLES})
|
||||||
|
project (${PROJECT_NAME}) # Adds c++ compiler
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (WITH_OPENMP)
|
if (WITH_OPENMP)
|
||||||
find_package (OpenMP)
|
find_package (OpenMP)
|
||||||
if (OpenMP_FOUND)
|
if (OPENMP_FOUND)
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
||||||
set (CMAKE_EXE_LINKER_FLAGS
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||||
"${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
|
if (MINGW) # Is this still needed?
|
||||||
set (CMAKE_SHARED_LINKER_FLAGS
|
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS}")
|
||||||
"${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS}")
|
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_C_FLAGS}")
|
||||||
endif ()
|
endif ()
|
||||||
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (WITH_CR32S)
|
if (WITH_CR32S)
|
||||||
|
@ -145,15 +149,14 @@ test_big_endian (HAVE_BIGENDIAN)
|
||||||
# Compiler configuration:
|
# Compiler configuration:
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||||
set (PROJECT_CXX_FLAGS "${PROJECT_CXX_FLAGS} -Wconversion -Wall -Wextra")
|
set (PROJECT_CXX_FLAGS "${PROJECT_CXX_FLAGS} -Wconversion -Wall -Wextra \
|
||||||
set (PROJECT_CXX_FLAGS "${PROJECT_CXX_FLAGS} -pedantic -Wundef -Wpointer-arith")
|
-pedantic -Wundef -Wpointer-arith -Wno-long-long -Wno-keyword-macro")
|
||||||
set (PROJECT_CXX_FLAGS "${PROJECT_CXX_FLAGS} -Wno-long-long -Wno-keyword-macro")
|
|
||||||
if (WITH_DEV_GPROF)
|
if (WITH_DEV_GPROF)
|
||||||
set (PROJECT_CXX_FLAGS "${PROJECT_CXX_FLAGS} -pg")
|
set (PROJECT_CXX_FLAGS "${PROJECT_CXX_FLAGS} -pg")
|
||||||
endif ()
|
endif ()
|
||||||
# Can use std=c89, but gnu89 should give faster sinf, cosf, etc.:
|
# Can use std=c89, but gnu89 should give faster sinf, cosf, etc.:
|
||||||
set (PROJECT_C_FLAGS "${PROJECT_CXX_FLAGS} -std=gnu89 -Wnested-externs")
|
set (PROJECT_C_FLAGS "${PROJECT_CXX_FLAGS} \
|
||||||
set (PROJECT_C_FLAGS "${PROJECT_C_FLAGS} -Wmissing-prototypes -Wstrict-prototypes")
|
-std=gnu89 -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes")
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s") # strip
|
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s") # strip
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -208,6 +211,10 @@ if (BUILD_SHARED_LIBS)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL "None") # As used by some distros.
|
||||||
|
add_definitions (-DNDEBUG)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Installation configuration:
|
# Installation configuration:
|
||||||
|
@ -277,24 +284,21 @@ endif ()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Rough-and-ready distclean for anyone still doing in-tree builds:
|
# GNU Autotools compatibility; 'make check':
|
||||||
|
|
||||||
|
add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# GNU Autotools compatibility; 'make distclean':
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
add_custom_target (distclean
|
add_custom_target (distclean COMMAND make clean && find .
|
||||||
COMMAND make clean && rm -rf
|
\\! -path \\*/Modules/\\* \\! -name cmp-test.cmake -a -name \\*.cmake
|
||||||
CMakeCache.txt
|
-o -name CMakeFiles -o -name Makefile -o -name CMakeCache.txt -o -name
|
||||||
CMakeFiles
|
Testing -o -name cmake_install.cmake -o -name install_manifest.txt -o
|
||||||
cmake_install.cmake
|
-path ./soxr-config.h -o -name config.h -o -name \\*.pc -o -name \\*.s32
|
||||||
CPackConfig.cmake
|
| xargs rm -rf)
|
||||||
CPackSourceConfig.cmake
|
|
||||||
deinstall.cmake
|
|
||||||
Makefile
|
|
||||||
soxr-config.h
|
|
||||||
src/CMakeFiles
|
|
||||||
src/cmake_install.cmake
|
|
||||||
src/libsoxr-lsr.pc
|
|
||||||
src/libsoxr.pc
|
|
||||||
src/Makefile)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
@ -317,13 +321,8 @@ if (UNIX)
|
||||||
set (CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
set (CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
||||||
set (CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
set (CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
||||||
set (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
set (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
||||||
|
set (CPACK_SOURCE_GENERATOR "TGZ") # Use TXZ (cmake 3.1) after 17-12-16
|
||||||
set (CPACK_SOURCE_GENERATOR "TGZ")
|
set (CPACK_SOURCE_IGNORE_FILES
|
||||||
set (CPACK_SOURCE_IGNORE_FILES "dist;/lsr-tests/;/Debug/;/Release/;/cpack/;\\\\.swp$;\\\\.gitignore;/\\\\.git/")
|
"dist;/lsr-tests/;/Debug.*/;/Release.*/;\\\\.swp$;\\\\.git.*;/\\\\.git/")
|
||||||
|
|
||||||
include (CPack)
|
include (CPack)
|
||||||
|
|
||||||
if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/cpack)
|
|
||||||
add_subdirectory (cpack)
|
|
||||||
endif ()
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
37
INSTALL
37
INSTALL
|
@ -21,7 +21,7 @@ STANDARD BUILD
|
||||||
|
|
||||||
* A 'make' utility (most compiler installations already have one of these).
|
* A 'make' utility (most compiler installations already have one of these).
|
||||||
|
|
||||||
* CMake: https://cmake.org/download/
|
* CMake v3.0 or newer: https://cmake.org/download/
|
||||||
|
|
||||||
|
|
||||||
2. Build:
|
2. Build:
|
||||||
|
@ -61,30 +61,32 @@ STANDARD BUILD
|
||||||
|
|
||||||
BUILD CUSTOMISATION
|
BUILD CUSTOMISATION
|
||||||
|
|
||||||
If it is necessary to customise the build, then steps 2 and 3 above may be
|
If it is necessary to customise the build, then steps 2 and 3 above should be
|
||||||
substituted as follows. Change directory to the one containing this file,
|
substituted as follows: change directory to the one containing this file, then
|
||||||
then enter commands along the lines of:
|
enter commands along the lines:
|
||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake [OPTIONS] ..
|
cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release [OPTIONS] ..
|
||||||
make
|
make
|
||||||
make test
|
make test
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
|
N.B. The CMAKE_BUILD_TYPE to use for library deployment is Release.
|
||||||
|
|
||||||
To list help on the available options, enter:
|
To list help on the available options, enter:
|
||||||
|
|
||||||
cmake -LH ..
|
cmake -LH ..
|
||||||
|
|
||||||
Options, if given, should be preceded with '-D', e.g.
|
Options, if given, should be preceded with '-D', e.g.
|
||||||
|
|
||||||
cmake -DBUILD_SHARED_LIBS:BOOL=OFF ..
|
-DBUILD_SHARED_LIBS:BOOL=OFF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Resampling engines
|
Resampling engines
|
||||||
|
|
||||||
As available on a given system, options for including up to five resampling
|
As available on a given system, options for including up-to five resampling
|
||||||
‘engines’ are available (per above) as follows:
|
‘engines’ are available (per above) as follows:
|
||||||
|
|
||||||
WITH_CR32: for constant-rate HQ resampling,
|
WITH_CR32: for constant-rate HQ resampling,
|
||||||
|
@ -98,7 +100,9 @@ By default, these options are all set to ON.
|
||||||
When both SIMD and non-SIMD engine variants are included, run-time selection
|
When both SIMD and non-SIMD engine variants are included, run-time selection
|
||||||
is automatic (based on CPU capability) for x86 CPUs, and can be automatic for
|
is automatic (based on CPU capability) for x86 CPUs, and can be automatic for
|
||||||
ARM CPUs if the 3rd-party library `libavutil' is available at libsoxr
|
ARM CPUs if the 3rd-party library `libavutil' is available at libsoxr
|
||||||
build-time.
|
build-time. Which engine has been selected for a specific configuration and
|
||||||
|
invocation of the library can be checked using example #3, which reports it.
|
||||||
|
See also Run-time Configuration, below.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,7 +157,7 @@ Autotools-based systems might find it useful to create a file called
|
||||||
cmake -DBUILD_SHARED_LIBS=OFF .
|
cmake -DBUILD_SHARED_LIBS=OFF .
|
||||||
(or with other build options as required).
|
(or with other build options as required).
|
||||||
|
|
||||||
For MS Visual C++, see msvc/README.
|
For MS Visual Studio, see msvc/README.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,11 +165,11 @@ RUN-TIME CONFIGURATION
|
||||||
|
|
||||||
The libsoxr API structure ‘soxr_runtime_spec_t’ allows application developers
|
The libsoxr API structure ‘soxr_runtime_spec_t’ allows application developers
|
||||||
to optimise some aspects of libsoxr’s operation for a particular application.
|
to optimise some aspects of libsoxr’s operation for a particular application.
|
||||||
However, since optimal performance might depend on an individual end-user’s
|
Optimal performance however, might depend on an individual end-user’s run-
|
||||||
run-time system and the end-user’s preferences, environment variables are
|
time system and the end-user’s preferences. Hence environment variables are
|
||||||
available to set (override) run-time parameters as follows:
|
available to set (override) run-time parameters as follows:
|
||||||
|
|
||||||
Env. variable Equivalent soxr_runtime_spec_t item
|
Env. variable Equivalent soxr_runtime_spec_t item (see soxr.h)
|
||||||
------------------ -----------------------------------
|
------------------ -----------------------------------
|
||||||
SOXR_COEFS_SIZE coef_size_kbytes
|
SOXR_COEFS_SIZE coef_size_kbytes
|
||||||
SOXR_COEF_INTERP SOXR_COEF_INTERP_xxx
|
SOXR_COEF_INTERP SOXR_COEF_INTERP_xxx
|
||||||
|
@ -173,8 +177,7 @@ available to set (override) run-time parameters as follows:
|
||||||
SOXR_MIN_DFT_SIZE log2_min_dft_size
|
SOXR_MIN_DFT_SIZE log2_min_dft_size
|
||||||
SOXR_NUM_THREADS num_threads
|
SOXR_NUM_THREADS num_threads
|
||||||
|
|
||||||
Additionally, the SOXR_USE_SIMD32 and SOXR_USE_SIMD64 environment variables
|
Additionally, the SOXR_USE_SIMD32 and SOXR_USE_SIMD64 boolean environment
|
||||||
may be used to override automatic selection (or to provide manual selection
|
variables can be used to override automatic selection (or to provide manual
|
||||||
where automatic selection is not available) between SIMD and non-SIMD engine
|
selection where automatic selection is not available) between SIMD and
|
||||||
variants. (Which engine is selected for a specific configuration of libsoxr
|
non-SIMD engine variants.
|
||||||
can be checked using example #3, which reports it.)
|
|
||||||
|
|
6
NEWS
6
NEWS
|
@ -1,8 +1,8 @@
|
||||||
Version 0.1.3 (2016-mm-dd)
|
Version 0.1.3 (2016-mm-dd)
|
||||||
* SIMD enhancements: SSE, AVX, Neon.
|
* SIMD enhancements: SSE, AVX, Neon.
|
||||||
* Improved support for clang, ARM, and cross-compilation.
|
* Improve support for clang, ARM, and cross-compilation.
|
||||||
* Other minor fixes/improvements to build/tests/documentation.
|
* Provide env. var. override of runtime parameters.
|
||||||
* N.B. some cmake configuration variable name changes.
|
* N.B. some build configuration name changes; see INSTALL.
|
||||||
|
|
||||||
Version 0.1.2 (2015-09-05)
|
Version 0.1.2 (2015-09-05)
|
||||||
* Fix conversion failure when I/O types differ but I/O rates don't.
|
* Fix conversion failure when I/O types differ but I/O rates don't.
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
# SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
|
||||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
|
||||||
|
|
||||||
# - Finds OpenMP support
|
|
||||||
#
|
|
||||||
# The following variables are set:
|
|
||||||
# OpenMP_C_FLAGS - flags to add to the C compiler for this package.
|
|
||||||
# OpenMP_FOUND - true if support for this package is found.
|
|
||||||
|
|
||||||
if (DEFINED OpenMP_C_FLAGS)
|
|
||||||
set (TRIAL_C_FLAGS)
|
|
||||||
else ()
|
|
||||||
set (TRIAL_C_FLAGS
|
|
||||||
"-fopenmp" # Gnu
|
|
||||||
"-fopenmp=libiomp5" # Clang
|
|
||||||
"/openmp" # MSVC
|
|
||||||
" "
|
|
||||||
)
|
|
||||||
|
|
||||||
set (TEST_C_SOURCE "
|
|
||||||
#ifndef _OPENMP
|
|
||||||
#error
|
|
||||||
#endif
|
|
||||||
#include <omp.h>
|
|
||||||
int main() {return 0;}
|
|
||||||
")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
include (FindCFlags)
|
|
||||||
|
|
||||||
FindCFlags ("OpenMP" "OpenMP threading"
|
|
||||||
"${TRIAL_C_FLAGS}" "${TEST_C_SOURCE}")
|
|
||||||
|
|
||||||
if (MINGW)
|
|
||||||
set (OpenMP_SHARED_LINKER_FLAGS "${OpenMP_SHARED_LINKER_FLAGS} ${OpenMP_C_FLAGS}")
|
|
||||||
set (OpenMP_EXE_LINKER_FLAGS "${OpenMP_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS}")
|
|
||||||
mark_as_advanced (OpenMP_SHARED_LINKER_FLAGS OpenMP_EXE_LINKER_FLAGS)
|
|
||||||
endif ()
|
|
|
@ -19,9 +19,9 @@ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
|
||||||
)
|
)
|
||||||
set (TEST_C_SOURCE "
|
set (TEST_C_SOURCE "
|
||||||
#include <arm_neon.h>
|
#include <arm_neon.h>
|
||||||
int main() {
|
int main(int c, char * * v) {
|
||||||
float32x4_t a = vdupq_n_f32(0), b = a, c = vaddq_f32(a,b);
|
float32x4_t a = vdupq_n_f32((float)c), b = vdupq_n_f32((float)!!v);
|
||||||
return 0;
|
return !vgetq_lane_u32(vceqq_f32(a,b),0);
|
||||||
}
|
}
|
||||||
")
|
")
|
||||||
else ()
|
else ()
|
||||||
|
@ -41,9 +41,9 @@ else ()
|
||||||
)
|
)
|
||||||
set (TEST_C_SOURCE "
|
set (TEST_C_SOURCE "
|
||||||
#include <xmmintrin.h>
|
#include <xmmintrin.h>
|
||||||
int main() {
|
int main(int c, char * * v) {
|
||||||
__m128 a = _mm_setzero_ps(), b = a, c = _mm_add_ps(a,b);
|
__m128 a = _mm_set_ss((float)c), b = _mm_set_ss((float)!!v);
|
||||||
return 0;
|
return _mm_comineq_ss(a,b);
|
||||||
}
|
}
|
||||||
")
|
")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -1,35 +1,37 @@
|
||||||
# SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
# SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||||
|
|
||||||
# Sets CMAKE_SYSTEM_PROCESSOR (for cross-compiling).
|
# Sets CMAKE_SYSTEM_PROCESSOR for cross-compiling.
|
||||||
|
|
||||||
macro (set_system_processor)
|
macro (set_system_processor)
|
||||||
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "unknown")
|
if (CMAKE_CROSSCOMPILING)
|
||||||
unset(CMAKE_SYSTEM_PROCESSOR)
|
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "unknown")
|
||||||
endif ()
|
unset(CMAKE_SYSTEM_PROCESSOR)
|
||||||
if (NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
|
endif ()
|
||||||
include (CheckCSourceCompiles)
|
if (NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
|
||||||
set (CPU_LINES
|
include (CheckCSourceCompiles)
|
||||||
"#if defined __x86_64__ || defined _M_X64 /*\;x86_64\;*/"
|
set (CPU_LINES
|
||||||
"#if defined __i386__ || defined _M_IX86 /*\;x86_32\;*/"
|
"#if defined __x86_64__ || defined _M_X64 /*\;x86_64\;*/"
|
||||||
"#if defined __arm__ || defined _M_ARM /*\;arm\;*/"
|
"#if defined __i386__ || defined _M_IX86 /*\;x86_32\;*/"
|
||||||
)
|
"#if defined __arm__ || defined _M_ARM /*\;arm\;*/"
|
||||||
foreach (CPU_LINE ${CPU_LINES})
|
)
|
||||||
string (CONCAT CPU_SOURCE "${CPU_LINE}" "
|
foreach (CPU_LINE ${CPU_LINES})
|
||||||
int main() {return 0;}
|
string (CONCAT CPU_SOURCE "${CPU_LINE}" "
|
||||||
#endif
|
int main() {return 0;}
|
||||||
")
|
#endif
|
||||||
unset (SYSTEM_PROCESSOR_DETECTED CACHE)
|
")
|
||||||
check_c_source_compiles ("${CPU_SOURCE}" SYSTEM_PROCESSOR_DETECTED)
|
unset (SYSTEM_PROCESSOR_DETECTED CACHE)
|
||||||
if (SYSTEM_PROCESSOR_DETECTED)
|
check_c_source_compiles ("${CPU_SOURCE}" SYSTEM_PROCESSOR_DETECTED)
|
||||||
list (GET CPU_LINE 1 CMAKE_SYSTEM_PROCESSOR)
|
if (SYSTEM_PROCESSOR_DETECTED)
|
||||||
message (STATUS "CMAKE_SYSTEM_PROCESSOR is ${CMAKE_SYSTEM_PROCESSOR}")
|
list (GET CPU_LINE 1 CMAKE_SYSTEM_PROCESSOR)
|
||||||
break ()
|
message (STATUS "CMAKE_SYSTEM_PROCESSOR is ${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
endif ()
|
break ()
|
||||||
endforeach ()
|
endif ()
|
||||||
endif ()
|
endforeach ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
# N.B. Will not overwrite existing cache variable:
|
# N.B. Will not overwrite existing cache variable:
|
||||||
set (CMAKE_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}"
|
set (CMAKE_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}"
|
||||||
CACHE STRING "Target system processor")
|
CACHE STRING "Target system processor")
|
||||||
|
endif ()
|
||||||
endmacro ()
|
endmacro ()
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
# SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
# SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||||
|
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROJECT_C_FLAGS}")
|
||||||
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROJECT_CXX_FLAGS}")
|
||||||
|
link_libraries (${PROJECT_NAME} ${LIBM_LIBRARIES})
|
||||||
|
|
||||||
if (${BUILD_EXAMPLES} OR ${BUILD_TESTS})
|
if (${BUILD_EXAMPLES} OR ${BUILD_TESTS})
|
||||||
set (SOURCES 3-options-input-fn)
|
set (SOURCES 3-options-input-fn)
|
||||||
if (${WITH_LSR_BINDINGS})
|
if (${WITH_LSR_BINDINGS})
|
||||||
|
@ -9,20 +13,12 @@ if (${BUILD_EXAMPLES} OR ${BUILD_TESTS})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (${BUILD_EXAMPLES})
|
if (${BUILD_EXAMPLES})
|
||||||
project (soxr) # Adds c++ compiler
|
|
||||||
list (APPEND SOURCES 1-single-block 2-stream 4-split-channels)
|
list (APPEND SOURCES 1-single-block 2-stream 4-split-channels)
|
||||||
if (${WITH_VR32})
|
if (${WITH_VR32})
|
||||||
list (APPEND SOURCES 5-variable-rate)
|
list (APPEND SOURCES 5-variable-rate)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT BUILD_SHARED_LIBS AND OPENMP_FOUND)
|
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_C_FLAGS}")
|
|
||||||
endif ()
|
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROJECT_C_FLAGS}")
|
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROJECT_CXX_FLAGS}")
|
|
||||||
link_libraries (${PROJECT_NAME} ${LIBM_LIBRARIES})
|
|
||||||
|
|
||||||
foreach (fe ${SOURCES} ${LSR_SOURCES})
|
foreach (fe ${SOURCES} ${LSR_SOURCES})
|
||||||
get_filename_component (f ${fe} NAME_WE)
|
get_filename_component (f ${fe} NAME_WE)
|
||||||
add_executable (${f} ${fe})
|
add_executable (${f} ${fe})
|
||||||
|
|
13
go
13
go
|
@ -1,19 +1,18 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
|
# SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||||
|
|
||||||
case $1 in -j*) j=$1; shift;; esac # Support -jX for parallel build/test
|
case "$1" in -j*) j="$1"; shift;; esac # Support -jX for parallel build/test
|
||||||
|
|
||||||
build=$1
|
test x"$1" = x && build=Release || build="$1"
|
||||||
test x$build = x && build=Release
|
|
||||||
|
|
||||||
rm -f CMakeCache.txt # Prevent interference from any in-tree build
|
rm -f CMakeCache.txt # Prevent interference from any in-tree build
|
||||||
|
|
||||||
mkdir -p $build
|
mkdir -p "$build"
|
||||||
cd $build
|
cd "$build"
|
||||||
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=$build -Wno-dev ..
|
cmake -Wno-dev -DCMAKE_BUILD_TYPE="$build" ..
|
||||||
make $j
|
make $j
|
||||||
ctest $j || echo "FAILURE details in $build/Testing/Temporary/LastTest.log"
|
ctest $j || echo "FAILURE details in $build/Testing/Temporary/LastTest.log"
|
||||||
|
|
27
msvc/README
27
msvc/README
|
@ -1,9 +1,22 @@
|
||||||
SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
|
SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
|
|
||||||
Cmake is able to configure, build (as either a DLL or a static library),
|
Cmake is the recommended way to configure, build (as either a DLL or a static
|
||||||
and install libsoxr for general use on MS-Windows as on other OSs.
|
library), and install libsoxr for general use on MS-Windows, as on other OSs.
|
||||||
However, for projects that prefer to maintain a more monolithic build
|
|
||||||
structure using the MSVC compiler, the accompanying files may be useful.
|
|
||||||
|
|
||||||
* libsoxr.vcproj Builds a static lib for MSVC ver >= 9 (2008).
|
However, building within MS Visual Studio is also possible, as exemplified by
|
||||||
* soxr-config.h Pre-configured for a typical Win32 system.
|
the accompanying files:
|
||||||
|
|
||||||
|
* soxr-config.h Pre-configured for a modern Win32 system.
|
||||||
|
|
||||||
|
* libsoxr.vcproj Builds the library as a DLL, per above.
|
||||||
|
|
||||||
|
* libsoxr.sln, Build an example exe using the above.
|
||||||
|
example1.vcproj
|
||||||
|
|
||||||
|
The following notes apply to adaptation of these files:
|
||||||
|
|
||||||
|
* For a system without AVX support, set WITH_CR64S to 0 in
|
||||||
|
soxr-config.h and exclude the three files ...64s.c from the build.
|
||||||
|
|
||||||
|
* If changing libsoxr.vcproj to build a static library, then also
|
||||||
|
remove the preprocessor definition: SOXR_DLL.
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="example1"
|
||||||
|
ProjectGUID="{CA28595B-B14F-45FD-BA56-FBDFFB70FFC4}"
|
||||||
|
RootNamespace="soxr"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform Name="Win32" />
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\src"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
AdditionalIncludeDirectories="..\src"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<File RelativePath="..\examples\1-single-block.c" />
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual C++ Express 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example1", "example1.vcproj", "{CA28595B-B14F-45FD-BA56-FBDFFB70FFC4}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{4916B0C1-2F99-433A-B88A-A99CB4E1E0AB} = {4916B0C1-2F99-433A-B88A-A99CB4E1E0AB}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsoxr", "libsoxr.vcproj", "{4916B0C1-2F99-433A-B88A-A99CB4E1E0AB}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{CA28595B-B14F-45FD-BA56-FBDFFB70FFC4}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{CA28595B-B14F-45FD-BA56-FBDFFB70FFC4}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{CA28595B-B14F-45FD-BA56-FBDFFB70FFC4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{CA28595B-B14F-45FD-BA56-FBDFFB70FFC4}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{4916B0C1-2F99-433A-B88A-A99CB4E1E0AB}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{4916B0C1-2F99-433A-B88A-A99CB4E1E0AB}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{4916B0C1-2F99-433A-B88A-A99CB4E1E0AB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{4916B0C1-2F99-433A-B88A-A99CB4E1E0AB}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -3,9 +3,10 @@
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="9.00"
|
Version="9.00"
|
||||||
Name="libsoxr"
|
Name="libsoxr"
|
||||||
ProjectGUID="{af9ad75c-4785-4432-bac3-adab1e7f1192}"
|
ProjectGUID="{4916B0C1-2F99-433A-B88A-A99CB4E1E0AB}"
|
||||||
RootNamespace="libsoxr"
|
RootNamespace="libsoxr"
|
||||||
TargetFrameworkVersion="131072"
|
Keyword="Win32Proj"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
>
|
>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform Name="Win32" />
|
<Platform Name="Win32" />
|
||||||
|
@ -17,68 +18,79 @@
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="4"
|
ConfigurationType="2"
|
||||||
CharacterSet="2"
|
CharacterSet="1"
|
||||||
WholeProgramOptimization="0"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="."
|
AdditionalIncludeDirectories="."
|
||||||
PreprocessorDefinitions="_DEBUG;_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;SOXR_LIB"
|
PreprocessorDefinitions="_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;SOXR_LIB;SOXR_DLL;soxr_EXPORTS"
|
||||||
StringPooling="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
EnableFunctionLevelLinking="true"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="4"
|
DebugInformationFormat="4"
|
||||||
CompileAs="0"
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
TargetMachine="1"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="4"
|
ConfigurationType="2"
|
||||||
CharacterSet="2"
|
CharacterSet="1"
|
||||||
WholeProgramOptimization="1"
|
WholeProgramOptimization="1"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
AdditionalIncludeDirectories="."
|
AdditionalIncludeDirectories="."
|
||||||
PreprocessorDefinitions="NDEBUG;_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;SOXR_LIB"
|
PreprocessorDefinitions="NDEBUG;_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;SOXR_LIB;SOXR_DLL;soxr_EXPORTS"
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableFunctionLevelLinking="true"
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
CompileAs="0"
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<Filter Name="Source Files" >
|
<File RelativePath="..\src\cr.c" />
|
||||||
<File RelativePath="../src/constructors.c" />
|
<File RelativePath="..\src\cr32.c" />
|
||||||
<File RelativePath="../src/cr.c" />
|
<File RelativePath="..\src\cr32s.c" />
|
||||||
<File RelativePath="../src/cr32.c" />
|
<File RelativePath="..\src\cr64.c" />
|
||||||
<File RelativePath="../src/cr32s.c" />
|
<File RelativePath="..\src\cr64s.c" />
|
||||||
<File RelativePath="../src/cr64.c" />
|
<File RelativePath="..\src\data-io.c" />
|
||||||
<File RelativePath="../src/cr64s.c" />
|
<File RelativePath="..\src\dbesi0.c" />
|
||||||
<File RelativePath="../src/data-io.c" />
|
<File RelativePath="..\src\fft4g32.c" />
|
||||||
<File RelativePath="../src/dbesi0.c" />
|
<File RelativePath="..\src\fft4g64.c" />
|
||||||
<File RelativePath="../src/fft4g32.c" />
|
<File RelativePath="..\src\filter.c" />
|
||||||
<File RelativePath="../src/fft4g64.c" />
|
<File RelativePath="..\src\pffft32s.c" />
|
||||||
<File RelativePath="../src/filter.c" />
|
<File RelativePath="..\src\pffft64s.c" />
|
||||||
<File RelativePath="../src/lsr.c" />
|
<File RelativePath="..\src\util32s.c" />
|
||||||
<File RelativePath="../src/pffft32s.c" />
|
<File RelativePath="..\src\util64s.c" />
|
||||||
<File RelativePath="../src/pffft64s.c" />
|
<File RelativePath="..\src\soxr.c" />
|
||||||
<File RelativePath="../src/simd32.c" />
|
<File RelativePath="..\src\vr32.c" />
|
||||||
<File RelativePath="../src/simd64.c" />
|
|
||||||
<File RelativePath="../src/soxr.c" />
|
|
||||||
<File RelativePath="../src/vr32.c" />
|
|
||||||
</Filter>
|
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
|
|
@ -1,26 +1,27 @@
|
||||||
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
||||||
|
|
||||||
/* N.B. Pre-configured for typical MS-Windows systems. However, the normal
|
/* N.B. Pre-configured for modern MS-Windows systems. However, the normal
|
||||||
* procedure is to use the cmake configuration and build system. See INSTALL. */
|
* procedure is to use the cmake configuration and build system. See INSTALL. */
|
||||||
|
|
||||||
#if !defined soxr_config_included
|
#if !defined soxr_config_included
|
||||||
#define soxr_config_included
|
#define soxr_config_included
|
||||||
|
|
||||||
|
#define AVCODEC_FOUND 0
|
||||||
|
#define AVUTIL_FOUND 0
|
||||||
|
|
||||||
|
#define HAVE_FENV_H 1
|
||||||
|
#define HAVE_STDBOOL_H 1
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#define HAVE_LRINT 1
|
||||||
|
#define HAVE_BIGENDIAN 0
|
||||||
|
|
||||||
#define WITH_CR32 1
|
#define WITH_CR32 1
|
||||||
#define WITH_CR32S 1
|
#define WITH_CR32S 1
|
||||||
#define WITH_CR64 1
|
#define WITH_CR64 1
|
||||||
#define WITH_CR64S 1
|
#define WITH_CR64S 1
|
||||||
#define WITH_VR32 1
|
#define WITH_VR32 1
|
||||||
|
|
||||||
#define AVCODEC_FOUND 0
|
#define WITH_DEV_TRACE 1
|
||||||
#define AVUTIL_FOUND 0
|
|
||||||
|
|
||||||
#define HAVE_FENV_H 0
|
|
||||||
#define HAVE_STDBOOL_H 0
|
|
||||||
#define HAVE_STDINT_H 0
|
|
||||||
#define HAVE_LRINT 0
|
|
||||||
#define HAVE_BIGENDIAN 0
|
|
||||||
#define WITH_DEV_TRACE 0
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,12 +4,6 @@
|
||||||
#if !defined soxr_config_included
|
#if !defined soxr_config_included
|
||||||
#define soxr_config_included
|
#define soxr_config_included
|
||||||
|
|
||||||
#cmakedefine01 WITH_CR32
|
|
||||||
#cmakedefine01 WITH_CR32S
|
|
||||||
#cmakedefine01 WITH_CR64
|
|
||||||
#cmakedefine01 WITH_CR64S
|
|
||||||
#cmakedefine01 WITH_VR32
|
|
||||||
|
|
||||||
#cmakedefine01 AVCODEC_FOUND
|
#cmakedefine01 AVCODEC_FOUND
|
||||||
#cmakedefine01 AVUTIL_FOUND
|
#cmakedefine01 AVUTIL_FOUND
|
||||||
|
|
||||||
|
@ -18,6 +12,13 @@
|
||||||
#cmakedefine01 HAVE_STDINT_H
|
#cmakedefine01 HAVE_STDINT_H
|
||||||
#cmakedefine01 HAVE_LRINT
|
#cmakedefine01 HAVE_LRINT
|
||||||
#cmakedefine01 HAVE_BIGENDIAN
|
#cmakedefine01 HAVE_BIGENDIAN
|
||||||
|
|
||||||
|
#cmakedefine01 WITH_CR32
|
||||||
|
#cmakedefine01 WITH_CR32S
|
||||||
|
#cmakedefine01 WITH_CR64
|
||||||
|
#cmakedefine01 WITH_CR64S
|
||||||
|
#cmakedefine01 WITH_VR32
|
||||||
|
|
||||||
#cmakedefine01 WITH_DEV_TRACE
|
#cmakedefine01 WITH_DEV_TRACE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,7 +35,7 @@ elseif (WITH_CR32S)
|
||||||
set (RDFT32S fft4g32s fft4g32)
|
set (RDFT32S fft4g32s fft4g32)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set (SOURCES ${PROJECT_NAME}.c constructors data-io)
|
set (SOURCES ${PROJECT_NAME}.c data-io)
|
||||||
|
|
||||||
if (WITH_CR32 OR WITH_CR32S OR WITH_CR64 OR WITH_CR64S)
|
if (WITH_CR32 OR WITH_CR32S OR WITH_CR64 OR WITH_CR64S)
|
||||||
list (APPEND SOURCES dbesi0 filter fft4g64 cr.c)
|
list (APPEND SOURCES dbesi0 filter fft4g64 cr.c)
|
||||||
|
@ -54,7 +54,7 @@ if (WITH_VR32)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (WITH_CR32S)
|
if (WITH_CR32S)
|
||||||
foreach (source cr32s ${RDFT32S} simd32)
|
foreach (source cr32s ${RDFT32S} util32s)
|
||||||
list (APPEND SOURCES ${source})
|
list (APPEND SOURCES ${source})
|
||||||
set_property (SOURCE ${source}
|
set_property (SOURCE ${source}
|
||||||
APPEND_STRING PROPERTY COMPILE_FLAGS ${SIMD32_C_FLAGS})
|
APPEND_STRING PROPERTY COMPILE_FLAGS ${SIMD32_C_FLAGS})
|
||||||
|
@ -62,7 +62,7 @@ if (WITH_CR32S)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (WITH_CR64S)
|
if (WITH_CR64S)
|
||||||
foreach (source cr64s pffft64s simd64)
|
foreach (source cr64s pffft64s util64s)
|
||||||
list (APPEND SOURCES ${source})
|
list (APPEND SOURCES ${source})
|
||||||
set_property (SOURCE ${source}
|
set_property (SOURCE ${source}
|
||||||
APPEND_STRING PROPERTY COMPILE_FLAGS ${SIMD64_C_FLAGS})
|
APPEND_STRING PROPERTY COMPILE_FLAGS ${SIMD64_C_FLAGS})
|
||||||
|
@ -97,7 +97,7 @@ if (WITH_LSR_BINDINGS)
|
||||||
set (LSR ${PROJECT_NAME}-lsr)
|
set (LSR ${PROJECT_NAME}-lsr)
|
||||||
set (LSR_SO_VERSION 0.1.9)
|
set (LSR_SO_VERSION 0.1.9)
|
||||||
set (LSR_SO_VERSION_MAJOR 0)
|
set (LSR_SO_VERSION_MAJOR 0)
|
||||||
add_library (${LSR} ${LIB_TYPE} lsr)
|
add_library (${LSR} ${LIB_TYPE} ${LSR})
|
||||||
target_link_libraries (${LSR} ${PROJECT_NAME})
|
target_link_libraries (${LSR} ${PROJECT_NAME})
|
||||||
set_target_properties (${LSR} PROPERTIES
|
set_target_properties (${LSR} PROPERTIES
|
||||||
VERSION "${LSR_SO_VERSION}"
|
VERSION "${LSR_SO_VERSION}"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
|
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
||||||
|
|
||||||
#if defined SOXR_LIB
|
#if defined SOXR_LIB
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <libavcodec/avfft.h>
|
#include <libavcodec/avfft.h>
|
||||||
#include "simd32.h"
|
#include "util32s.h"
|
||||||
#include "rdft_t.h"
|
#include "rdft_t.h"
|
||||||
|
|
||||||
static void * forward_setup(int len) {return av_rdft_init((int)(log(len)/log(2)+.5),DFT_R2C);}
|
static void * forward_setup(int len) {return av_rdft_init((int)(log(len)/log(2)+.5),DFT_R2C);}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
/* Concurrent Control with "Readers" and "Writers", P.J. Courtois et al, 1971 */
|
/* Concurrent Control with "Readers" and "Writers", P.J. Courtois et al, 1971 */
|
||||||
|
|
||||||
#if !defined ccrw2_included
|
#if !defined soxr_ccrw2_included
|
||||||
#define ccrw2_included
|
#define soxr_ccrw2_included
|
||||||
|
|
||||||
#if defined SOXR_LIB
|
#if defined SOXR_LIB
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
|
@ -1,85 +0,0 @@
|
||||||
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
|
||||||
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
|
||||||
|
|
||||||
#include "soxr.h"
|
|
||||||
#include "filter.h"
|
|
||||||
#include "internal.h"
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#if !WITH_CR32 && !WITH_CR32S && !WITH_CR64 && !WITH_CR64S
|
|
||||||
#undef lsx_to_3dB
|
|
||||||
#define lsx_to_3dB(x) ((x)/(x))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
soxr_quality_spec_t soxr_quality_spec(unsigned long recipe, unsigned long flags)
|
|
||||||
{
|
|
||||||
soxr_quality_spec_t spec, * p = &spec;
|
|
||||||
unsigned quality = recipe & 0xf;
|
|
||||||
double rej;
|
|
||||||
memset(p, 0, sizeof(*p));
|
|
||||||
if (quality > SOXR_PRECISIONQ) {
|
|
||||||
p->e = "invalid quality type";
|
|
||||||
return spec;
|
|
||||||
}
|
|
||||||
flags |= quality < SOXR_LSR0Q ? RESET_ON_CLEAR : 0;
|
|
||||||
p->phase_response = "\62\31\144"[(recipe & 0x30)>>4];
|
|
||||||
p->stopband_begin = 1;
|
|
||||||
p->precision =
|
|
||||||
quality == SOXR_QQ ? 0 :
|
|
||||||
quality <= SOXR_16_BITQ ? 16 :
|
|
||||||
quality <= SOXR_32_BITQ ? 4 + quality * 4 :
|
|
||||||
quality <= SOXR_LSR2Q ? 55 - quality * 4 : /* TODO: move to lsr.c */
|
|
||||||
0;
|
|
||||||
rej = p->precision * linear_to_dB(2.);
|
|
||||||
p->flags = flags;
|
|
||||||
if (quality <= SOXR_32_BITQ || quality == SOXR_PRECISIONQ) {
|
|
||||||
#define LOW_Q_BW0 (1385 / 2048.) /* 0.67625 rounded to be a FP exact. */
|
|
||||||
p->passband_end = quality == 1? LOW_Q_BW0 : 1 - .05 / lsx_to_3dB(rej);
|
|
||||||
if (quality <= 2)
|
|
||||||
p->flags &= ~SOXR_ROLLOFF_NONE, p->flags |= SOXR_ROLLOFF_MEDIUM;
|
|
||||||
}
|
|
||||||
else { /* TODO: move to lsr.c */
|
|
||||||
static float const bw[] = {.931f, .832f, .663f};
|
|
||||||
p->passband_end = bw[quality - SOXR_LSR0Q];
|
|
||||||
if (quality == SOXR_LSR2Q)
|
|
||||||
p->flags &= ~SOXR_ROLLOFF_NONE, p->flags |= SOXR_ROLLOFF_LSR2Q | SOXR_PROMOTE_TO_LQ;
|
|
||||||
}
|
|
||||||
if (recipe & SOXR_STEEP_FILTER)
|
|
||||||
p->passband_end = 1 - .01 / lsx_to_3dB(rej);
|
|
||||||
return spec;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
soxr_runtime_spec_t soxr_runtime_spec(unsigned num_threads)
|
|
||||||
{
|
|
||||||
soxr_runtime_spec_t spec, * p = &spec;
|
|
||||||
memset(p, 0, sizeof(*p));
|
|
||||||
p->log2_min_dft_size = 10;
|
|
||||||
p->log2_large_dft_size = 17;
|
|
||||||
p->coef_size_kbytes = 400;
|
|
||||||
p->num_threads = num_threads;
|
|
||||||
return spec;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
soxr_io_spec_t soxr_io_spec(
|
|
||||||
soxr_datatype_t itype,
|
|
||||||
soxr_datatype_t otype)
|
|
||||||
{
|
|
||||||
soxr_io_spec_t spec, * p = &spec;
|
|
||||||
memset(p, 0, sizeof(*p));
|
|
||||||
if ((itype | otype) >= SOXR_SPLIT * 2)
|
|
||||||
p->e = "invalid io datatype(s)";
|
|
||||||
else {
|
|
||||||
p->itype = itype;
|
|
||||||
p->otype = otype;
|
|
||||||
p->scale = 1;
|
|
||||||
}
|
|
||||||
return spec;
|
|
||||||
}
|
|
|
@ -31,11 +31,11 @@
|
||||||
|
|
||||||
#if CORE_TYPE & (CORE_SIMD_POLY|CORE_SIMD_HALF|CORE_SIMD_DFT)
|
#if CORE_TYPE & (CORE_SIMD_POLY|CORE_SIMD_HALF|CORE_SIMD_DFT)
|
||||||
#if CORE_TYPE & CORE_DBL
|
#if CORE_TYPE & CORE_DBL
|
||||||
#include "simd64.h"
|
#include "util64s.h"
|
||||||
#include "simd64-dev.h"
|
#include "dev64s.h"
|
||||||
#else
|
#else
|
||||||
#include "simd32.h"
|
#include "util32s.h"
|
||||||
#include "simd32-dev.h"
|
#include "dev32s.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
4
src/cr.h
4
src/cr.h
|
@ -1,8 +1,8 @@
|
||||||
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
||||||
|
|
||||||
#if !defined soxr_rate1_included
|
#if !defined soxr_cr_included
|
||||||
#define soxr_rate1_included
|
#define soxr_cr_included
|
||||||
|
|
||||||
#define FIFO_SIZE_T int
|
#define FIFO_SIZE_T int
|
||||||
#include "fifo.h"
|
#include "fifo.h"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
||||||
|
|
||||||
#if !defined soxr_simd_dev_included
|
#if !defined soxr_dev32s_included
|
||||||
#define soxr_simd_dev_included
|
#define soxr_dev32s_included
|
||||||
|
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
#define SIMD_INLINE(T) static __inline T __attribute__((always_inline))
|
#define SIMD_INLINE(T) static __inline T __attribute__((always_inline))
|
|
@ -1,8 +1,8 @@
|
||||||
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
||||||
|
|
||||||
#if !defined soxr_simd64_dev_included
|
#if !defined soxr_dev64s_included
|
||||||
#define soxr_simd64_dev_included
|
#define soxr_dev64s_included
|
||||||
|
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
#define SIMD_INLINE(T) static __inline T __attribute__((always_inline))
|
#define SIMD_INLINE(T) static __inline T __attribute__((always_inline))
|
|
@ -2,7 +2,7 @@
|
||||||
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
||||||
|
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
#include "simd.h"
|
#include "util32s.h"
|
||||||
#include "rdft_t.h"
|
#include "rdft_t.h"
|
||||||
|
|
||||||
static void * null(void) {return 0;}
|
static void * null(void) {return 0;}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
|
/* SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
|
||||||
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
||||||
|
|
||||||
#ifndef fifo_included
|
#ifndef soxr_fifo_included
|
||||||
#define fifo_included
|
#define soxr_fifo_included
|
||||||
|
|
||||||
#if !defined FIFO_SIZE_T
|
#if !defined FIFO_SIZE_T
|
||||||
#define FIFO_SIZE_T size_t
|
#define FIFO_SIZE_T size_t
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
#include "math-wrap.h"
|
#include "math-wrap.h"
|
||||||
|
|
||||||
#if PFFFT_DOUBLE
|
#if PFFFT_DOUBLE
|
||||||
#include "simd64.h"
|
#include "util64s.h"
|
||||||
#else
|
#else
|
||||||
#include "simd32.h"
|
#include "util32s.h"
|
||||||
#define sin(x) sinf(x)
|
#define sin(x) sinf(x)
|
||||||
#define cos(x) cosf(x)
|
#define cos(x) cosf(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -151,7 +151,7 @@ typedef __m128 v4sf;
|
||||||
# define VALIGNED(ptr) ((((long)(ptr)) & 0xF) == 0)
|
# define VALIGNED(ptr) ((((long)(ptr)) & 0xF) == 0)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include "avx.h"
|
#include "pffft-avx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -37,9 +37,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef float SRC_SAMPLE;
|
typedef float SRC_SAMPLE;
|
||||||
|
#if !defined SOXR_LIB
|
||||||
enum SRC_SRCTYPE_e {SRC_SINC_BEST_QUALITY, SRC_SINC_MEDIUM_QUALITY,
|
enum SRC_SRCTYPE_e {SRC_SINC_BEST_QUALITY, SRC_SINC_MEDIUM_QUALITY,
|
||||||
SRC_SINC_FASTEST, SRC_ZERO_ORDER_HOLD, SRC_LINEAR};
|
SRC_SINC_FASTEST, SRC_ZERO_ORDER_HOLD, SRC_LINEAR};
|
||||||
#if !defined SOXR_LIB
|
|
||||||
typedef int SRC_SRCTYPE;
|
typedef int SRC_SRCTYPE;
|
||||||
typedef int SRC_ERROR;
|
typedef int SRC_ERROR;
|
||||||
typedef long (* src_callback_t)(void *, SRC_SAMPLE * *);
|
typedef long (* src_callback_t)(void *, SRC_SAMPLE * *);
|
||||||
|
|
81
src/soxr.c
81
src/soxr.c
|
@ -43,6 +43,7 @@ char const * soxr_version(void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef void sample_t; /* float or double */
|
typedef void sample_t; /* float or double */
|
||||||
typedef void (* fn_t)(void);
|
typedef void (* fn_t)(void);
|
||||||
typedef fn_t control_block_t[10];
|
typedef fn_t control_block_t[10];
|
||||||
|
@ -91,6 +92,55 @@ struct soxr {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if !WITH_CR32 && !WITH_CR32S && !WITH_CR64 && !WITH_CR64S
|
||||||
|
#define lsx_to_3dB(x) ((x)/(x))
|
||||||
|
#else
|
||||||
|
#include "filter.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
soxr_quality_spec_t soxr_quality_spec(unsigned long recipe, unsigned long flags)
|
||||||
|
{
|
||||||
|
soxr_quality_spec_t spec, * p = &spec;
|
||||||
|
unsigned q = recipe & 0xf; /* TODO: move to soxr-lsr.c: */
|
||||||
|
unsigned quality = q > SOXR_LSR2Q+2? SOXR_VHQ : q > SOXR_LSR2Q? SOXR_QQ : q;
|
||||||
|
double rej;
|
||||||
|
memset(p, 0, sizeof(*p));
|
||||||
|
if (quality > SOXR_PRECISIONQ) {
|
||||||
|
p->e = "invalid quality type";
|
||||||
|
return spec;
|
||||||
|
}
|
||||||
|
flags |= quality < SOXR_LSR0Q ? RESET_ON_CLEAR : 0;
|
||||||
|
p->phase_response = "\62\31\144"[(recipe & 0x30)>>4];
|
||||||
|
p->stopband_begin = 1;
|
||||||
|
p->precision =
|
||||||
|
quality == SOXR_QQ ? 0 :
|
||||||
|
quality <= SOXR_16_BITQ ? 16 :
|
||||||
|
quality <= SOXR_32_BITQ ? 4 + quality * 4 :
|
||||||
|
quality <= SOXR_LSR2Q ? 55 - quality * 4 : /* TODO: move to soxr-lsr.c */
|
||||||
|
0;
|
||||||
|
rej = p->precision * linear_to_dB(2.);
|
||||||
|
p->flags = flags;
|
||||||
|
if (quality <= SOXR_32_BITQ || quality == SOXR_PRECISIONQ) {
|
||||||
|
#define LOW_Q_BW0 (1385 / 2048.) /* 0.67625 rounded to be a FP exact. */
|
||||||
|
p->passband_end = quality == 1? LOW_Q_BW0 : 1 - .05 / lsx_to_3dB(rej);
|
||||||
|
if (quality <= 2)
|
||||||
|
p->flags &= ~SOXR_ROLLOFF_NONE, p->flags |= SOXR_ROLLOFF_MEDIUM;
|
||||||
|
}
|
||||||
|
else { /* TODO: move to soxr-lsr.c */
|
||||||
|
static float const bw[] = {.931f, .832f, .663f};
|
||||||
|
p->passband_end = bw[quality - SOXR_LSR0Q];
|
||||||
|
if (quality == SOXR_LSR2Q)
|
||||||
|
p->flags &= ~SOXR_ROLLOFF_NONE, p->flags |= SOXR_ROLLOFF_LSR2Q | SOXR_PROMOTE_TO_LQ;
|
||||||
|
}
|
||||||
|
if (recipe & SOXR_STEEP_FILTER)
|
||||||
|
p->passband_end = 1 - .01 / lsx_to_3dB(rej);
|
||||||
|
return spec;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char const * soxr_engine(soxr_t p)
|
char const * soxr_engine(soxr_t p)
|
||||||
{
|
{
|
||||||
return resampler_id();
|
return resampler_id();
|
||||||
|
@ -112,6 +162,37 @@ soxr_error_t soxr_error(soxr_t p)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
soxr_runtime_spec_t soxr_runtime_spec(unsigned num_threads)
|
||||||
|
{
|
||||||
|
soxr_runtime_spec_t spec, * p = &spec;
|
||||||
|
memset(p, 0, sizeof(*p));
|
||||||
|
p->log2_min_dft_size = 10;
|
||||||
|
p->log2_large_dft_size = 17;
|
||||||
|
p->coef_size_kbytes = 400;
|
||||||
|
p->num_threads = num_threads;
|
||||||
|
return spec;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
soxr_io_spec_t soxr_io_spec(
|
||||||
|
soxr_datatype_t itype,
|
||||||
|
soxr_datatype_t otype)
|
||||||
|
{
|
||||||
|
soxr_io_spec_t spec, * p = &spec;
|
||||||
|
memset(p, 0, sizeof(*p));
|
||||||
|
if ((itype | otype) >= SOXR_SPLIT * 2)
|
||||||
|
p->e = "invalid io datatype(s)";
|
||||||
|
else {
|
||||||
|
p->itype = itype;
|
||||||
|
p->otype = otype;
|
||||||
|
p->scale = 1;
|
||||||
|
}
|
||||||
|
return spec;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if WITH_CR32S || WITH_CR64S
|
#if WITH_CR32S || WITH_CR64S
|
||||||
#if defined __GNUC__ && defined __x86_64__
|
#if defined __GNUC__ && defined __x86_64__
|
||||||
#define CPUID(type, eax_, ebx_, ecx_, edx_) \
|
#define CPUID(type, eax_, ebx_, ecx_, edx_) \
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
#define PFFFT_DOUBLE 0
|
#define PFFFT_DOUBLE 0
|
||||||
|
|
||||||
#include "simd32.h"
|
#include "util32s.h"
|
||||||
|
|
||||||
#include "simd.c"
|
#include "util-simd.c"
|
|
@ -1,8 +1,8 @@
|
||||||
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
||||||
|
|
||||||
#if !defined simd32_included
|
#if !defined soxr_util32s_included
|
||||||
#define simd32_included
|
#define soxr_util32s_included
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
#define PFFFT_DOUBLE 1
|
#define PFFFT_DOUBLE 1
|
||||||
|
|
||||||
#include "simd64.h"
|
#include "util64s.h"
|
||||||
|
|
||||||
#include "simd.c"
|
#include "util-simd.c"
|
|
@ -1,8 +1,8 @@
|
||||||
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
||||||
|
|
||||||
#if !defined simd64_included
|
#if !defined soxr_util64s_included
|
||||||
#define simd64_included
|
#define soxr_util64s_included
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
|
@ -103,6 +103,9 @@ static void iir(int N, double Fp, char const * name)
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
puts("/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net");
|
||||||
|
puts(" * Licence for this file: LGPL v2.1 See LICENCE for details. */\n");
|
||||||
|
|
||||||
fir(241, 1, .45, .5, 160, 32, "half_fir_coefs");
|
fir(241, 1, .45, .5, 160, 32, "half_fir_coefs");
|
||||||
fir( 24, .5, .25, .5, 1, 31, "fast_half_fir_coefs");
|
fir( 24, .5, .25, .5, 1, 31, "fast_half_fir_coefs");
|
||||||
fir( 20, 12, .9 , 1.5, 160, 58, "coefs0_d");
|
fir( 20, 12, .9 , 1.5, 160, 58, "coefs0_d");
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/* SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||||
|
* Licence for this file: LGPL v2.1 See LICENCE for details. */
|
||||||
|
|
||||||
static float const half_fir_coefs[] = {
|
static float const half_fir_coefs[] = {
|
||||||
0.471112154f, 0.316907549f, 0.0286963396f, -0.101927032f,
|
0.471112154f, 0.316907549f, 0.0286963396f, -0.101927032f,
|
||||||
-0.0281272982f, 0.0568029535f, 0.027196876f, -0.0360795942f,
|
-0.0281272982f, 0.0568029535f, 0.027196876f, -0.0360795942f,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
|
# SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
|
||||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||||
|
|
||||||
add_definitions (${PROJECT_C_FLAGS})
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROJECT_C_FLAGS}")
|
||||||
link_libraries (${PROJECT_NAME} ${LIBM_LIBRARIES})
|
link_libraries (${PROJECT_NAME} ${LIBM_LIBRARIES})
|
||||||
|
|
||||||
file (GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
|
file (GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
for /L %%i in (0,1,3) DO throughput 44.1 48 1 0 %%i
|
@echo off
|
||||||
|
for /L %%i in (0,1,3) DO throughput 44.1 48 1 0 %%i
|
||||||
|
|
|
@ -6,24 +6,49 @@
|
||||||
#include "../examples/examples-common.h"
|
#include "../examples/examples-common.h"
|
||||||
|
|
||||||
#define k 1000
|
#define k 1000
|
||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define timerDecl LARGE_INTEGER start, stop, tmp
|
#define timerStart(msecs) LARGE_INTEGER start, stop, tmp; \
|
||||||
#define timerStart(msecs) QueryPerformanceCounter(&start), \
|
QueryPerformanceCounter(&start), QueryPerformanceFrequency(&tmp), \
|
||||||
QueryPerformanceFrequency(&tmp), \
|
|
||||||
stop.QuadPart = (msecs * tmp.QuadPart + k/2) / k
|
stop.QuadPart = (msecs * tmp.QuadPart + k/2) / k
|
||||||
#define timerRunning() (QueryPerformanceCounter(&tmp), \
|
#define timerRunning() (QueryPerformanceCounter(&tmp), \
|
||||||
(tmp.QuadPart-start.QuadPart < stop.QuadPart))
|
(tmp.QuadPart-start.QuadPart < stop.QuadPart))
|
||||||
#else
|
#else
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#define timerDecl struct timespec stop, tmp
|
#include <unistd.h>
|
||||||
#define timerStart(msecs) clock_gettime(CLOCK_MONOTONIC, &stop), \
|
#if defined _POSIX_TIMERS && _POSIX_TIMERS > 0
|
||||||
stop.tv_nsec += (msecs%k)*(k*k), \
|
#define K (k*k)
|
||||||
stop.tv_sec += msecs/k + stop.tv_nsec/(k*k*k), \
|
#define tv_frac tv_nsec
|
||||||
stop.tv_nsec %= k*k*k
|
#if defined _POSIX_MONOTONIC_CLOCK
|
||||||
#define timerRunning() (clock_gettime(CLOCK_MONOTONIC, &tmp), \
|
#define get_time(x) clock_gettime(CLOCK_MONOTONIC, x)
|
||||||
(tmp.tv_sec < stop.tv_sec || tmp.tv_nsec < stop.tv_nsec))
|
#else
|
||||||
|
#define get_time(x) clock_gettime(CLOCK_REALTIME, x)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <sys/time.h>
|
||||||
|
#if defined timeradd
|
||||||
|
#define K k
|
||||||
|
#define tv_frac tv_usec
|
||||||
|
#define timespec timeval
|
||||||
|
#define get_time(x) gettimeofday(x, NULL)
|
||||||
|
#else
|
||||||
|
#include <sys/timeb.h>
|
||||||
|
#define K 1
|
||||||
|
#define tv_frac millitm
|
||||||
|
#define tv_sec time
|
||||||
|
#define timespec timeb
|
||||||
|
#define get_time(x) ftime(x)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define timerStart(msecs) struct timespec stop, tmp; get_time(&stop), \
|
||||||
|
stop.tv_frac += (msecs%k)*K, \
|
||||||
|
stop.tv_sec += msecs/k + stop.tv_frac/(K*k), \
|
||||||
|
stop.tv_frac %= K*k
|
||||||
|
#define timerRunning() (get_time(&tmp), \
|
||||||
|
(tmp.tv_sec < stop.tv_sec || tmp.tv_frac < stop.tv_frac))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(int n, char const * arg[])
|
int main(int n, char const * arg[])
|
||||||
|
@ -74,9 +99,12 @@ int main(int n, char const * arg[])
|
||||||
&error, /* To report any error during creation. */
|
&error, /* To report any error during creation. */
|
||||||
&io_spec, &q_spec, &runtime_spec);
|
&io_spec, &q_spec, &runtime_spec);
|
||||||
|
|
||||||
|
#define RAND ((rand()*(1./RAND_MAX)-.5)*1)
|
||||||
|
#define DURATION_MSECS 125
|
||||||
|
#define NUM_ATTEMPTS 8
|
||||||
|
|
||||||
if (!error) { /* If all is well, run the resampler: */
|
if (!error) { /* If all is well, run the resampler: */
|
||||||
engine = soxr_engine(soxr);
|
engine = soxr_engine(soxr);
|
||||||
#define RAND ((rand()*(1./RAND_MAX)-.5)*1)
|
|
||||||
switch (itype & 3) {
|
switch (itype & 3) {
|
||||||
case 0: for (i=0;i<ilen*chans; ((float *)ibuf)[i]=(float )RAND, ++i); break;
|
case 0: for (i=0;i<ilen*chans; ((float *)ibuf)[i]=(float )RAND, ++i); break;
|
||||||
case 1: for (i=0;i<ilen*chans; ((double *)ibuf)[i]=(double )RAND, ++i); break;
|
case 1: for (i=0;i<ilen*chans; ((double *)ibuf)[i]=(double )RAND, ++i); break;
|
||||||
|
@ -84,11 +112,9 @@ int main(int n, char const * arg[])
|
||||||
case 3: for (i=0;i<ilen*chans; ((int16_t *)ibuf)[i]=rint16( 1.*32768*RAND), ++i); break;
|
case 3: for (i=0;i<ilen*chans; ((int16_t *)ibuf)[i]=rint16( 1.*32768*RAND), ++i); break;
|
||||||
}
|
}
|
||||||
/* Resample in blocks: */
|
/* Resample in blocks: */
|
||||||
for (i=0; i<8; ++i) {
|
for (i=0; i<NUM_ATTEMPTS; ++i) {
|
||||||
size_t itotal = 0, ototal = 0;
|
size_t itotal = 0, ototal = 0;
|
||||||
timerDecl;
|
timerStart(DURATION_MSECS);
|
||||||
#define MSECS 125
|
|
||||||
timerStart(MSECS);
|
|
||||||
do {
|
do {
|
||||||
size_t const ilen1 = odone < olen? ilen : 0;
|
size_t const ilen1 = odone < olen? ilen : 0;
|
||||||
error = soxr_process(soxr, ibuf, ilen1, NULL, obuf, olen, &odone);
|
error = soxr_process(soxr, ibuf, ilen1, NULL, obuf, olen, &odone);
|
||||||
|
@ -103,9 +129,9 @@ int main(int n, char const * arg[])
|
||||||
soxr_delete(soxr);
|
soxr_delete(soxr);
|
||||||
free(obuf), free(ibuf);
|
free(obuf), free(ibuf);
|
||||||
/* Diagnostics: */
|
/* Diagnostics: */
|
||||||
fprintf(stderr, "%-26s %s; %lu clips; I/O: %s (%s) %.2fMs/s\n",
|
fprintf(stderr, "%-26s %s; %lu clips; I/O: %s (%s) %.2f Ms/s\n",
|
||||||
arg0, soxr_strerror(error), (long unsigned)clips,
|
arg0, soxr_strerror(error), (long unsigned)clips,
|
||||||
ferror(stdin) || ferror(stdout)? strerror(errno) : "no error", engine,
|
ferror(stdin) || ferror(stdout)? strerror(errno) : "no error", engine,
|
||||||
1e-6*k/MSECS*chans*(double)omax);
|
1e-6 * k / DURATION_MSECS * chans * (double)omax);
|
||||||
return !!error;
|
return !!error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue