[opus] [opus PATCH 7/9] silk: move down- and upsamplers constants to the header file.

Diego Elio Pettenò flameeyes at flameeyes.eu
Mon Sep 10 01:48:25 PDT 2012


These are only being used outside if the translation unit and only in
a few codepaths; by making them static in the header, the compiler can
optimize them quickly.

This avoids GOT-based access to the external symbol on Unix, and can
allow for constant propagation to optimize the code.

Signed-off-by: Diego Elio Pettenò <flameeyes at flameeyes.eu>
---
 silk/resampler_rom.c | 8 --------
 silk/resampler_rom.h | 8 ++++----
 2 file modificati, 4 inserzioni(+), 12 rimozioni(-)

diff --git a/silk/resampler_rom.c b/silk/resampler_rom.c
index b723c41..b50af2e 100644
--- a/silk/resampler_rom.c
+++ b/silk/resampler_rom.c
@@ -34,14 +34,6 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include "resampler_private.h"
 
-/* Tables for 2x downsampler */
-const opus_int16 silk_resampler_down2_0 = 9872;
-const opus_int16 silk_resampler_down2_1 = 39809 - 65536;
-
-/* Tables for 2x upsampler, high quality */
-const opus_int16 silk_resampler_up2_hq_0[ 3 ] = { 1746, 14986, 39083 - 65536 };
-const opus_int16 silk_resampler_up2_hq_1[ 3 ] = { 6854, 25769, 55542 - 65536 };
-
 /* Matlab code for the notch filter coefficients: */
 /* B = [1, 0.147, 1];  A = [1, 0.107, 0.89]; G = 0.93; freqz(G * B, A, 2^14, 16e3); axis([0, 8000, -10, 1]) */
 /* fprintf('\t%6d, %6d, %6d, %6d\n', round(B(2)*2^16), round(-A(2)*2^16), round((1-A(3))*2^16), round(G*2^15)) */
diff --git a/silk/resampler_rom.h b/silk/resampler_rom.h
index 0ad0686..473b24a 100644
--- a/silk/resampler_rom.h
+++ b/silk/resampler_rom.h
@@ -42,12 +42,12 @@ extern "C"
 #define RESAMPLER_ORDER_FIR_12                  8
 
 /* Tables for 2x downsampler */
-extern const opus_int16 silk_resampler_down2_0;
-extern const opus_int16 silk_resampler_down2_1;
+static const opus_int16 silk_resampler_down2_0 = 9872;
+static const opus_int16 silk_resampler_down2_1 = 39809 - 65536;
 
 /* Tables for 2x upsampler, high quality */
-extern const opus_int16 silk_resampler_up2_hq_0[ 3 ];
-extern const opus_int16 silk_resampler_up2_hq_1[ 3 ];
+static const opus_int16 silk_resampler_up2_hq_0[ 3 ] = { 1746, 14986, 39083 - 65536 };
+static const opus_int16 silk_resampler_up2_hq_1[ 3 ] = { 6854, 25769, 55542 - 65536 };
 
 /* Tables with IIR and FIR coefficients for fractional downsamplers */
 extern const opus_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR0 / 2 ];
-- 
1.7.12



More information about the opus mailing list