Hello all, after FOMS I decided to take a look at the opus library and I found that I could improve a bit the build system and cleanup the code a little bit. Most of the changes to the code has been suggested by my two tools cowstats and missingstatic (part of the ruby-elf gem if you care). HTH, Diego
Diego Elio Pettenò
2012-Sep-10 08:48 UTC
[opus] [opus PATCH 1/9] opus_demo: mark tables as static constants.
While this is not making a huge difference it still makes the code more consistent. Signed-off-by: Diego Elio Petten? <flameeyes at flameeyes.eu> --- src/opus_demo.c | 16 ++++++++-------- 1 file modificato, 8 inserzioni(+), 8 rimozioni(-) diff --git a/src/opus_demo.c b/src/opus_demo.c index 20bebba..1cb153a 100644 --- a/src/opus_demo.c +++ b/src/opus_demo.c @@ -95,7 +95,7 @@ static void check_encoder_option(int decode_only, const char *opt) } } -int silk8_test[][4] = { +static const int silk8_test[][4] = { {MODE_SILK_ONLY, OPUS_BANDWIDTH_NARROWBAND, 960*3, 1}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_NARROWBAND, 960*2, 1}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_NARROWBAND, 960, 1}, @@ -106,7 +106,7 @@ int silk8_test[][4] = { {MODE_SILK_ONLY, OPUS_BANDWIDTH_NARROWBAND, 480, 2} }; -int silk12_test[][4] = { +static const int silk12_test[][4] = { {MODE_SILK_ONLY, OPUS_BANDWIDTH_MEDIUMBAND, 960*3, 1}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_MEDIUMBAND, 960*2, 1}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_MEDIUMBAND, 960, 1}, @@ -117,7 +117,7 @@ int silk12_test[][4] = { {MODE_SILK_ONLY, OPUS_BANDWIDTH_MEDIUMBAND, 480, 2} }; -int silk16_test[][4] = { +static const int silk16_test[][4] = { {MODE_SILK_ONLY, OPUS_BANDWIDTH_WIDEBAND, 960*3, 1}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_WIDEBAND, 960*2, 1}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_WIDEBAND, 960, 1}, @@ -128,21 +128,21 @@ int silk16_test[][4] = { {MODE_SILK_ONLY, OPUS_BANDWIDTH_WIDEBAND, 480, 2} }; -int hybrid24_test[][4] = { +static const int hybrid24_test[][4] = { {MODE_SILK_ONLY, OPUS_BANDWIDTH_SUPERWIDEBAND, 960, 1}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_SUPERWIDEBAND, 480, 1}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_SUPERWIDEBAND, 960, 2}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_SUPERWIDEBAND, 480, 2} }; -int hybrid48_test[][4] = { +static const int hybrid48_test[][4] = { {MODE_SILK_ONLY, OPUS_BANDWIDTH_FULLBAND, 960, 1}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_FULLBAND, 480, 1}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_FULLBAND, 960, 2}, {MODE_SILK_ONLY, OPUS_BANDWIDTH_FULLBAND, 480, 2} }; -int celt_test[][4] = { +static const int celt_test[][4] = { {MODE_CELT_ONLY, OPUS_BANDWIDTH_FULLBAND, 960, 1}, {MODE_CELT_ONLY, OPUS_BANDWIDTH_SUPERWIDEBAND, 960, 1}, {MODE_CELT_ONLY, OPUS_BANDWIDTH_WIDEBAND, 960, 1}, @@ -185,7 +185,7 @@ int celt_test[][4] = { }; -int celt_hq_test[][4] = { +static const int celt_hq_test[][4] = { {MODE_CELT_ONLY, OPUS_BANDWIDTH_FULLBAND, 960, 2}, {MODE_CELT_ONLY, OPUS_BANDWIDTH_FULLBAND, 480, 2}, {MODE_CELT_ONLY, OPUS_BANDWIDTH_FULLBAND, 240, 2}, @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) int random_framesize=0, newsize=0, delayed_celt=0; int sweep_max=0, sweep_min=0; int random_fec=0; - int (*mode_list)[4]=NULL; + const int (*mode_list)[4]=NULL; int nb_modes_in_list=0; int curr_mode=0; int curr_mode_count=0; -- 1.7.12
Signed-off-by: Diego Elio Petten? <flameeyes at flameeyes.eu> --- .gitignore | 46 +++++++++++++++++++++++----------------------- 1 file modificato, 23 inserzioni(+), 23 rimozioni(-) diff --git a/.gitignore b/.gitignore index b7bcdce..c37834e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,23 @@ +*.kdevelop.pcs +*.kdevses +*.la +*.lo +*.o +*.sw +*.vcxproj.user +*~ +.deps +.libs Makefile Makefile.in aclocal.m4 autom4te.cache -*.kdevelop.pcs -*.kdevses +celt.pc +celt.spec +celt/Debug +celt/Release +celt/dump_modes/dump_modes +celt/x64 compile config.guess config.h @@ -14,40 +28,26 @@ config.sub configure depcomp install-sh -.deps -.libs -*.la -testcelt libtool ltmain.sh missing -stamp-h1 -*.sw -*.o -*.lo -*~ -tests/*test -tools/celtdec -tools/celtenc -celt.pc -celt.spec -celt/dump_modes/dump_modes -*.vcxproj.user opus.sdf opus.suo -version.h -celt/Debug -celt/Release -celt/x64 silk/Debug silk/Release -silk/x64 silk/fixed/Debug silk/fixed/Release silk/fixed/x64 silk/float/Debug silk/float/Release silk/float/x64 +silk/x64 src/Debug src/Release src/x64 +stamp-h1 +testcelt +tests/*test +tools/celtdec +tools/celtenc +version.h -- 1.7.12
Diego Elio Pettenò
2012-Sep-10 08:48 UTC
[opus] [opus PATCH 3/9] gitignore: update to actually ignore generated/built files.
Signed-off-by: Diego Elio Petten? <flameeyes at flameeyes.eu> --- .gitignore | 22 +++++++++++++++++++++- 1 file modificato, 21 inserzioni(+). 1 rimozione(-) diff --git a/.gitignore b/.gitignore index c37834e..205ff5f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,20 +3,29 @@ *.la *.lo *.o +*.pc *.sw *.vcxproj.user *~ .deps +.dirstamp .libs Makefile Makefile.in aclocal.m4 autom4te.cache -celt.pc celt.spec celt/Debug celt/Release celt/dump_modes/dump_modes +celt/tests/test_unit_cwrs32 +celt/tests/test_unit_dft +celt/tests/test_unit_entropy +celt/tests/test_unit_laplace +celt/tests/test_unit_mathops +celt/tests/test_unit_mdct +celt/tests/test_unit_rotation +celt/tests/test_unit_types celt/x64 compile config.guess @@ -27,12 +36,20 @@ config.status config.sub configure depcomp +doc/Doxyfile +doc/doxygen-build.stamp +doc/html/ +doc/latex/ +doc/man/ install-sh libtool ltmain.sh missing opus.sdf opus.suo +opus_compare +opus_demo +repacketizer_demo silk/Debug silk/Release silk/fixed/Debug @@ -48,6 +65,9 @@ src/x64 stamp-h1 testcelt tests/*test +tests/test_opus_api +tests/test_opus_decode +tests/test_opus_encode tools/celtdec tools/celtenc version.h -- 1.7.12
Diego Elio Pettenò
2012-Sep-10 08:48 UTC
[opus] [opus PATCH 4/9] Mark functions static if they are only used in their own translation unit.
This allows the compiler to perform more optimization on them as it knows how the functions are being called. Signed-off-by: Diego Elio Petten? <flameeyes at flameeyes.eu> --- silk/API.h | 8 -------- silk/control_codec.c | 12 ++++++------ silk/enc_API.c | 10 +++++++++- silk/float/prefilter_FLP.c | 2 +- src/opus_encoder.c | 2 +- 5 file modificati, 17 inserzioni(+), 17 rimozioni(-) diff --git a/silk/API.h b/silk/API.h index c77ad2f..4b8ca12 100644 --- a/silk/API.h +++ b/silk/API.h @@ -67,14 +67,6 @@ opus_int silk_InitEncoder( /* O Returns error co silk_EncControlStruct *encStatus /* O Encoder Status */ ); -/***************************************/ -/* Read control structure from encoder */ -/***************************************/ -opus_int silk_QueryEncoder( /* O Returns error code */ - const void *encState, /* I State */ - silk_EncControlStruct *encStatus /* O Encoder Status */ -); - /**************************/ /* Encode frame with Silk */ /**************************/ diff --git a/silk/control_codec.c b/silk/control_codec.c index d0ed528..ecc338c 100644 --- a/silk/control_codec.c +++ b/silk/control_codec.c @@ -38,18 +38,18 @@ POSSIBILITY OF SUCH DAMAGE. #include "tuning_parameters.h" #include "pitch_est_defines.h" -opus_int silk_setup_resamplers( +static opus_int silk_setup_resamplers( silk_encoder_state_Fxx *psEnc, /* I/O */ opus_int fs_kHz /* I */ ); -opus_int silk_setup_fs( +static opus_int silk_setup_fs( silk_encoder_state_Fxx *psEnc, /* I/O */ opus_int fs_kHz, /* I */ opus_int PacketSize_ms /* I */ ); -opus_int silk_setup_complexity( +static opus_int silk_setup_complexity( silk_encoder_state *psEncC, /* I/O */ opus_int Complexity /* I */ ); @@ -131,7 +131,7 @@ opus_int silk_control_encoder( return ret; } -opus_int silk_setup_resamplers( +static opus_int silk_setup_resamplers( silk_encoder_state_Fxx *psEnc, /* I/O */ opus_int fs_kHz /* I */ ) @@ -186,7 +186,7 @@ opus_int silk_setup_resamplers( return ret; } -opus_int silk_setup_fs( +static opus_int silk_setup_fs( silk_encoder_state_Fxx *psEnc, /* I/O */ opus_int fs_kHz, /* I */ opus_int PacketSize_ms /* I */ @@ -299,7 +299,7 @@ opus_int silk_setup_fs( return ret; } -opus_int silk_setup_complexity( +static opus_int silk_setup_complexity( silk_encoder_state *psEncC, /* I/O */ opus_int Complexity /* I */ ) diff --git a/silk/enc_API.c b/silk/enc_API.c index c0143fd..ec7915c 100644 --- a/silk/enc_API.c +++ b/silk/enc_API.c @@ -40,6 +40,14 @@ POSSIBILITY OF SUCH DAMAGE. #include "main_FLP.h" #endif +/***************************************/ +/* Read control structure from encoder */ +/***************************************/ +static opus_int silk_QueryEncoder( /* O Returns error code */ + const void *encState, /* I State */ + silk_EncControlStruct *encStatus /* O Encoder Status */ +); + /****************************************/ /* Encoder functions */ /****************************************/ @@ -90,7 +98,7 @@ opus_int silk_InitEncoder( /* O Returns error co /***************************************/ /* Read control structure from encoder */ /***************************************/ -opus_int silk_QueryEncoder( /* O Returns error code */ +static opus_int silk_QueryEncoder( /* O Returns error code */ const void *encState, /* I State */ silk_EncControlStruct *encStatus /* O Encoder Status */ ) diff --git a/silk/float/prefilter_FLP.c b/silk/float/prefilter_FLP.c index 95b32da..d6c8439 100644 --- a/silk/float/prefilter_FLP.c +++ b/silk/float/prefilter_FLP.c @@ -47,7 +47,7 @@ static inline void silk_prefilt_FLP( opus_int length /* I */ ); -void silk_warped_LPC_analysis_filter_FLP( +static void silk_warped_LPC_analysis_filter_FLP( silk_float state[], /* I/O State [order + 1] */ silk_float res[], /* O Residual signal [length] */ const silk_float coef[], /* I Coefficients [order] */ diff --git a/src/opus_encoder.c b/src/opus_encoder.c index b77e48e..ea6bfa3 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -291,7 +291,7 @@ static unsigned char gen_toc(int mode, int framerate, int bandwidth, int channel } #ifndef FIXED_POINT -void silk_biquad_float( +static void silk_biquad_float( const opus_val16 *in, /* I: Input signal */ const opus_int32 *B_Q28, /* I: MA coefficients [3] */ const opus_int32 *A_Q28, /* I: AR coefficients [2] */ -- 1.7.12
Diego Elio Pettenò
2012-Sep-10 08:48 UTC
[opus] [opus PATCH 5/9] Mark tables static when not used outside of their translation unit.
This is similar to the change for functions, but is only used to perform DCE. Signed-off-by: Diego Elio Petten? <flameeyes at flameeyes.eu> --- silk/tables_LTP.c | 18 +++++++++--------- silk/tables_NLSF_CB_NB_MB.c | 14 +++++++------- silk/tables_NLSF_CB_WB.c | 14 +++++++------- silk/tables_other.c | 4 ++-- 4 file modificati, 25 inserzioni(+), 25 rimozioni(-) diff --git a/silk/tables_LTP.c b/silk/tables_LTP.c index 5522e32..dd1fb55 100644 --- a/silk/tables_LTP.c +++ b/silk/tables_LTP.c @@ -35,16 +35,16 @@ const opus_uint8 silk_LTP_per_index_iCDF[3] = { 179, 99, 0 }; -const opus_uint8 silk_LTP_gain_iCDF_0[8] = { +static const opus_uint8 silk_LTP_gain_iCDF_0[8] = { 71, 56, 43, 30, 21, 12, 6, 0 }; -const opus_uint8 silk_LTP_gain_iCDF_1[16] = { +static const opus_uint8 silk_LTP_gain_iCDF_1[16] = { 199, 165, 144, 124, 109, 96, 84, 71, 61, 51, 42, 32, 23, 15, 8, 0 }; -const opus_uint8 silk_LTP_gain_iCDF_2[32] = { +static const opus_uint8 silk_LTP_gain_iCDF_2[32] = { 241, 225, 211, 199, 187, 175, 164, 153, 142, 132, 123, 114, 105, 96, 88, 80, 72, 64, 57, 50, 44, 38, 33, 29, @@ -53,16 +53,16 @@ const opus_uint8 silk_LTP_gain_iCDF_2[32] = { const opus_int16 silk_LTP_gain_middle_avg_RD_Q14 = 12304; -const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = { +static const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = { 15, 131, 138, 138, 155, 155, 173, 173 }; -const opus_uint8 silk_LTP_gain_BITS_Q5_1[16] = { +static const opus_uint8 silk_LTP_gain_BITS_Q5_1[16] = { 69, 93, 115, 118, 131, 138, 141, 138, 150, 150, 155, 150, 155, 160, 166, 160 }; -const opus_uint8 silk_LTP_gain_BITS_Q5_2[32] = { +static const opus_uint8 silk_LTP_gain_BITS_Q5_2[32] = { 131, 128, 134, 141, 141, 141, 145, 145, 145, 150, 155, 155, 155, 155, 160, 160, 160, 160, 166, 166, 173, 173, 182, 192, @@ -81,7 +81,7 @@ const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = { silk_LTP_gain_BITS_Q5_2 }; -const opus_int8 silk_LTP_gain_vq_0[8][5] +static const opus_int8 silk_LTP_gain_vq_0[8][5] { { 4, 6, 24, 7, 5 @@ -109,7 +109,7 @@ const opus_int8 silk_LTP_gain_vq_0[8][5] } }; -const opus_int8 silk_LTP_gain_vq_1[16][5] +static const opus_int8 silk_LTP_gain_vq_1[16][5] { { 13, 22, 39, 23, 12 @@ -161,7 +161,7 @@ const opus_int8 silk_LTP_gain_vq_1[16][5] } }; -const opus_int8 silk_LTP_gain_vq_2[32][5] +static const opus_int8 silk_LTP_gain_vq_2[32][5] { { -6, 27, 61, 39, 5 diff --git a/silk/tables_NLSF_CB_NB_MB.c b/silk/tables_NLSF_CB_NB_MB.c index 57bb817..7548052 100644 --- a/silk/tables_NLSF_CB_NB_MB.c +++ b/silk/tables_NLSF_CB_NB_MB.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "tables.h" -const opus_uint8 silk_NLSF_CB1_NB_MB_Q8[ 320 ] = { +static const opus_uint8 silk_NLSF_CB1_NB_MB_Q8[ 320 ] = { 12, 35, 60, 83, 108, 132, 157, 180, 206, 228, 15, 32, 55, 77, 101, 125, 151, 175, 201, 225, 19, 42, 66, 89, @@ -74,7 +74,7 @@ const opus_uint8 silk_NLSF_CB1_NB_MB_Q8[ 320 ] = { 64, 84, 104, 118, 156, 177, 201, 230 }; -const opus_uint8 silk_NLSF_CB1_iCDF_NB_MB[ 64 ] = { +static const opus_uint8 silk_NLSF_CB1_iCDF_NB_MB[ 64 ] = { 212, 178, 148, 129, 108, 96, 85, 82, 79, 77, 61, 59, 57, 56, 51, 49, 48, 45, 42, 41, 40, 38, 36, 34, @@ -85,7 +85,7 @@ const opus_uint8 silk_NLSF_CB1_iCDF_NB_MB[ 64 ] = { 28, 20, 19, 18, 12, 11, 5, 0 }; -const opus_uint8 silk_NLSF_CB2_SELECT_NB_MB[ 160 ] = { +static const opus_uint8 silk_NLSF_CB2_SELECT_NB_MB[ 160 ] = { 16, 0, 0, 0, 0, 99, 66, 36, 36, 34, 36, 34, 34, 34, 34, 83, 69, 36, 52, 34, 116, 102, 70, 68, @@ -108,7 +108,7 @@ const opus_uint8 silk_NLSF_CB2_SELECT_NB_MB[ 160 ] = { 171, 137, 139, 137, 155, 218, 219, 139 }; -const opus_uint8 silk_NLSF_CB2_iCDF_NB_MB[ 72 ] = { +static const opus_uint8 silk_NLSF_CB2_iCDF_NB_MB[ 72 ] = { 255, 254, 253, 238, 14, 3, 2, 1, 0, 255, 254, 252, 218, 35, 3, 2, 1, 0, 255, 254, 250, 208, 59, 4, @@ -120,7 +120,7 @@ const opus_uint8 silk_NLSF_CB2_iCDF_NB_MB[ 72 ] = { 254, 236, 173, 95, 37, 7, 1, 0 }; -const opus_uint8 silk_NLSF_CB2_BITS_NB_MB_Q5[ 72 ] = { +static const opus_uint8 silk_NLSF_CB2_BITS_NB_MB_Q5[ 72 ] = { 255, 255, 255, 131, 6, 145, 255, 255, 255, 255, 255, 236, 93, 15, 96, 255, 255, 255, 255, 255, 194, 83, 25, 71, @@ -132,13 +132,13 @@ const opus_uint8 silk_NLSF_CB2_BITS_NB_MB_Q5[ 72 ] = { 251, 123, 65, 55, 68, 100, 171, 255 }; -const opus_uint8 silk_NLSF_PRED_NB_MB_Q8[ 18 ] = { +static const opus_uint8 silk_NLSF_PRED_NB_MB_Q8[ 18 ] = { 179, 138, 140, 148, 151, 149, 153, 151, 163, 116, 67, 82, 59, 92, 72, 100, 89, 92 }; -const opus_int16 silk_NLSF_DELTA_MIN_NB_MB_Q15[ 11 ] = { +static const opus_int16 silk_NLSF_DELTA_MIN_NB_MB_Q15[ 11 ] = { 250, 3, 6, 3, 3, 3, 4, 3, 3, 3, 461 }; diff --git a/silk/tables_NLSF_CB_WB.c b/silk/tables_NLSF_CB_WB.c index 00b68f7..3d6052e 100644 --- a/silk/tables_NLSF_CB_WB.c +++ b/silk/tables_NLSF_CB_WB.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "tables.h" -const opus_uint8 silk_NLSF_CB1_WB_Q8[ 512 ] = { +static const opus_uint8 silk_NLSF_CB1_WB_Q8[ 512 ] = { 7, 23, 38, 54, 69, 85, 100, 116, 131, 147, 162, 178, 193, 208, 223, 239, 13, 25, 41, 55, 69, 83, 98, 112, @@ -98,7 +98,7 @@ const opus_uint8 silk_NLSF_CB1_WB_Q8[ 512 ] = { 110, 119, 129, 141, 175, 198, 218, 237 }; -const opus_uint8 silk_NLSF_CB1_iCDF_WB[ 64 ] = { +static const opus_uint8 silk_NLSF_CB1_iCDF_WB[ 64 ] = { 225, 204, 201, 184, 183, 175, 158, 154, 153, 135, 119, 115, 113, 110, 109, 99, 98, 95, 79, 68, 52, 50, 48, 45, @@ -109,7 +109,7 @@ const opus_uint8 silk_NLSF_CB1_iCDF_WB[ 64 ] = { 24, 21, 11, 6, 5, 4, 3, 0 }; -const opus_uint8 silk_NLSF_CB2_SELECT_WB[ 256 ] = { +static const opus_uint8 silk_NLSF_CB2_SELECT_WB[ 256 ] = { 0, 0, 0, 0, 0, 0, 0, 1, 100, 102, 102, 68, 68, 36, 34, 96, 164, 107, 158, 185, 180, 185, 139, 102, @@ -144,7 +144,7 @@ const opus_uint8 silk_NLSF_CB2_SELECT_WB[ 256 ] = { 100, 107, 120, 119, 36, 197, 24, 0 }; -const opus_uint8 silk_NLSF_CB2_iCDF_WB[ 72 ] = { +static const opus_uint8 silk_NLSF_CB2_iCDF_WB[ 72 ] = { 255, 254, 253, 244, 12, 3, 2, 1, 0, 255, 254, 252, 224, 38, 3, 2, 1, 0, 255, 254, 251, 209, 57, 4, @@ -156,7 +156,7 @@ const opus_uint8 silk_NLSF_CB2_iCDF_WB[ 72 ] = { 248, 227, 177, 100, 19, 2, 1, 0 }; -const opus_uint8 silk_NLSF_CB2_BITS_WB_Q5[ 72 ] = { +static const opus_uint8 silk_NLSF_CB2_BITS_WB_Q5[ 72 ] = { 255, 255, 255, 156, 4, 154, 255, 255, 255, 255, 255, 227, 102, 15, 92, 255, 255, 255, 255, 255, 213, 83, 24, 72, @@ -168,14 +168,14 @@ const opus_uint8 silk_NLSF_CB2_BITS_WB_Q5[ 72 ] = { 166, 116, 76, 55, 53, 125, 255, 255 }; -const opus_uint8 silk_NLSF_PRED_WB_Q8[ 30 ] = { +static const opus_uint8 silk_NLSF_PRED_WB_Q8[ 30 ] = { 175, 148, 160, 176, 178, 173, 174, 164, 177, 174, 196, 182, 198, 192, 182, 68, 62, 66, 60, 72, 117, 85, 90, 118, 136, 151, 142, 160, 142, 155 }; -const opus_int16 silk_NLSF_DELTA_MIN_WB_Q15[ 17 ] = { +static const opus_int16 silk_NLSF_DELTA_MIN_WB_Q15[ 17 ] = { 100, 3, 40, 3, 3, 3, 5, 14, 14, 10, 11, 3, 8, 9, 7, 3, 347 diff --git a/silk/tables_other.c b/silk/tables_other.c index dedff26..3dc68d4 100644 --- a/silk/tables_other.c +++ b/silk/tables_other.c @@ -67,8 +67,8 @@ const opus_uint8 silk_stereo_pred_joint_iCDF[ 25 ] = { const opus_uint8 silk_stereo_only_code_mid_iCDF[ 2 ] = { 64, 0 }; /* Tables for LBRR flags */ -const opus_uint8 silk_LBRR_flags_2_iCDF[ 3 ] = { 203, 150, 0 }; -const opus_uint8 silk_LBRR_flags_3_iCDF[ 7 ] = { 215, 195, 166, 125, 110, 82, 0 }; +static const opus_uint8 silk_LBRR_flags_2_iCDF[ 3 ] = { 203, 150, 0 }; +static const opus_uint8 silk_LBRR_flags_3_iCDF[ 7 ] = { 215, 195, 166, 125, 110, 82, 0 }; const opus_uint8 * const silk_LBRR_flags_iCDF_ptr[ 2 ] = { silk_LBRR_flags_2_iCDF, silk_LBRR_flags_3_iCDF -- 1.7.12
Diego Elio Pettenò
2012-Sep-10 08:48 UTC
[opus] [opus PATCH 6/9] Move to comment a table that is never used in the code.
Signed-off-by: Diego Elio Petten? <flameeyes at flameeyes.eu> --- silk/resampler_rom.c | 2 +- 1 file modificato, 1 inserzione(+). 1 rimozione(-) diff --git a/silk/resampler_rom.c b/silk/resampler_rom.c index a09d188..b723c41 100644 --- a/silk/resampler_rom.c +++ b/silk/resampler_rom.c @@ -45,7 +45,7 @@ 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)) */ -const opus_int16 silk_resampler_up2_hq_notch[ 4 ] = { 9634, -7012, 7209, 30474 }; +/* const opus_int16 silk_resampler_up2_hq_notch[ 4 ] = { 9634, -7012, 7209, 30474 }; */ /* Tables with IIR and FIR coefficients for fractional downsamplers (123 Words) */ silk_DWORD_ALIGN const opus_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR0 / 2 ] = { -- 1.7.12
Diego Elio Pettenò
2012-Sep-10 08:48 UTC
[opus] [opus PATCH 7/9] silk: move down- and upsamplers constants to the header file.
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
Diego Elio Pettenò
2012-Sep-10 08:48 UTC
[opus] [opus PATCH 8/9] build: use the proper invocation of AC_INIT and AM_INIT_AUTOMAKE.
The old AC_INIT invocation is deprecated, so don't use that anymore. To use the new one, the version calculation needs to be done ASAP, and it can't rely on AC_MSG_* functions. Also this allows to use the new AM_INIT_AUTOMAKE syntax, which is deprecated starting from automake 1.13. Signed-off-by: Diego Elio Petten? <flameeyes at flameeyes.eu> --- configure.ac | 30 +++++++++++------------------- 1 file modificato, 11 inserzioni(+), 19 rimozioni(-) diff --git a/configure.ac b/configure.ac index 0773c37..403d997 100644 --- a/configure.ac +++ b/configure.ac @@ -1,15 +1,7 @@ dnl Process this file with autoconf to produce a configure script. -*-m4-*- -AC_INIT(src/opus_encoder.c) - -AM_CONFIG_HEADER([config.h]) - -dnl enable silent rules on automake 1.11 and later -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - # Read our default version string from version.mk. # Please update this file for releases. -AC_MSG_CHECKING([version.mk]) MK_VERSION=$(awk 'BEGIN { FS = "=" } /OPUS_VERSION/ { ver = $2} END { @@ -18,20 +10,13 @@ MK_VERSION=$(awk 'BEGIN { FS = "=" } gsub(/ $/, "", ver); print ver; }' $srcdir/version.mk) -if test -z "$MK_VERSION"; then - AC_MSG_RESULT([no]) -else - AC_MSG_RESULT([$MK_VERSION]) +if ! test -z "$MK_VERSION"; then OPUS_VERSION="$MK_VERSION" fi # Override with the git version, if available. -AC_MSG_CHECKING([git revision]) GIT_VERSION=$(git describe --tags --match 'v*' 2>/dev/null | sed 's/^v//') -if test -z "$GIT_VERSION"; then - AC_MSG_RESULT([no]) -else - AC_MSG_RESULT([$GIT_VERSION]) +if ! test -z "$GIT_VERSION"; then OPUS_VERSION="$GIT_VERSION" fi @@ -40,10 +25,18 @@ if test -z "$OPUS_VERSION"; then OPUS_VERSION="unknown" fi -# For automake. +dnl for AC_INIT PACKAGE=opus VERSION=$OPUS_VERSION +AC_INIT(PACKAGE, VERSION) +AM_INIT_AUTOMAKE([no-define]) + +AM_CONFIG_HEADER([config.h]) + +dnl enable silent rules on automake 1.11 and later +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + # For autoconf AC_SUBST(OPUS_VERSION) @@ -61,7 +54,6 @@ AC_SUBST(OPUS_LT_CURRENT) AC_SUBST(OPUS_LT_REVISION) AC_SUBST(OPUS_LT_AGE) -AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define) AM_MAINTAINER_MODE AC_CANONICAL_HOST -- 1.7.12
Diego Elio Pettenò
2012-Sep-10 08:48 UTC
[opus] [opus PATCH 9/9] build: use foreign automake flavour and remove dummy files.
Since this is not a GNU project, there's no reason to keep the placeholder files, but unless you tell automake to go 'foreign' it'll require their presence. Signed-off-by: Diego Elio Petten? <flameeyes at flameeyes.eu> --- INSTALL | 1 - configure.ac | 2 +- 2 file modificati, 1 inserzione(+), 2 rimozioni(-) delete mode 100644 ChangeLog delete mode 100644 INSTALL delete mode 100644 NEWS diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index e69de29..0000000 diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 40d51f0..0000000 --- a/INSTALL +++ /dev/null @@ -1 +0,0 @@ -See README file for details diff --git a/NEWS b/NEWS deleted file mode 100644 index e69de29..0000000 diff --git a/configure.ac b/configure.ac index 403d997..2427500 100644 --- a/configure.ac +++ b/configure.ac @@ -30,7 +30,7 @@ PACKAGE=opus VERSION=$OPUS_VERSION AC_INIT(PACKAGE, VERSION) -AM_INIT_AUTOMAKE([no-define]) +AM_INIT_AUTOMAKE([no-define foreign]) AM_CONFIG_HEADER([config.h]) -- 1.7.12
Hi Diego, Thanks for the patches. I'll have a closer look at them shortly. Just to confirm, these are meant for the master branch, right? Cheers, Jean-Marc On 12-09-10 04:48 AM, Diego Elio Petten? wrote:> Hello all, > > after FOMS I decided to take a look at the opus library and I found > that I could improve a bit the build system and cleanup the code a > little bit. > > Most of the changes to the code has been suggested by my two tools > cowstats and missingstatic (part of the ruby-elf gem if you care). > > HTH, > Diego > > _______________________________________________ > opus mailing list > opus at xiph.org > http://lists.xiph.org/mailman/listinfo/opus > >
OK, I merged patches 1, 4, 5, 6, 7 without any problem so far. Patch 2 doesn't apply (haven't checked why), so I didn't merge 3 either. As for 8, it caused "make dist" to produce a tarball named (literally) package-VERSION.tar.gz . I didn't merge 9 because I need to check what to add to EXTRA_DIST to make sure that all the other files (README, AUTHORS, ...) are included. Jean-Marc On 12-09-10 04:48 AM, Diego Elio Petten? wrote:> Hello all, > > after FOMS I decided to take a look at the opus library and I found > that I could improve a bit the build system and cleanup the code a > little bit. > > Most of the changes to the code has been suggested by my two tools > cowstats and missingstatic (part of the ruby-elf gem if you care). > > HTH, > Diego > > _______________________________________________ > opus mailing list > opus at xiph.org > http://lists.xiph.org/mailman/listinfo/opus > >
Maybe Matching Threads
- [AArch64 neon intrinsics v4 0/5] Rework Neon intrinsic code for Aarch64 patchset
- [PATCH 0/8] Patches for arm64 (aarch64) support
- [Aarch64 v2 00/18] Patches to enable Aarch64 (version 2)
- [Aarch64 00/11] Patches to enable Aarch64 (arm64) optimizations, rebased to current master.
- Reg an issue with smoothing factor in VAD implementation