mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 16:43:33 +02:00
Upgrade to libsoxr 0.0.2.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# SoX Resampler Library Copyright (c) 2007-12 robs@users.sourceforge.net
|
||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||
|
||||
add_definitions (${PROJECT_DEFS})
|
||||
add_definitions (${PROJECT_C_FLAGS})
|
||||
link_libraries (${PROJECT_NAME})
|
||||
|
||||
file (GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
|
||||
@@ -20,13 +20,13 @@ math (EXPR base_rate "${sweep_to_freq} + ${sweep_to_freq}")
|
||||
macro (add_vector r)
|
||||
set (output ${CMAKE_CURRENT_BINARY_DIR}/ref-${r}.s32)
|
||||
add_custom_command (OUTPUT ${output} DEPENDS vector-gen ${CMAKE_CURRENT_LIST_FILE}
|
||||
COMMAND vector-gen ${r} ${leader} ${len} ${sweep_to_freq} ${output})
|
||||
COMMAND vector-gen ${r} ${leader} ${len} ${sweep_to_freq} 1 ${output})
|
||||
set (vectors ${output} ${vectors})
|
||||
endmacro ()
|
||||
|
||||
macro (add_cmp_test from to bits)
|
||||
set (name ${bits}-bit-perfect-${from}-${to})
|
||||
add_test (NAME ${name} COMMAND ${CMAKE_COMMAND} -Dbits=${bits} -Dbin=${bin} -Dobin=${obin} -Dleader=${leader} -Dto=${to}
|
||||
add_test (NAME ${name} COMMAND ${CMAKE_COMMAND} -Dbits=${bits} -DBIN=${BIN} -DEXAMPLES_BIN=${EXAMPLES_BIN} -Dleader=${leader} -Dto=${to}
|
||||
-Dfrom=${from} -Dlen=${len} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmp-test.cmake)
|
||||
add_vector (${from})
|
||||
add_vector (${to})
|
||||
@@ -42,8 +42,8 @@ endif ()
|
||||
|
||||
foreach (b ${test_bits})
|
||||
foreach (r 96000 65537)
|
||||
add_cmp_test(${base_rate} ${r} ${b})
|
||||
add_cmp_test(${r} ${base_rate} ${b})
|
||||
add_cmp_test (${base_rate} ${r} ${b})
|
||||
add_cmp_test (${r} ${base_rate} ${b})
|
||||
endforeach ()
|
||||
endforeach ()
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
A few tests on the pass-band performance; not the comprehensive test suite.
|
||||
A few tests on the pass-band performance; not a comprehensive test suite.
|
||||
|
@@ -2,12 +2,12 @@
|
||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||
|
||||
if (${bits} STREQUAL 24)
|
||||
set (quality A0045)
|
||||
set (quality 45)
|
||||
else ()
|
||||
set (quality A0044)
|
||||
set (quality 44)
|
||||
endif ()
|
||||
|
||||
execute_process(COMMAND ${obin}3b-options-with-input-fn ${from} ${to} 1 2 2 ${quality}
|
||||
execute_process(COMMAND ${EXAMPLES_BIN}3b-options-with-input-fn ${from} ${to} 1 2 2 ${quality} a
|
||||
INPUT_FILE ref-${from}.s32
|
||||
OUTPUT_FILE ${from}-${to}.s32
|
||||
ERROR_VARIABLE test_error
|
||||
@@ -19,7 +19,7 @@ if (test_result)
|
||||
#message (STATUS ${test_error})
|
||||
endif ()
|
||||
|
||||
execute_process(COMMAND ${bin}vector-cmp ref-${to}.s32 ${from}-${to}.s32 ${to} ${leader} ${len} ${bits} 98
|
||||
execute_process(COMMAND ${BIN}vector-cmp ref-${to}.s32 ${from}-${to}.s32 ${to} ${leader} ${len} ${bits} 98
|
||||
OUTPUT_VARIABLE test_output
|
||||
RESULT_VARIABLE test_result)
|
||||
|
||||
|
21
lib-src/libsoxr/tests/eg-test
Normal file
21
lib-src/libsoxr/tests/eg-test
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# SoX Resampler Library Copyright (c) 2007-12 robs@users.sourceforge.net
|
||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||
|
||||
len=8
|
||||
#vg="valgrind --leak-check=full --show-reachable=yes"
|
||||
|
||||
ir=96000
|
||||
or=44100
|
||||
for i in 1 2; do
|
||||
prev=""
|
||||
sox -r $ir -n 0.f32 synth $len sin 0+`expr $ir / 2`
|
||||
for f in `find ../examples -type f -executable -name "[2-4]*"`; do
|
||||
$vg $f $ir $or < 0.f32 > $f.f32
|
||||
test x$prev != x && cmp $f.f32 $prev
|
||||
prev=$f.f32
|
||||
done
|
||||
or=96000
|
||||
ir=44100
|
||||
done
|
||||
rm *.f32
|
@@ -8,9 +8,7 @@ len=8
|
||||
f=3k
|
||||
f=0+48k
|
||||
g=48k+0
|
||||
ex=../examples/4-split-channels
|
||||
#vg="valgrind --leak-check=full --show-reachable=yes "
|
||||
ex="$vg../examples/3b-options-with-input-fn"
|
||||
ex=../examples/3b-options-with-input-fn
|
||||
|
||||
types=(f32 f64 s32 s16)
|
||||
|
||||
|
13
lib-src/libsoxr/tests/large-ratio
Normal file
13
lib-src/libsoxr/tests/large-ratio
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# SoX Resampler Library Copyright (c) 2007-12 robs@users.sourceforge.net
|
||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||
|
||||
# Warning: the intermediate signal (piped) is 3.2 Gbytes so may slug the
|
||||
# system somewhat.
|
||||
|
||||
ex=../examples/3b-options-with-input-fn
|
||||
q=6
|
||||
./vector-gen 1000 0 8 500 .9375 1.s32
|
||||
$ex 1 1e5 1 2 1 $q < 1.s32 | $ex 1e5 1 1 1 2 $q > 2.s32
|
||||
/usr/bin/sox -M -r 1k 1.s32 -r 1k 2.s32 -n spectrogram -hwk -z180 -o 2.png
|
||||
display 2.png &
|
@@ -11,7 +11,7 @@
|
||||
#include <quadmath.h>
|
||||
#endif
|
||||
|
||||
#include "../examples/util.h"
|
||||
#include "../examples/examples-common.h"
|
||||
|
||||
#if QUAD
|
||||
#define modf modfq
|
||||
@@ -31,23 +31,26 @@ int main(int i, char const * argv[])
|
||||
real rate = atof(argv[1]), /* Rate for this vector */
|
||||
lead_in_len = atof(argv[2]), /* Lead-in length in seconds */
|
||||
len = atof(argv[3]), /* Sweep length (excl. lead_in_len) */
|
||||
sweep_to_freq = atof(argv[4]),
|
||||
sweep_to_freq = atof(argv[4]), /* Sweep from DC to this freq. */
|
||||
multiplier = atof(argv[5]), /* For headroom */
|
||||
f1 = -sweep_to_freq / len * lead_in_len, f2 = sweep_to_freq,
|
||||
n1 = rate * -lead_in_len, n2 = rate * len,
|
||||
m = (f2 - f1) / (n2 - n1) / 2, dummy;
|
||||
FILE * file = fopen(argv[5], "wb");
|
||||
FILE * file = fopen(argv[6], "wb");
|
||||
i = (int)n1;
|
||||
if (!file || i != n1)
|
||||
exit(1);
|
||||
for (; i < (int)(n2 + .5); ++i) {
|
||||
double d1 = sin(2 * M_PI * modf(i * m * i / rate, &dummy));
|
||||
double d1 = multiplier * sin(2 * M_PI * modf(i * m * i / rate, &dummy));
|
||||
double d = i < 0? d1 * (1 - cos(M_PI * (i + n1) / n1)) * .5 : d1;
|
||||
#if QUAD
|
||||
fwrite(&d, sizeof(d), 1, file);
|
||||
size_t actual = fwrite(&d, sizeof(d), 1, file);
|
||||
#else
|
||||
int32_t out = rint32(d * (32768. * 65536 - 1));
|
||||
fwrite(&out, sizeof(out), 1, file);
|
||||
size_t actual = fwrite(&out, sizeof(out), 1, file);
|
||||
#endif
|
||||
if (actual != 1)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user