################# REMOVE warnings on trimedia compiler ############################## | |
################# Not critical to compilation ############################## | |
1. Change the following statements to remove warning for constant expression | |
(i) mdf.c [if(0) --> #if 0] | |
(ii) ltp.c [if(1) --> #if 1] | |
(iii) preprocess.c [if(1) --> #if 1] | |
(iv) sb_celp.c [if (SPEEX_SET_VBR_MAX_BITRATE<1) --> #if (SPEEX_SET_VBR_MAX_BITRATE<1)] | |
2. add REMARK_ON macro to remove warning on not reference variable | |
-- uses (void)<variable> to remove warning on not referenced variable | |
-- #define REMARK_ON | |
-- (void)<variable> | |
-- #endif | |
-- search for REMARK_ON on the following files | |
(i) jitter.c | |
(ii) lsp.c | |
(iii) ltp.c | |
(iv) mdf.c | |
(v) filters.c | |
(vi) filterbank.c | |
(vii) cb_search.c | |
(viii) vq.c | |
(ix) vbr.c | |
(x) stereo.c | |
(xi) speex_callbacks.c | |
(xii) preprocess.c | |
3. commented out the following in pseudofloat.h for unused variable | |
//static const spx_float_t FLOAT_HALF = {16384,-15}; | |
4. commented out unused variable in nb_celp.c | |
//spx_word16_t *sp; ***unused variable*** | |
//sp=out+offset; ***unused variable*** | |
//int submode; ***unused variable*** | |
// ***unused variable*** | |
// advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS); | |
advance = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS); | |
// ***unused variable*** | |
//advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS); | |
advance = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS); | |
// spx_word16_t *exc; ***unused variable*** | |
// exc=st->exc+offset; ***unused variable*** | |
5. commented out unused variable in vbr.c | |
//int va; ***unused variable*** | |
//va = 0; ***unused variable*** | |
//va = 1; ***unused variable*** | |
6. added HAVE_CONFIG into medfilter.c | |
################# Patches for trimedia compiler ############################## | |
################# Critical to compilation ############################## | |
-- change the following in modes.c and speex.h as compiler does not support const * const... | |
(i) modes.c | |
#ifdef __TCS__ | |
const SpeexMode * speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode}; | |
#else | |
const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode}; | |
#endif | |
(ii) speex.h | |
#ifdef __TCS__ | |
extern const SpeexMode * speex_mode_list[SPEEX_NB_MODES]; | |
#else | |
extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES]; | |
#endif | |
-- added the #elif defined (TM_ASM) to the following files for optimized codes | |
(1) arch.h | |
(2) cb_search.c | |
(3) fftwrap.c | |
(4) filterbank.c | |
(5) filters.c | |
(6) kiss_fft.c | |
(7) kiss_fftr.c | |
(8) lpc.c | |
(9) lsp.c | |
(10) ltp.c | |
(11) mdf.c | |
(12) misc.c | |
(13) preprocess.c | |
(14) quant_lsp.c | |
(15) vq.c | |
-- reorder macro definations in quant_lsp.c | |
#ifdef FIXED_POINT | |
#define LSP_LINEAR(i) (SHL16(i+1,11)) | |
#define LSP_LINEAR_HIGH(i) (ADD16(MULT16_16_16(i,2560),6144)) | |
#define LSP_DIV_256(x) (SHL16((spx_word16_t)x, 5)) | |
#define LSP_DIV_512(x) (SHL16((spx_word16_t)x, 4)) | |
#define LSP_DIV_1024(x) (SHL16((spx_word16_t)x, 3)) | |
#define LSP_PI 25736 | |
#else | |
#define LSP_LINEAR(i) (.25*(i)+.25) | |
#define LSP_LINEAR_HIGH(i) (.3125*(i)+.75) | |
#define LSP_SCALE 256. | |
#define LSP_DIV_256(x) (0.0039062*(x)) | |
#define LSP_DIV_512(x) (0.0019531*(x)) | |
#define LSP_DIV_1024(x) (0.00097656*(x)) | |
#define LSP_PI M_PI | |
#endif | |
#ifdef BFIN_ASM | |
#include "quant_lsp_bfin.h" | |
#elif defined (TM_ASM) | |
#include "quant_lsp_tm.h" | |
#endif | |
-- added macro PREPROCESS_MDF_FLOAT to allow using of floating point | |
-- in mdf and preprocess while keeping fixed point in encoder/decoder | |
-- This is due to the fact that preprocess/mdf run faster on floating | |
-- point on trimedia | |
-- added the following 3 lines to the files below | |
#ifdef PREPROCESS_MDF_FLOAT | |
#undef FIXED_POINT | |
#endif | |
(1) mdf.c | |
(2) preprocess.c | |
(3) filterbank.c | |
(4) fftwrap.c | |
(5) kiss_fft.c | |
(6) kiss_fftr.c | |
-- created a new USE_COMPACT_KISS_FFT for fftwrap.c and shifted defination | |
-- to config file so that user configure the usage of fft on config.h | |
-- TOEXPLORE:is it possible to share table between mdf/preprocess? | |
-- Introducing this macro made the following changes in C code | |
-- New macro to facilitate integration | |
(grouping real/complex for dc and nyquist frequency seems to require a large | |
amount of memory for mdf, therefore did not made the changes for that) | |
(1) modify preprocess.c on init and destroy | |
(2) modify mdf.c on init and destroy | |
(3) shifted power_spectrum to fftwrap.c to share optimised code between | |
preprocess.c and mdf.c | |
################# NOTES ############################## | |
(1) fixed point encoding/decoding is tested on narrowband | |
- some of the QX fractions are packed together to | |
(frac1 * a + frac2 * a) >> X (should be more accurate in rounding) | |
instead of | |
((frac1 * a) >> X) + ((frac2 * a) >> X) | |
will cause some different between optimized and unoptimized code. | |
tried decoding/encoding optimized code on some audio files retains | |
the clearity of the word | |
- wideband/ultrawideband is not heavily tested yet | |
(2) optimized fixed point code requires memory alignment | |
- used config to debug on functions where memory is not align | |
(3) floating point optimization for preprocess/mdf is tested | |
fixed point is not tested yet (except fft/filterbank) | |
Note (1) also applies to sround in fft for fixed point | |
some optimization is provided for fixed point as it requires lesser | |
memory compared to floating point. | |
(4) unroll configurations provided to reduce code size if required | |
(5) use profile options only if compiler profiling fails to work | |
(6) can't include the makefile as it is close proprietary | |
################# TODO:For Trimedia ############################## | |
(1) Possible add TSSA wrapper for codec but don't think this can be open source. | |
(2) Optimizations for fixed point in mdf/preprocess | |
################# Added Files ############################## | |
- _kiss_fft_guts_tm.h | |
- cb_search_tm.h | |
- fftwrap_tm.h | |
- filterbank_tm.h | |
- filters_tm.h | |
- fixed_tm.h | |
- kiss_fft_tm.h | |
- kiss_fftr_tm.h | |
- lpc_tm.h | |
- lsp_tm.h | |
- ltp_tm.h | |
- mdf_tm.h | |
- misc_tm.h | |
- preprocess_tm.h | |
- profile_tm.h | |
- quant_lsp_tm.h | |
- vq_tm.h | |
- config.h | |
- speex_config_types.h |