Initialize Tizen 2.3 2.3a_release submit/tizen_2.3/20140531.102232
authorSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:55:00 +0000 (12:55 +0900)
committerSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:55:00 +0000 (12:55 +0900)
461 files changed:
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
INSTALL [new file with mode: 0644]
LICENSE [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
Makefile.in [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
aclocal.m4 [new file with mode: 0644]
amrnb/Makefile.am [new file with mode: 0644]
amrnb/Makefile.in [new file with mode: 0644]
amrnb/interf_dec.h [new file with mode: 0644]
amrnb/interf_enc.h [new file with mode: 0644]
amrnb/opencore-amrnb.pc.in [new file with mode: 0644]
amrnb/opencore-amrnb.sym [new file with mode: 0644]
amrnb/wrapper.cpp [new file with mode: 0644]
amrwb/Makefile.am [new file with mode: 0644]
amrwb/Makefile.in [new file with mode: 0644]
amrwb/dec_if.h [new file with mode: 0644]
amrwb/if_rom.h [new file with mode: 0644]
amrwb/opencore-amrwb.pc.in [new file with mode: 0644]
amrwb/opencore-amrwb.sym [new file with mode: 0644]
amrwb/wrapper.cpp [new file with mode: 0644]
autogen.sh [new file with mode: 0755]
config.guess [new file with mode: 0755]
config.h.in [new file with mode: 0644]
config.sub [new file with mode: 0755]
configure [new file with mode: 0755]
configure.ac [new file with mode: 0644]
depcomp [new file with mode: 0755]
install-sh [new file with mode: 0755]
ltmain.sh [new file with mode: 0644]
m4/libtool.m4 [new file with mode: 0644]
m4/ltoptions.m4 [new file with mode: 0644]
m4/ltsugar.m4 [new file with mode: 0644]
m4/ltversion.m4 [new file with mode: 0644]
m4/lt~obsolete.m4 [new file with mode: 0644]
missing [new file with mode: 0755]
opencore-amr.manifest [new file with mode: 0644]
opencore/ChangeLog [new file with mode: 0644]
opencore/NOTICE [new file with mode: 0644]
opencore/README [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build/make/local.mk [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/abs_s.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/add.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/az_lsp.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basicop_malloc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitno_tab.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitreorder_tab.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst_vad.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_c.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_p.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_plsf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_s.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/dtx_common_def.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame_type_3gpp.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gc_pred.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/get_const_tbls.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gmed_n.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gsm_amr_typedefs.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lpc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lsf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/inv_sqrt.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add_c.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_comp.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_extract.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_negate.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shl.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr_r.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2_norm.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsfwt.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_az.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_lsf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_tab.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mac_32.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mode.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult_r.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/n_proc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/oper_32b.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/p_ol_wgh.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pow2.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pred_lt.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pvgsmamr.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_3_tbl.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_5_tbl.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qgain475_tab.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain_tbl.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reorder.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/residu.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reverse_bits.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/round.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/set_zero.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shl.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr_r.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sqrt_l.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sub.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/syn_filt.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/weight_a.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/window_tab.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/wmf_to_ets.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/add.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitno_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitreorder_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bits2prm.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/c2_9pf_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/copy.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_32.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_h.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_l.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gains_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/get_const_tbls.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gray_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/grid_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/int_lpc.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_h.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_l.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_norm.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsfwt.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/overflow_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/ph_disp_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/qua_gain_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/r_fft.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/reorder.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/set_zero.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l_tbl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sub.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/syn_filt.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad1.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad2.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/window_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/Android.mk [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/build/make/local.mk [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/decoder_gsm_amr.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/pvamrnbdecoder_api.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_c.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_p.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_3.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_input_format_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/decoder_gsm_amr.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/gsmamr_dec.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder_dpi.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/qgain475_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/wmf_to_ets.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build/make/local.mk [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/include/gsmamr_encoder_wrapper.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/corrwght_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_output_format_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_enc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_encoder_wrapper.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_comp.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_extract.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lflg_upd.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/p_ol_wgh.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qua_gain.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad2.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/build/make/local.mk [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/decoder_amr_wb.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/pvamrwbdecoder_api.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/agc2_amr_wb.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/band_pass_6k_7k.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_2p_in_64.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_4p_in_64.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_alg_codebook.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_gain2_amr_wb.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/decoder_amr_wb.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/deemphasis_32.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx_decoder_amr_wb.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/e_pv_amrwbdec.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_400hz_at_12k8.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_50hz_at_12k8.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/homing_amr_wb_dec.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/interpolate_isp.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isf_extrapolation.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_az.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_isf.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/lagconceal.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/low_pass_filt_7k.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/median5.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/noise_gen_amrwb.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/oversamp_12k8_to_16k.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/phase_dispersion.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pit_shrp.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pred_lt4.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/preemph_amrwb_dec.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pv_amr_wb_type_defs.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_acelp.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_cequivalent.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_cnst.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_mem_funcs.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_gain2_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_pulse.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s_tab.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/scale_signal.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/voice_factor.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/wb_syn_filt.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/weight_amrwb_lpc.cpp [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/common/dec/Android.mk [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/common/dec/build/make/local.mk [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/common/dec/include/pvgsmamrdecoderinterface.h [new file with mode: 0644]
opencore/codecs_v2/audio/gsm_amr/patent_disclaimer.txt [new file with mode: 0644]
oscl/oscl_base.h [new file with mode: 0644]
oscl/oscl_base_macros.h [new file with mode: 0644]
oscl/oscl_mem.h [new file with mode: 0644]
packaging/opencore-amr.spec [new file with mode: 0644]
test/Makefile.am [new file with mode: 0644]
test/Makefile.in [new file with mode: 0644]
test/amrnb-dec.c [new file with mode: 0644]
test/amrnb-enc-sine.c [new file with mode: 0644]
test/amrnb-enc.c [new file with mode: 0644]
test/amrwb-dec.c [new file with mode: 0644]
test/linkboth.c [new file with mode: 0644]
test/wavreader.c [new file with mode: 0644]
test/wavreader.h [new file with mode: 0644]
test/wavwriter.c [new file with mode: 0644]
test/wavwriter.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..a195537
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+See README.
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..5ec4bf0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,191 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the
+copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other
+entities that control, are controlled by, or are under common control with
+that entity. For the purposes of this definition, "control" means (i) the
+power, direct or indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (ii) ownership of fifty
+percent (50%) or more of the outstanding shares, or (iii) beneficial
+ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation
+or translation of a Source form, including but not limited to compiled
+object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice that
+is included in or attached to the work (an example is provided in the
+Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent, as
+a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from, or
+merely link (or bind by name) to the interfaces of, the Work and Derivative
+Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor for
+inclusion in the Work by the copyright owner or by an individual or Legal
+Entity authorized to submit on behalf of the copyright owner. For the
+purposes of this definition, "submitted" means any form of electronic,
+verbal, or written communication sent to the Licensor or its
+representatives, including but not limited to communication on electronic
+mailing lists, source code control systems, and issue tracking systems that
+are managed by, or on behalf of, the Licensor for the purpose of discussing
+and improving the Work, but excluding communication that is conspicuously
+marked or otherwise designated in writing by the copyright owner as "Not a
+Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on
+behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this
+License, each Contributor hereby grants to You a perpetual, worldwide,
+non-exclusive, no-charge, royalty-free, irrevocable copyright license to
+reproduce, prepare Derivative Works of, publicly display, publicly perform,
+sublicense, and distribute the Work and such Derivative Works in Source or
+Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this
+License, each Contributor hereby grants to You a perpetual, worldwide,
+non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
+this section) patent license to make, have made, use, offer to sell, sell,
+import, and otherwise transfer the Work, where such license applies only to
+those patent claims licensable by such Contributor that are necessarily
+infringed by their Contribution(s) alone or by combination of their
+Contribution(s) with the Work to which such Contribution(s) was submitted.
+If You institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work or a
+Contribution incorporated within the Work constitutes direct or
+contributory patent infringement, then any patent licenses granted to You
+under this License for that Work shall terminate as of the date such
+litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or
+Derivative Works thereof in any medium, with or without modifications, and
+in Source or Object form, provided that You meet the following conditions:
+
+   1. You must give any other recipients of the Work or Derivative Works a
+copy of this License; and
+
+   2. You must cause any modified files to carry prominent notices stating
+that You changed the files; and
+
+   3. You must retain, in the Source form of any Derivative Works that You
+distribute, all copyright, patent, trademark, and attribution notices from
+the Source form of the Work, excluding those notices that do not pertain to
+any part of the Derivative Works; and
+
+   4. If the Work includes a "NOTICE" text file as part of its
+distribution, then any Derivative Works that You distribute must include a
+readable copy of the attribution notices contained within such NOTICE file,
+excluding those notices that do not pertain to any part of the Derivative
+Works, in at least one of the following places: within a NOTICE text file
+distributed as part of the Derivative Works; within the Source form or
+documentation, if provided along with the Derivative Works; or, within a
+display generated by the Derivative Works, if and wherever such third-party
+notices normally appear. The contents of the NOTICE file are for
+informational purposes only and do not modify the License. You may add Your
+own attribution notices within Derivative Works that You distribute,
+alongside or as an addendum to the NOTICE text from the Work, provided that
+such additional attribution notices cannot be construed as modifying the
+License.
+
+You may add Your own copyright statement to Your modifications and may
+provide additional or different license terms and conditions for use,
+reproduction, or distribution of Your modifications, or for any such
+Derivative Works as a whole, provided Your use, reproduction, and
+distribution of the Work otherwise complies with the conditions stated in
+this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any
+Contribution intentionally submitted for inclusion in the Work by You to
+the Licensor shall be under the terms and conditions of this License,
+without any additional terms or conditions. Notwithstanding the above,
+nothing herein shall supersede or modify the terms of any separate license
+agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor, except
+as required for reasonable and customary use in describing the origin of
+the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to
+in writing, Licensor provides the Work (and each Contributor provides its
+Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied, including, without limitation, any
+warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
+FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
+determining the appropriateness of using or redistributing the Work and
+assume any risks associated with Your exercise of permissions under this
+License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether
+in tort (including negligence), contract, or otherwise, unless required by
+applicable law (such as deliberate and grossly negligent acts) or agreed to
+in writing, shall any Contributor be liable to You for damages, including
+any direct, indirect, special, incidental, or consequential damages of any
+character arising as a result of this License or out of the use or
+inability to use the Work (including but not limited to damages for loss of
+goodwill, work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor has been
+advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the
+Work or Derivative Works thereof, You may choose to offer, and charge a fee
+for, acceptance of support, warranty, indemnity, or other liability
+obligations and/or rights consistent with this License. However, in
+accepting such obligations, You may act only on Your own behalf and on Your
+sole responsibility, not on behalf of any other Contributor, and only if
+You agree to indemnify, defend, and hold each Contributor harmless for any
+liability incurred by, or claims asserted against, such Contributor by
+reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work
+
+To apply the Apache License to your work, attach the following boilerplate
+notice, with the fields enclosed by brackets "[]" replaced with your own
+identifying information. (Don't include the brackets!) The text should be
+enclosed in the appropriate comment syntax for the file format. We also
+recommend that a file or class name and description of purpose be included
+on the same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License"); you may
+ not use this file except in compliance with the License. You may obtain a
+ copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable
+ law or agreed to in writing, software distributed under the License is
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the specific language
+ governing permissions and limitations under the License.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..6acf662
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,22 @@
+0.1.3
+ - Adjusted libtool flags for building DLLs for windows
+ - Update to the latest upstream opencore source
+ - Updated and improved example applications
+ - Add options for enabling the arm inline assembly
+ - Add options for disabling the encoder or decoder in the amrnb library
+ - Avoid dependencies on libstdc++ if building the source as C
+ - Hide internal symbols in shared libraries
+ - Minor tweaks
+ - Remove old static makefiles and corresponding build scripts
+
+0.1.2
+ - Fixed AMR-NB encoding on 64-bit architectures
+ - Switch to using automake/autoconf/libtool
+ - Update to the latest upstream opencore source as of September 1, 2009 
+
+0.1.1
+ - Rename the libraries from libamr* to libopencore-amr*
+ - Fix a bunch of compiler warnings
+
+0.1.0
+ - Start of opencore-amr project.
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..a1e89e1
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,370 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
+Inc.
+
+   Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+   Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.  Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below.  The lack of an optional feature in a given package is not
+necessarily a bug.  More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+   The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package, generally using the just-built uninstalled binaries.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.  When installing into a prefix owned by root, it is
+     recommended that the package be configured and built as a regular
+     user, and only the `make install' phase executed with root
+     privileges.
+
+  5. Optionally, type `make installcheck' to repeat any self-tests, but
+     this time using the binaries in their final installed location.
+     This target does not install anything.  Running this target as a
+     regular user, particularly if the prior `make install' required
+     root privileges, verifies that the installation completed
+     correctly.
+
+  6. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  7. Often, you can also type `make uninstall' to remove the installed
+     files again.  In practice, not all packages have tested that
+     uninstallation works correctly, even though it is required by the
+     GNU Coding Standards.
+
+  8. Some packages, particularly those that use Automake, provide `make
+     distcheck', which can by used by developers to test that all other
+     targets like `make install' and `make uninstall' work correctly.
+     This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.  This
+is known as a "VPATH" build.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.  In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+   The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+   The first method involves providing an override variable for each
+affected directory.  For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'.  Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated.  The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the `DESTDIR' variable.  For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names.  The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters.  On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+   Some packages offer the ability to configure how verbose the
+execution of `make' will be.  For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved.  Use GNU `make'
+instead.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+   On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'.  It is recommended to use the following options:
+
+     ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS
+     KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..5ec4bf0
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,191 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the
+copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other
+entities that control, are controlled by, or are under common control with
+that entity. For the purposes of this definition, "control" means (i) the
+power, direct or indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (ii) ownership of fifty
+percent (50%) or more of the outstanding shares, or (iii) beneficial
+ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation
+or translation of a Source form, including but not limited to compiled
+object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice that
+is included in or attached to the work (an example is provided in the
+Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent, as
+a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from, or
+merely link (or bind by name) to the interfaces of, the Work and Derivative
+Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor for
+inclusion in the Work by the copyright owner or by an individual or Legal
+Entity authorized to submit on behalf of the copyright owner. For the
+purposes of this definition, "submitted" means any form of electronic,
+verbal, or written communication sent to the Licensor or its
+representatives, including but not limited to communication on electronic
+mailing lists, source code control systems, and issue tracking systems that
+are managed by, or on behalf of, the Licensor for the purpose of discussing
+and improving the Work, but excluding communication that is conspicuously
+marked or otherwise designated in writing by the copyright owner as "Not a
+Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on
+behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this
+License, each Contributor hereby grants to You a perpetual, worldwide,
+non-exclusive, no-charge, royalty-free, irrevocable copyright license to
+reproduce, prepare Derivative Works of, publicly display, publicly perform,
+sublicense, and distribute the Work and such Derivative Works in Source or
+Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this
+License, each Contributor hereby grants to You a perpetual, worldwide,
+non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
+this section) patent license to make, have made, use, offer to sell, sell,
+import, and otherwise transfer the Work, where such license applies only to
+those patent claims licensable by such Contributor that are necessarily
+infringed by their Contribution(s) alone or by combination of their
+Contribution(s) with the Work to which such Contribution(s) was submitted.
+If You institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work or a
+Contribution incorporated within the Work constitutes direct or
+contributory patent infringement, then any patent licenses granted to You
+under this License for that Work shall terminate as of the date such
+litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or
+Derivative Works thereof in any medium, with or without modifications, and
+in Source or Object form, provided that You meet the following conditions:
+
+   1. You must give any other recipients of the Work or Derivative Works a
+copy of this License; and
+
+   2. You must cause any modified files to carry prominent notices stating
+that You changed the files; and
+
+   3. You must retain, in the Source form of any Derivative Works that You
+distribute, all copyright, patent, trademark, and attribution notices from
+the Source form of the Work, excluding those notices that do not pertain to
+any part of the Derivative Works; and
+
+   4. If the Work includes a "NOTICE" text file as part of its
+distribution, then any Derivative Works that You distribute must include a
+readable copy of the attribution notices contained within such NOTICE file,
+excluding those notices that do not pertain to any part of the Derivative
+Works, in at least one of the following places: within a NOTICE text file
+distributed as part of the Derivative Works; within the Source form or
+documentation, if provided along with the Derivative Works; or, within a
+display generated by the Derivative Works, if and wherever such third-party
+notices normally appear. The contents of the NOTICE file are for
+informational purposes only and do not modify the License. You may add Your
+own attribution notices within Derivative Works that You distribute,
+alongside or as an addendum to the NOTICE text from the Work, provided that
+such additional attribution notices cannot be construed as modifying the
+License.
+
+You may add Your own copyright statement to Your modifications and may
+provide additional or different license terms and conditions for use,
+reproduction, or distribution of Your modifications, or for any such
+Derivative Works as a whole, provided Your use, reproduction, and
+distribution of the Work otherwise complies with the conditions stated in
+this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any
+Contribution intentionally submitted for inclusion in the Work by You to
+the Licensor shall be under the terms and conditions of this License,
+without any additional terms or conditions. Notwithstanding the above,
+nothing herein shall supersede or modify the terms of any separate license
+agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor, except
+as required for reasonable and customary use in describing the origin of
+the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to
+in writing, Licensor provides the Work (and each Contributor provides its
+Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied, including, without limitation, any
+warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
+FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
+determining the appropriateness of using or redistributing the Work and
+assume any risks associated with Your exercise of permissions under this
+License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether
+in tort (including negligence), contract, or otherwise, unless required by
+applicable law (such as deliberate and grossly negligent acts) or agreed to
+in writing, shall any Contributor be liable to You for damages, including
+any direct, indirect, special, incidental, or consequential damages of any
+character arising as a result of this License or out of the use or
+inability to use the Work (including but not limited to damages for loss of
+goodwill, work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor has been
+advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the
+Work or Derivative Works thereof, You may choose to offer, and charge a fee
+for, acceptance of support, warranty, indemnity, or other liability
+obligations and/or rights consistent with this License. However, in
+accepting such obligations, You may act only on Your own behalf and on Your
+sole responsibility, not on behalf of any other Contributor, and only if
+You agree to indemnify, defend, and hold each Contributor harmless for any
+liability incurred by, or claims asserted against, such Contributor by
+reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work
+
+To apply the Apache License to your work, attach the following boilerplate
+notice, with the fields enclosed by brackets "[]" replaced with your own
+identifying information. (Don't include the brackets!) The text should be
+enclosed in the appropriate comment syntax for the file format. We also
+recommend that a file or class name and description of purpose be included
+on the same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License"); you may
+ not use this file except in compliance with the License. You may obtain a
+ copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable
+ law or agreed to in writing, software distributed under the License is
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the specific language
+ governing permissions and limitations under the License.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..f8eee3f
--- /dev/null
@@ -0,0 +1,36 @@
+SUBDIRS = amrnb amrwb
+if EXAMPLES
+    SUBDIRS += test
+endif
+
+ACLOCAL_AMFLAGS = -I m4
+
+noinst_HEADERS = oscl/oscl_base.h oscl/oscl_mem.h oscl/oscl_base_macros.h
+
+EXTRA_DIST = $(top_srcdir)/LICENSE \
+    $(top_srcdir)/opencore/README \
+    $(top_srcdir)/opencore/NOTICE opencore/ChangeLog \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/patent_disclaimer.txt \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/common/dec/include \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/common/dec/build \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/common/dec/Android.mk \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/*.cpp \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/Android.mk \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/build \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/*.cpp \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/*.h \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/include \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/*.cpp \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/*.h \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/build \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/*.cpp \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/*.h
+
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..68b8715
--- /dev/null
@@ -0,0 +1,789 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@EXAMPLES_TRUE@am__append_1 = test
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(noinst_HEADERS) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \
+       ChangeLog INSTALL NEWS config.guess config.sub depcomp \
+       install-sh ltmain.sh missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN   " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-dvi-recursive install-exec-recursive \
+       install-html-recursive install-info-recursive \
+       install-pdf-recursive install-ps-recursive install-recursive \
+       installcheck-recursive installdirs-recursive pdf-recursive \
+       ps-recursive uninstall-recursive
+HEADERS = $(noinst_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
+  distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+       $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+       distdir dist dist-all distcheck
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = amrnb amrwb test
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  if test -d "$(distdir)"; then \
+    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+      && rm -rf "$(distdir)" \
+      || { sleep 5 && rm -rf "$(distdir)"; }; \
+  else :; fi
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENCORE_AMRNB_VERSION = @OPENCORE_AMRNB_VERSION@
+OPENCORE_AMRWB_VERSION = @OPENCORE_AMRWB_VERSION@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = amrnb amrwb $(am__append_1)
+ACLOCAL_AMFLAGS = -I m4
+noinst_HEADERS = oscl/oscl_base.h oscl/oscl_mem.h oscl/oscl_base_macros.h
+EXTRA_DIST = $(top_srcdir)/LICENSE \
+    $(top_srcdir)/opencore/README \
+    $(top_srcdir)/opencore/NOTICE opencore/ChangeLog \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/patent_disclaimer.txt \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/common/dec/include \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/common/dec/build \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/common/dec/Android.mk \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/*.cpp \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/Android.mk \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/build \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/*.cpp \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/*.h \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/include \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/*.cpp \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/*.h \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/build \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/*.cpp \
+    $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/*.h
+
+all: config.h
+       $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh: Makefile
+       @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
+             $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           echo ' $(SHELL) ./config.status'; \
+           $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+       $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+       $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+       @if test ! -f $@; then rm -f stamp-h1; else :; fi
+       @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+       @rm -f stamp-h1
+       cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
+       ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+       rm -f stamp-h1
+       touch $@
+
+distclean-hdr:
+       -rm -f config.h stamp-h1
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool config.lt
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @fail= failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+       @fail= failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       set x; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(am__remove_distdir)
+       test -d "$(distdir)" || mkdir "$(distdir)"
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+       @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(MKDIR_P) "$(distdir)/$$subdir" \
+           || exit 1; \
+         fi; \
+       done
+       @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+           $(am__relativize); \
+           new_distdir=$$reldir; \
+           dir1=$$subdir; dir2="$(top_distdir)"; \
+           $(am__relativize); \
+           new_top_distdir=$$reldir; \
+           echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+           echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+           ($(am__cd) $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$new_top_distdir" \
+               distdir="$$new_distdir" \
+               am__remove_distdir=: \
+               am__skip_length_check=: \
+               am__skip_mode_fix=: \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+       -test -n "$(am__skip_mode_fix)" \
+       || find "$(distdir)" -type d ! -perm -755 \
+               -exec chmod u+rwx,go+rx {} \; -o \
+         ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+       || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+dist-bzip2: distdir
+       tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+       $(am__remove_distdir)
+
+dist-lzip: distdir
+       tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+       $(am__remove_distdir)
+
+dist-lzma: distdir
+       tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+       $(am__remove_distdir)
+
+dist-xz: distdir
+       tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+       $(am__remove_distdir)
+
+dist-tarZ: distdir
+       tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+       $(am__remove_distdir)
+
+dist-shar: distdir
+       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       $(am__remove_distdir)
+
+dist-zip: distdir
+       -rm -f $(distdir).zip
+       zip -rq $(distdir).zip $(distdir)
+       $(am__remove_distdir)
+
+dist dist-all: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+       case '$(DIST_ARCHIVES)' in \
+       *.tar.gz*) \
+         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+       *.tar.bz2*) \
+         bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+       *.tar.lzma*) \
+         lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+       *.tar.lz*) \
+         lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+       *.tar.xz*) \
+         xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+       *.tar.Z*) \
+         uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+       *.shar.gz*) \
+         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+       *.zip*) \
+         unzip $(distdir).zip ;;\
+       esac
+       chmod -R a-w $(distdir); chmod a+w $(distdir)
+       mkdir $(distdir)/_build
+       mkdir $(distdir)/_inst
+       chmod a-w $(distdir)
+       test -d $(distdir)/_build || exit 0; \
+       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+         && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+         && am__cwd=`pwd` \
+         && $(am__cd) $(distdir)/_build \
+         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+           $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+           $(DISTCHECK_CONFIGURE_FLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+         && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+               distuninstallcheck \
+         && chmod -R a-w "$$dc_install_base" \
+         && ({ \
+              (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+                   distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+             } || { rm -rf "$$dc_destdir"; exit 1; }) \
+         && rm -rf "$$dc_destdir" \
+         && $(MAKE) $(AM_MAKEFLAGS) dist \
+         && rm -rf $(DIST_ARCHIVES) \
+         && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+         && cd "$$am__cwd" \
+         || exit 1
+       $(am__remove_distdir)
+       @(echo "$(distdir) archives ready for distribution: "; \
+         list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+         sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+       @test -n '$(distuninstallcheck_dir)' || { \
+         echo 'ERROR: trying to run $@ with an empty' \
+              '$$(distuninstallcheck_dir)' >&2; \
+         exit 1; \
+       }; \
+       $(am__cd) '$(distuninstallcheck_dir)' || { \
+         echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+         exit 1; \
+       }; \
+       test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+          || { echo "ERROR: files left after uninstall:" ; \
+               if test -n "$(DESTDIR)"; then \
+                 echo "  (check DESTDIR support)"; \
+               fi ; \
+               $(distuninstallcheck_listfiles) ; \
+               exit 1; } >&2
+distcleancheck: distclean
+       @if test '$(srcdir)' = . ; then \
+         echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+         exit 1 ; \
+       fi
+       @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+         || { echo "ERROR: files left in build directory after distclean:" ; \
+              $(distcleancheck_listfiles) ; \
+              exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(HEADERS) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       if test -z '$(STRIP)'; then \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+             install; \
+       else \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+       fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr \
+       distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf $(top_srcdir)/autom4te.cache
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+       ctags-recursive install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+       all all-am am--refresh check check-am clean clean-generic \
+       clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
+       dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \
+       dist-zip distcheck distclean distclean-generic distclean-hdr \
+       distclean-libtool distclean-tags distcleancheck distdir \
+       distuninstallcheck dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-dvi \
+       install-dvi-am install-exec install-exec-am install-html \
+       install-html-am install-info install-info-am install-man \
+       install-pdf install-pdf-am install-ps install-ps-am \
+       install-strip installcheck installcheck-am installdirs \
+       installdirs-am maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+       ps ps-am tags tags-recursive uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..8241bdf
--- /dev/null
+++ b/README
@@ -0,0 +1,11 @@
+OpenCORE Adaptive Multi Rate (AMR) speech codec library implementation.
+
+This library contains an implementation of the 3GPP TS 26.073 specification for
+the Adaptive Multi Rate (AMR) speech codec and an implementation for the
+3GPP TS 26.173 specification for the Adaptive Multi-Rate - Wideband (AMR-WB)
+speech decoder. The implementation is derived from the OpenCORE framework, part
+of the Google Android project.
+
+This library is Licensed under the Apache License, Version 2.0. A copy me be
+found in the file 'LICENSE' and at
+http://www.apache.org/licenses/LICENSE-2.0.html
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644 (file)
index 0000000..8ea794f
--- /dev/null
@@ -0,0 +1,1092 @@
+# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
+# Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.11'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.11.3], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11.3])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
+# 2010, 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  am__universal=false
+  m4_case([$1], [CC],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac],
+    [CXX],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac])
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+  am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 5
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`AS_DIRNAME("$mf")`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`AS_DIRNAME(["$file"])`
+      AS_MKDIR_P([$dirpart/$fdir])
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 16
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+             [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+                            [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                 [_AM_DEPENDENCIES(CC)],
+                 [define([AC_PROG_CC],
+                         defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                 [_AM_DEPENDENCIES(CXX)],
+                 [define([AC_PROG_CXX],
+                         defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+                 [_AM_DEPENDENCIES(OBJC)],
+                 [define([AC_PROG_OBJC],
+                         defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
+# Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
+# 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well.  Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+       [enable], [m4_define([am_maintainer_other], [disable])],
+       [disable], [m4_define([am_maintainer_other], [enable])],
+       [m4_define([am_maintainer_other], [enable])
+        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+  AC_ARG_ENABLE([maintainer-mode],
+[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
+                         (and sometimes confusing) to the casual installer],
+      [USE_MAINTAINER_MODE=$enableval],
+      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes.                 -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
+# Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[[\\\"\#\$\&\'\`$am_lf]]*)
+    AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+  *[[\\\"\#\$\&\'\`$am_lf\ \   ]]*)
+    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2009, 2011  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# (`yes' being less verbose, `no' or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules],
+[  --enable-silent-rules          less verbose build output (undo: `make V=1')
+  --disable-silent-rules         verbose build output (undo: `make V=0')])
+case $enable_silent_rules in
+yes) AM_DEFAULT_VERBOSITY=0;;
+no)  AM_DEFAULT_VERBOSITY=1;;
+*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few `make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+   [am_cv_make_support_nested_variables],
+   [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+       @$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+  dnl Using `$V' instead of `$(V)' breaks IRIX make.
+  AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+m4_if([$1], [v7],
+     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([m4/libtool.m4])
+m4_include([m4/ltoptions.m4])
+m4_include([m4/ltsugar.m4])
+m4_include([m4/ltversion.m4])
+m4_include([m4/lt~obsolete.m4])
diff --git a/amrnb/Makefile.am b/amrnb/Makefile.am
new file mode 100644 (file)
index 0000000..1b42bd5
--- /dev/null
@@ -0,0 +1,224 @@
+# Just set OC_BASE to the opencore root, or set AMR_BASE directly to
+# a detached gsm_amr directory
+OC_BASE = $(top_srcdir)/opencore
+AMR_BASE = $(OC_BASE)/codecs_v2/audio/gsm_amr
+
+DEC_DIR = $(AMR_BASE)/amr_nb/dec
+ENC_DIR = $(AMR_BASE)/amr_nb/enc
+COMMON_DIR = $(AMR_BASE)/amr_nb/common
+DEC_SRC_DIR = $(DEC_DIR)/src
+ENC_SRC_DIR = $(ENC_DIR)/src
+COMMON_SRC_DIR = $(COMMON_DIR)/src
+OSCL = $(top_srcdir)/oscl
+
+AM_CFLAGS = -I$(OSCL) -I$(DEC_SRC_DIR) -I$(COMMON_DIR)/include \
+    -I$(DEC_DIR)/include -I$(AMR_BASE)/common/dec/include -I$(ENC_SRC_DIR)
+
+if GCC_ARMV5
+    AM_CFLAGS += -DPV_CPU_ARCH_VERSION=5 -DPV_COMPILER=1
+endif
+
+if COMPILE_AS_C
+    AM_CFLAGS += -x c -std=c99
+    libopencore_amrnb_la_LINK = $(LINK) $(libopencore_amrnb_la_LDFLAGS)
+    # Mention a dummy pure C file to trigger generation of the $(LINK) variable
+    nodist_EXTRA_libopencore_amrnb_la_SOURCES = dummy.c
+else
+    libopencore_amrnb_la_LINK = $(CXXLINK) $(libopencore_amrnb_la_LDFLAGS)
+endif
+
+AM_CXXFLAGS = $(AM_CFLAGS)
+
+amrnbincludedir = $(includedir)/opencore-amrnb
+amrnbinclude_HEADERS =
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = opencore-amrnb.pc
+
+lib_LTLIBRARIES = libopencore-amrnb.la
+
+libopencore_amrnb_la_LDFLAGS = -version-info @OPENCORE_AMRNB_VERSION@ -no-undefined -export-symbols $(top_srcdir)/amrnb/opencore-amrnb.sym
+EXTRA_DIST = $(top_srcdir)/amrnb/opencore-amrnb.sym
+
+# Our sources to include. There are certain sources we exclude and they are
+# $(DEC_SRC_DIR)/decoder_gsm_amr.cpp
+# $(DEC_SRC_DIR)/pvgsmamrdecoder.cpp
+# $(ENC_SRC_DIR)/gsmamr_encoder_wrapper.cpp
+# $(COMMON_SRC_DIR)/bits2prm.cpp
+# $(COMMON_SRC_DIR)/copy.cpp
+# $(COMMON_SRC_DIR)/div_32.cpp
+# $(COMMON_SRC_DIR)/l_abs.cpp
+# $(COMMON_SRC_DIR)/r_fft.cpp
+# $(COMMON_SRC_DIR)/vad1.cpp
+# $(COMMON_SRC_DIR)/vad2.cpp
+libopencore_amrnb_la_SOURCES = \
+    wrapper.cpp
+
+if AMRNB_DECODER
+    libopencore_amrnb_la_SOURCES += \
+    $(DEC_SRC_DIR)/agc.cpp \
+        $(DEC_SRC_DIR)/amrdecode.cpp \
+        $(DEC_SRC_DIR)/a_refl.cpp \
+        $(DEC_SRC_DIR)/b_cn_cod.cpp \
+        $(DEC_SRC_DIR)/bgnscd.cpp \
+        $(DEC_SRC_DIR)/c_g_aver.cpp \
+        $(DEC_SRC_DIR)/d1035pf.cpp \
+        $(DEC_SRC_DIR)/d2_11pf.cpp \
+        $(DEC_SRC_DIR)/d2_9pf.cpp \
+        $(DEC_SRC_DIR)/d3_14pf.cpp \
+        $(DEC_SRC_DIR)/d4_17pf.cpp \
+        $(DEC_SRC_DIR)/d8_31pf.cpp \
+        $(DEC_SRC_DIR)/dec_amr.cpp \
+        $(DEC_SRC_DIR)/dec_gain.cpp \
+        $(DEC_SRC_DIR)/dec_input_format_tab.cpp \
+        $(DEC_SRC_DIR)/dec_lag3.cpp \
+        $(DEC_SRC_DIR)/dec_lag6.cpp \
+        $(DEC_SRC_DIR)/d_gain_c.cpp \
+        $(DEC_SRC_DIR)/d_gain_p.cpp \
+        $(DEC_SRC_DIR)/d_plsf_3.cpp \
+        $(DEC_SRC_DIR)/d_plsf_5.cpp \
+        $(DEC_SRC_DIR)/d_plsf.cpp \
+        $(DEC_SRC_DIR)/dtx_dec.cpp \
+        $(DEC_SRC_DIR)/ec_gains.cpp \
+        $(DEC_SRC_DIR)/ex_ctrl.cpp \
+        $(DEC_SRC_DIR)/if2_to_ets.cpp \
+        $(DEC_SRC_DIR)/int_lsf.cpp \
+        $(DEC_SRC_DIR)/lsp_avg.cpp \
+        $(DEC_SRC_DIR)/ph_disp.cpp \
+        $(DEC_SRC_DIR)/post_pro.cpp \
+        $(DEC_SRC_DIR)/preemph.cpp \
+        $(DEC_SRC_DIR)/pstfilt.cpp \
+        $(DEC_SRC_DIR)/qgain475_tab.cpp \
+        $(DEC_SRC_DIR)/sp_dec.cpp \
+        $(DEC_SRC_DIR)/wmf_to_ets.cpp
+    amrnbinclude_HEADERS += interf_dec.h
+else
+    AM_CFLAGS += -DDISABLE_AMRNB_DECODER
+endif
+
+if AMRNB_ENCODER
+    libopencore_amrnb_la_SOURCES += \
+    $(ENC_SRC_DIR)/amrencode.cpp \
+        $(ENC_SRC_DIR)/autocorr.cpp \
+        $(ENC_SRC_DIR)/c1035pf.cpp \
+        $(ENC_SRC_DIR)/c2_11pf.cpp \
+        $(ENC_SRC_DIR)/c2_9pf.cpp \
+        $(ENC_SRC_DIR)/c3_14pf.cpp \
+        $(ENC_SRC_DIR)/c4_17pf.cpp \
+        $(ENC_SRC_DIR)/c8_31pf.cpp \
+        $(ENC_SRC_DIR)/calc_cor.cpp \
+        $(ENC_SRC_DIR)/calc_en.cpp \
+        $(ENC_SRC_DIR)/cbsearch.cpp \
+        $(ENC_SRC_DIR)/cl_ltp.cpp \
+        $(ENC_SRC_DIR)/cod_amr.cpp \
+        $(ENC_SRC_DIR)/convolve.cpp \
+        $(ENC_SRC_DIR)/cor_h.cpp \
+        $(ENC_SRC_DIR)/cor_h_x2.cpp \
+        $(ENC_SRC_DIR)/cor_h_x.cpp \
+        $(ENC_SRC_DIR)/corrwght_tab.cpp \
+        $(ENC_SRC_DIR)/div_32.cpp \
+        $(ENC_SRC_DIR)/dtx_enc.cpp \
+        $(ENC_SRC_DIR)/enc_lag3.cpp \
+        $(ENC_SRC_DIR)/enc_lag6.cpp \
+        $(ENC_SRC_DIR)/enc_output_format_tab.cpp \
+        $(ENC_SRC_DIR)/ets_to_if2.cpp \
+        $(ENC_SRC_DIR)/ets_to_wmf.cpp \
+        $(ENC_SRC_DIR)/g_adapt.cpp \
+        $(ENC_SRC_DIR)/gain_q.cpp \
+        $(ENC_SRC_DIR)/g_code.cpp \
+        $(ENC_SRC_DIR)/g_pitch.cpp \
+        $(ENC_SRC_DIR)/hp_max.cpp \
+        $(ENC_SRC_DIR)/inter_36.cpp \
+        $(ENC_SRC_DIR)/inter_36_tab.cpp \
+        $(ENC_SRC_DIR)/l_abs.cpp \
+        $(ENC_SRC_DIR)/lag_wind.cpp \
+        $(ENC_SRC_DIR)/lag_wind_tab.cpp \
+        $(ENC_SRC_DIR)/l_comp.cpp \
+        $(ENC_SRC_DIR)/levinson.cpp \
+        $(ENC_SRC_DIR)/l_extract.cpp \
+        $(ENC_SRC_DIR)/lflg_upd.cpp \
+        $(ENC_SRC_DIR)/l_negate.cpp \
+        $(ENC_SRC_DIR)/lpc.cpp \
+        $(ENC_SRC_DIR)/ol_ltp.cpp \
+        $(ENC_SRC_DIR)/pitch_fr.cpp \
+        $(ENC_SRC_DIR)/pitch_ol.cpp \
+        $(ENC_SRC_DIR)/p_ol_wgh.cpp \
+        $(ENC_SRC_DIR)/pre_big.cpp \
+        $(ENC_SRC_DIR)/pre_proc.cpp \
+        $(ENC_SRC_DIR)/prm2bits.cpp \
+        $(ENC_SRC_DIR)/qgain475.cpp \
+        $(ENC_SRC_DIR)/qgain795.cpp \
+        $(ENC_SRC_DIR)/q_gain_c.cpp \
+        $(ENC_SRC_DIR)/q_gain_p.cpp \
+        $(ENC_SRC_DIR)/qua_gain.cpp \
+        $(ENC_SRC_DIR)/s10_8pf.cpp \
+        $(ENC_SRC_DIR)/set_sign.cpp \
+        $(ENC_SRC_DIR)/sid_sync.cpp \
+        $(ENC_SRC_DIR)/sp_enc.cpp \
+        $(ENC_SRC_DIR)/spreproc.cpp \
+        $(ENC_SRC_DIR)/spstproc.cpp \
+        $(ENC_SRC_DIR)/ton_stab.cpp \
+        $(ENC_SRC_DIR)/vad1.cpp
+    amrnbinclude_HEADERS += interf_enc.h
+else
+    AM_CFLAGS += -DDISABLE_AMRNB_ENCODER
+endif
+
+libopencore_amrnb_la_SOURCES += \
+    $(COMMON_SRC_DIR)/add.cpp \
+        $(COMMON_SRC_DIR)/az_lsp.cpp \
+        $(COMMON_SRC_DIR)/bitno_tab.cpp \
+        $(COMMON_SRC_DIR)/bitreorder_tab.cpp \
+        $(COMMON_SRC_DIR)/c2_9pf_tab.cpp \
+        $(COMMON_SRC_DIR)/div_s.cpp \
+        $(COMMON_SRC_DIR)/extract_h.cpp \
+        $(COMMON_SRC_DIR)/extract_l.cpp \
+        $(COMMON_SRC_DIR)/gains_tbl.cpp \
+        $(COMMON_SRC_DIR)/gc_pred.cpp \
+        $(COMMON_SRC_DIR)/get_const_tbls.cpp \
+        $(COMMON_SRC_DIR)/gmed_n.cpp \
+        $(COMMON_SRC_DIR)/gray_tbl.cpp \
+        $(COMMON_SRC_DIR)/grid_tbl.cpp \
+        $(COMMON_SRC_DIR)/int_lpc.cpp \
+        $(COMMON_SRC_DIR)/inv_sqrt.cpp \
+        $(COMMON_SRC_DIR)/inv_sqrt_tbl.cpp \
+        $(COMMON_SRC_DIR)/l_deposit_h.cpp \
+        $(COMMON_SRC_DIR)/l_deposit_l.cpp \
+        $(COMMON_SRC_DIR)/log2.cpp \
+        $(COMMON_SRC_DIR)/log2_norm.cpp \
+        $(COMMON_SRC_DIR)/log2_tbl.cpp \
+        $(COMMON_SRC_DIR)/lsfwt.cpp \
+        $(COMMON_SRC_DIR)/l_shr_r.cpp \
+        $(COMMON_SRC_DIR)/lsp_az.cpp \
+        $(COMMON_SRC_DIR)/lsp.cpp \
+        $(COMMON_SRC_DIR)/lsp_lsf.cpp \
+        $(COMMON_SRC_DIR)/lsp_lsf_tbl.cpp \
+        $(COMMON_SRC_DIR)/lsp_tab.cpp \
+        $(COMMON_SRC_DIR)/mult_r.cpp \
+        $(COMMON_SRC_DIR)/negate.cpp \
+        $(COMMON_SRC_DIR)/norm_l.cpp \
+        $(COMMON_SRC_DIR)/norm_s.cpp \
+        $(COMMON_SRC_DIR)/overflow_tbl.cpp \
+        $(COMMON_SRC_DIR)/ph_disp_tab.cpp \
+        $(COMMON_SRC_DIR)/pow2.cpp \
+        $(COMMON_SRC_DIR)/pow2_tbl.cpp \
+        $(COMMON_SRC_DIR)/pred_lt.cpp \
+        $(COMMON_SRC_DIR)/q_plsf_3.cpp \
+        $(COMMON_SRC_DIR)/q_plsf_3_tbl.cpp \
+        $(COMMON_SRC_DIR)/q_plsf_5.cpp \
+        $(COMMON_SRC_DIR)/q_plsf_5_tbl.cpp \
+        $(COMMON_SRC_DIR)/q_plsf.cpp \
+        $(COMMON_SRC_DIR)/qua_gain_tbl.cpp \
+        $(COMMON_SRC_DIR)/reorder.cpp \
+        $(COMMON_SRC_DIR)/residu.cpp \
+        $(COMMON_SRC_DIR)/round.cpp \
+        $(COMMON_SRC_DIR)/set_zero.cpp \
+        $(COMMON_SRC_DIR)/shr.cpp \
+        $(COMMON_SRC_DIR)/shr_r.cpp \
+        $(COMMON_SRC_DIR)/sqrt_l.cpp \
+        $(COMMON_SRC_DIR)/sqrt_l_tbl.cpp \
+        $(COMMON_SRC_DIR)/sub.cpp \
+        $(COMMON_SRC_DIR)/syn_filt.cpp \
+        $(COMMON_SRC_DIR)/weight_a.cpp \
+        $(COMMON_SRC_DIR)/window_tab.cpp
+
diff --git a/amrnb/Makefile.in b/amrnb/Makefile.in
new file mode 100644 (file)
index 0000000..b8eba75
--- /dev/null
@@ -0,0 +1,2171 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@GCC_ARMV5_TRUE@am__append_1 = -DPV_CPU_ARCH_VERSION=5 -DPV_COMPILER=1
+@COMPILE_AS_C_TRUE@am__append_2 = -x c -std=c99
+@AMRNB_DECODER_TRUE@am__append_3 = \
+@AMRNB_DECODER_TRUE@    $(DEC_SRC_DIR)/agc.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/amrdecode.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/a_refl.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/b_cn_cod.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/bgnscd.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/c_g_aver.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d1035pf.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d2_11pf.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d2_9pf.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d3_14pf.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d4_17pf.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d8_31pf.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/dec_amr.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/dec_gain.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/dec_input_format_tab.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/dec_lag3.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/dec_lag6.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d_gain_c.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d_gain_p.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d_plsf_3.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d_plsf_5.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/d_plsf.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/dtx_dec.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/ec_gains.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/ex_ctrl.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/if2_to_ets.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/int_lsf.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/lsp_avg.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/ph_disp.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/post_pro.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/preemph.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/pstfilt.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/qgain475_tab.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/sp_dec.cpp \
+@AMRNB_DECODER_TRUE@        $(DEC_SRC_DIR)/wmf_to_ets.cpp
+
+@AMRNB_DECODER_TRUE@am__append_4 = interf_dec.h
+@AMRNB_DECODER_FALSE@am__append_5 = -DDISABLE_AMRNB_DECODER
+@AMRNB_ENCODER_TRUE@am__append_6 = \
+@AMRNB_ENCODER_TRUE@    $(ENC_SRC_DIR)/amrencode.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/autocorr.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/c1035pf.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/c2_11pf.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/c2_9pf.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/c3_14pf.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/c4_17pf.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/c8_31pf.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/calc_cor.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/calc_en.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/cbsearch.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/cl_ltp.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/cod_amr.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/convolve.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/cor_h.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/cor_h_x2.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/cor_h_x.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/corrwght_tab.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/div_32.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/dtx_enc.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/enc_lag3.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/enc_lag6.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/enc_output_format_tab.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/ets_to_if2.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/ets_to_wmf.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/g_adapt.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/gain_q.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/g_code.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/g_pitch.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/hp_max.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/inter_36.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/inter_36_tab.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/l_abs.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/lag_wind.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/lag_wind_tab.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/l_comp.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/levinson.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/l_extract.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/lflg_upd.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/l_negate.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/lpc.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/ol_ltp.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/pitch_fr.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/pitch_ol.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/p_ol_wgh.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/pre_big.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/pre_proc.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/prm2bits.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/qgain475.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/qgain795.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/q_gain_c.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/q_gain_p.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/qua_gain.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/s10_8pf.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/set_sign.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/sid_sync.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/sp_enc.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/spreproc.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/spstproc.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/ton_stab.cpp \
+@AMRNB_ENCODER_TRUE@        $(ENC_SRC_DIR)/vad1.cpp
+
+@AMRNB_ENCODER_TRUE@am__append_7 = interf_enc.h
+@AMRNB_ENCODER_FALSE@am__append_8 = -DDISABLE_AMRNB_ENCODER
+subdir = amrnb
+DIST_COMMON = $(am__amrnbinclude_HEADERS_DIST) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(srcdir)/opencore-amrnb.pc.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = opencore-amrnb.pc
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \
+       "$(DESTDIR)$(amrnbincludedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libopencore_amrnb_la_LIBADD =
+am__libopencore_amrnb_la_SOURCES_DIST = wrapper.cpp \
+       $(DEC_SRC_DIR)/agc.cpp $(DEC_SRC_DIR)/amrdecode.cpp \
+       $(DEC_SRC_DIR)/a_refl.cpp $(DEC_SRC_DIR)/b_cn_cod.cpp \
+       $(DEC_SRC_DIR)/bgnscd.cpp $(DEC_SRC_DIR)/c_g_aver.cpp \
+       $(DEC_SRC_DIR)/d1035pf.cpp $(DEC_SRC_DIR)/d2_11pf.cpp \
+       $(DEC_SRC_DIR)/d2_9pf.cpp $(DEC_SRC_DIR)/d3_14pf.cpp \
+       $(DEC_SRC_DIR)/d4_17pf.cpp $(DEC_SRC_DIR)/d8_31pf.cpp \
+       $(DEC_SRC_DIR)/dec_amr.cpp $(DEC_SRC_DIR)/dec_gain.cpp \
+       $(DEC_SRC_DIR)/dec_input_format_tab.cpp \
+       $(DEC_SRC_DIR)/dec_lag3.cpp $(DEC_SRC_DIR)/dec_lag6.cpp \
+       $(DEC_SRC_DIR)/d_gain_c.cpp $(DEC_SRC_DIR)/d_gain_p.cpp \
+       $(DEC_SRC_DIR)/d_plsf_3.cpp $(DEC_SRC_DIR)/d_plsf_5.cpp \
+       $(DEC_SRC_DIR)/d_plsf.cpp $(DEC_SRC_DIR)/dtx_dec.cpp \
+       $(DEC_SRC_DIR)/ec_gains.cpp $(DEC_SRC_DIR)/ex_ctrl.cpp \
+       $(DEC_SRC_DIR)/if2_to_ets.cpp $(DEC_SRC_DIR)/int_lsf.cpp \
+       $(DEC_SRC_DIR)/lsp_avg.cpp $(DEC_SRC_DIR)/ph_disp.cpp \
+       $(DEC_SRC_DIR)/post_pro.cpp $(DEC_SRC_DIR)/preemph.cpp \
+       $(DEC_SRC_DIR)/pstfilt.cpp $(DEC_SRC_DIR)/qgain475_tab.cpp \
+       $(DEC_SRC_DIR)/sp_dec.cpp $(DEC_SRC_DIR)/wmf_to_ets.cpp \
+       $(ENC_SRC_DIR)/amrencode.cpp $(ENC_SRC_DIR)/autocorr.cpp \
+       $(ENC_SRC_DIR)/c1035pf.cpp $(ENC_SRC_DIR)/c2_11pf.cpp \
+       $(ENC_SRC_DIR)/c2_9pf.cpp $(ENC_SRC_DIR)/c3_14pf.cpp \
+       $(ENC_SRC_DIR)/c4_17pf.cpp $(ENC_SRC_DIR)/c8_31pf.cpp \
+       $(ENC_SRC_DIR)/calc_cor.cpp $(ENC_SRC_DIR)/calc_en.cpp \
+       $(ENC_SRC_DIR)/cbsearch.cpp $(ENC_SRC_DIR)/cl_ltp.cpp \
+       $(ENC_SRC_DIR)/cod_amr.cpp $(ENC_SRC_DIR)/convolve.cpp \
+       $(ENC_SRC_DIR)/cor_h.cpp $(ENC_SRC_DIR)/cor_h_x2.cpp \
+       $(ENC_SRC_DIR)/cor_h_x.cpp $(ENC_SRC_DIR)/corrwght_tab.cpp \
+       $(ENC_SRC_DIR)/div_32.cpp $(ENC_SRC_DIR)/dtx_enc.cpp \
+       $(ENC_SRC_DIR)/enc_lag3.cpp $(ENC_SRC_DIR)/enc_lag6.cpp \
+       $(ENC_SRC_DIR)/enc_output_format_tab.cpp \
+       $(ENC_SRC_DIR)/ets_to_if2.cpp $(ENC_SRC_DIR)/ets_to_wmf.cpp \
+       $(ENC_SRC_DIR)/g_adapt.cpp $(ENC_SRC_DIR)/gain_q.cpp \
+       $(ENC_SRC_DIR)/g_code.cpp $(ENC_SRC_DIR)/g_pitch.cpp \
+       $(ENC_SRC_DIR)/hp_max.cpp $(ENC_SRC_DIR)/inter_36.cpp \
+       $(ENC_SRC_DIR)/inter_36_tab.cpp $(ENC_SRC_DIR)/l_abs.cpp \
+       $(ENC_SRC_DIR)/lag_wind.cpp $(ENC_SRC_DIR)/lag_wind_tab.cpp \
+       $(ENC_SRC_DIR)/l_comp.cpp $(ENC_SRC_DIR)/levinson.cpp \
+       $(ENC_SRC_DIR)/l_extract.cpp $(ENC_SRC_DIR)/lflg_upd.cpp \
+       $(ENC_SRC_DIR)/l_negate.cpp $(ENC_SRC_DIR)/lpc.cpp \
+       $(ENC_SRC_DIR)/ol_ltp.cpp $(ENC_SRC_DIR)/pitch_fr.cpp \
+       $(ENC_SRC_DIR)/pitch_ol.cpp $(ENC_SRC_DIR)/p_ol_wgh.cpp \
+       $(ENC_SRC_DIR)/pre_big.cpp $(ENC_SRC_DIR)/pre_proc.cpp \
+       $(ENC_SRC_DIR)/prm2bits.cpp $(ENC_SRC_DIR)/qgain475.cpp \
+       $(ENC_SRC_DIR)/qgain795.cpp $(ENC_SRC_DIR)/q_gain_c.cpp \
+       $(ENC_SRC_DIR)/q_gain_p.cpp $(ENC_SRC_DIR)/qua_gain.cpp \
+       $(ENC_SRC_DIR)/s10_8pf.cpp $(ENC_SRC_DIR)/set_sign.cpp \
+       $(ENC_SRC_DIR)/sid_sync.cpp $(ENC_SRC_DIR)/sp_enc.cpp \
+       $(ENC_SRC_DIR)/spreproc.cpp $(ENC_SRC_DIR)/spstproc.cpp \
+       $(ENC_SRC_DIR)/ton_stab.cpp $(ENC_SRC_DIR)/vad1.cpp \
+       $(COMMON_SRC_DIR)/add.cpp $(COMMON_SRC_DIR)/az_lsp.cpp \
+       $(COMMON_SRC_DIR)/bitno_tab.cpp \
+       $(COMMON_SRC_DIR)/bitreorder_tab.cpp \
+       $(COMMON_SRC_DIR)/c2_9pf_tab.cpp $(COMMON_SRC_DIR)/div_s.cpp \
+       $(COMMON_SRC_DIR)/extract_h.cpp \
+       $(COMMON_SRC_DIR)/extract_l.cpp \
+       $(COMMON_SRC_DIR)/gains_tbl.cpp $(COMMON_SRC_DIR)/gc_pred.cpp \
+       $(COMMON_SRC_DIR)/get_const_tbls.cpp \
+       $(COMMON_SRC_DIR)/gmed_n.cpp $(COMMON_SRC_DIR)/gray_tbl.cpp \
+       $(COMMON_SRC_DIR)/grid_tbl.cpp $(COMMON_SRC_DIR)/int_lpc.cpp \
+       $(COMMON_SRC_DIR)/inv_sqrt.cpp \
+       $(COMMON_SRC_DIR)/inv_sqrt_tbl.cpp \
+       $(COMMON_SRC_DIR)/l_deposit_h.cpp \
+       $(COMMON_SRC_DIR)/l_deposit_l.cpp $(COMMON_SRC_DIR)/log2.cpp \
+       $(COMMON_SRC_DIR)/log2_norm.cpp $(COMMON_SRC_DIR)/log2_tbl.cpp \
+       $(COMMON_SRC_DIR)/lsfwt.cpp $(COMMON_SRC_DIR)/l_shr_r.cpp \
+       $(COMMON_SRC_DIR)/lsp_az.cpp $(COMMON_SRC_DIR)/lsp.cpp \
+       $(COMMON_SRC_DIR)/lsp_lsf.cpp \
+       $(COMMON_SRC_DIR)/lsp_lsf_tbl.cpp \
+       $(COMMON_SRC_DIR)/lsp_tab.cpp $(COMMON_SRC_DIR)/mult_r.cpp \
+       $(COMMON_SRC_DIR)/negate.cpp $(COMMON_SRC_DIR)/norm_l.cpp \
+       $(COMMON_SRC_DIR)/norm_s.cpp \
+       $(COMMON_SRC_DIR)/overflow_tbl.cpp \
+       $(COMMON_SRC_DIR)/ph_disp_tab.cpp $(COMMON_SRC_DIR)/pow2.cpp \
+       $(COMMON_SRC_DIR)/pow2_tbl.cpp $(COMMON_SRC_DIR)/pred_lt.cpp \
+       $(COMMON_SRC_DIR)/q_plsf_3.cpp \
+       $(COMMON_SRC_DIR)/q_plsf_3_tbl.cpp \
+       $(COMMON_SRC_DIR)/q_plsf_5.cpp \
+       $(COMMON_SRC_DIR)/q_plsf_5_tbl.cpp \
+       $(COMMON_SRC_DIR)/q_plsf.cpp \
+       $(COMMON_SRC_DIR)/qua_gain_tbl.cpp \
+       $(COMMON_SRC_DIR)/reorder.cpp $(COMMON_SRC_DIR)/residu.cpp \
+       $(COMMON_SRC_DIR)/round.cpp $(COMMON_SRC_DIR)/set_zero.cpp \
+       $(COMMON_SRC_DIR)/shr.cpp $(COMMON_SRC_DIR)/shr_r.cpp \
+       $(COMMON_SRC_DIR)/sqrt_l.cpp $(COMMON_SRC_DIR)/sqrt_l_tbl.cpp \
+       $(COMMON_SRC_DIR)/sub.cpp $(COMMON_SRC_DIR)/syn_filt.cpp \
+       $(COMMON_SRC_DIR)/weight_a.cpp \
+       $(COMMON_SRC_DIR)/window_tab.cpp
+@AMRNB_DECODER_TRUE@am__objects_1 = agc.lo amrdecode.lo a_refl.lo \
+@AMRNB_DECODER_TRUE@   b_cn_cod.lo bgnscd.lo c_g_aver.lo \
+@AMRNB_DECODER_TRUE@   d1035pf.lo d2_11pf.lo d2_9pf.lo d3_14pf.lo \
+@AMRNB_DECODER_TRUE@   d4_17pf.lo d8_31pf.lo dec_amr.lo \
+@AMRNB_DECODER_TRUE@   dec_gain.lo dec_input_format_tab.lo \
+@AMRNB_DECODER_TRUE@   dec_lag3.lo dec_lag6.lo d_gain_c.lo \
+@AMRNB_DECODER_TRUE@   d_gain_p.lo d_plsf_3.lo d_plsf_5.lo \
+@AMRNB_DECODER_TRUE@   d_plsf.lo dtx_dec.lo ec_gains.lo \
+@AMRNB_DECODER_TRUE@   ex_ctrl.lo if2_to_ets.lo int_lsf.lo \
+@AMRNB_DECODER_TRUE@   lsp_avg.lo ph_disp.lo post_pro.lo \
+@AMRNB_DECODER_TRUE@   preemph.lo pstfilt.lo qgain475_tab.lo \
+@AMRNB_DECODER_TRUE@   sp_dec.lo wmf_to_ets.lo
+@AMRNB_ENCODER_TRUE@am__objects_2 = amrencode.lo autocorr.lo \
+@AMRNB_ENCODER_TRUE@   c1035pf.lo c2_11pf.lo c2_9pf.lo c3_14pf.lo \
+@AMRNB_ENCODER_TRUE@   c4_17pf.lo c8_31pf.lo calc_cor.lo \
+@AMRNB_ENCODER_TRUE@   calc_en.lo cbsearch.lo cl_ltp.lo \
+@AMRNB_ENCODER_TRUE@   cod_amr.lo convolve.lo cor_h.lo \
+@AMRNB_ENCODER_TRUE@   cor_h_x2.lo cor_h_x.lo corrwght_tab.lo \
+@AMRNB_ENCODER_TRUE@   div_32.lo dtx_enc.lo enc_lag3.lo \
+@AMRNB_ENCODER_TRUE@   enc_lag6.lo enc_output_format_tab.lo \
+@AMRNB_ENCODER_TRUE@   ets_to_if2.lo ets_to_wmf.lo g_adapt.lo \
+@AMRNB_ENCODER_TRUE@   gain_q.lo g_code.lo g_pitch.lo hp_max.lo \
+@AMRNB_ENCODER_TRUE@   inter_36.lo inter_36_tab.lo l_abs.lo \
+@AMRNB_ENCODER_TRUE@   lag_wind.lo lag_wind_tab.lo l_comp.lo \
+@AMRNB_ENCODER_TRUE@   levinson.lo l_extract.lo lflg_upd.lo \
+@AMRNB_ENCODER_TRUE@   l_negate.lo lpc.lo ol_ltp.lo pitch_fr.lo \
+@AMRNB_ENCODER_TRUE@   pitch_ol.lo p_ol_wgh.lo pre_big.lo \
+@AMRNB_ENCODER_TRUE@   pre_proc.lo prm2bits.lo qgain475.lo \
+@AMRNB_ENCODER_TRUE@   qgain795.lo q_gain_c.lo q_gain_p.lo \
+@AMRNB_ENCODER_TRUE@   qua_gain.lo s10_8pf.lo set_sign.lo \
+@AMRNB_ENCODER_TRUE@   sid_sync.lo sp_enc.lo spreproc.lo \
+@AMRNB_ENCODER_TRUE@   spstproc.lo ton_stab.lo vad1.lo
+am_libopencore_amrnb_la_OBJECTS = wrapper.lo $(am__objects_1) \
+       $(am__objects_2) add.lo az_lsp.lo bitno_tab.lo \
+       bitreorder_tab.lo c2_9pf_tab.lo div_s.lo extract_h.lo \
+       extract_l.lo gains_tbl.lo gc_pred.lo get_const_tbls.lo \
+       gmed_n.lo gray_tbl.lo grid_tbl.lo int_lpc.lo inv_sqrt.lo \
+       inv_sqrt_tbl.lo l_deposit_h.lo l_deposit_l.lo log2.lo \
+       log2_norm.lo log2_tbl.lo lsfwt.lo l_shr_r.lo lsp_az.lo lsp.lo \
+       lsp_lsf.lo lsp_lsf_tbl.lo lsp_tab.lo mult_r.lo negate.lo \
+       norm_l.lo norm_s.lo overflow_tbl.lo ph_disp_tab.lo pow2.lo \
+       pow2_tbl.lo pred_lt.lo q_plsf_3.lo q_plsf_3_tbl.lo q_plsf_5.lo \
+       q_plsf_5_tbl.lo q_plsf.lo qua_gain_tbl.lo reorder.lo residu.lo \
+       round.lo set_zero.lo shr.lo shr_r.lo sqrt_l.lo sqrt_l_tbl.lo \
+       sub.lo syn_filt.lo weight_a.lo window_tab.lo
+libopencore_amrnb_la_OBJECTS = $(am_libopencore_amrnb_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC    " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD  " $@;
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX   " $@;
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+       $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN   " $@;
+SOURCES = $(libopencore_amrnb_la_SOURCES) \
+       $(nodist_EXTRA_libopencore_amrnb_la_SOURCES)
+DIST_SOURCES = $(am__libopencore_amrnb_la_SOURCES_DIST)
+DATA = $(pkgconfig_DATA)
+am__amrnbinclude_HEADERS_DIST = interf_dec.h interf_enc.h
+HEADERS = $(amrnbinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENCORE_AMRNB_VERSION = @OPENCORE_AMRNB_VERSION@
+OPENCORE_AMRWB_VERSION = @OPENCORE_AMRWB_VERSION@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Just set OC_BASE to the opencore root, or set AMR_BASE directly to
+# a detached gsm_amr directory
+OC_BASE = $(top_srcdir)/opencore
+AMR_BASE = $(OC_BASE)/codecs_v2/audio/gsm_amr
+DEC_DIR = $(AMR_BASE)/amr_nb/dec
+ENC_DIR = $(AMR_BASE)/amr_nb/enc
+COMMON_DIR = $(AMR_BASE)/amr_nb/common
+DEC_SRC_DIR = $(DEC_DIR)/src
+ENC_SRC_DIR = $(ENC_DIR)/src
+COMMON_SRC_DIR = $(COMMON_DIR)/src
+OSCL = $(top_srcdir)/oscl
+AM_CFLAGS = -I$(OSCL) -I$(DEC_SRC_DIR) -I$(COMMON_DIR)/include \
+       -I$(DEC_DIR)/include -I$(AMR_BASE)/common/dec/include \
+       -I$(ENC_SRC_DIR) $(am__append_1) $(am__append_2) \
+       $(am__append_5) $(am__append_8)
+@COMPILE_AS_C_FALSE@libopencore_amrnb_la_LINK = $(CXXLINK) $(libopencore_amrnb_la_LDFLAGS)
+@COMPILE_AS_C_TRUE@libopencore_amrnb_la_LINK = $(LINK) $(libopencore_amrnb_la_LDFLAGS)
+@COMPILE_AS_C_TRUE@nodist_EXTRA_libopencore_amrnb_la_SOURCES = dummy.c
+AM_CXXFLAGS = $(AM_CFLAGS)
+amrnbincludedir = $(includedir)/opencore-amrnb
+amrnbinclude_HEADERS = $(am__append_4) $(am__append_7)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = opencore-amrnb.pc
+lib_LTLIBRARIES = libopencore-amrnb.la
+libopencore_amrnb_la_LDFLAGS = -version-info @OPENCORE_AMRNB_VERSION@ -no-undefined -export-symbols $(top_srcdir)/amrnb/opencore-amrnb.sym
+EXTRA_DIST = $(top_srcdir)/amrnb/opencore-amrnb.sym
+
+# Our sources to include. There are certain sources we exclude and they are
+# $(DEC_SRC_DIR)/decoder_gsm_amr.cpp
+# $(DEC_SRC_DIR)/pvgsmamrdecoder.cpp
+# $(ENC_SRC_DIR)/gsmamr_encoder_wrapper.cpp
+# $(COMMON_SRC_DIR)/bits2prm.cpp
+# $(COMMON_SRC_DIR)/copy.cpp
+# $(COMMON_SRC_DIR)/div_32.cpp
+# $(COMMON_SRC_DIR)/l_abs.cpp
+# $(COMMON_SRC_DIR)/r_fft.cpp
+# $(COMMON_SRC_DIR)/vad1.cpp
+# $(COMMON_SRC_DIR)/vad2.cpp
+libopencore_amrnb_la_SOURCES = wrapper.cpp $(am__append_3) \
+       $(am__append_6) $(COMMON_SRC_DIR)/add.cpp \
+       $(COMMON_SRC_DIR)/az_lsp.cpp $(COMMON_SRC_DIR)/bitno_tab.cpp \
+       $(COMMON_SRC_DIR)/bitreorder_tab.cpp \
+       $(COMMON_SRC_DIR)/c2_9pf_tab.cpp $(COMMON_SRC_DIR)/div_s.cpp \
+       $(COMMON_SRC_DIR)/extract_h.cpp \
+       $(COMMON_SRC_DIR)/extract_l.cpp \
+       $(COMMON_SRC_DIR)/gains_tbl.cpp $(COMMON_SRC_DIR)/gc_pred.cpp \
+       $(COMMON_SRC_DIR)/get_const_tbls.cpp \
+       $(COMMON_SRC_DIR)/gmed_n.cpp $(COMMON_SRC_DIR)/gray_tbl.cpp \
+       $(COMMON_SRC_DIR)/grid_tbl.cpp $(COMMON_SRC_DIR)/int_lpc.cpp \
+       $(COMMON_SRC_DIR)/inv_sqrt.cpp \
+       $(COMMON_SRC_DIR)/inv_sqrt_tbl.cpp \
+       $(COMMON_SRC_DIR)/l_deposit_h.cpp \
+       $(COMMON_SRC_DIR)/l_deposit_l.cpp $(COMMON_SRC_DIR)/log2.cpp \
+       $(COMMON_SRC_DIR)/log2_norm.cpp $(COMMON_SRC_DIR)/log2_tbl.cpp \
+       $(COMMON_SRC_DIR)/lsfwt.cpp $(COMMON_SRC_DIR)/l_shr_r.cpp \
+       $(COMMON_SRC_DIR)/lsp_az.cpp $(COMMON_SRC_DIR)/lsp.cpp \
+       $(COMMON_SRC_DIR)/lsp_lsf.cpp \
+       $(COMMON_SRC_DIR)/lsp_lsf_tbl.cpp \
+       $(COMMON_SRC_DIR)/lsp_tab.cpp $(COMMON_SRC_DIR)/mult_r.cpp \
+       $(COMMON_SRC_DIR)/negate.cpp $(COMMON_SRC_DIR)/norm_l.cpp \
+       $(COMMON_SRC_DIR)/norm_s.cpp \
+       $(COMMON_SRC_DIR)/overflow_tbl.cpp \
+       $(COMMON_SRC_DIR)/ph_disp_tab.cpp $(COMMON_SRC_DIR)/pow2.cpp \
+       $(COMMON_SRC_DIR)/pow2_tbl.cpp $(COMMON_SRC_DIR)/pred_lt.cpp \
+       $(COMMON_SRC_DIR)/q_plsf_3.cpp \
+       $(COMMON_SRC_DIR)/q_plsf_3_tbl.cpp \
+       $(COMMON_SRC_DIR)/q_plsf_5.cpp \
+       $(COMMON_SRC_DIR)/q_plsf_5_tbl.cpp \
+       $(COMMON_SRC_DIR)/q_plsf.cpp \
+       $(COMMON_SRC_DIR)/qua_gain_tbl.cpp \
+       $(COMMON_SRC_DIR)/reorder.cpp $(COMMON_SRC_DIR)/residu.cpp \
+       $(COMMON_SRC_DIR)/round.cpp $(COMMON_SRC_DIR)/set_zero.cpp \
+       $(COMMON_SRC_DIR)/shr.cpp $(COMMON_SRC_DIR)/shr_r.cpp \
+       $(COMMON_SRC_DIR)/sqrt_l.cpp $(COMMON_SRC_DIR)/sqrt_l_tbl.cpp \
+       $(COMMON_SRC_DIR)/sub.cpp $(COMMON_SRC_DIR)/syn_filt.cpp \
+       $(COMMON_SRC_DIR)/weight_a.cpp \
+       $(COMMON_SRC_DIR)/window_tab.cpp
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cpp .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu amrnb/Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --gnu amrnb/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+opencore-amrnb.pc: $(top_builddir)/config.status $(srcdir)/opencore-amrnb.pc.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       list2=; for p in $$list; do \
+         if test -f $$p; then \
+           list2="$$list2 $$p"; \
+         else :; fi; \
+       done; \
+       test -z "$$list2" || { \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+       }
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       for p in $$list; do \
+         $(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libopencore-amrnb.la: $(libopencore_amrnb_la_OBJECTS) $(libopencore_amrnb_la_DEPENDENCIES) $(EXTRA_libopencore_amrnb_la_DEPENDENCIES) 
+       $(AM_V_GEN)$(libopencore_amrnb_la_LINK) -rpath $(libdir) $(libopencore_amrnb_la_OBJECTS) $(libopencore_amrnb_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/a_refl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amrdecode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amrencode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/autocorr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/az_lsp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/b_cn_cod.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bgnscd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitno_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitreorder_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c1035pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2_11pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2_9pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2_9pf_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c3_14pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c4_17pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c8_31pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_g_aver.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calc_cor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calc_en.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cbsearch.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cl_ltp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cod_amr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convolve.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cor_h.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cor_h_x.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cor_h_x2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/corrwght_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d1035pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d2_11pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d2_9pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d3_14pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d4_17pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d8_31pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_gain_c.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_gain_p.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_plsf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_plsf_3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_plsf_5.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dec_amr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dec_gain.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dec_input_format_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dec_lag3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dec_lag6.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_32.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_s.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtx_dec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtx_enc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ec_gains.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_lag3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_lag6.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_output_format_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ets_to_if2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ets_to_wmf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ex_ctrl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extract_h.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extract_l.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_adapt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_code.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_pitch.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gain_q.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gains_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gc_pred.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_const_tbls.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gmed_n.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gray_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grid_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hp_max.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/if2_to_ets.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/int_lpc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/int_lsf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inter_36.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inter_36_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inv_sqrt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inv_sqrt_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l_abs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l_comp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l_deposit_h.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l_deposit_l.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l_extract.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l_negate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l_shr_r.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lag_wind.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lag_wind_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/levinson.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lflg_upd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log2_norm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log2_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsfwt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp_avg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp_az.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp_lsf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp_lsf_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mult_r.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/negate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/norm_l.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/norm_s.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ol_ltp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/overflow_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_ol_wgh.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ph_disp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ph_disp_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pitch_fr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pitch_ol.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/post_pro.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow2_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_big.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_proc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pred_lt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preemph.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prm2bits.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pstfilt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q_gain_c.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q_gain_p.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q_plsf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q_plsf_3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q_plsf_3_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q_plsf_5.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q_plsf_5_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgain475.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgain475_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgain795.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qua_gain.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qua_gain_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reorder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/residu.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s10_8pf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_sign.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_zero.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shr_r.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sid_sync.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sp_dec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sp_enc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spreproc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spstproc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqrt_l.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqrt_l_tbl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syn_filt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ton_stab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vad1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/weight_a.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wmf_to_ets.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrapper.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+.cpp.o:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+
+agc.lo: $(DEC_SRC_DIR)/agc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT agc.lo -MD -MP -MF $(DEPDIR)/agc.Tpo -c -o agc.lo `test -f '$(DEC_SRC_DIR)/agc.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/agc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/agc.Tpo $(DEPDIR)/agc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/agc.cpp' object='agc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o agc.lo `test -f '$(DEC_SRC_DIR)/agc.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/agc.cpp
+
+amrdecode.lo: $(DEC_SRC_DIR)/amrdecode.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT amrdecode.lo -MD -MP -MF $(DEPDIR)/amrdecode.Tpo -c -o amrdecode.lo `test -f '$(DEC_SRC_DIR)/amrdecode.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/amrdecode.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/amrdecode.Tpo $(DEPDIR)/amrdecode.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/amrdecode.cpp' object='amrdecode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o amrdecode.lo `test -f '$(DEC_SRC_DIR)/amrdecode.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/amrdecode.cpp
+
+a_refl.lo: $(DEC_SRC_DIR)/a_refl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT a_refl.lo -MD -MP -MF $(DEPDIR)/a_refl.Tpo -c -o a_refl.lo `test -f '$(DEC_SRC_DIR)/a_refl.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/a_refl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/a_refl.Tpo $(DEPDIR)/a_refl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/a_refl.cpp' object='a_refl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o a_refl.lo `test -f '$(DEC_SRC_DIR)/a_refl.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/a_refl.cpp
+
+b_cn_cod.lo: $(DEC_SRC_DIR)/b_cn_cod.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT b_cn_cod.lo -MD -MP -MF $(DEPDIR)/b_cn_cod.Tpo -c -o b_cn_cod.lo `test -f '$(DEC_SRC_DIR)/b_cn_cod.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/b_cn_cod.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/b_cn_cod.Tpo $(DEPDIR)/b_cn_cod.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/b_cn_cod.cpp' object='b_cn_cod.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o b_cn_cod.lo `test -f '$(DEC_SRC_DIR)/b_cn_cod.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/b_cn_cod.cpp
+
+bgnscd.lo: $(DEC_SRC_DIR)/bgnscd.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bgnscd.lo -MD -MP -MF $(DEPDIR)/bgnscd.Tpo -c -o bgnscd.lo `test -f '$(DEC_SRC_DIR)/bgnscd.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/bgnscd.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/bgnscd.Tpo $(DEPDIR)/bgnscd.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/bgnscd.cpp' object='bgnscd.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bgnscd.lo `test -f '$(DEC_SRC_DIR)/bgnscd.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/bgnscd.cpp
+
+c_g_aver.lo: $(DEC_SRC_DIR)/c_g_aver.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT c_g_aver.lo -MD -MP -MF $(DEPDIR)/c_g_aver.Tpo -c -o c_g_aver.lo `test -f '$(DEC_SRC_DIR)/c_g_aver.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/c_g_aver.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/c_g_aver.Tpo $(DEPDIR)/c_g_aver.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/c_g_aver.cpp' object='c_g_aver.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o c_g_aver.lo `test -f '$(DEC_SRC_DIR)/c_g_aver.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/c_g_aver.cpp
+
+d1035pf.lo: $(DEC_SRC_DIR)/d1035pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d1035pf.lo -MD -MP -MF $(DEPDIR)/d1035pf.Tpo -c -o d1035pf.lo `test -f '$(DEC_SRC_DIR)/d1035pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d1035pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d1035pf.Tpo $(DEPDIR)/d1035pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d1035pf.cpp' object='d1035pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d1035pf.lo `test -f '$(DEC_SRC_DIR)/d1035pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d1035pf.cpp
+
+d2_11pf.lo: $(DEC_SRC_DIR)/d2_11pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d2_11pf.lo -MD -MP -MF $(DEPDIR)/d2_11pf.Tpo -c -o d2_11pf.lo `test -f '$(DEC_SRC_DIR)/d2_11pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d2_11pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d2_11pf.Tpo $(DEPDIR)/d2_11pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d2_11pf.cpp' object='d2_11pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d2_11pf.lo `test -f '$(DEC_SRC_DIR)/d2_11pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d2_11pf.cpp
+
+d2_9pf.lo: $(DEC_SRC_DIR)/d2_9pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d2_9pf.lo -MD -MP -MF $(DEPDIR)/d2_9pf.Tpo -c -o d2_9pf.lo `test -f '$(DEC_SRC_DIR)/d2_9pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d2_9pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d2_9pf.Tpo $(DEPDIR)/d2_9pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d2_9pf.cpp' object='d2_9pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d2_9pf.lo `test -f '$(DEC_SRC_DIR)/d2_9pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d2_9pf.cpp
+
+d3_14pf.lo: $(DEC_SRC_DIR)/d3_14pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d3_14pf.lo -MD -MP -MF $(DEPDIR)/d3_14pf.Tpo -c -o d3_14pf.lo `test -f '$(DEC_SRC_DIR)/d3_14pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d3_14pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d3_14pf.Tpo $(DEPDIR)/d3_14pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d3_14pf.cpp' object='d3_14pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d3_14pf.lo `test -f '$(DEC_SRC_DIR)/d3_14pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d3_14pf.cpp
+
+d4_17pf.lo: $(DEC_SRC_DIR)/d4_17pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d4_17pf.lo -MD -MP -MF $(DEPDIR)/d4_17pf.Tpo -c -o d4_17pf.lo `test -f '$(DEC_SRC_DIR)/d4_17pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d4_17pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d4_17pf.Tpo $(DEPDIR)/d4_17pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d4_17pf.cpp' object='d4_17pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d4_17pf.lo `test -f '$(DEC_SRC_DIR)/d4_17pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d4_17pf.cpp
+
+d8_31pf.lo: $(DEC_SRC_DIR)/d8_31pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d8_31pf.lo -MD -MP -MF $(DEPDIR)/d8_31pf.Tpo -c -o d8_31pf.lo `test -f '$(DEC_SRC_DIR)/d8_31pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d8_31pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d8_31pf.Tpo $(DEPDIR)/d8_31pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d8_31pf.cpp' object='d8_31pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d8_31pf.lo `test -f '$(DEC_SRC_DIR)/d8_31pf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d8_31pf.cpp
+
+dec_amr.lo: $(DEC_SRC_DIR)/dec_amr.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dec_amr.lo -MD -MP -MF $(DEPDIR)/dec_amr.Tpo -c -o dec_amr.lo `test -f '$(DEC_SRC_DIR)/dec_amr.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_amr.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dec_amr.Tpo $(DEPDIR)/dec_amr.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dec_amr.cpp' object='dec_amr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dec_amr.lo `test -f '$(DEC_SRC_DIR)/dec_amr.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_amr.cpp
+
+dec_gain.lo: $(DEC_SRC_DIR)/dec_gain.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dec_gain.lo -MD -MP -MF $(DEPDIR)/dec_gain.Tpo -c -o dec_gain.lo `test -f '$(DEC_SRC_DIR)/dec_gain.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_gain.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dec_gain.Tpo $(DEPDIR)/dec_gain.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dec_gain.cpp' object='dec_gain.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dec_gain.lo `test -f '$(DEC_SRC_DIR)/dec_gain.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_gain.cpp
+
+dec_input_format_tab.lo: $(DEC_SRC_DIR)/dec_input_format_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dec_input_format_tab.lo -MD -MP -MF $(DEPDIR)/dec_input_format_tab.Tpo -c -o dec_input_format_tab.lo `test -f '$(DEC_SRC_DIR)/dec_input_format_tab.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_input_format_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dec_input_format_tab.Tpo $(DEPDIR)/dec_input_format_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dec_input_format_tab.cpp' object='dec_input_format_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dec_input_format_tab.lo `test -f '$(DEC_SRC_DIR)/dec_input_format_tab.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_input_format_tab.cpp
+
+dec_lag3.lo: $(DEC_SRC_DIR)/dec_lag3.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dec_lag3.lo -MD -MP -MF $(DEPDIR)/dec_lag3.Tpo -c -o dec_lag3.lo `test -f '$(DEC_SRC_DIR)/dec_lag3.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_lag3.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dec_lag3.Tpo $(DEPDIR)/dec_lag3.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dec_lag3.cpp' object='dec_lag3.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dec_lag3.lo `test -f '$(DEC_SRC_DIR)/dec_lag3.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_lag3.cpp
+
+dec_lag6.lo: $(DEC_SRC_DIR)/dec_lag6.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dec_lag6.lo -MD -MP -MF $(DEPDIR)/dec_lag6.Tpo -c -o dec_lag6.lo `test -f '$(DEC_SRC_DIR)/dec_lag6.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_lag6.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dec_lag6.Tpo $(DEPDIR)/dec_lag6.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dec_lag6.cpp' object='dec_lag6.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dec_lag6.lo `test -f '$(DEC_SRC_DIR)/dec_lag6.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_lag6.cpp
+
+d_gain_c.lo: $(DEC_SRC_DIR)/d_gain_c.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d_gain_c.lo -MD -MP -MF $(DEPDIR)/d_gain_c.Tpo -c -o d_gain_c.lo `test -f '$(DEC_SRC_DIR)/d_gain_c.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d_gain_c.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d_gain_c.Tpo $(DEPDIR)/d_gain_c.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d_gain_c.cpp' object='d_gain_c.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d_gain_c.lo `test -f '$(DEC_SRC_DIR)/d_gain_c.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d_gain_c.cpp
+
+d_gain_p.lo: $(DEC_SRC_DIR)/d_gain_p.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d_gain_p.lo -MD -MP -MF $(DEPDIR)/d_gain_p.Tpo -c -o d_gain_p.lo `test -f '$(DEC_SRC_DIR)/d_gain_p.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d_gain_p.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d_gain_p.Tpo $(DEPDIR)/d_gain_p.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d_gain_p.cpp' object='d_gain_p.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d_gain_p.lo `test -f '$(DEC_SRC_DIR)/d_gain_p.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d_gain_p.cpp
+
+d_plsf_3.lo: $(DEC_SRC_DIR)/d_plsf_3.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d_plsf_3.lo -MD -MP -MF $(DEPDIR)/d_plsf_3.Tpo -c -o d_plsf_3.lo `test -f '$(DEC_SRC_DIR)/d_plsf_3.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d_plsf_3.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d_plsf_3.Tpo $(DEPDIR)/d_plsf_3.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d_plsf_3.cpp' object='d_plsf_3.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d_plsf_3.lo `test -f '$(DEC_SRC_DIR)/d_plsf_3.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d_plsf_3.cpp
+
+d_plsf_5.lo: $(DEC_SRC_DIR)/d_plsf_5.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d_plsf_5.lo -MD -MP -MF $(DEPDIR)/d_plsf_5.Tpo -c -o d_plsf_5.lo `test -f '$(DEC_SRC_DIR)/d_plsf_5.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d_plsf_5.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d_plsf_5.Tpo $(DEPDIR)/d_plsf_5.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d_plsf_5.cpp' object='d_plsf_5.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d_plsf_5.lo `test -f '$(DEC_SRC_DIR)/d_plsf_5.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d_plsf_5.cpp
+
+d_plsf.lo: $(DEC_SRC_DIR)/d_plsf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT d_plsf.lo -MD -MP -MF $(DEPDIR)/d_plsf.Tpo -c -o d_plsf.lo `test -f '$(DEC_SRC_DIR)/d_plsf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d_plsf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/d_plsf.Tpo $(DEPDIR)/d_plsf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/d_plsf.cpp' object='d_plsf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o d_plsf.lo `test -f '$(DEC_SRC_DIR)/d_plsf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/d_plsf.cpp
+
+dtx_dec.lo: $(DEC_SRC_DIR)/dtx_dec.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dtx_dec.lo -MD -MP -MF $(DEPDIR)/dtx_dec.Tpo -c -o dtx_dec.lo `test -f '$(DEC_SRC_DIR)/dtx_dec.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dtx_dec.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dtx_dec.Tpo $(DEPDIR)/dtx_dec.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dtx_dec.cpp' object='dtx_dec.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dtx_dec.lo `test -f '$(DEC_SRC_DIR)/dtx_dec.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dtx_dec.cpp
+
+ec_gains.lo: $(DEC_SRC_DIR)/ec_gains.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ec_gains.lo -MD -MP -MF $(DEPDIR)/ec_gains.Tpo -c -o ec_gains.lo `test -f '$(DEC_SRC_DIR)/ec_gains.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/ec_gains.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/ec_gains.Tpo $(DEPDIR)/ec_gains.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/ec_gains.cpp' object='ec_gains.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ec_gains.lo `test -f '$(DEC_SRC_DIR)/ec_gains.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/ec_gains.cpp
+
+ex_ctrl.lo: $(DEC_SRC_DIR)/ex_ctrl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ex_ctrl.lo -MD -MP -MF $(DEPDIR)/ex_ctrl.Tpo -c -o ex_ctrl.lo `test -f '$(DEC_SRC_DIR)/ex_ctrl.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/ex_ctrl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/ex_ctrl.Tpo $(DEPDIR)/ex_ctrl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/ex_ctrl.cpp' object='ex_ctrl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ex_ctrl.lo `test -f '$(DEC_SRC_DIR)/ex_ctrl.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/ex_ctrl.cpp
+
+if2_to_ets.lo: $(DEC_SRC_DIR)/if2_to_ets.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT if2_to_ets.lo -MD -MP -MF $(DEPDIR)/if2_to_ets.Tpo -c -o if2_to_ets.lo `test -f '$(DEC_SRC_DIR)/if2_to_ets.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/if2_to_ets.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/if2_to_ets.Tpo $(DEPDIR)/if2_to_ets.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/if2_to_ets.cpp' object='if2_to_ets.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o if2_to_ets.lo `test -f '$(DEC_SRC_DIR)/if2_to_ets.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/if2_to_ets.cpp
+
+int_lsf.lo: $(DEC_SRC_DIR)/int_lsf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT int_lsf.lo -MD -MP -MF $(DEPDIR)/int_lsf.Tpo -c -o int_lsf.lo `test -f '$(DEC_SRC_DIR)/int_lsf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/int_lsf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/int_lsf.Tpo $(DEPDIR)/int_lsf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/int_lsf.cpp' object='int_lsf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o int_lsf.lo `test -f '$(DEC_SRC_DIR)/int_lsf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/int_lsf.cpp
+
+lsp_avg.lo: $(DEC_SRC_DIR)/lsp_avg.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lsp_avg.lo -MD -MP -MF $(DEPDIR)/lsp_avg.Tpo -c -o lsp_avg.lo `test -f '$(DEC_SRC_DIR)/lsp_avg.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/lsp_avg.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lsp_avg.Tpo $(DEPDIR)/lsp_avg.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/lsp_avg.cpp' object='lsp_avg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lsp_avg.lo `test -f '$(DEC_SRC_DIR)/lsp_avg.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/lsp_avg.cpp
+
+ph_disp.lo: $(DEC_SRC_DIR)/ph_disp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ph_disp.lo -MD -MP -MF $(DEPDIR)/ph_disp.Tpo -c -o ph_disp.lo `test -f '$(DEC_SRC_DIR)/ph_disp.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/ph_disp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/ph_disp.Tpo $(DEPDIR)/ph_disp.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/ph_disp.cpp' object='ph_disp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ph_disp.lo `test -f '$(DEC_SRC_DIR)/ph_disp.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/ph_disp.cpp
+
+post_pro.lo: $(DEC_SRC_DIR)/post_pro.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT post_pro.lo -MD -MP -MF $(DEPDIR)/post_pro.Tpo -c -o post_pro.lo `test -f '$(DEC_SRC_DIR)/post_pro.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/post_pro.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/post_pro.Tpo $(DEPDIR)/post_pro.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/post_pro.cpp' object='post_pro.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o post_pro.lo `test -f '$(DEC_SRC_DIR)/post_pro.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/post_pro.cpp
+
+preemph.lo: $(DEC_SRC_DIR)/preemph.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT preemph.lo -MD -MP -MF $(DEPDIR)/preemph.Tpo -c -o preemph.lo `test -f '$(DEC_SRC_DIR)/preemph.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/preemph.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/preemph.Tpo $(DEPDIR)/preemph.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/preemph.cpp' object='preemph.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o preemph.lo `test -f '$(DEC_SRC_DIR)/preemph.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/preemph.cpp
+
+pstfilt.lo: $(DEC_SRC_DIR)/pstfilt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pstfilt.lo -MD -MP -MF $(DEPDIR)/pstfilt.Tpo -c -o pstfilt.lo `test -f '$(DEC_SRC_DIR)/pstfilt.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/pstfilt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pstfilt.Tpo $(DEPDIR)/pstfilt.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/pstfilt.cpp' object='pstfilt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pstfilt.lo `test -f '$(DEC_SRC_DIR)/pstfilt.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/pstfilt.cpp
+
+qgain475_tab.lo: $(DEC_SRC_DIR)/qgain475_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT qgain475_tab.lo -MD -MP -MF $(DEPDIR)/qgain475_tab.Tpo -c -o qgain475_tab.lo `test -f '$(DEC_SRC_DIR)/qgain475_tab.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/qgain475_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/qgain475_tab.Tpo $(DEPDIR)/qgain475_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/qgain475_tab.cpp' object='qgain475_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o qgain475_tab.lo `test -f '$(DEC_SRC_DIR)/qgain475_tab.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/qgain475_tab.cpp
+
+sp_dec.lo: $(DEC_SRC_DIR)/sp_dec.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sp_dec.lo -MD -MP -MF $(DEPDIR)/sp_dec.Tpo -c -o sp_dec.lo `test -f '$(DEC_SRC_DIR)/sp_dec.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/sp_dec.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/sp_dec.Tpo $(DEPDIR)/sp_dec.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/sp_dec.cpp' object='sp_dec.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sp_dec.lo `test -f '$(DEC_SRC_DIR)/sp_dec.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/sp_dec.cpp
+
+wmf_to_ets.lo: $(DEC_SRC_DIR)/wmf_to_ets.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wmf_to_ets.lo -MD -MP -MF $(DEPDIR)/wmf_to_ets.Tpo -c -o wmf_to_ets.lo `test -f '$(DEC_SRC_DIR)/wmf_to_ets.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/wmf_to_ets.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/wmf_to_ets.Tpo $(DEPDIR)/wmf_to_ets.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/wmf_to_ets.cpp' object='wmf_to_ets.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wmf_to_ets.lo `test -f '$(DEC_SRC_DIR)/wmf_to_ets.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/wmf_to_ets.cpp
+
+amrencode.lo: $(ENC_SRC_DIR)/amrencode.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT amrencode.lo -MD -MP -MF $(DEPDIR)/amrencode.Tpo -c -o amrencode.lo `test -f '$(ENC_SRC_DIR)/amrencode.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/amrencode.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/amrencode.Tpo $(DEPDIR)/amrencode.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/amrencode.cpp' object='amrencode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o amrencode.lo `test -f '$(ENC_SRC_DIR)/amrencode.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/amrencode.cpp
+
+autocorr.lo: $(ENC_SRC_DIR)/autocorr.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT autocorr.lo -MD -MP -MF $(DEPDIR)/autocorr.Tpo -c -o autocorr.lo `test -f '$(ENC_SRC_DIR)/autocorr.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/autocorr.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/autocorr.Tpo $(DEPDIR)/autocorr.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/autocorr.cpp' object='autocorr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o autocorr.lo `test -f '$(ENC_SRC_DIR)/autocorr.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/autocorr.cpp
+
+c1035pf.lo: $(ENC_SRC_DIR)/c1035pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT c1035pf.lo -MD -MP -MF $(DEPDIR)/c1035pf.Tpo -c -o c1035pf.lo `test -f '$(ENC_SRC_DIR)/c1035pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c1035pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/c1035pf.Tpo $(DEPDIR)/c1035pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/c1035pf.cpp' object='c1035pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o c1035pf.lo `test -f '$(ENC_SRC_DIR)/c1035pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c1035pf.cpp
+
+c2_11pf.lo: $(ENC_SRC_DIR)/c2_11pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT c2_11pf.lo -MD -MP -MF $(DEPDIR)/c2_11pf.Tpo -c -o c2_11pf.lo `test -f '$(ENC_SRC_DIR)/c2_11pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c2_11pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/c2_11pf.Tpo $(DEPDIR)/c2_11pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/c2_11pf.cpp' object='c2_11pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o c2_11pf.lo `test -f '$(ENC_SRC_DIR)/c2_11pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c2_11pf.cpp
+
+c2_9pf.lo: $(ENC_SRC_DIR)/c2_9pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT c2_9pf.lo -MD -MP -MF $(DEPDIR)/c2_9pf.Tpo -c -o c2_9pf.lo `test -f '$(ENC_SRC_DIR)/c2_9pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c2_9pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/c2_9pf.Tpo $(DEPDIR)/c2_9pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/c2_9pf.cpp' object='c2_9pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o c2_9pf.lo `test -f '$(ENC_SRC_DIR)/c2_9pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c2_9pf.cpp
+
+c3_14pf.lo: $(ENC_SRC_DIR)/c3_14pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT c3_14pf.lo -MD -MP -MF $(DEPDIR)/c3_14pf.Tpo -c -o c3_14pf.lo `test -f '$(ENC_SRC_DIR)/c3_14pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c3_14pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/c3_14pf.Tpo $(DEPDIR)/c3_14pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/c3_14pf.cpp' object='c3_14pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o c3_14pf.lo `test -f '$(ENC_SRC_DIR)/c3_14pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c3_14pf.cpp
+
+c4_17pf.lo: $(ENC_SRC_DIR)/c4_17pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT c4_17pf.lo -MD -MP -MF $(DEPDIR)/c4_17pf.Tpo -c -o c4_17pf.lo `test -f '$(ENC_SRC_DIR)/c4_17pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c4_17pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/c4_17pf.Tpo $(DEPDIR)/c4_17pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/c4_17pf.cpp' object='c4_17pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o c4_17pf.lo `test -f '$(ENC_SRC_DIR)/c4_17pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c4_17pf.cpp
+
+c8_31pf.lo: $(ENC_SRC_DIR)/c8_31pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT c8_31pf.lo -MD -MP -MF $(DEPDIR)/c8_31pf.Tpo -c -o c8_31pf.lo `test -f '$(ENC_SRC_DIR)/c8_31pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c8_31pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/c8_31pf.Tpo $(DEPDIR)/c8_31pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/c8_31pf.cpp' object='c8_31pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o c8_31pf.lo `test -f '$(ENC_SRC_DIR)/c8_31pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/c8_31pf.cpp
+
+calc_cor.lo: $(ENC_SRC_DIR)/calc_cor.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT calc_cor.lo -MD -MP -MF $(DEPDIR)/calc_cor.Tpo -c -o calc_cor.lo `test -f '$(ENC_SRC_DIR)/calc_cor.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/calc_cor.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/calc_cor.Tpo $(DEPDIR)/calc_cor.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/calc_cor.cpp' object='calc_cor.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o calc_cor.lo `test -f '$(ENC_SRC_DIR)/calc_cor.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/calc_cor.cpp
+
+calc_en.lo: $(ENC_SRC_DIR)/calc_en.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT calc_en.lo -MD -MP -MF $(DEPDIR)/calc_en.Tpo -c -o calc_en.lo `test -f '$(ENC_SRC_DIR)/calc_en.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/calc_en.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/calc_en.Tpo $(DEPDIR)/calc_en.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/calc_en.cpp' object='calc_en.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o calc_en.lo `test -f '$(ENC_SRC_DIR)/calc_en.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/calc_en.cpp
+
+cbsearch.lo: $(ENC_SRC_DIR)/cbsearch.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cbsearch.lo -MD -MP -MF $(DEPDIR)/cbsearch.Tpo -c -o cbsearch.lo `test -f '$(ENC_SRC_DIR)/cbsearch.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cbsearch.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/cbsearch.Tpo $(DEPDIR)/cbsearch.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/cbsearch.cpp' object='cbsearch.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cbsearch.lo `test -f '$(ENC_SRC_DIR)/cbsearch.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cbsearch.cpp
+
+cl_ltp.lo: $(ENC_SRC_DIR)/cl_ltp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cl_ltp.lo -MD -MP -MF $(DEPDIR)/cl_ltp.Tpo -c -o cl_ltp.lo `test -f '$(ENC_SRC_DIR)/cl_ltp.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cl_ltp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/cl_ltp.Tpo $(DEPDIR)/cl_ltp.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/cl_ltp.cpp' object='cl_ltp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cl_ltp.lo `test -f '$(ENC_SRC_DIR)/cl_ltp.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cl_ltp.cpp
+
+cod_amr.lo: $(ENC_SRC_DIR)/cod_amr.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cod_amr.lo -MD -MP -MF $(DEPDIR)/cod_amr.Tpo -c -o cod_amr.lo `test -f '$(ENC_SRC_DIR)/cod_amr.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cod_amr.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/cod_amr.Tpo $(DEPDIR)/cod_amr.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/cod_amr.cpp' object='cod_amr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cod_amr.lo `test -f '$(ENC_SRC_DIR)/cod_amr.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cod_amr.cpp
+
+convolve.lo: $(ENC_SRC_DIR)/convolve.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT convolve.lo -MD -MP -MF $(DEPDIR)/convolve.Tpo -c -o convolve.lo `test -f '$(ENC_SRC_DIR)/convolve.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/convolve.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/convolve.Tpo $(DEPDIR)/convolve.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/convolve.cpp' object='convolve.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o convolve.lo `test -f '$(ENC_SRC_DIR)/convolve.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/convolve.cpp
+
+cor_h.lo: $(ENC_SRC_DIR)/cor_h.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cor_h.lo -MD -MP -MF $(DEPDIR)/cor_h.Tpo -c -o cor_h.lo `test -f '$(ENC_SRC_DIR)/cor_h.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cor_h.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/cor_h.Tpo $(DEPDIR)/cor_h.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/cor_h.cpp' object='cor_h.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cor_h.lo `test -f '$(ENC_SRC_DIR)/cor_h.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cor_h.cpp
+
+cor_h_x2.lo: $(ENC_SRC_DIR)/cor_h_x2.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cor_h_x2.lo -MD -MP -MF $(DEPDIR)/cor_h_x2.Tpo -c -o cor_h_x2.lo `test -f '$(ENC_SRC_DIR)/cor_h_x2.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cor_h_x2.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/cor_h_x2.Tpo $(DEPDIR)/cor_h_x2.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/cor_h_x2.cpp' object='cor_h_x2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cor_h_x2.lo `test -f '$(ENC_SRC_DIR)/cor_h_x2.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cor_h_x2.cpp
+
+cor_h_x.lo: $(ENC_SRC_DIR)/cor_h_x.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cor_h_x.lo -MD -MP -MF $(DEPDIR)/cor_h_x.Tpo -c -o cor_h_x.lo `test -f '$(ENC_SRC_DIR)/cor_h_x.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cor_h_x.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/cor_h_x.Tpo $(DEPDIR)/cor_h_x.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/cor_h_x.cpp' object='cor_h_x.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cor_h_x.lo `test -f '$(ENC_SRC_DIR)/cor_h_x.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/cor_h_x.cpp
+
+corrwght_tab.lo: $(ENC_SRC_DIR)/corrwght_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT corrwght_tab.lo -MD -MP -MF $(DEPDIR)/corrwght_tab.Tpo -c -o corrwght_tab.lo `test -f '$(ENC_SRC_DIR)/corrwght_tab.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/corrwght_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/corrwght_tab.Tpo $(DEPDIR)/corrwght_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/corrwght_tab.cpp' object='corrwght_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o corrwght_tab.lo `test -f '$(ENC_SRC_DIR)/corrwght_tab.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/corrwght_tab.cpp
+
+div_32.lo: $(ENC_SRC_DIR)/div_32.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT div_32.lo -MD -MP -MF $(DEPDIR)/div_32.Tpo -c -o div_32.lo `test -f '$(ENC_SRC_DIR)/div_32.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/div_32.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/div_32.Tpo $(DEPDIR)/div_32.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/div_32.cpp' object='div_32.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o div_32.lo `test -f '$(ENC_SRC_DIR)/div_32.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/div_32.cpp
+
+dtx_enc.lo: $(ENC_SRC_DIR)/dtx_enc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dtx_enc.lo -MD -MP -MF $(DEPDIR)/dtx_enc.Tpo -c -o dtx_enc.lo `test -f '$(ENC_SRC_DIR)/dtx_enc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/dtx_enc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dtx_enc.Tpo $(DEPDIR)/dtx_enc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/dtx_enc.cpp' object='dtx_enc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dtx_enc.lo `test -f '$(ENC_SRC_DIR)/dtx_enc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/dtx_enc.cpp
+
+enc_lag3.lo: $(ENC_SRC_DIR)/enc_lag3.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT enc_lag3.lo -MD -MP -MF $(DEPDIR)/enc_lag3.Tpo -c -o enc_lag3.lo `test -f '$(ENC_SRC_DIR)/enc_lag3.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/enc_lag3.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/enc_lag3.Tpo $(DEPDIR)/enc_lag3.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/enc_lag3.cpp' object='enc_lag3.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o enc_lag3.lo `test -f '$(ENC_SRC_DIR)/enc_lag3.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/enc_lag3.cpp
+
+enc_lag6.lo: $(ENC_SRC_DIR)/enc_lag6.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT enc_lag6.lo -MD -MP -MF $(DEPDIR)/enc_lag6.Tpo -c -o enc_lag6.lo `test -f '$(ENC_SRC_DIR)/enc_lag6.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/enc_lag6.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/enc_lag6.Tpo $(DEPDIR)/enc_lag6.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/enc_lag6.cpp' object='enc_lag6.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o enc_lag6.lo `test -f '$(ENC_SRC_DIR)/enc_lag6.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/enc_lag6.cpp
+
+enc_output_format_tab.lo: $(ENC_SRC_DIR)/enc_output_format_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT enc_output_format_tab.lo -MD -MP -MF $(DEPDIR)/enc_output_format_tab.Tpo -c -o enc_output_format_tab.lo `test -f '$(ENC_SRC_DIR)/enc_output_format_tab.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/enc_output_format_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/enc_output_format_tab.Tpo $(DEPDIR)/enc_output_format_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/enc_output_format_tab.cpp' object='enc_output_format_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o enc_output_format_tab.lo `test -f '$(ENC_SRC_DIR)/enc_output_format_tab.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/enc_output_format_tab.cpp
+
+ets_to_if2.lo: $(ENC_SRC_DIR)/ets_to_if2.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ets_to_if2.lo -MD -MP -MF $(DEPDIR)/ets_to_if2.Tpo -c -o ets_to_if2.lo `test -f '$(ENC_SRC_DIR)/ets_to_if2.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/ets_to_if2.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/ets_to_if2.Tpo $(DEPDIR)/ets_to_if2.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/ets_to_if2.cpp' object='ets_to_if2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ets_to_if2.lo `test -f '$(ENC_SRC_DIR)/ets_to_if2.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/ets_to_if2.cpp
+
+ets_to_wmf.lo: $(ENC_SRC_DIR)/ets_to_wmf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ets_to_wmf.lo -MD -MP -MF $(DEPDIR)/ets_to_wmf.Tpo -c -o ets_to_wmf.lo `test -f '$(ENC_SRC_DIR)/ets_to_wmf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/ets_to_wmf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/ets_to_wmf.Tpo $(DEPDIR)/ets_to_wmf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/ets_to_wmf.cpp' object='ets_to_wmf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ets_to_wmf.lo `test -f '$(ENC_SRC_DIR)/ets_to_wmf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/ets_to_wmf.cpp
+
+g_adapt.lo: $(ENC_SRC_DIR)/g_adapt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT g_adapt.lo -MD -MP -MF $(DEPDIR)/g_adapt.Tpo -c -o g_adapt.lo `test -f '$(ENC_SRC_DIR)/g_adapt.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/g_adapt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/g_adapt.Tpo $(DEPDIR)/g_adapt.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/g_adapt.cpp' object='g_adapt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o g_adapt.lo `test -f '$(ENC_SRC_DIR)/g_adapt.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/g_adapt.cpp
+
+gain_q.lo: $(ENC_SRC_DIR)/gain_q.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gain_q.lo -MD -MP -MF $(DEPDIR)/gain_q.Tpo -c -o gain_q.lo `test -f '$(ENC_SRC_DIR)/gain_q.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/gain_q.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/gain_q.Tpo $(DEPDIR)/gain_q.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/gain_q.cpp' object='gain_q.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gain_q.lo `test -f '$(ENC_SRC_DIR)/gain_q.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/gain_q.cpp
+
+g_code.lo: $(ENC_SRC_DIR)/g_code.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT g_code.lo -MD -MP -MF $(DEPDIR)/g_code.Tpo -c -o g_code.lo `test -f '$(ENC_SRC_DIR)/g_code.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/g_code.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/g_code.Tpo $(DEPDIR)/g_code.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/g_code.cpp' object='g_code.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o g_code.lo `test -f '$(ENC_SRC_DIR)/g_code.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/g_code.cpp
+
+g_pitch.lo: $(ENC_SRC_DIR)/g_pitch.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT g_pitch.lo -MD -MP -MF $(DEPDIR)/g_pitch.Tpo -c -o g_pitch.lo `test -f '$(ENC_SRC_DIR)/g_pitch.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/g_pitch.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/g_pitch.Tpo $(DEPDIR)/g_pitch.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/g_pitch.cpp' object='g_pitch.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o g_pitch.lo `test -f '$(ENC_SRC_DIR)/g_pitch.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/g_pitch.cpp
+
+hp_max.lo: $(ENC_SRC_DIR)/hp_max.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hp_max.lo -MD -MP -MF $(DEPDIR)/hp_max.Tpo -c -o hp_max.lo `test -f '$(ENC_SRC_DIR)/hp_max.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/hp_max.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/hp_max.Tpo $(DEPDIR)/hp_max.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/hp_max.cpp' object='hp_max.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hp_max.lo `test -f '$(ENC_SRC_DIR)/hp_max.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/hp_max.cpp
+
+inter_36.lo: $(ENC_SRC_DIR)/inter_36.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT inter_36.lo -MD -MP -MF $(DEPDIR)/inter_36.Tpo -c -o inter_36.lo `test -f '$(ENC_SRC_DIR)/inter_36.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/inter_36.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/inter_36.Tpo $(DEPDIR)/inter_36.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/inter_36.cpp' object='inter_36.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o inter_36.lo `test -f '$(ENC_SRC_DIR)/inter_36.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/inter_36.cpp
+
+inter_36_tab.lo: $(ENC_SRC_DIR)/inter_36_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT inter_36_tab.lo -MD -MP -MF $(DEPDIR)/inter_36_tab.Tpo -c -o inter_36_tab.lo `test -f '$(ENC_SRC_DIR)/inter_36_tab.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/inter_36_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/inter_36_tab.Tpo $(DEPDIR)/inter_36_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/inter_36_tab.cpp' object='inter_36_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o inter_36_tab.lo `test -f '$(ENC_SRC_DIR)/inter_36_tab.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/inter_36_tab.cpp
+
+l_abs.lo: $(ENC_SRC_DIR)/l_abs.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l_abs.lo -MD -MP -MF $(DEPDIR)/l_abs.Tpo -c -o l_abs.lo `test -f '$(ENC_SRC_DIR)/l_abs.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/l_abs.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/l_abs.Tpo $(DEPDIR)/l_abs.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/l_abs.cpp' object='l_abs.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l_abs.lo `test -f '$(ENC_SRC_DIR)/l_abs.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/l_abs.cpp
+
+lag_wind.lo: $(ENC_SRC_DIR)/lag_wind.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lag_wind.lo -MD -MP -MF $(DEPDIR)/lag_wind.Tpo -c -o lag_wind.lo `test -f '$(ENC_SRC_DIR)/lag_wind.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/lag_wind.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lag_wind.Tpo $(DEPDIR)/lag_wind.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/lag_wind.cpp' object='lag_wind.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lag_wind.lo `test -f '$(ENC_SRC_DIR)/lag_wind.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/lag_wind.cpp
+
+lag_wind_tab.lo: $(ENC_SRC_DIR)/lag_wind_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lag_wind_tab.lo -MD -MP -MF $(DEPDIR)/lag_wind_tab.Tpo -c -o lag_wind_tab.lo `test -f '$(ENC_SRC_DIR)/lag_wind_tab.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/lag_wind_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lag_wind_tab.Tpo $(DEPDIR)/lag_wind_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/lag_wind_tab.cpp' object='lag_wind_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lag_wind_tab.lo `test -f '$(ENC_SRC_DIR)/lag_wind_tab.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/lag_wind_tab.cpp
+
+l_comp.lo: $(ENC_SRC_DIR)/l_comp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l_comp.lo -MD -MP -MF $(DEPDIR)/l_comp.Tpo -c -o l_comp.lo `test -f '$(ENC_SRC_DIR)/l_comp.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/l_comp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/l_comp.Tpo $(DEPDIR)/l_comp.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/l_comp.cpp' object='l_comp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l_comp.lo `test -f '$(ENC_SRC_DIR)/l_comp.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/l_comp.cpp
+
+levinson.lo: $(ENC_SRC_DIR)/levinson.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT levinson.lo -MD -MP -MF $(DEPDIR)/levinson.Tpo -c -o levinson.lo `test -f '$(ENC_SRC_DIR)/levinson.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/levinson.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/levinson.Tpo $(DEPDIR)/levinson.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/levinson.cpp' object='levinson.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o levinson.lo `test -f '$(ENC_SRC_DIR)/levinson.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/levinson.cpp
+
+l_extract.lo: $(ENC_SRC_DIR)/l_extract.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l_extract.lo -MD -MP -MF $(DEPDIR)/l_extract.Tpo -c -o l_extract.lo `test -f '$(ENC_SRC_DIR)/l_extract.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/l_extract.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/l_extract.Tpo $(DEPDIR)/l_extract.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/l_extract.cpp' object='l_extract.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l_extract.lo `test -f '$(ENC_SRC_DIR)/l_extract.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/l_extract.cpp
+
+lflg_upd.lo: $(ENC_SRC_DIR)/lflg_upd.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lflg_upd.lo -MD -MP -MF $(DEPDIR)/lflg_upd.Tpo -c -o lflg_upd.lo `test -f '$(ENC_SRC_DIR)/lflg_upd.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/lflg_upd.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lflg_upd.Tpo $(DEPDIR)/lflg_upd.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/lflg_upd.cpp' object='lflg_upd.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lflg_upd.lo `test -f '$(ENC_SRC_DIR)/lflg_upd.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/lflg_upd.cpp
+
+l_negate.lo: $(ENC_SRC_DIR)/l_negate.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l_negate.lo -MD -MP -MF $(DEPDIR)/l_negate.Tpo -c -o l_negate.lo `test -f '$(ENC_SRC_DIR)/l_negate.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/l_negate.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/l_negate.Tpo $(DEPDIR)/l_negate.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/l_negate.cpp' object='l_negate.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l_negate.lo `test -f '$(ENC_SRC_DIR)/l_negate.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/l_negate.cpp
+
+lpc.lo: $(ENC_SRC_DIR)/lpc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lpc.lo -MD -MP -MF $(DEPDIR)/lpc.Tpo -c -o lpc.lo `test -f '$(ENC_SRC_DIR)/lpc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/lpc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lpc.Tpo $(DEPDIR)/lpc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/lpc.cpp' object='lpc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lpc.lo `test -f '$(ENC_SRC_DIR)/lpc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/lpc.cpp
+
+ol_ltp.lo: $(ENC_SRC_DIR)/ol_ltp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ol_ltp.lo -MD -MP -MF $(DEPDIR)/ol_ltp.Tpo -c -o ol_ltp.lo `test -f '$(ENC_SRC_DIR)/ol_ltp.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/ol_ltp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/ol_ltp.Tpo $(DEPDIR)/ol_ltp.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/ol_ltp.cpp' object='ol_ltp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ol_ltp.lo `test -f '$(ENC_SRC_DIR)/ol_ltp.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/ol_ltp.cpp
+
+pitch_fr.lo: $(ENC_SRC_DIR)/pitch_fr.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pitch_fr.lo -MD -MP -MF $(DEPDIR)/pitch_fr.Tpo -c -o pitch_fr.lo `test -f '$(ENC_SRC_DIR)/pitch_fr.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/pitch_fr.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pitch_fr.Tpo $(DEPDIR)/pitch_fr.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/pitch_fr.cpp' object='pitch_fr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pitch_fr.lo `test -f '$(ENC_SRC_DIR)/pitch_fr.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/pitch_fr.cpp
+
+pitch_ol.lo: $(ENC_SRC_DIR)/pitch_ol.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pitch_ol.lo -MD -MP -MF $(DEPDIR)/pitch_ol.Tpo -c -o pitch_ol.lo `test -f '$(ENC_SRC_DIR)/pitch_ol.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/pitch_ol.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pitch_ol.Tpo $(DEPDIR)/pitch_ol.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/pitch_ol.cpp' object='pitch_ol.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pitch_ol.lo `test -f '$(ENC_SRC_DIR)/pitch_ol.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/pitch_ol.cpp
+
+p_ol_wgh.lo: $(ENC_SRC_DIR)/p_ol_wgh.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT p_ol_wgh.lo -MD -MP -MF $(DEPDIR)/p_ol_wgh.Tpo -c -o p_ol_wgh.lo `test -f '$(ENC_SRC_DIR)/p_ol_wgh.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/p_ol_wgh.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/p_ol_wgh.Tpo $(DEPDIR)/p_ol_wgh.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/p_ol_wgh.cpp' object='p_ol_wgh.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o p_ol_wgh.lo `test -f '$(ENC_SRC_DIR)/p_ol_wgh.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/p_ol_wgh.cpp
+
+pre_big.lo: $(ENC_SRC_DIR)/pre_big.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pre_big.lo -MD -MP -MF $(DEPDIR)/pre_big.Tpo -c -o pre_big.lo `test -f '$(ENC_SRC_DIR)/pre_big.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/pre_big.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pre_big.Tpo $(DEPDIR)/pre_big.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/pre_big.cpp' object='pre_big.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pre_big.lo `test -f '$(ENC_SRC_DIR)/pre_big.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/pre_big.cpp
+
+pre_proc.lo: $(ENC_SRC_DIR)/pre_proc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pre_proc.lo -MD -MP -MF $(DEPDIR)/pre_proc.Tpo -c -o pre_proc.lo `test -f '$(ENC_SRC_DIR)/pre_proc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/pre_proc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pre_proc.Tpo $(DEPDIR)/pre_proc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/pre_proc.cpp' object='pre_proc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pre_proc.lo `test -f '$(ENC_SRC_DIR)/pre_proc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/pre_proc.cpp
+
+prm2bits.lo: $(ENC_SRC_DIR)/prm2bits.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT prm2bits.lo -MD -MP -MF $(DEPDIR)/prm2bits.Tpo -c -o prm2bits.lo `test -f '$(ENC_SRC_DIR)/prm2bits.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/prm2bits.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/prm2bits.Tpo $(DEPDIR)/prm2bits.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/prm2bits.cpp' object='prm2bits.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o prm2bits.lo `test -f '$(ENC_SRC_DIR)/prm2bits.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/prm2bits.cpp
+
+qgain475.lo: $(ENC_SRC_DIR)/qgain475.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT qgain475.lo -MD -MP -MF $(DEPDIR)/qgain475.Tpo -c -o qgain475.lo `test -f '$(ENC_SRC_DIR)/qgain475.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/qgain475.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/qgain475.Tpo $(DEPDIR)/qgain475.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/qgain475.cpp' object='qgain475.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o qgain475.lo `test -f '$(ENC_SRC_DIR)/qgain475.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/qgain475.cpp
+
+qgain795.lo: $(ENC_SRC_DIR)/qgain795.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT qgain795.lo -MD -MP -MF $(DEPDIR)/qgain795.Tpo -c -o qgain795.lo `test -f '$(ENC_SRC_DIR)/qgain795.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/qgain795.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/qgain795.Tpo $(DEPDIR)/qgain795.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/qgain795.cpp' object='qgain795.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o qgain795.lo `test -f '$(ENC_SRC_DIR)/qgain795.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/qgain795.cpp
+
+q_gain_c.lo: $(ENC_SRC_DIR)/q_gain_c.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT q_gain_c.lo -MD -MP -MF $(DEPDIR)/q_gain_c.Tpo -c -o q_gain_c.lo `test -f '$(ENC_SRC_DIR)/q_gain_c.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/q_gain_c.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/q_gain_c.Tpo $(DEPDIR)/q_gain_c.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/q_gain_c.cpp' object='q_gain_c.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o q_gain_c.lo `test -f '$(ENC_SRC_DIR)/q_gain_c.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/q_gain_c.cpp
+
+q_gain_p.lo: $(ENC_SRC_DIR)/q_gain_p.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT q_gain_p.lo -MD -MP -MF $(DEPDIR)/q_gain_p.Tpo -c -o q_gain_p.lo `test -f '$(ENC_SRC_DIR)/q_gain_p.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/q_gain_p.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/q_gain_p.Tpo $(DEPDIR)/q_gain_p.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/q_gain_p.cpp' object='q_gain_p.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o q_gain_p.lo `test -f '$(ENC_SRC_DIR)/q_gain_p.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/q_gain_p.cpp
+
+qua_gain.lo: $(ENC_SRC_DIR)/qua_gain.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT qua_gain.lo -MD -MP -MF $(DEPDIR)/qua_gain.Tpo -c -o qua_gain.lo `test -f '$(ENC_SRC_DIR)/qua_gain.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/qua_gain.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/qua_gain.Tpo $(DEPDIR)/qua_gain.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/qua_gain.cpp' object='qua_gain.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o qua_gain.lo `test -f '$(ENC_SRC_DIR)/qua_gain.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/qua_gain.cpp
+
+s10_8pf.lo: $(ENC_SRC_DIR)/s10_8pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT s10_8pf.lo -MD -MP -MF $(DEPDIR)/s10_8pf.Tpo -c -o s10_8pf.lo `test -f '$(ENC_SRC_DIR)/s10_8pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/s10_8pf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/s10_8pf.Tpo $(DEPDIR)/s10_8pf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/s10_8pf.cpp' object='s10_8pf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o s10_8pf.lo `test -f '$(ENC_SRC_DIR)/s10_8pf.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/s10_8pf.cpp
+
+set_sign.lo: $(ENC_SRC_DIR)/set_sign.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT set_sign.lo -MD -MP -MF $(DEPDIR)/set_sign.Tpo -c -o set_sign.lo `test -f '$(ENC_SRC_DIR)/set_sign.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/set_sign.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/set_sign.Tpo $(DEPDIR)/set_sign.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/set_sign.cpp' object='set_sign.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o set_sign.lo `test -f '$(ENC_SRC_DIR)/set_sign.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/set_sign.cpp
+
+sid_sync.lo: $(ENC_SRC_DIR)/sid_sync.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sid_sync.lo -MD -MP -MF $(DEPDIR)/sid_sync.Tpo -c -o sid_sync.lo `test -f '$(ENC_SRC_DIR)/sid_sync.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/sid_sync.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/sid_sync.Tpo $(DEPDIR)/sid_sync.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/sid_sync.cpp' object='sid_sync.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sid_sync.lo `test -f '$(ENC_SRC_DIR)/sid_sync.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/sid_sync.cpp
+
+sp_enc.lo: $(ENC_SRC_DIR)/sp_enc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sp_enc.lo -MD -MP -MF $(DEPDIR)/sp_enc.Tpo -c -o sp_enc.lo `test -f '$(ENC_SRC_DIR)/sp_enc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/sp_enc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/sp_enc.Tpo $(DEPDIR)/sp_enc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/sp_enc.cpp' object='sp_enc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sp_enc.lo `test -f '$(ENC_SRC_DIR)/sp_enc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/sp_enc.cpp
+
+spreproc.lo: $(ENC_SRC_DIR)/spreproc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT spreproc.lo -MD -MP -MF $(DEPDIR)/spreproc.Tpo -c -o spreproc.lo `test -f '$(ENC_SRC_DIR)/spreproc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/spreproc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/spreproc.Tpo $(DEPDIR)/spreproc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/spreproc.cpp' object='spreproc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o spreproc.lo `test -f '$(ENC_SRC_DIR)/spreproc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/spreproc.cpp
+
+spstproc.lo: $(ENC_SRC_DIR)/spstproc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT spstproc.lo -MD -MP -MF $(DEPDIR)/spstproc.Tpo -c -o spstproc.lo `test -f '$(ENC_SRC_DIR)/spstproc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/spstproc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/spstproc.Tpo $(DEPDIR)/spstproc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/spstproc.cpp' object='spstproc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o spstproc.lo `test -f '$(ENC_SRC_DIR)/spstproc.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/spstproc.cpp
+
+ton_stab.lo: $(ENC_SRC_DIR)/ton_stab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ton_stab.lo -MD -MP -MF $(DEPDIR)/ton_stab.Tpo -c -o ton_stab.lo `test -f '$(ENC_SRC_DIR)/ton_stab.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/ton_stab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/ton_stab.Tpo $(DEPDIR)/ton_stab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/ton_stab.cpp' object='ton_stab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ton_stab.lo `test -f '$(ENC_SRC_DIR)/ton_stab.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/ton_stab.cpp
+
+vad1.lo: $(ENC_SRC_DIR)/vad1.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vad1.lo -MD -MP -MF $(DEPDIR)/vad1.Tpo -c -o vad1.lo `test -f '$(ENC_SRC_DIR)/vad1.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/vad1.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/vad1.Tpo $(DEPDIR)/vad1.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(ENC_SRC_DIR)/vad1.cpp' object='vad1.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vad1.lo `test -f '$(ENC_SRC_DIR)/vad1.cpp' || echo '$(srcdir)/'`$(ENC_SRC_DIR)/vad1.cpp
+
+add.lo: $(COMMON_SRC_DIR)/add.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT add.lo -MD -MP -MF $(DEPDIR)/add.Tpo -c -o add.lo `test -f '$(COMMON_SRC_DIR)/add.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/add.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/add.Tpo $(DEPDIR)/add.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/add.cpp' object='add.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o add.lo `test -f '$(COMMON_SRC_DIR)/add.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/add.cpp
+
+az_lsp.lo: $(COMMON_SRC_DIR)/az_lsp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT az_lsp.lo -MD -MP -MF $(DEPDIR)/az_lsp.Tpo -c -o az_lsp.lo `test -f '$(COMMON_SRC_DIR)/az_lsp.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/az_lsp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/az_lsp.Tpo $(DEPDIR)/az_lsp.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/az_lsp.cpp' object='az_lsp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o az_lsp.lo `test -f '$(COMMON_SRC_DIR)/az_lsp.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/az_lsp.cpp
+
+bitno_tab.lo: $(COMMON_SRC_DIR)/bitno_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bitno_tab.lo -MD -MP -MF $(DEPDIR)/bitno_tab.Tpo -c -o bitno_tab.lo `test -f '$(COMMON_SRC_DIR)/bitno_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/bitno_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/bitno_tab.Tpo $(DEPDIR)/bitno_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/bitno_tab.cpp' object='bitno_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bitno_tab.lo `test -f '$(COMMON_SRC_DIR)/bitno_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/bitno_tab.cpp
+
+bitreorder_tab.lo: $(COMMON_SRC_DIR)/bitreorder_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bitreorder_tab.lo -MD -MP -MF $(DEPDIR)/bitreorder_tab.Tpo -c -o bitreorder_tab.lo `test -f '$(COMMON_SRC_DIR)/bitreorder_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/bitreorder_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/bitreorder_tab.Tpo $(DEPDIR)/bitreorder_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/bitreorder_tab.cpp' object='bitreorder_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bitreorder_tab.lo `test -f '$(COMMON_SRC_DIR)/bitreorder_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/bitreorder_tab.cpp
+
+c2_9pf_tab.lo: $(COMMON_SRC_DIR)/c2_9pf_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT c2_9pf_tab.lo -MD -MP -MF $(DEPDIR)/c2_9pf_tab.Tpo -c -o c2_9pf_tab.lo `test -f '$(COMMON_SRC_DIR)/c2_9pf_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/c2_9pf_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/c2_9pf_tab.Tpo $(DEPDIR)/c2_9pf_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/c2_9pf_tab.cpp' object='c2_9pf_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o c2_9pf_tab.lo `test -f '$(COMMON_SRC_DIR)/c2_9pf_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/c2_9pf_tab.cpp
+
+div_s.lo: $(COMMON_SRC_DIR)/div_s.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT div_s.lo -MD -MP -MF $(DEPDIR)/div_s.Tpo -c -o div_s.lo `test -f '$(COMMON_SRC_DIR)/div_s.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/div_s.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/div_s.Tpo $(DEPDIR)/div_s.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/div_s.cpp' object='div_s.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o div_s.lo `test -f '$(COMMON_SRC_DIR)/div_s.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/div_s.cpp
+
+extract_h.lo: $(COMMON_SRC_DIR)/extract_h.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT extract_h.lo -MD -MP -MF $(DEPDIR)/extract_h.Tpo -c -o extract_h.lo `test -f '$(COMMON_SRC_DIR)/extract_h.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/extract_h.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/extract_h.Tpo $(DEPDIR)/extract_h.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/extract_h.cpp' object='extract_h.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o extract_h.lo `test -f '$(COMMON_SRC_DIR)/extract_h.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/extract_h.cpp
+
+extract_l.lo: $(COMMON_SRC_DIR)/extract_l.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT extract_l.lo -MD -MP -MF $(DEPDIR)/extract_l.Tpo -c -o extract_l.lo `test -f '$(COMMON_SRC_DIR)/extract_l.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/extract_l.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/extract_l.Tpo $(DEPDIR)/extract_l.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/extract_l.cpp' object='extract_l.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o extract_l.lo `test -f '$(COMMON_SRC_DIR)/extract_l.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/extract_l.cpp
+
+gains_tbl.lo: $(COMMON_SRC_DIR)/gains_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gains_tbl.lo -MD -MP -MF $(DEPDIR)/gains_tbl.Tpo -c -o gains_tbl.lo `test -f '$(COMMON_SRC_DIR)/gains_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/gains_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/gains_tbl.Tpo $(DEPDIR)/gains_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/gains_tbl.cpp' object='gains_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gains_tbl.lo `test -f '$(COMMON_SRC_DIR)/gains_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/gains_tbl.cpp
+
+gc_pred.lo: $(COMMON_SRC_DIR)/gc_pred.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gc_pred.lo -MD -MP -MF $(DEPDIR)/gc_pred.Tpo -c -o gc_pred.lo `test -f '$(COMMON_SRC_DIR)/gc_pred.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/gc_pred.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/gc_pred.Tpo $(DEPDIR)/gc_pred.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/gc_pred.cpp' object='gc_pred.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gc_pred.lo `test -f '$(COMMON_SRC_DIR)/gc_pred.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/gc_pred.cpp
+
+get_const_tbls.lo: $(COMMON_SRC_DIR)/get_const_tbls.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT get_const_tbls.lo -MD -MP -MF $(DEPDIR)/get_const_tbls.Tpo -c -o get_const_tbls.lo `test -f '$(COMMON_SRC_DIR)/get_const_tbls.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/get_const_tbls.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/get_const_tbls.Tpo $(DEPDIR)/get_const_tbls.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/get_const_tbls.cpp' object='get_const_tbls.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o get_const_tbls.lo `test -f '$(COMMON_SRC_DIR)/get_const_tbls.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/get_const_tbls.cpp
+
+gmed_n.lo: $(COMMON_SRC_DIR)/gmed_n.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gmed_n.lo -MD -MP -MF $(DEPDIR)/gmed_n.Tpo -c -o gmed_n.lo `test -f '$(COMMON_SRC_DIR)/gmed_n.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/gmed_n.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/gmed_n.Tpo $(DEPDIR)/gmed_n.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/gmed_n.cpp' object='gmed_n.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gmed_n.lo `test -f '$(COMMON_SRC_DIR)/gmed_n.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/gmed_n.cpp
+
+gray_tbl.lo: $(COMMON_SRC_DIR)/gray_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gray_tbl.lo -MD -MP -MF $(DEPDIR)/gray_tbl.Tpo -c -o gray_tbl.lo `test -f '$(COMMON_SRC_DIR)/gray_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/gray_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/gray_tbl.Tpo $(DEPDIR)/gray_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/gray_tbl.cpp' object='gray_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gray_tbl.lo `test -f '$(COMMON_SRC_DIR)/gray_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/gray_tbl.cpp
+
+grid_tbl.lo: $(COMMON_SRC_DIR)/grid_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT grid_tbl.lo -MD -MP -MF $(DEPDIR)/grid_tbl.Tpo -c -o grid_tbl.lo `test -f '$(COMMON_SRC_DIR)/grid_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/grid_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/grid_tbl.Tpo $(DEPDIR)/grid_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/grid_tbl.cpp' object='grid_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o grid_tbl.lo `test -f '$(COMMON_SRC_DIR)/grid_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/grid_tbl.cpp
+
+int_lpc.lo: $(COMMON_SRC_DIR)/int_lpc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT int_lpc.lo -MD -MP -MF $(DEPDIR)/int_lpc.Tpo -c -o int_lpc.lo `test -f '$(COMMON_SRC_DIR)/int_lpc.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/int_lpc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/int_lpc.Tpo $(DEPDIR)/int_lpc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/int_lpc.cpp' object='int_lpc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o int_lpc.lo `test -f '$(COMMON_SRC_DIR)/int_lpc.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/int_lpc.cpp
+
+inv_sqrt.lo: $(COMMON_SRC_DIR)/inv_sqrt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT inv_sqrt.lo -MD -MP -MF $(DEPDIR)/inv_sqrt.Tpo -c -o inv_sqrt.lo `test -f '$(COMMON_SRC_DIR)/inv_sqrt.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/inv_sqrt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/inv_sqrt.Tpo $(DEPDIR)/inv_sqrt.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/inv_sqrt.cpp' object='inv_sqrt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o inv_sqrt.lo `test -f '$(COMMON_SRC_DIR)/inv_sqrt.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/inv_sqrt.cpp
+
+inv_sqrt_tbl.lo: $(COMMON_SRC_DIR)/inv_sqrt_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT inv_sqrt_tbl.lo -MD -MP -MF $(DEPDIR)/inv_sqrt_tbl.Tpo -c -o inv_sqrt_tbl.lo `test -f '$(COMMON_SRC_DIR)/inv_sqrt_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/inv_sqrt_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/inv_sqrt_tbl.Tpo $(DEPDIR)/inv_sqrt_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/inv_sqrt_tbl.cpp' object='inv_sqrt_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o inv_sqrt_tbl.lo `test -f '$(COMMON_SRC_DIR)/inv_sqrt_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/inv_sqrt_tbl.cpp
+
+l_deposit_h.lo: $(COMMON_SRC_DIR)/l_deposit_h.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l_deposit_h.lo -MD -MP -MF $(DEPDIR)/l_deposit_h.Tpo -c -o l_deposit_h.lo `test -f '$(COMMON_SRC_DIR)/l_deposit_h.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/l_deposit_h.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/l_deposit_h.Tpo $(DEPDIR)/l_deposit_h.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/l_deposit_h.cpp' object='l_deposit_h.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l_deposit_h.lo `test -f '$(COMMON_SRC_DIR)/l_deposit_h.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/l_deposit_h.cpp
+
+l_deposit_l.lo: $(COMMON_SRC_DIR)/l_deposit_l.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l_deposit_l.lo -MD -MP -MF $(DEPDIR)/l_deposit_l.Tpo -c -o l_deposit_l.lo `test -f '$(COMMON_SRC_DIR)/l_deposit_l.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/l_deposit_l.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/l_deposit_l.Tpo $(DEPDIR)/l_deposit_l.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/l_deposit_l.cpp' object='l_deposit_l.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l_deposit_l.lo `test -f '$(COMMON_SRC_DIR)/l_deposit_l.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/l_deposit_l.cpp
+
+log2.lo: $(COMMON_SRC_DIR)/log2.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT log2.lo -MD -MP -MF $(DEPDIR)/log2.Tpo -c -o log2.lo `test -f '$(COMMON_SRC_DIR)/log2.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/log2.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/log2.Tpo $(DEPDIR)/log2.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/log2.cpp' object='log2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o log2.lo `test -f '$(COMMON_SRC_DIR)/log2.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/log2.cpp
+
+log2_norm.lo: $(COMMON_SRC_DIR)/log2_norm.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT log2_norm.lo -MD -MP -MF $(DEPDIR)/log2_norm.Tpo -c -o log2_norm.lo `test -f '$(COMMON_SRC_DIR)/log2_norm.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/log2_norm.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/log2_norm.Tpo $(DEPDIR)/log2_norm.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/log2_norm.cpp' object='log2_norm.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o log2_norm.lo `test -f '$(COMMON_SRC_DIR)/log2_norm.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/log2_norm.cpp
+
+log2_tbl.lo: $(COMMON_SRC_DIR)/log2_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT log2_tbl.lo -MD -MP -MF $(DEPDIR)/log2_tbl.Tpo -c -o log2_tbl.lo `test -f '$(COMMON_SRC_DIR)/log2_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/log2_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/log2_tbl.Tpo $(DEPDIR)/log2_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/log2_tbl.cpp' object='log2_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o log2_tbl.lo `test -f '$(COMMON_SRC_DIR)/log2_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/log2_tbl.cpp
+
+lsfwt.lo: $(COMMON_SRC_DIR)/lsfwt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lsfwt.lo -MD -MP -MF $(DEPDIR)/lsfwt.Tpo -c -o lsfwt.lo `test -f '$(COMMON_SRC_DIR)/lsfwt.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsfwt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lsfwt.Tpo $(DEPDIR)/lsfwt.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/lsfwt.cpp' object='lsfwt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lsfwt.lo `test -f '$(COMMON_SRC_DIR)/lsfwt.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsfwt.cpp
+
+l_shr_r.lo: $(COMMON_SRC_DIR)/l_shr_r.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l_shr_r.lo -MD -MP -MF $(DEPDIR)/l_shr_r.Tpo -c -o l_shr_r.lo `test -f '$(COMMON_SRC_DIR)/l_shr_r.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/l_shr_r.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/l_shr_r.Tpo $(DEPDIR)/l_shr_r.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/l_shr_r.cpp' object='l_shr_r.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l_shr_r.lo `test -f '$(COMMON_SRC_DIR)/l_shr_r.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/l_shr_r.cpp
+
+lsp_az.lo: $(COMMON_SRC_DIR)/lsp_az.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lsp_az.lo -MD -MP -MF $(DEPDIR)/lsp_az.Tpo -c -o lsp_az.lo `test -f '$(COMMON_SRC_DIR)/lsp_az.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsp_az.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lsp_az.Tpo $(DEPDIR)/lsp_az.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/lsp_az.cpp' object='lsp_az.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lsp_az.lo `test -f '$(COMMON_SRC_DIR)/lsp_az.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsp_az.cpp
+
+lsp.lo: $(COMMON_SRC_DIR)/lsp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lsp.lo -MD -MP -MF $(DEPDIR)/lsp.Tpo -c -o lsp.lo `test -f '$(COMMON_SRC_DIR)/lsp.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lsp.Tpo $(DEPDIR)/lsp.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/lsp.cpp' object='lsp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lsp.lo `test -f '$(COMMON_SRC_DIR)/lsp.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsp.cpp
+
+lsp_lsf.lo: $(COMMON_SRC_DIR)/lsp_lsf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lsp_lsf.lo -MD -MP -MF $(DEPDIR)/lsp_lsf.Tpo -c -o lsp_lsf.lo `test -f '$(COMMON_SRC_DIR)/lsp_lsf.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsp_lsf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lsp_lsf.Tpo $(DEPDIR)/lsp_lsf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/lsp_lsf.cpp' object='lsp_lsf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lsp_lsf.lo `test -f '$(COMMON_SRC_DIR)/lsp_lsf.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsp_lsf.cpp
+
+lsp_lsf_tbl.lo: $(COMMON_SRC_DIR)/lsp_lsf_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lsp_lsf_tbl.lo -MD -MP -MF $(DEPDIR)/lsp_lsf_tbl.Tpo -c -o lsp_lsf_tbl.lo `test -f '$(COMMON_SRC_DIR)/lsp_lsf_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsp_lsf_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lsp_lsf_tbl.Tpo $(DEPDIR)/lsp_lsf_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/lsp_lsf_tbl.cpp' object='lsp_lsf_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lsp_lsf_tbl.lo `test -f '$(COMMON_SRC_DIR)/lsp_lsf_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsp_lsf_tbl.cpp
+
+lsp_tab.lo: $(COMMON_SRC_DIR)/lsp_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lsp_tab.lo -MD -MP -MF $(DEPDIR)/lsp_tab.Tpo -c -o lsp_tab.lo `test -f '$(COMMON_SRC_DIR)/lsp_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsp_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lsp_tab.Tpo $(DEPDIR)/lsp_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/lsp_tab.cpp' object='lsp_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lsp_tab.lo `test -f '$(COMMON_SRC_DIR)/lsp_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/lsp_tab.cpp
+
+mult_r.lo: $(COMMON_SRC_DIR)/mult_r.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mult_r.lo -MD -MP -MF $(DEPDIR)/mult_r.Tpo -c -o mult_r.lo `test -f '$(COMMON_SRC_DIR)/mult_r.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/mult_r.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/mult_r.Tpo $(DEPDIR)/mult_r.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/mult_r.cpp' object='mult_r.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mult_r.lo `test -f '$(COMMON_SRC_DIR)/mult_r.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/mult_r.cpp
+
+negate.lo: $(COMMON_SRC_DIR)/negate.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT negate.lo -MD -MP -MF $(DEPDIR)/negate.Tpo -c -o negate.lo `test -f '$(COMMON_SRC_DIR)/negate.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/negate.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/negate.Tpo $(DEPDIR)/negate.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/negate.cpp' object='negate.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o negate.lo `test -f '$(COMMON_SRC_DIR)/negate.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/negate.cpp
+
+norm_l.lo: $(COMMON_SRC_DIR)/norm_l.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT norm_l.lo -MD -MP -MF $(DEPDIR)/norm_l.Tpo -c -o norm_l.lo `test -f '$(COMMON_SRC_DIR)/norm_l.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/norm_l.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/norm_l.Tpo $(DEPDIR)/norm_l.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/norm_l.cpp' object='norm_l.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o norm_l.lo `test -f '$(COMMON_SRC_DIR)/norm_l.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/norm_l.cpp
+
+norm_s.lo: $(COMMON_SRC_DIR)/norm_s.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT norm_s.lo -MD -MP -MF $(DEPDIR)/norm_s.Tpo -c -o norm_s.lo `test -f '$(COMMON_SRC_DIR)/norm_s.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/norm_s.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/norm_s.Tpo $(DEPDIR)/norm_s.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/norm_s.cpp' object='norm_s.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o norm_s.lo `test -f '$(COMMON_SRC_DIR)/norm_s.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/norm_s.cpp
+
+overflow_tbl.lo: $(COMMON_SRC_DIR)/overflow_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT overflow_tbl.lo -MD -MP -MF $(DEPDIR)/overflow_tbl.Tpo -c -o overflow_tbl.lo `test -f '$(COMMON_SRC_DIR)/overflow_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/overflow_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/overflow_tbl.Tpo $(DEPDIR)/overflow_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/overflow_tbl.cpp' object='overflow_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o overflow_tbl.lo `test -f '$(COMMON_SRC_DIR)/overflow_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/overflow_tbl.cpp
+
+ph_disp_tab.lo: $(COMMON_SRC_DIR)/ph_disp_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ph_disp_tab.lo -MD -MP -MF $(DEPDIR)/ph_disp_tab.Tpo -c -o ph_disp_tab.lo `test -f '$(COMMON_SRC_DIR)/ph_disp_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/ph_disp_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/ph_disp_tab.Tpo $(DEPDIR)/ph_disp_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/ph_disp_tab.cpp' object='ph_disp_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ph_disp_tab.lo `test -f '$(COMMON_SRC_DIR)/ph_disp_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/ph_disp_tab.cpp
+
+pow2.lo: $(COMMON_SRC_DIR)/pow2.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pow2.lo -MD -MP -MF $(DEPDIR)/pow2.Tpo -c -o pow2.lo `test -f '$(COMMON_SRC_DIR)/pow2.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/pow2.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pow2.Tpo $(DEPDIR)/pow2.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/pow2.cpp' object='pow2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pow2.lo `test -f '$(COMMON_SRC_DIR)/pow2.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/pow2.cpp
+
+pow2_tbl.lo: $(COMMON_SRC_DIR)/pow2_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pow2_tbl.lo -MD -MP -MF $(DEPDIR)/pow2_tbl.Tpo -c -o pow2_tbl.lo `test -f '$(COMMON_SRC_DIR)/pow2_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/pow2_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pow2_tbl.Tpo $(DEPDIR)/pow2_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/pow2_tbl.cpp' object='pow2_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pow2_tbl.lo `test -f '$(COMMON_SRC_DIR)/pow2_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/pow2_tbl.cpp
+
+pred_lt.lo: $(COMMON_SRC_DIR)/pred_lt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pred_lt.lo -MD -MP -MF $(DEPDIR)/pred_lt.Tpo -c -o pred_lt.lo `test -f '$(COMMON_SRC_DIR)/pred_lt.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/pred_lt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pred_lt.Tpo $(DEPDIR)/pred_lt.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/pred_lt.cpp' object='pred_lt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pred_lt.lo `test -f '$(COMMON_SRC_DIR)/pred_lt.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/pred_lt.cpp
+
+q_plsf_3.lo: $(COMMON_SRC_DIR)/q_plsf_3.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT q_plsf_3.lo -MD -MP -MF $(DEPDIR)/q_plsf_3.Tpo -c -o q_plsf_3.lo `test -f '$(COMMON_SRC_DIR)/q_plsf_3.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/q_plsf_3.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/q_plsf_3.Tpo $(DEPDIR)/q_plsf_3.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/q_plsf_3.cpp' object='q_plsf_3.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o q_plsf_3.lo `test -f '$(COMMON_SRC_DIR)/q_plsf_3.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/q_plsf_3.cpp
+
+q_plsf_3_tbl.lo: $(COMMON_SRC_DIR)/q_plsf_3_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT q_plsf_3_tbl.lo -MD -MP -MF $(DEPDIR)/q_plsf_3_tbl.Tpo -c -o q_plsf_3_tbl.lo `test -f '$(COMMON_SRC_DIR)/q_plsf_3_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/q_plsf_3_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/q_plsf_3_tbl.Tpo $(DEPDIR)/q_plsf_3_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/q_plsf_3_tbl.cpp' object='q_plsf_3_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o q_plsf_3_tbl.lo `test -f '$(COMMON_SRC_DIR)/q_plsf_3_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/q_plsf_3_tbl.cpp
+
+q_plsf_5.lo: $(COMMON_SRC_DIR)/q_plsf_5.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT q_plsf_5.lo -MD -MP -MF $(DEPDIR)/q_plsf_5.Tpo -c -o q_plsf_5.lo `test -f '$(COMMON_SRC_DIR)/q_plsf_5.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/q_plsf_5.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/q_plsf_5.Tpo $(DEPDIR)/q_plsf_5.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/q_plsf_5.cpp' object='q_plsf_5.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o q_plsf_5.lo `test -f '$(COMMON_SRC_DIR)/q_plsf_5.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/q_plsf_5.cpp
+
+q_plsf_5_tbl.lo: $(COMMON_SRC_DIR)/q_plsf_5_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT q_plsf_5_tbl.lo -MD -MP -MF $(DEPDIR)/q_plsf_5_tbl.Tpo -c -o q_plsf_5_tbl.lo `test -f '$(COMMON_SRC_DIR)/q_plsf_5_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/q_plsf_5_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/q_plsf_5_tbl.Tpo $(DEPDIR)/q_plsf_5_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/q_plsf_5_tbl.cpp' object='q_plsf_5_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o q_plsf_5_tbl.lo `test -f '$(COMMON_SRC_DIR)/q_plsf_5_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/q_plsf_5_tbl.cpp
+
+q_plsf.lo: $(COMMON_SRC_DIR)/q_plsf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT q_plsf.lo -MD -MP -MF $(DEPDIR)/q_plsf.Tpo -c -o q_plsf.lo `test -f '$(COMMON_SRC_DIR)/q_plsf.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/q_plsf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/q_plsf.Tpo $(DEPDIR)/q_plsf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/q_plsf.cpp' object='q_plsf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o q_plsf.lo `test -f '$(COMMON_SRC_DIR)/q_plsf.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/q_plsf.cpp
+
+qua_gain_tbl.lo: $(COMMON_SRC_DIR)/qua_gain_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT qua_gain_tbl.lo -MD -MP -MF $(DEPDIR)/qua_gain_tbl.Tpo -c -o qua_gain_tbl.lo `test -f '$(COMMON_SRC_DIR)/qua_gain_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/qua_gain_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/qua_gain_tbl.Tpo $(DEPDIR)/qua_gain_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/qua_gain_tbl.cpp' object='qua_gain_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o qua_gain_tbl.lo `test -f '$(COMMON_SRC_DIR)/qua_gain_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/qua_gain_tbl.cpp
+
+reorder.lo: $(COMMON_SRC_DIR)/reorder.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT reorder.lo -MD -MP -MF $(DEPDIR)/reorder.Tpo -c -o reorder.lo `test -f '$(COMMON_SRC_DIR)/reorder.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/reorder.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/reorder.Tpo $(DEPDIR)/reorder.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/reorder.cpp' object='reorder.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o reorder.lo `test -f '$(COMMON_SRC_DIR)/reorder.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/reorder.cpp
+
+residu.lo: $(COMMON_SRC_DIR)/residu.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT residu.lo -MD -MP -MF $(DEPDIR)/residu.Tpo -c -o residu.lo `test -f '$(COMMON_SRC_DIR)/residu.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/residu.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/residu.Tpo $(DEPDIR)/residu.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/residu.cpp' object='residu.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o residu.lo `test -f '$(COMMON_SRC_DIR)/residu.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/residu.cpp
+
+round.lo: $(COMMON_SRC_DIR)/round.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT round.lo -MD -MP -MF $(DEPDIR)/round.Tpo -c -o round.lo `test -f '$(COMMON_SRC_DIR)/round.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/round.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/round.Tpo $(DEPDIR)/round.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/round.cpp' object='round.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o round.lo `test -f '$(COMMON_SRC_DIR)/round.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/round.cpp
+
+set_zero.lo: $(COMMON_SRC_DIR)/set_zero.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT set_zero.lo -MD -MP -MF $(DEPDIR)/set_zero.Tpo -c -o set_zero.lo `test -f '$(COMMON_SRC_DIR)/set_zero.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/set_zero.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/set_zero.Tpo $(DEPDIR)/set_zero.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/set_zero.cpp' object='set_zero.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o set_zero.lo `test -f '$(COMMON_SRC_DIR)/set_zero.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/set_zero.cpp
+
+shr.lo: $(COMMON_SRC_DIR)/shr.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT shr.lo -MD -MP -MF $(DEPDIR)/shr.Tpo -c -o shr.lo `test -f '$(COMMON_SRC_DIR)/shr.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/shr.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/shr.Tpo $(DEPDIR)/shr.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/shr.cpp' object='shr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o shr.lo `test -f '$(COMMON_SRC_DIR)/shr.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/shr.cpp
+
+shr_r.lo: $(COMMON_SRC_DIR)/shr_r.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT shr_r.lo -MD -MP -MF $(DEPDIR)/shr_r.Tpo -c -o shr_r.lo `test -f '$(COMMON_SRC_DIR)/shr_r.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/shr_r.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/shr_r.Tpo $(DEPDIR)/shr_r.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/shr_r.cpp' object='shr_r.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o shr_r.lo `test -f '$(COMMON_SRC_DIR)/shr_r.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/shr_r.cpp
+
+sqrt_l.lo: $(COMMON_SRC_DIR)/sqrt_l.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sqrt_l.lo -MD -MP -MF $(DEPDIR)/sqrt_l.Tpo -c -o sqrt_l.lo `test -f '$(COMMON_SRC_DIR)/sqrt_l.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/sqrt_l.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/sqrt_l.Tpo $(DEPDIR)/sqrt_l.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/sqrt_l.cpp' object='sqrt_l.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sqrt_l.lo `test -f '$(COMMON_SRC_DIR)/sqrt_l.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/sqrt_l.cpp
+
+sqrt_l_tbl.lo: $(COMMON_SRC_DIR)/sqrt_l_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sqrt_l_tbl.lo -MD -MP -MF $(DEPDIR)/sqrt_l_tbl.Tpo -c -o sqrt_l_tbl.lo `test -f '$(COMMON_SRC_DIR)/sqrt_l_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/sqrt_l_tbl.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/sqrt_l_tbl.Tpo $(DEPDIR)/sqrt_l_tbl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/sqrt_l_tbl.cpp' object='sqrt_l_tbl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sqrt_l_tbl.lo `test -f '$(COMMON_SRC_DIR)/sqrt_l_tbl.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/sqrt_l_tbl.cpp
+
+sub.lo: $(COMMON_SRC_DIR)/sub.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sub.lo -MD -MP -MF $(DEPDIR)/sub.Tpo -c -o sub.lo `test -f '$(COMMON_SRC_DIR)/sub.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/sub.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/sub.Tpo $(DEPDIR)/sub.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/sub.cpp' object='sub.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sub.lo `test -f '$(COMMON_SRC_DIR)/sub.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/sub.cpp
+
+syn_filt.lo: $(COMMON_SRC_DIR)/syn_filt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT syn_filt.lo -MD -MP -MF $(DEPDIR)/syn_filt.Tpo -c -o syn_filt.lo `test -f '$(COMMON_SRC_DIR)/syn_filt.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/syn_filt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/syn_filt.Tpo $(DEPDIR)/syn_filt.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/syn_filt.cpp' object='syn_filt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o syn_filt.lo `test -f '$(COMMON_SRC_DIR)/syn_filt.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/syn_filt.cpp
+
+weight_a.lo: $(COMMON_SRC_DIR)/weight_a.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT weight_a.lo -MD -MP -MF $(DEPDIR)/weight_a.Tpo -c -o weight_a.lo `test -f '$(COMMON_SRC_DIR)/weight_a.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/weight_a.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/weight_a.Tpo $(DEPDIR)/weight_a.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/weight_a.cpp' object='weight_a.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o weight_a.lo `test -f '$(COMMON_SRC_DIR)/weight_a.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/weight_a.cpp
+
+window_tab.lo: $(COMMON_SRC_DIR)/window_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT window_tab.lo -MD -MP -MF $(DEPDIR)/window_tab.Tpo -c -o window_tab.lo `test -f '$(COMMON_SRC_DIR)/window_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/window_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/window_tab.Tpo $(DEPDIR)/window_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(COMMON_SRC_DIR)/window_tab.cpp' object='window_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o window_tab.lo `test -f '$(COMMON_SRC_DIR)/window_tab.cpp' || echo '$(srcdir)/'`$(COMMON_SRC_DIR)/window_tab.cpp
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+install-pkgconfigDATA: $(pkgconfig_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
+       @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
+       done
+
+uninstall-pkgconfigDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
+install-amrnbincludeHEADERS: $(amrnbinclude_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(amrnbincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amrnbincludedir)"
+       @list='$(amrnbinclude_HEADERS)'; test -n "$(amrnbincludedir)" || list=; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amrnbincludedir)'"; \
+         $(INSTALL_HEADER) $$files "$(DESTDIR)$(amrnbincludedir)" || exit $$?; \
+       done
+
+uninstall-amrnbincludeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(amrnbinclude_HEADERS)'; test -n "$(amrnbincludedir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(amrnbincludedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       set x; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(amrnbincludedir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       if test -z '$(STRIP)'; then \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+             install; \
+       else \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+       fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+       mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-amrnbincludeHEADERS install-pkgconfigDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amrnbincludeHEADERS uninstall-libLTLIBRARIES \
+       uninstall-pkgconfigDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+       clean-libLTLIBRARIES clean-libtool ctags distclean \
+       distclean-compile distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-amrnbincludeHEADERS install-data \
+       install-data-am install-dvi install-dvi-am install-exec \
+       install-exec-am install-html install-html-am install-info \
+       install-info-am install-libLTLIBRARIES install-man install-pdf \
+       install-pdf-am install-pkgconfigDATA install-ps install-ps-am \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am tags uninstall uninstall-am \
+       uninstall-amrnbincludeHEADERS uninstall-libLTLIBRARIES \
+       uninstall-pkgconfigDATA
+
+@COMPILE_AS_C_TRUE@    # Mention a dummy pure C file to trigger generation of the $(LINK) variable
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/amrnb/interf_dec.h b/amrnb/interf_dec.h
new file mode 100644 (file)
index 0000000..98051f4
--- /dev/null
@@ -0,0 +1,34 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OPENCORE_AMRNB_INTERF_DEC_H
+#define OPENCORE_AMRNB_INTERF_DEC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* Decoder_Interface_init(void);
+void Decoder_Interface_exit(void* state);
+void Decoder_Interface_Decode(void* state, const unsigned char* in, short* out, int bfi);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/amrnb/interf_enc.h b/amrnb/interf_enc.h
new file mode 100644 (file)
index 0000000..b89b0c7
--- /dev/null
@@ -0,0 +1,50 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OPENCORE_AMRNB_INTERF_ENC_H
+#define OPENCORE_AMRNB_INTERF_ENC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef AMRNB_WRAPPER_INTERNAL
+/* Copied from enc/src/gsmamr_enc.h */
+enum Mode {
+       MR475 = 0,/* 4.75 kbps */
+       MR515,    /* 5.15 kbps */
+       MR59,     /* 5.90 kbps */
+       MR67,     /* 6.70 kbps */
+       MR74,     /* 7.40 kbps */
+       MR795,    /* 7.95 kbps */
+       MR102,    /* 10.2 kbps */
+       MR122,    /* 12.2 kbps */
+       MRDTX,    /* DTX       */
+       N_MODES   /* Not Used  */
+};
+#endif
+
+void* Encoder_Interface_init(int dtx);
+void Encoder_Interface_exit(void* state);
+int Encoder_Interface_Encode(void* state, enum Mode mode, const short* speech, unsigned char* out, int forceSpeech);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/amrnb/opencore-amrnb.pc.in b/amrnb/opencore-amrnb.pc.in
new file mode 100644 (file)
index 0000000..b838c0d
--- /dev/null
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/opencore-amrnb
+
+Name: OpenCORE AMR-NB
+Description: Adaptive Multi-Rate speech codec library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lopencore-amrnb
+Cflags: -I${includedir}
diff --git a/amrnb/opencore-amrnb.sym b/amrnb/opencore-amrnb.sym
new file mode 100644 (file)
index 0000000..25bc1c7
--- /dev/null
@@ -0,0 +1,6 @@
+Decoder_Interface_init
+Decoder_Interface_exit
+Decoder_Interface_Decode
+Encoder_Interface_init
+Encoder_Interface_exit
+Encoder_Interface_Encode
diff --git a/amrnb/wrapper.cpp b/amrnb/wrapper.cpp
new file mode 100644 (file)
index 0000000..633f251
--- /dev/null
@@ -0,0 +1,71 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#define AMRNB_WRAPPER_INTERNAL
+#include <sp_dec.h>
+#include <amrdecode.h>
+#include <amrencode.h>
+#include "interf_dec.h"
+#include "interf_enc.h"
+#include <stdlib.h>
+
+#ifndef DISABLE_AMRNB_DECODER
+void* Decoder_Interface_init(void) {
+       void* ptr = NULL;
+       GSMInitDecode(&ptr, (int8*)"Decoder");
+       return ptr;
+}
+
+void Decoder_Interface_exit(void* state) {
+       GSMDecodeFrameExit(&state);
+}
+
+void Decoder_Interface_Decode(void* state, const unsigned char* in, short* out, int bfi) {
+       unsigned char type = (in[0] >> 3) & 0x0f;
+       in++;
+       AMRDecode(state, (enum Frame_Type_3GPP) type, (UWord8*) in, out, MIME_IETF);
+}
+#endif
+
+#ifndef DISABLE_AMRNB_ENCODER
+struct encoder_state {
+       void* encCtx;
+       void* pidSyncCtx;
+};
+
+void* Encoder_Interface_init(int dtx) {
+       struct encoder_state* state = (struct encoder_state*) malloc(sizeof(struct encoder_state));
+       AMREncodeInit(&state->encCtx, &state->pidSyncCtx, dtx);
+       return state;
+}
+
+void Encoder_Interface_exit(void* s) {
+       struct encoder_state* state = (struct encoder_state*) s;
+       AMREncodeExit(&state->encCtx, &state->pidSyncCtx);
+       free(state);
+}
+
+int Encoder_Interface_Encode(void* s, enum Mode mode, const short* speech, unsigned char* out, int forceSpeech) {
+       struct encoder_state* state = (struct encoder_state*) s;
+       enum Frame_Type_3GPP frame_type = (enum Frame_Type_3GPP) mode;
+       int ret = AMREncode(state->encCtx, state->pidSyncCtx, mode, (Word16*) speech, out, &frame_type, AMR_TX_IETF);
+       out[0] |= 0x04;
+       return ret;
+}
+#endif
+
diff --git a/amrwb/Makefile.am b/amrwb/Makefile.am
new file mode 100644 (file)
index 0000000..a6cc33c
--- /dev/null
@@ -0,0 +1,82 @@
+# Just set OC_BASE to the opencore root, or set AMR_BASE directly to
+# a detached gsm_amr directory
+OC_BASE = $(top_srcdir)/opencore
+AMR_BASE = $(OC_BASE)/codecs_v2/audio/gsm_amr
+
+DEC_DIR = $(AMR_BASE)/amr_wb/dec
+DEC_SRC_DIR = $(DEC_DIR)/src
+OSCL = $(top_srcdir)/oscl
+
+AM_CFLAGS = -I$(OSCL) -I$(DEC_SRC_DIR) -I$(DEC_DIR)/include \
+    -I$(AMR_BASE)/common/dec/include
+
+if GCC_ARMV5
+    AM_CFLAGS += -DPV_CPU_ARCH_VERSION=5 -DPV_COMPILER=1
+endif
+
+if COMPILE_AS_C
+    AM_CFLAGS += -x c -std=c99
+    libopencore_amrwb_la_LINK = $(LINK) $(libopencore_amrwb_la_LDFLAGS)
+    # Mention a dummy pure C file to trigger generation of the $(LINK) variable
+    nodist_EXTRA_libopencore_amrwb_la_SOURCES = dummy.c
+else
+    libopencore_amrwb_la_LINK = $(CXXLINK) $(libopencore_amrwb_la_LDFLAGS)
+endif
+
+AM_CXXFLAGS = $(AM_CFLAGS)
+
+amrwbincludedir = $(includedir)/opencore-amrwb
+amrwbinclude_HEADERS = dec_if.h if_rom.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = opencore-amrwb.pc
+
+lib_LTLIBRARIES = libopencore-amrwb.la
+
+libopencore_amrwb_la_LDFLAGS = -version-info @OPENCORE_AMRWB_VERSION@ -no-undefined -export-symbols $(top_srcdir)/amrwb/opencore-amrwb.sym
+EXTRA_DIST = $(top_srcdir)/amrwb/opencore-amrwb.sym
+
+# Our sources to include. There are certain sources we exclude and they are
+# $(DEC_SRC_DIR)/decoder_amr_wb.cpp
+libopencore_amrwb_la_SOURCES = \
+    wrapper.cpp \
+    $(DEC_SRC_DIR)/agc2_amr_wb.cpp \
+        $(DEC_SRC_DIR)/band_pass_6k_7k.cpp \
+        $(DEC_SRC_DIR)/dec_acelp_2p_in_64.cpp \
+        $(DEC_SRC_DIR)/dec_acelp_4p_in_64.cpp \
+        $(DEC_SRC_DIR)/dec_alg_codebook.cpp \
+        $(DEC_SRC_DIR)/dec_gain2_amr_wb.cpp \
+        $(DEC_SRC_DIR)/deemphasis_32.cpp \
+        $(DEC_SRC_DIR)/dtx_decoder_amr_wb.cpp \
+        $(DEC_SRC_DIR)/get_amr_wb_bits.cpp \
+        $(DEC_SRC_DIR)/highpass_400hz_at_12k8.cpp \
+        $(DEC_SRC_DIR)/highpass_50hz_at_12k8.cpp \
+        $(DEC_SRC_DIR)/homing_amr_wb_dec.cpp \
+        $(DEC_SRC_DIR)/interpolate_isp.cpp \
+        $(DEC_SRC_DIR)/isf_extrapolation.cpp \
+        $(DEC_SRC_DIR)/isp_az.cpp \
+        $(DEC_SRC_DIR)/isp_isf.cpp \
+        $(DEC_SRC_DIR)/lagconceal.cpp \
+        $(DEC_SRC_DIR)/low_pass_filt_7k.cpp \
+        $(DEC_SRC_DIR)/median5.cpp \
+        $(DEC_SRC_DIR)/mime_io.cpp \
+        $(DEC_SRC_DIR)/noise_gen_amrwb.cpp \
+        $(DEC_SRC_DIR)/normalize_amr_wb.cpp \
+        $(DEC_SRC_DIR)/oversamp_12k8_to_16k.cpp \
+        $(DEC_SRC_DIR)/phase_dispersion.cpp \
+        $(DEC_SRC_DIR)/pit_shrp.cpp \
+        $(DEC_SRC_DIR)/pred_lt4.cpp \
+        $(DEC_SRC_DIR)/preemph_amrwb_dec.cpp \
+        $(DEC_SRC_DIR)/pvamrwbdecoder.cpp \
+        $(DEC_SRC_DIR)/pvamrwb_math_op.cpp \
+        $(DEC_SRC_DIR)/q_gain2_tab.cpp \
+        $(DEC_SRC_DIR)/qisf_ns.cpp \
+        $(DEC_SRC_DIR)/qisf_ns_tab.cpp \
+        $(DEC_SRC_DIR)/qpisf_2s.cpp \
+        $(DEC_SRC_DIR)/qpisf_2s_tab.cpp \
+        $(DEC_SRC_DIR)/scale_signal.cpp \
+        $(DEC_SRC_DIR)/synthesis_amr_wb.cpp \
+        $(DEC_SRC_DIR)/voice_factor.cpp \
+        $(DEC_SRC_DIR)/wb_syn_filt.cpp \
+        $(DEC_SRC_DIR)/weight_amrwb_lpc.cpp
+
diff --git a/amrwb/Makefile.in b/amrwb/Makefile.in
new file mode 100644 (file)
index 0000000..00482b7
--- /dev/null
@@ -0,0 +1,1032 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@GCC_ARMV5_TRUE@am__append_1 = -DPV_CPU_ARCH_VERSION=5 -DPV_COMPILER=1
+@COMPILE_AS_C_TRUE@am__append_2 = -x c -std=c99
+subdir = amrwb
+DIST_COMMON = $(amrwbinclude_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(srcdir)/opencore-amrwb.pc.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = opencore-amrwb.pc
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \
+       "$(DESTDIR)$(amrwbincludedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libopencore_amrwb_la_LIBADD =
+am_libopencore_amrwb_la_OBJECTS = wrapper.lo agc2_amr_wb.lo \
+       band_pass_6k_7k.lo dec_acelp_2p_in_64.lo dec_acelp_4p_in_64.lo \
+       dec_alg_codebook.lo dec_gain2_amr_wb.lo deemphasis_32.lo \
+       dtx_decoder_amr_wb.lo get_amr_wb_bits.lo \
+       highpass_400hz_at_12k8.lo highpass_50hz_at_12k8.lo \
+       homing_amr_wb_dec.lo interpolate_isp.lo isf_extrapolation.lo \
+       isp_az.lo isp_isf.lo lagconceal.lo low_pass_filt_7k.lo \
+       median5.lo mime_io.lo noise_gen_amrwb.lo normalize_amr_wb.lo \
+       oversamp_12k8_to_16k.lo phase_dispersion.lo pit_shrp.lo \
+       pred_lt4.lo preemph_amrwb_dec.lo pvamrwbdecoder.lo \
+       pvamrwb_math_op.lo q_gain2_tab.lo qisf_ns.lo qisf_ns_tab.lo \
+       qpisf_2s.lo qpisf_2s_tab.lo scale_signal.lo \
+       synthesis_amr_wb.lo voice_factor.lo wb_syn_filt.lo \
+       weight_amrwb_lpc.lo
+libopencore_amrwb_la_OBJECTS = $(am_libopencore_amrwb_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC    " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD  " $@;
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX   " $@;
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+       $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN   " $@;
+SOURCES = $(libopencore_amrwb_la_SOURCES) \
+       $(nodist_EXTRA_libopencore_amrwb_la_SOURCES)
+DIST_SOURCES = $(libopencore_amrwb_la_SOURCES)
+DATA = $(pkgconfig_DATA)
+HEADERS = $(amrwbinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENCORE_AMRNB_VERSION = @OPENCORE_AMRNB_VERSION@
+OPENCORE_AMRWB_VERSION = @OPENCORE_AMRWB_VERSION@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Just set OC_BASE to the opencore root, or set AMR_BASE directly to
+# a detached gsm_amr directory
+OC_BASE = $(top_srcdir)/opencore
+AMR_BASE = $(OC_BASE)/codecs_v2/audio/gsm_amr
+DEC_DIR = $(AMR_BASE)/amr_wb/dec
+DEC_SRC_DIR = $(DEC_DIR)/src
+OSCL = $(top_srcdir)/oscl
+AM_CFLAGS = -I$(OSCL) -I$(DEC_SRC_DIR) -I$(DEC_DIR)/include \
+       -I$(AMR_BASE)/common/dec/include $(am__append_1) \
+       $(am__append_2)
+@COMPILE_AS_C_FALSE@libopencore_amrwb_la_LINK = $(CXXLINK) $(libopencore_amrwb_la_LDFLAGS)
+@COMPILE_AS_C_TRUE@libopencore_amrwb_la_LINK = $(LINK) $(libopencore_amrwb_la_LDFLAGS)
+@COMPILE_AS_C_TRUE@nodist_EXTRA_libopencore_amrwb_la_SOURCES = dummy.c
+AM_CXXFLAGS = $(AM_CFLAGS)
+amrwbincludedir = $(includedir)/opencore-amrwb
+amrwbinclude_HEADERS = dec_if.h if_rom.h
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = opencore-amrwb.pc
+lib_LTLIBRARIES = libopencore-amrwb.la
+libopencore_amrwb_la_LDFLAGS = -version-info @OPENCORE_AMRWB_VERSION@ -no-undefined -export-symbols $(top_srcdir)/amrwb/opencore-amrwb.sym
+EXTRA_DIST = $(top_srcdir)/amrwb/opencore-amrwb.sym
+
+# Our sources to include. There are certain sources we exclude and they are
+# $(DEC_SRC_DIR)/decoder_amr_wb.cpp
+libopencore_amrwb_la_SOURCES = \
+    wrapper.cpp \
+    $(DEC_SRC_DIR)/agc2_amr_wb.cpp \
+        $(DEC_SRC_DIR)/band_pass_6k_7k.cpp \
+        $(DEC_SRC_DIR)/dec_acelp_2p_in_64.cpp \
+        $(DEC_SRC_DIR)/dec_acelp_4p_in_64.cpp \
+        $(DEC_SRC_DIR)/dec_alg_codebook.cpp \
+        $(DEC_SRC_DIR)/dec_gain2_amr_wb.cpp \
+        $(DEC_SRC_DIR)/deemphasis_32.cpp \
+        $(DEC_SRC_DIR)/dtx_decoder_amr_wb.cpp \
+        $(DEC_SRC_DIR)/get_amr_wb_bits.cpp \
+        $(DEC_SRC_DIR)/highpass_400hz_at_12k8.cpp \
+        $(DEC_SRC_DIR)/highpass_50hz_at_12k8.cpp \
+        $(DEC_SRC_DIR)/homing_amr_wb_dec.cpp \
+        $(DEC_SRC_DIR)/interpolate_isp.cpp \
+        $(DEC_SRC_DIR)/isf_extrapolation.cpp \
+        $(DEC_SRC_DIR)/isp_az.cpp \
+        $(DEC_SRC_DIR)/isp_isf.cpp \
+        $(DEC_SRC_DIR)/lagconceal.cpp \
+        $(DEC_SRC_DIR)/low_pass_filt_7k.cpp \
+        $(DEC_SRC_DIR)/median5.cpp \
+        $(DEC_SRC_DIR)/mime_io.cpp \
+        $(DEC_SRC_DIR)/noise_gen_amrwb.cpp \
+        $(DEC_SRC_DIR)/normalize_amr_wb.cpp \
+        $(DEC_SRC_DIR)/oversamp_12k8_to_16k.cpp \
+        $(DEC_SRC_DIR)/phase_dispersion.cpp \
+        $(DEC_SRC_DIR)/pit_shrp.cpp \
+        $(DEC_SRC_DIR)/pred_lt4.cpp \
+        $(DEC_SRC_DIR)/preemph_amrwb_dec.cpp \
+        $(DEC_SRC_DIR)/pvamrwbdecoder.cpp \
+        $(DEC_SRC_DIR)/pvamrwb_math_op.cpp \
+        $(DEC_SRC_DIR)/q_gain2_tab.cpp \
+        $(DEC_SRC_DIR)/qisf_ns.cpp \
+        $(DEC_SRC_DIR)/qisf_ns_tab.cpp \
+        $(DEC_SRC_DIR)/qpisf_2s.cpp \
+        $(DEC_SRC_DIR)/qpisf_2s_tab.cpp \
+        $(DEC_SRC_DIR)/scale_signal.cpp \
+        $(DEC_SRC_DIR)/synthesis_amr_wb.cpp \
+        $(DEC_SRC_DIR)/voice_factor.cpp \
+        $(DEC_SRC_DIR)/wb_syn_filt.cpp \
+        $(DEC_SRC_DIR)/weight_amrwb_lpc.cpp
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cpp .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu amrwb/Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --gnu amrwb/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+opencore-amrwb.pc: $(top_builddir)/config.status $(srcdir)/opencore-amrwb.pc.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       list2=; for p in $$list; do \
+         if test -f $$p; then \
+           list2="$$list2 $$p"; \
+         else :; fi; \
+       done; \
+       test -z "$$list2" || { \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+       }
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       for p in $$list; do \
+         $(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libopencore-amrwb.la: $(libopencore_amrwb_la_OBJECTS) $(libopencore_amrwb_la_DEPENDENCIES) $(EXTRA_libopencore_amrwb_la_DEPENDENCIES) 
+       $(AM_V_GEN)$(libopencore_amrwb_la_LINK) -rpath $(libdir) $(libopencore_amrwb_la_OBJECTS) $(libopencore_amrwb_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agc2_amr_wb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/band_pass_6k_7k.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dec_acelp_2p_in_64.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dec_acelp_4p_in_64.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dec_alg_codebook.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dec_gain2_amr_wb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deemphasis_32.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtx_decoder_amr_wb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_amr_wb_bits.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/highpass_400hz_at_12k8.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/highpass_50hz_at_12k8.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/homing_amr_wb_dec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpolate_isp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isf_extrapolation.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isp_az.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isp_isf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lagconceal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/low_pass_filt_7k.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/median5.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mime_io.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/noise_gen_amrwb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/normalize_amr_wb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oversamp_12k8_to_16k.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/phase_dispersion.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pit_shrp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pred_lt4.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preemph_amrwb_dec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvamrwb_math_op.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvamrwbdecoder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q_gain2_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qisf_ns.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qisf_ns_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qpisf_2s.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qpisf_2s_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scale_signal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/synthesis_amr_wb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/voice_factor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wb_syn_filt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/weight_amrwb_lpc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrapper.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+.cpp.o:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+
+agc2_amr_wb.lo: $(DEC_SRC_DIR)/agc2_amr_wb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT agc2_amr_wb.lo -MD -MP -MF $(DEPDIR)/agc2_amr_wb.Tpo -c -o agc2_amr_wb.lo `test -f '$(DEC_SRC_DIR)/agc2_amr_wb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/agc2_amr_wb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/agc2_amr_wb.Tpo $(DEPDIR)/agc2_amr_wb.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/agc2_amr_wb.cpp' object='agc2_amr_wb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o agc2_amr_wb.lo `test -f '$(DEC_SRC_DIR)/agc2_amr_wb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/agc2_amr_wb.cpp
+
+band_pass_6k_7k.lo: $(DEC_SRC_DIR)/band_pass_6k_7k.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT band_pass_6k_7k.lo -MD -MP -MF $(DEPDIR)/band_pass_6k_7k.Tpo -c -o band_pass_6k_7k.lo `test -f '$(DEC_SRC_DIR)/band_pass_6k_7k.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/band_pass_6k_7k.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/band_pass_6k_7k.Tpo $(DEPDIR)/band_pass_6k_7k.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/band_pass_6k_7k.cpp' object='band_pass_6k_7k.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o band_pass_6k_7k.lo `test -f '$(DEC_SRC_DIR)/band_pass_6k_7k.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/band_pass_6k_7k.cpp
+
+dec_acelp_2p_in_64.lo: $(DEC_SRC_DIR)/dec_acelp_2p_in_64.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dec_acelp_2p_in_64.lo -MD -MP -MF $(DEPDIR)/dec_acelp_2p_in_64.Tpo -c -o dec_acelp_2p_in_64.lo `test -f '$(DEC_SRC_DIR)/dec_acelp_2p_in_64.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_acelp_2p_in_64.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dec_acelp_2p_in_64.Tpo $(DEPDIR)/dec_acelp_2p_in_64.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dec_acelp_2p_in_64.cpp' object='dec_acelp_2p_in_64.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dec_acelp_2p_in_64.lo `test -f '$(DEC_SRC_DIR)/dec_acelp_2p_in_64.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_acelp_2p_in_64.cpp
+
+dec_acelp_4p_in_64.lo: $(DEC_SRC_DIR)/dec_acelp_4p_in_64.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dec_acelp_4p_in_64.lo -MD -MP -MF $(DEPDIR)/dec_acelp_4p_in_64.Tpo -c -o dec_acelp_4p_in_64.lo `test -f '$(DEC_SRC_DIR)/dec_acelp_4p_in_64.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_acelp_4p_in_64.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dec_acelp_4p_in_64.Tpo $(DEPDIR)/dec_acelp_4p_in_64.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dec_acelp_4p_in_64.cpp' object='dec_acelp_4p_in_64.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dec_acelp_4p_in_64.lo `test -f '$(DEC_SRC_DIR)/dec_acelp_4p_in_64.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_acelp_4p_in_64.cpp
+
+dec_alg_codebook.lo: $(DEC_SRC_DIR)/dec_alg_codebook.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dec_alg_codebook.lo -MD -MP -MF $(DEPDIR)/dec_alg_codebook.Tpo -c -o dec_alg_codebook.lo `test -f '$(DEC_SRC_DIR)/dec_alg_codebook.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_alg_codebook.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dec_alg_codebook.Tpo $(DEPDIR)/dec_alg_codebook.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dec_alg_codebook.cpp' object='dec_alg_codebook.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dec_alg_codebook.lo `test -f '$(DEC_SRC_DIR)/dec_alg_codebook.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_alg_codebook.cpp
+
+dec_gain2_amr_wb.lo: $(DEC_SRC_DIR)/dec_gain2_amr_wb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dec_gain2_amr_wb.lo -MD -MP -MF $(DEPDIR)/dec_gain2_amr_wb.Tpo -c -o dec_gain2_amr_wb.lo `test -f '$(DEC_SRC_DIR)/dec_gain2_amr_wb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_gain2_amr_wb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dec_gain2_amr_wb.Tpo $(DEPDIR)/dec_gain2_amr_wb.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dec_gain2_amr_wb.cpp' object='dec_gain2_amr_wb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dec_gain2_amr_wb.lo `test -f '$(DEC_SRC_DIR)/dec_gain2_amr_wb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dec_gain2_amr_wb.cpp
+
+deemphasis_32.lo: $(DEC_SRC_DIR)/deemphasis_32.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT deemphasis_32.lo -MD -MP -MF $(DEPDIR)/deemphasis_32.Tpo -c -o deemphasis_32.lo `test -f '$(DEC_SRC_DIR)/deemphasis_32.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/deemphasis_32.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/deemphasis_32.Tpo $(DEPDIR)/deemphasis_32.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/deemphasis_32.cpp' object='deemphasis_32.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o deemphasis_32.lo `test -f '$(DEC_SRC_DIR)/deemphasis_32.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/deemphasis_32.cpp
+
+dtx_decoder_amr_wb.lo: $(DEC_SRC_DIR)/dtx_decoder_amr_wb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dtx_decoder_amr_wb.lo -MD -MP -MF $(DEPDIR)/dtx_decoder_amr_wb.Tpo -c -o dtx_decoder_amr_wb.lo `test -f '$(DEC_SRC_DIR)/dtx_decoder_amr_wb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dtx_decoder_amr_wb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/dtx_decoder_amr_wb.Tpo $(DEPDIR)/dtx_decoder_amr_wb.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/dtx_decoder_amr_wb.cpp' object='dtx_decoder_amr_wb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dtx_decoder_amr_wb.lo `test -f '$(DEC_SRC_DIR)/dtx_decoder_amr_wb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/dtx_decoder_amr_wb.cpp
+
+get_amr_wb_bits.lo: $(DEC_SRC_DIR)/get_amr_wb_bits.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT get_amr_wb_bits.lo -MD -MP -MF $(DEPDIR)/get_amr_wb_bits.Tpo -c -o get_amr_wb_bits.lo `test -f '$(DEC_SRC_DIR)/get_amr_wb_bits.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/get_amr_wb_bits.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/get_amr_wb_bits.Tpo $(DEPDIR)/get_amr_wb_bits.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/get_amr_wb_bits.cpp' object='get_amr_wb_bits.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o get_amr_wb_bits.lo `test -f '$(DEC_SRC_DIR)/get_amr_wb_bits.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/get_amr_wb_bits.cpp
+
+highpass_400hz_at_12k8.lo: $(DEC_SRC_DIR)/highpass_400hz_at_12k8.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT highpass_400hz_at_12k8.lo -MD -MP -MF $(DEPDIR)/highpass_400hz_at_12k8.Tpo -c -o highpass_400hz_at_12k8.lo `test -f '$(DEC_SRC_DIR)/highpass_400hz_at_12k8.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/highpass_400hz_at_12k8.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/highpass_400hz_at_12k8.Tpo $(DEPDIR)/highpass_400hz_at_12k8.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/highpass_400hz_at_12k8.cpp' object='highpass_400hz_at_12k8.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o highpass_400hz_at_12k8.lo `test -f '$(DEC_SRC_DIR)/highpass_400hz_at_12k8.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/highpass_400hz_at_12k8.cpp
+
+highpass_50hz_at_12k8.lo: $(DEC_SRC_DIR)/highpass_50hz_at_12k8.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT highpass_50hz_at_12k8.lo -MD -MP -MF $(DEPDIR)/highpass_50hz_at_12k8.Tpo -c -o highpass_50hz_at_12k8.lo `test -f '$(DEC_SRC_DIR)/highpass_50hz_at_12k8.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/highpass_50hz_at_12k8.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/highpass_50hz_at_12k8.Tpo $(DEPDIR)/highpass_50hz_at_12k8.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/highpass_50hz_at_12k8.cpp' object='highpass_50hz_at_12k8.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o highpass_50hz_at_12k8.lo `test -f '$(DEC_SRC_DIR)/highpass_50hz_at_12k8.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/highpass_50hz_at_12k8.cpp
+
+homing_amr_wb_dec.lo: $(DEC_SRC_DIR)/homing_amr_wb_dec.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT homing_amr_wb_dec.lo -MD -MP -MF $(DEPDIR)/homing_amr_wb_dec.Tpo -c -o homing_amr_wb_dec.lo `test -f '$(DEC_SRC_DIR)/homing_amr_wb_dec.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/homing_amr_wb_dec.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/homing_amr_wb_dec.Tpo $(DEPDIR)/homing_amr_wb_dec.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/homing_amr_wb_dec.cpp' object='homing_amr_wb_dec.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o homing_amr_wb_dec.lo `test -f '$(DEC_SRC_DIR)/homing_amr_wb_dec.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/homing_amr_wb_dec.cpp
+
+interpolate_isp.lo: $(DEC_SRC_DIR)/interpolate_isp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT interpolate_isp.lo -MD -MP -MF $(DEPDIR)/interpolate_isp.Tpo -c -o interpolate_isp.lo `test -f '$(DEC_SRC_DIR)/interpolate_isp.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/interpolate_isp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/interpolate_isp.Tpo $(DEPDIR)/interpolate_isp.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/interpolate_isp.cpp' object='interpolate_isp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o interpolate_isp.lo `test -f '$(DEC_SRC_DIR)/interpolate_isp.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/interpolate_isp.cpp
+
+isf_extrapolation.lo: $(DEC_SRC_DIR)/isf_extrapolation.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT isf_extrapolation.lo -MD -MP -MF $(DEPDIR)/isf_extrapolation.Tpo -c -o isf_extrapolation.lo `test -f '$(DEC_SRC_DIR)/isf_extrapolation.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/isf_extrapolation.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/isf_extrapolation.Tpo $(DEPDIR)/isf_extrapolation.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/isf_extrapolation.cpp' object='isf_extrapolation.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o isf_extrapolation.lo `test -f '$(DEC_SRC_DIR)/isf_extrapolation.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/isf_extrapolation.cpp
+
+isp_az.lo: $(DEC_SRC_DIR)/isp_az.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT isp_az.lo -MD -MP -MF $(DEPDIR)/isp_az.Tpo -c -o isp_az.lo `test -f '$(DEC_SRC_DIR)/isp_az.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/isp_az.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/isp_az.Tpo $(DEPDIR)/isp_az.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/isp_az.cpp' object='isp_az.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o isp_az.lo `test -f '$(DEC_SRC_DIR)/isp_az.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/isp_az.cpp
+
+isp_isf.lo: $(DEC_SRC_DIR)/isp_isf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT isp_isf.lo -MD -MP -MF $(DEPDIR)/isp_isf.Tpo -c -o isp_isf.lo `test -f '$(DEC_SRC_DIR)/isp_isf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/isp_isf.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/isp_isf.Tpo $(DEPDIR)/isp_isf.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/isp_isf.cpp' object='isp_isf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o isp_isf.lo `test -f '$(DEC_SRC_DIR)/isp_isf.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/isp_isf.cpp
+
+lagconceal.lo: $(DEC_SRC_DIR)/lagconceal.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lagconceal.lo -MD -MP -MF $(DEPDIR)/lagconceal.Tpo -c -o lagconceal.lo `test -f '$(DEC_SRC_DIR)/lagconceal.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/lagconceal.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/lagconceal.Tpo $(DEPDIR)/lagconceal.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/lagconceal.cpp' object='lagconceal.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lagconceal.lo `test -f '$(DEC_SRC_DIR)/lagconceal.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/lagconceal.cpp
+
+low_pass_filt_7k.lo: $(DEC_SRC_DIR)/low_pass_filt_7k.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT low_pass_filt_7k.lo -MD -MP -MF $(DEPDIR)/low_pass_filt_7k.Tpo -c -o low_pass_filt_7k.lo `test -f '$(DEC_SRC_DIR)/low_pass_filt_7k.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/low_pass_filt_7k.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/low_pass_filt_7k.Tpo $(DEPDIR)/low_pass_filt_7k.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/low_pass_filt_7k.cpp' object='low_pass_filt_7k.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o low_pass_filt_7k.lo `test -f '$(DEC_SRC_DIR)/low_pass_filt_7k.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/low_pass_filt_7k.cpp
+
+median5.lo: $(DEC_SRC_DIR)/median5.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT median5.lo -MD -MP -MF $(DEPDIR)/median5.Tpo -c -o median5.lo `test -f '$(DEC_SRC_DIR)/median5.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/median5.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/median5.Tpo $(DEPDIR)/median5.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/median5.cpp' object='median5.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o median5.lo `test -f '$(DEC_SRC_DIR)/median5.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/median5.cpp
+
+mime_io.lo: $(DEC_SRC_DIR)/mime_io.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mime_io.lo -MD -MP -MF $(DEPDIR)/mime_io.Tpo -c -o mime_io.lo `test -f '$(DEC_SRC_DIR)/mime_io.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/mime_io.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/mime_io.Tpo $(DEPDIR)/mime_io.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/mime_io.cpp' object='mime_io.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mime_io.lo `test -f '$(DEC_SRC_DIR)/mime_io.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/mime_io.cpp
+
+noise_gen_amrwb.lo: $(DEC_SRC_DIR)/noise_gen_amrwb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT noise_gen_amrwb.lo -MD -MP -MF $(DEPDIR)/noise_gen_amrwb.Tpo -c -o noise_gen_amrwb.lo `test -f '$(DEC_SRC_DIR)/noise_gen_amrwb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/noise_gen_amrwb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/noise_gen_amrwb.Tpo $(DEPDIR)/noise_gen_amrwb.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/noise_gen_amrwb.cpp' object='noise_gen_amrwb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o noise_gen_amrwb.lo `test -f '$(DEC_SRC_DIR)/noise_gen_amrwb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/noise_gen_amrwb.cpp
+
+normalize_amr_wb.lo: $(DEC_SRC_DIR)/normalize_amr_wb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT normalize_amr_wb.lo -MD -MP -MF $(DEPDIR)/normalize_amr_wb.Tpo -c -o normalize_amr_wb.lo `test -f '$(DEC_SRC_DIR)/normalize_amr_wb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/normalize_amr_wb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/normalize_amr_wb.Tpo $(DEPDIR)/normalize_amr_wb.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/normalize_amr_wb.cpp' object='normalize_amr_wb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o normalize_amr_wb.lo `test -f '$(DEC_SRC_DIR)/normalize_amr_wb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/normalize_amr_wb.cpp
+
+oversamp_12k8_to_16k.lo: $(DEC_SRC_DIR)/oversamp_12k8_to_16k.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT oversamp_12k8_to_16k.lo -MD -MP -MF $(DEPDIR)/oversamp_12k8_to_16k.Tpo -c -o oversamp_12k8_to_16k.lo `test -f '$(DEC_SRC_DIR)/oversamp_12k8_to_16k.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/oversamp_12k8_to_16k.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/oversamp_12k8_to_16k.Tpo $(DEPDIR)/oversamp_12k8_to_16k.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/oversamp_12k8_to_16k.cpp' object='oversamp_12k8_to_16k.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o oversamp_12k8_to_16k.lo `test -f '$(DEC_SRC_DIR)/oversamp_12k8_to_16k.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/oversamp_12k8_to_16k.cpp
+
+phase_dispersion.lo: $(DEC_SRC_DIR)/phase_dispersion.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT phase_dispersion.lo -MD -MP -MF $(DEPDIR)/phase_dispersion.Tpo -c -o phase_dispersion.lo `test -f '$(DEC_SRC_DIR)/phase_dispersion.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/phase_dispersion.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/phase_dispersion.Tpo $(DEPDIR)/phase_dispersion.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/phase_dispersion.cpp' object='phase_dispersion.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o phase_dispersion.lo `test -f '$(DEC_SRC_DIR)/phase_dispersion.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/phase_dispersion.cpp
+
+pit_shrp.lo: $(DEC_SRC_DIR)/pit_shrp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pit_shrp.lo -MD -MP -MF $(DEPDIR)/pit_shrp.Tpo -c -o pit_shrp.lo `test -f '$(DEC_SRC_DIR)/pit_shrp.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/pit_shrp.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pit_shrp.Tpo $(DEPDIR)/pit_shrp.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/pit_shrp.cpp' object='pit_shrp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pit_shrp.lo `test -f '$(DEC_SRC_DIR)/pit_shrp.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/pit_shrp.cpp
+
+pred_lt4.lo: $(DEC_SRC_DIR)/pred_lt4.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pred_lt4.lo -MD -MP -MF $(DEPDIR)/pred_lt4.Tpo -c -o pred_lt4.lo `test -f '$(DEC_SRC_DIR)/pred_lt4.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/pred_lt4.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pred_lt4.Tpo $(DEPDIR)/pred_lt4.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/pred_lt4.cpp' object='pred_lt4.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pred_lt4.lo `test -f '$(DEC_SRC_DIR)/pred_lt4.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/pred_lt4.cpp
+
+preemph_amrwb_dec.lo: $(DEC_SRC_DIR)/preemph_amrwb_dec.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT preemph_amrwb_dec.lo -MD -MP -MF $(DEPDIR)/preemph_amrwb_dec.Tpo -c -o preemph_amrwb_dec.lo `test -f '$(DEC_SRC_DIR)/preemph_amrwb_dec.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/preemph_amrwb_dec.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/preemph_amrwb_dec.Tpo $(DEPDIR)/preemph_amrwb_dec.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/preemph_amrwb_dec.cpp' object='preemph_amrwb_dec.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o preemph_amrwb_dec.lo `test -f '$(DEC_SRC_DIR)/preemph_amrwb_dec.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/preemph_amrwb_dec.cpp
+
+pvamrwbdecoder.lo: $(DEC_SRC_DIR)/pvamrwbdecoder.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pvamrwbdecoder.lo -MD -MP -MF $(DEPDIR)/pvamrwbdecoder.Tpo -c -o pvamrwbdecoder.lo `test -f '$(DEC_SRC_DIR)/pvamrwbdecoder.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/pvamrwbdecoder.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pvamrwbdecoder.Tpo $(DEPDIR)/pvamrwbdecoder.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/pvamrwbdecoder.cpp' object='pvamrwbdecoder.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pvamrwbdecoder.lo `test -f '$(DEC_SRC_DIR)/pvamrwbdecoder.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/pvamrwbdecoder.cpp
+
+pvamrwb_math_op.lo: $(DEC_SRC_DIR)/pvamrwb_math_op.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pvamrwb_math_op.lo -MD -MP -MF $(DEPDIR)/pvamrwb_math_op.Tpo -c -o pvamrwb_math_op.lo `test -f '$(DEC_SRC_DIR)/pvamrwb_math_op.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/pvamrwb_math_op.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/pvamrwb_math_op.Tpo $(DEPDIR)/pvamrwb_math_op.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/pvamrwb_math_op.cpp' object='pvamrwb_math_op.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pvamrwb_math_op.lo `test -f '$(DEC_SRC_DIR)/pvamrwb_math_op.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/pvamrwb_math_op.cpp
+
+q_gain2_tab.lo: $(DEC_SRC_DIR)/q_gain2_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT q_gain2_tab.lo -MD -MP -MF $(DEPDIR)/q_gain2_tab.Tpo -c -o q_gain2_tab.lo `test -f '$(DEC_SRC_DIR)/q_gain2_tab.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/q_gain2_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/q_gain2_tab.Tpo $(DEPDIR)/q_gain2_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/q_gain2_tab.cpp' object='q_gain2_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o q_gain2_tab.lo `test -f '$(DEC_SRC_DIR)/q_gain2_tab.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/q_gain2_tab.cpp
+
+qisf_ns.lo: $(DEC_SRC_DIR)/qisf_ns.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT qisf_ns.lo -MD -MP -MF $(DEPDIR)/qisf_ns.Tpo -c -o qisf_ns.lo `test -f '$(DEC_SRC_DIR)/qisf_ns.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/qisf_ns.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/qisf_ns.Tpo $(DEPDIR)/qisf_ns.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/qisf_ns.cpp' object='qisf_ns.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o qisf_ns.lo `test -f '$(DEC_SRC_DIR)/qisf_ns.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/qisf_ns.cpp
+
+qisf_ns_tab.lo: $(DEC_SRC_DIR)/qisf_ns_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT qisf_ns_tab.lo -MD -MP -MF $(DEPDIR)/qisf_ns_tab.Tpo -c -o qisf_ns_tab.lo `test -f '$(DEC_SRC_DIR)/qisf_ns_tab.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/qisf_ns_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/qisf_ns_tab.Tpo $(DEPDIR)/qisf_ns_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/qisf_ns_tab.cpp' object='qisf_ns_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o qisf_ns_tab.lo `test -f '$(DEC_SRC_DIR)/qisf_ns_tab.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/qisf_ns_tab.cpp
+
+qpisf_2s.lo: $(DEC_SRC_DIR)/qpisf_2s.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT qpisf_2s.lo -MD -MP -MF $(DEPDIR)/qpisf_2s.Tpo -c -o qpisf_2s.lo `test -f '$(DEC_SRC_DIR)/qpisf_2s.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/qpisf_2s.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/qpisf_2s.Tpo $(DEPDIR)/qpisf_2s.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/qpisf_2s.cpp' object='qpisf_2s.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o qpisf_2s.lo `test -f '$(DEC_SRC_DIR)/qpisf_2s.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/qpisf_2s.cpp
+
+qpisf_2s_tab.lo: $(DEC_SRC_DIR)/qpisf_2s_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT qpisf_2s_tab.lo -MD -MP -MF $(DEPDIR)/qpisf_2s_tab.Tpo -c -o qpisf_2s_tab.lo `test -f '$(DEC_SRC_DIR)/qpisf_2s_tab.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/qpisf_2s_tab.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/qpisf_2s_tab.Tpo $(DEPDIR)/qpisf_2s_tab.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/qpisf_2s_tab.cpp' object='qpisf_2s_tab.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o qpisf_2s_tab.lo `test -f '$(DEC_SRC_DIR)/qpisf_2s_tab.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/qpisf_2s_tab.cpp
+
+scale_signal.lo: $(DEC_SRC_DIR)/scale_signal.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scale_signal.lo -MD -MP -MF $(DEPDIR)/scale_signal.Tpo -c -o scale_signal.lo `test -f '$(DEC_SRC_DIR)/scale_signal.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/scale_signal.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/scale_signal.Tpo $(DEPDIR)/scale_signal.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/scale_signal.cpp' object='scale_signal.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scale_signal.lo `test -f '$(DEC_SRC_DIR)/scale_signal.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/scale_signal.cpp
+
+synthesis_amr_wb.lo: $(DEC_SRC_DIR)/synthesis_amr_wb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT synthesis_amr_wb.lo -MD -MP -MF $(DEPDIR)/synthesis_amr_wb.Tpo -c -o synthesis_amr_wb.lo `test -f '$(DEC_SRC_DIR)/synthesis_amr_wb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/synthesis_amr_wb.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/synthesis_amr_wb.Tpo $(DEPDIR)/synthesis_amr_wb.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/synthesis_amr_wb.cpp' object='synthesis_amr_wb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o synthesis_amr_wb.lo `test -f '$(DEC_SRC_DIR)/synthesis_amr_wb.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/synthesis_amr_wb.cpp
+
+voice_factor.lo: $(DEC_SRC_DIR)/voice_factor.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT voice_factor.lo -MD -MP -MF $(DEPDIR)/voice_factor.Tpo -c -o voice_factor.lo `test -f '$(DEC_SRC_DIR)/voice_factor.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/voice_factor.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/voice_factor.Tpo $(DEPDIR)/voice_factor.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/voice_factor.cpp' object='voice_factor.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o voice_factor.lo `test -f '$(DEC_SRC_DIR)/voice_factor.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/voice_factor.cpp
+
+wb_syn_filt.lo: $(DEC_SRC_DIR)/wb_syn_filt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT wb_syn_filt.lo -MD -MP -MF $(DEPDIR)/wb_syn_filt.Tpo -c -o wb_syn_filt.lo `test -f '$(DEC_SRC_DIR)/wb_syn_filt.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/wb_syn_filt.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/wb_syn_filt.Tpo $(DEPDIR)/wb_syn_filt.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/wb_syn_filt.cpp' object='wb_syn_filt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o wb_syn_filt.lo `test -f '$(DEC_SRC_DIR)/wb_syn_filt.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/wb_syn_filt.cpp
+
+weight_amrwb_lpc.lo: $(DEC_SRC_DIR)/weight_amrwb_lpc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT weight_amrwb_lpc.lo -MD -MP -MF $(DEPDIR)/weight_amrwb_lpc.Tpo -c -o weight_amrwb_lpc.lo `test -f '$(DEC_SRC_DIR)/weight_amrwb_lpc.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/weight_amrwb_lpc.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/weight_amrwb_lpc.Tpo $(DEPDIR)/weight_amrwb_lpc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='$(DEC_SRC_DIR)/weight_amrwb_lpc.cpp' object='weight_amrwb_lpc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o weight_amrwb_lpc.lo `test -f '$(DEC_SRC_DIR)/weight_amrwb_lpc.cpp' || echo '$(srcdir)/'`$(DEC_SRC_DIR)/weight_amrwb_lpc.cpp
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+install-pkgconfigDATA: $(pkgconfig_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
+       @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
+       done
+
+uninstall-pkgconfigDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
+install-amrwbincludeHEADERS: $(amrwbinclude_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(amrwbincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amrwbincludedir)"
+       @list='$(amrwbinclude_HEADERS)'; test -n "$(amrwbincludedir)" || list=; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amrwbincludedir)'"; \
+         $(INSTALL_HEADER) $$files "$(DESTDIR)$(amrwbincludedir)" || exit $$?; \
+       done
+
+uninstall-amrwbincludeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(amrwbinclude_HEADERS)'; test -n "$(amrwbincludedir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(amrwbincludedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       set x; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(amrwbincludedir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       if test -z '$(STRIP)'; then \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+             install; \
+       else \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+       fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+       mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-amrwbincludeHEADERS install-pkgconfigDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amrwbincludeHEADERS uninstall-libLTLIBRARIES \
+       uninstall-pkgconfigDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+       clean-libLTLIBRARIES clean-libtool ctags distclean \
+       distclean-compile distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-amrwbincludeHEADERS install-data \
+       install-data-am install-dvi install-dvi-am install-exec \
+       install-exec-am install-html install-html-am install-info \
+       install-info-am install-libLTLIBRARIES install-man install-pdf \
+       install-pdf-am install-pkgconfigDATA install-ps install-ps-am \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am tags uninstall uninstall-am \
+       uninstall-amrwbincludeHEADERS uninstall-libLTLIBRARIES \
+       uninstall-pkgconfigDATA
+
+@COMPILE_AS_C_TRUE@    # Mention a dummy pure C file to trigger generation of the $(LINK) variable
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/amrwb/dec_if.h b/amrwb/dec_if.h
new file mode 100644 (file)
index 0000000..56acdaa
--- /dev/null
@@ -0,0 +1,36 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OPENCORE_AMRWB_DEC_IF_H
+#define OPENCORE_AMRWB_DEC_IF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _good_frame 0
+
+void* D_IF_init(void);
+void D_IF_decode(void* state, const unsigned char* bits, short* synth, int bfi);
+void D_IF_exit(void* state);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/amrwb/if_rom.h b/amrwb/if_rom.h
new file mode 100644 (file)
index 0000000..8977e03
--- /dev/null
@@ -0,0 +1,33 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OPENCORE_AMRWB_IF_ROM_H
+#define OPENCORE_AMRWB_IF_ROM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+typedef int16_t Word16;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/amrwb/opencore-amrwb.pc.in b/amrwb/opencore-amrwb.pc.in
new file mode 100644 (file)
index 0000000..8446310
--- /dev/null
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/opencore-amrwb
+
+Name: OpenCORE AMR-WB
+Description: Adaptive Multi-Rate Wideband speech codec library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lopencore-amrwb
+Cflags: -I${includedir}
diff --git a/amrwb/opencore-amrwb.sym b/amrwb/opencore-amrwb.sym
new file mode 100644 (file)
index 0000000..9a1cfcb
--- /dev/null
@@ -0,0 +1,3 @@
+D_IF_init
+D_IF_decode
+D_IF_exit
diff --git a/amrwb/wrapper.cpp b/amrwb/wrapper.cpp
new file mode 100644 (file)
index 0000000..dd28281
--- /dev/null
@@ -0,0 +1,128 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#include "dec_if.h"
+#include <stdlib.h>
+#include <string.h>
+#include <pvamrwbdecoder_api.h>
+#include <pvamrwbdecoder.h>
+#include <pvamrwbdecoder_cnst.h>
+#include <dtx.h>
+
+/* This is basically a C rewrite of decode_amr_wb.cpp */
+
+struct state {
+       void *st; /*   State structure  */
+       unsigned char *pt_st;
+       int16 *ScratchMem;
+
+       uint8* iInputBuf;
+       int16* iInputSampleBuf;
+       int16* iOutputBuf;
+
+       uint8 quality;
+       int16 mode;
+       int16 mode_old;
+       int16 frame_type;
+
+       int16 reset_flag;
+       int16 reset_flag_old;
+       int16 status;
+       RX_State rx_state;
+};
+
+void* D_IF_init(void) {
+       struct state* state = (struct state*) malloc(sizeof(struct state));
+       memset(state, 0, sizeof(*state));
+
+       state->iInputSampleBuf = (int16*) malloc(sizeof(int16)*KAMRWB_NB_BITS_MAX);
+       state->reset_flag = 0;
+       state->reset_flag_old = 1;
+       state->mode_old = 0;
+       state->rx_state.prev_ft = RX_SPEECH_GOOD;
+       state->rx_state.prev_mode = 0;
+       state->pt_st = (unsigned char*) malloc(pvDecoder_AmrWbMemRequirements());
+
+       pvDecoder_AmrWb_Init(&state->st, state->pt_st, &state->ScratchMem);
+       return state;
+}
+
+void D_IF_exit(void* s) {
+       struct state* state = (struct state*) s;
+       free(state->pt_st);
+       free(state->iInputSampleBuf);
+       free(state);
+}
+
+void D_IF_decode(void* s, const unsigned char* in, short* out, int bfi) {
+       struct state* state = (struct state*) s;
+
+       state->mode = (in[0] >> 3) & 0x0f;
+       in++;
+
+       state->quality = 1; /* ? */
+       mime_unsorting((uint8*) in, state->iInputSampleBuf, &state->frame_type, &state->mode, state->quality, &state->rx_state);
+       
+       if ((state->frame_type == RX_NO_DATA) | (state->frame_type == RX_SPEECH_LOST)) {
+               state->mode = state->mode_old;
+               state->reset_flag = 0;
+       } else {
+               state->mode_old = state->mode;
+
+               /* if homed: check if this frame is another homing frame */
+               if (state->reset_flag_old == 1) {
+                       /* only check until end of first subframe */
+                       state->reset_flag = pvDecoder_AmrWb_homing_frame_test_first(state->iInputSampleBuf, state->mode);
+               }
+       }
+
+       /* produce encoder homing frame if homed & input=decoder homing frame */
+       if ((state->reset_flag != 0) && (state->reset_flag_old != 0)) {
+               /* set homing sequence ( no need to decode anything */
+
+               for (int16 i = 0; i < AMR_WB_PCM_FRAME; i++) {
+                       out[i] = EHF_MASK;
+               }
+       } else {
+               int16 frameLength;
+               state->status = pvDecoder_AmrWb(state->mode,
+                                                  state->iInputSampleBuf,
+                                                  out,
+                                                  &frameLength,
+                                                  state->st,
+                                                  state->frame_type,
+                                                  state->ScratchMem);
+       }
+
+       for (int16 i = 0; i < AMR_WB_PCM_FRAME; i++) {  /* Delete the 2 LSBs (14-bit output) */
+               out[i] &= 0xfffC;
+       }
+
+       /* if not homed: check whether current frame is a homing frame */
+       if (state->reset_flag_old == 0) {
+               /* check whole frame */
+               state->reset_flag = pvDecoder_AmrWb_homing_frame_test(state->iInputSampleBuf, state->mode);
+       }
+       /* reset decoder if current frame is a homing frame */
+       if (state->reset_flag != 0) {
+               pvDecoder_AmrWb_Reset(state->st, 1);
+       }
+       state->reset_flag_old = state->reset_flag;
+
+}
+
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..f6d15bf
--- /dev/null
@@ -0,0 +1,6 @@
+#! /bin/sh
+libtoolize --copy --force
+aclocal -I m4
+autoheader
+autoconf
+automake -a -c
diff --git a/config.guess b/config.guess
new file mode 100755 (executable)
index 0000000..d622a44
--- /dev/null
@@ -0,0 +1,1530 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-02-10'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           sh5el) machine=sh5le-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep -q __ELF__
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit ;;
+    *:OpenBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+       exit ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit ;;
+    *:SolidBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+       exit ;;
+    macppc:MirBSD:*:*)
+       echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    alpha:OSF1:*:*)
+       case $UNAME_RELEASE in
+       *4.0)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
+       # A Pn.n version is a patched version.
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+       exitcode=$?
+       trap '' 0
+       exit $exitcode ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit ;;
+    *:z/VM:*:*)
+       echo s390-ibm-zvmoe
+       exit ;;
+    *:OS400:*:*)
+       echo powerpc-ibm-os400
+       exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+       echo arm-unknown-riscos
+       exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7; exit ;;
+       esac ;;
+    s390x:SunOS:*:*)
+       echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+       echo i386-pc-auroraux${UNAME_RELEASE}
+       exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+       eval $set_cc_for_build
+       SUN_ARCH="i386"
+       # If there is a compiler, see if it is configured for 64-bit objects.
+       # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+       # This test works for both compilers.
+       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+           if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+               grep IS_64BIT_ARCH >/dev/null
+           then
+               SUN_ARCH="x86_64"
+           fi
+       fi
+       echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+       echo m68k-milan-mint${UNAME_RELEASE}
+       exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+       echo m68k-hades-mint${UNAME_RELEASE}
+       exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+       echo m68k-unknown-mint${UNAME_RELEASE}
+       exit ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c &&
+         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+         SYSTEM_NAME=`$dummy $dummyarg` &&
+           { echo "$SYSTEM_NAME"; exit; }
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit ;;
+    AViiON:dgux:*:*)
+       # DG/UX returns AViiON for all architectures
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               then
+                       echo "$SYSTEM_NAME"
+               else
+                       echo rs6000-ibm-aix3.2.5
+               fi
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit ;;
+    *:AIX:*:[4567])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                   sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                   case "${sc_cpu_version}" in
+                     523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                     528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                     532)                      # CPU_PA_RISC2_0
+                       case "${sc_kernel_bits}" in
+                         32) HP_ARCH="hppa2.0n" ;;
+                         64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                       esac ;;
+                   esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^            //' << EOF >$dummy.c
+
+               #define _HPUX_SOURCE
+               #include <stdlib.h>
+               #include <unistd.h>
+
+               int main ()
+               {
+               #if defined(_SC_KERNEL_BITS)
+                   long bits = sysconf(_SC_KERNEL_BITS);
+               #endif
+                   long cpu  = sysconf (_SC_CPU_VERSION);
+
+                   switch (cpu)
+                       {
+                       case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+                       case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+                       case CPU_PA_RISC2_0:
+               #if defined(_SC_KERNEL_BITS)
+                           switch (bits)
+                               {
+                               case 64: puts ("hppa2.0w"); break;
+                               case 32: puts ("hppa2.0n"); break;
+                               default: puts ("hppa2.0"); break;
+                               } break;
+               #else  /* !defined(_SC_KERNEL_BITS) */
+                           puts ("hppa2.0"); break;
+               #endif
+                       default: puts ("hppa1.0"); break;
+                       }
+                   exit (0);
+               }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
+       esac
+       if [ ${HP_ARCH} = "hppa2.0w" ]
+       then
+           eval $set_cc_for_build
+
+           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+           # generating 64-bit code.  GNU and HP use different nomenclature:
+           #
+           # $ CC_FOR_BUILD=cc ./config.guess
+           # => hppa2.0w-hp-hpux11.23
+           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+           # => hppa64-hp-hpux11.23
+
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+               grep -q __LP64__
+           then
+               HP_ARCH="hppa2.0w"
+           else
+               HP_ARCH="hppa64"
+           fi
+       fi
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
+       echo unknown-hitachi-hiuxwe2
+       exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+       exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+       exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+       exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+       exit ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    *:UNICOS/mp:*:*)
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+       echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    5000:UNIX_System_V:4.*:*)
+       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+       echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:FreeBSD:*:*)
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       case ${UNAME_PROCESSOR} in
+           amd64)
+               echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           *)
+               echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+       esac
+       exit ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit ;;
+    *:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit ;;
+    i*:MSYS*:*)
+       echo ${UNAME_MACHINE}-pc-msys
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit ;;
+    *:Interix*:*)
+       case ${UNAME_MACHINE} in
+           x86)
+               echo i586-pc-interix${UNAME_RELEASE}
+               exit ;;
+           authenticamd | genuineintel | EM64T)
+               echo x86_64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+           IA64)
+               echo ia64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+       esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit ;;
+    8664:Windows_NT:*)
+       echo x86_64-pc-mks
+       exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+       echo x86_64-unknown-cygwin
+       exit ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    *:GNU:*:*)
+       # the GNU system
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       exit ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit ;;
+    aarch64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    aarch64_be:Linux:*:*)
+       UNAME_MACHINE=aarch64_be
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+       esac
+       objdump --private-headers /bin/sh | grep -q ld.so.1
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit ;;
+    arm*:Linux:*:*)
+       eval $set_cc_for_build
+       if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+           | grep -q __ARM_EABI__
+       then
+           echo ${UNAME_MACHINE}-unknown-linux-gnu
+       else
+           if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+               | grep -q __ARM_PCS_VFP
+           then
+               echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+           else
+               echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+           fi
+       fi
+       exit ;;
+    avr32*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    cris:Linux:*:*)
+       echo ${UNAME_MACHINE}-axis-linux-gnu
+       exit ;;
+    crisv32:Linux:*:*)
+       echo ${UNAME_MACHINE}-axis-linux-gnu
+       exit ;;
+    frv:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    hexagon:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    i*86:Linux:*:*)
+       LIBC=gnu
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+       echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+       exit ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef ${UNAME_MACHINE}
+       #undef ${UNAME_MACHINE}el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=${UNAME_MACHINE}el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=${UNAME_MACHINE}
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    or32:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    padre:Linux:*:*)
+       echo sparc-unknown-linux-gnu
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-gnu ;;
+         PA8*) echo hppa2.0-unknown-linux-gnu ;;
+         *)    echo hppa-unknown-linux-gnu ;;
+       esac
+       exit ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
+       exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux
+       exit ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    tile*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    vax:Linux:*:*)
+       echo ${UNAME_MACHINE}-dec-linux-gnu
+       exit ;;
+    x86_64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    xtensa*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+       # Unixware is an offshoot of SVR4, but it has its own version
+       # number series starting with 2...
+       # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+       # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit ;;
+    i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit ;;
+    i*86:*:5:[678]*)
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+       # uname -m prints for DJGPP always 'pc', but it prints nothing about
+       # the processor, so we play safe by assuming i586.
+       # Note: whatever this is, it MUST be the same as what config.sub
+       # prints for the "djgpp" host, or else GDB configury will decide that
+       # this is a cross-build.
+       echo i586-pc-msdosdjgpp
+       exit ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+       OS_REL='.3'
+       test -r /etc/.relid \
+           && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+           && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit ;;
+    PENTIUM:*:4.0*:*)  # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                       # says <Richard.M.Bartel@ccMail.Census.GOV>
+       echo i586-unisys-sysv4
+       exit ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit ;;
+    i*86:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo ${UNAME_MACHINE}-stratus-vos
+       exit ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+       exit ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit ;;
+    BePC:Haiku:*:*)    # Haiku running on Intel PC compatible.
+       echo i586-pc-haiku
+       exit ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-7:SUPER-UX:*:*)
+       echo sx7-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8:SUPER-UX:*:*)
+       echo sx8-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8R:SUPER-UX:*:*)
+       echo sx8r-nec-superux${UNAME_RELEASE}
+       exit ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Darwin:*:*)
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       case $UNAME_PROCESSOR in
+           i386)
+               eval $set_cc_for_build
+               if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+                 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+                     (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+                     grep IS_64BIT_ARCH >/dev/null
+                 then
+                     UNAME_PROCESSOR="x86_64"
+                 fi
+               fi ;;
+           unknown) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+       echo neo-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit ;;
+    SEI:*:*:SEIUX)
+       echo mips-sei-seiux${UNAME_RELEASE}
+       exit ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms ; exit ;;
+           I*) echo ia64-dec-vms ; exit ;;
+           V*) echo vax-dec-vms ; exit ;;
+       esac ;;
+    *:XENIX:*:SysV)
+       echo i386-pc-xenix
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       exit ;;
+    i*86:rdos:*:*)
+       echo ${UNAME_MACHINE}-pc-rdos
+       exit ;;
+    i*86:AROS:*:*)
+       echo ${UNAME_MACHINE}-pc-aros
+       exit ;;
+    x86_64:VMkernel:*:*)
+       echo ${UNAME_MACHINE}-unknown-esx
+       exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+       "4"
+#else
+       ""
+#endif
+       ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+       { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    c34*)
+       echo c34-convex-bsd
+       exit ;;
+    c38*)
+       echo c38-convex-bsd
+       exit ;;
+    c4*)
+       echo c4-convex-bsd
+       exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.h.in b/config.h.in
new file mode 100644 (file)
index 0000000..a365bfe
--- /dev/null
@@ -0,0 +1,134 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+   to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT64_T
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT8_T
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to the type of a signed integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int16_t
+
+/* Define to the type of a signed integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int32_t
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int64_t
+
+/* Define to the type of a signed integer type of width exactly 8 bits if such
+   a type exists and the standard includes do not define it. */
+#undef int8_t
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint16_t
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint64_t
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint8_t
diff --git a/config.sub b/config.sub
new file mode 100755 (executable)
index 0000000..c894da4
--- /dev/null
@@ -0,0 +1,1773 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-02-10'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis | -knuth | -cray | -microblaze)
+               os=
+               basic_machine=$1
+               ;;
+       -bluegene*)
+               os=-cnk
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco6)
+               os=-sco5v6
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5v6*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | aarch64 | aarch64_be \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+        | be32 | be64 \
+       | bfin \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | epiphany \
+       | fido | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | hexagon \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k | iq2000 \
+       | le32 | le64 \
+       | lm32 \
+       | m32c | m32r | m32rle | m68000 | m68k | m88k \
+       | maxq | mb | microblaze | mcore | mep | metag \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64octeon | mips64octeonel \
+       | mips64orion | mips64orionel \
+       | mips64r5900 | mips64r5900el \
+       | mips64vr | mips64vrel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | moxie \
+       | mt \
+       | msp430 \
+       | nds32 | nds32le | nds32be \
+       | nios | nios2 \
+       | ns16k | ns32k \
+       | open8 \
+       | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle \
+       | pyramid \
+       | rl78 | rx \
+       | score \
+       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+       | spu \
+       | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+       | ubicom32 \
+       | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+       | we32k \
+       | x86 | xc16x | xstormy16 | xtensa \
+       | z8k | z80)
+               basic_machine=$basic_machine-unknown
+               ;;
+       c54x)
+               basic_machine=tic54x-unknown
+               ;;
+       c55x)
+               basic_machine=tic55x-unknown
+               ;;
+       c6x)
+               basic_machine=tic6x-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+       ms1)
+               basic_machine=mt-unknown
+               ;;
+
+       strongarm | thumb | xscale)
+               basic_machine=arm-unknown
+               ;;
+       xgate)
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       xscaleeb)
+               basic_machine=armeb-unknown
+               ;;
+
+       xscaleel)
+               basic_machine=armel-unknown
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | aarch64-* | aarch64_be-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* | avr32-* \
+       | be32-* | be64-* \
+       | bfin-* | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* \
+       | clipper-* | craynv-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | hexagon-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* | iq2000-* \
+       | le32-* | le64-* \
+       | lm32-* \
+       | m32c-* | m32r-* | m32rle-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64octeon-* | mips64octeonel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64r5900-* | mips64r5900el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | mt-* \
+       | msp430-* \
+       | nds32-* | nds32le-* | nds32be-* \
+       | nios-* | nios2-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | open8-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+       | pyramid-* \
+       | rl78-* | romp-* | rs6000-* | rx-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+       | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+       | tahoe-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tile*-* \
+       | tron-* \
+       | ubicom32-* \
+       | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+       | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xc16x-* | xps100-* \
+       | xstormy16-* | xtensa*-* \
+       | ymp-* \
+       | z8k-* | z80-*)
+               ;;
+       # Recognize the basic CPU types without company name, with glob match.
+       xtensa*)
+               basic_machine=$basic_machine-unknown
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aros)
+               basic_machine=i386-pc
+               os=-aros
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       blackfin)
+               basic_machine=bfin-unknown
+               os=-linux
+               ;;
+       blackfin-*)
+               basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       bluegene*)
+               basic_machine=powerpc-ibm
+               os=-cnk
+               ;;
+       c54x-*)
+               basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c55x-*)
+               basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c6x-*)
+               basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       cegcc)
+               basic_machine=arm-unknown
+               os=-cegcc
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
+               ;;
+       cr16 | cr16-*)
+               basic_machine=cr16-unknown
+               os=-elf
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       crisv32 | crisv32-* | etraxfs*)
+               basic_machine=crisv32-axis
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       dicos)
+               basic_machine=i686-pc
+               os=-dicos
+               ;;
+       djgpp)
+               basic_machine=i586-pc
+               os=-msdosdjgpp
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m68knommu)
+               basic_machine=m68k-unknown
+               os=-linux
+               ;;
+       m68knommu-*)
+               basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       microblaze)
+               basic_machine=microblaze-xilinx
+               ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       mingw32ce)
+               basic_machine=arm-unknown
+               os=-mingw32ce
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       ms1-*)
+               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+               ;;
+       msys)
+               basic_machine=i386-pc
+               os=-msys
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       nacl)
+               basic_machine=le32-unknown
+               os=-nacl
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       neo-tandem)
+               basic_machine=neo-tandem
+               ;;
+       nse-tandem)
+               basic_machine=nse-tandem
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       openrisc | openrisc-*)
+               basic_machine=or32-unknown
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       parisc)
+               basic_machine=hppa-unknown
+               os=-linux
+               ;;
+       parisc-*)
+               basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pc98)
+               basic_machine=i386-pc
+               ;;
+       pc98-*)
+               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc | ppcbe)    basic_machine=powerpc-unknown
+               ;;
+       ppc-* | ppcbe-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rdos)
+               basic_machine=i386-pc
+               os=-rdos
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sde)
+               basic_machine=mipsisa32-sde
+               os=-elf
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sh5el)
+               basic_machine=sh5le-unknown
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       strongarm-* | thumb-*)
+               basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       tile*)
+               basic_machine=$basic_machine-unknown
+               os=-linux-gnu
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xbox)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       xscale-* | xscalee[bl]-*)
+               basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       z80-*-coff)
+               basic_machine=z80-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+       # First match some system type aliases
+       # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -auroraux)
+               os=-auroraux
+               ;;
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+             | -sym* | -kopensolaris* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* | -aros* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+             | -openbsd* | -solidbsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* | -cegcc* \
+             | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux-gnu* | -linux-android* \
+             | -linux-newlib* | -linux-uclibc* \
+             | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux-dietlibc)
+               os=-linux-dietlibc
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+       -os400*)
+               os=-os400
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -syllable*)
+               os=-syllable
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+       -tpf*)
+               os=-tpf
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
+       -zvmoe)
+               os=-zvmoe
+               ;;
+       -dicos*)
+               os=-dicos
+               ;;
+       -nacl*)
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       score-*)
+               os=-elf
+               ;;
+       spu-*)
+               os=-elf
+               ;;
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+       c4x-* | tic4x-*)
+               os=-coff
+               ;;
+       tic54x-*)
+               os=-coff
+               ;;
+       tic55x-*)
+               os=-coff
+               ;;
+       tic6x-*)
+               os=-coff
+               ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mep-*)
+               os=-elf
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-haiku)
+               os=-haiku
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-knuth)
+               os=-mmixware
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -cnk*|-aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -os400*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -tpf*)
+                               vendor=ibm
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..ddde0cf
--- /dev/null
+++ b/configure
@@ -0,0 +1,18525 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.68 for opencore-amr 0.1.3.
+#
+# Report bugs to <http://sourceforge.net/projects/opencore-amr/>.
+#
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+       expr "X$arg" : "X\\(.*\\)$as_nl";
+       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+        /*)
+          for as_base in sh bash ksh sh5; do
+            # Try only shells that exist, to save several forks.
+            as_shell=$as_dir/$as_base
+            if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+                   { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+                  if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+          done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+             { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+       # neutralization value for shells without unset; and this also
+       # works around shells that cannot unset nonexistent variables.
+       # Preserve -v and -x to the replacement shell.
+       BASH_ENV=/dev/null
+       ENV=/dev/null
+       (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+       export CONFIG_SHELL
+       case $- in # ((((
+         *v*x* | *x*v* ) as_opts=-vx ;;
+         *v* ) as_opts=-v ;;
+         *x* ) as_opts=-x ;;
+         * ) as_opts= ;;
+       esac
+       exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: http://sourceforge.net/projects/opencore-amr/ about
+$0: your system, including any error possibly output before
+$0: this message. Then install a modern shell, or manually
+$0: run the script under such a shell if you do have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='        ';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+       test -d "$1/.";
+      else
+       case $1 in #(
+       -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='opencore-amr'
+PACKAGE_TARNAME='opencore-amr'
+PACKAGE_VERSION='0.1.3'
+PACKAGE_STRING='opencore-amr 0.1.3'
+PACKAGE_BUGREPORT='http://sourceforge.net/projects/opencore-amr/'
+PACKAGE_URL=''
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+OPENCORE_AMRWB_VERSION
+OPENCORE_AMRNB_VERSION
+LIBOBJS
+LIBTOOL_DEPS
+CXXCPP
+CPP
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+RANLIB
+ac_ct_AR
+AR
+DLLTOOL
+OBJDUMP
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+EGREP
+GREP
+SED
+LIBTOOL
+LN_S
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+ac_ct_CC
+CFLAGS
+CC
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CXX
+CPPFLAGS
+LDFLAGS
+CXXFLAGS
+CXX
+EXAMPLES_FALSE
+EXAMPLES_TRUE
+AMRNB_DECODER_FALSE
+AMRNB_DECODER_TRUE
+AMRNB_ENCODER_FALSE
+AMRNB_ENCODER_TRUE
+GCC_ARMV5_FALSE
+GCC_ARMV5_TRUE
+COMPILE_AS_C_FALSE
+COMPILE_AS_C_TRUE
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_silent_rules
+enable_maintainer_mode
+enable_compile_c
+enable_gcc_armv5
+enable_amrnb_encoder
+enable_amrnb_decoder
+enable_examples
+enable_dependency_tracking
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+with_sysroot
+enable_libtool_lock
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CXX
+CXXFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CCC
+CC
+CFLAGS
+CPP
+CXXCPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
+               datadir sysconfdir sharedstatedir localstatedir includedir \
+               oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+               libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_myself" : 'X\(//\)[^/]' \| \
+        X"$as_myself" : 'X\(//\)$' \| \
+        X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+       cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+       pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures opencore-amr 0.1.3 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/opencore-amr]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of opencore-amr 0.1.3:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-silent-rules          less verbose build output (undo: `make V=1')
+  --disable-silent-rules         verbose build output (undo: `make V=0')
+  --enable-maintainer-mode  enable make rules and dependencies not useful
+                         (and sometimes confusing) to the casual installer
+  --enable-compile-c      enable compiling as C program (default is yes)
+  --enable-gcc-armv5      enable GCC specific ARMv5 assembler (default is no)
+  --enable-amrnb-encoder  enable AMR-NB encoder (default is yes)
+  --enable-amrnb-decoder  enable AMR-NB decoder (default is yes)
+  --enable-examples       enable example encoding/decoding programs (default
+                          is no)
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-shared[=PKGS]  build shared libraries [default=yes]
+  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
+
+Some influential environment variables:
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  CPP         C preprocessor
+  CXXCPP      C++ preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <http://sourceforge.net/projects/opencore-amr/>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+opencore-amr configure 0.1.3
+generated by GNU Autoconf 2.68
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_cpp
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_link
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ------------------------------------------------------------ ##
+## Report this to http://sourceforge.net/projects/opencore-amr/ ##
+## ------------------------------------------------------------ ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+        return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+           return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_find_intX_t LINENO BITS VAR
+# -----------------------------------
+# Finds a signed integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_intX_t ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
+$as_echo_n "checking for int$2_t... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     # Order is important - never check a type that is potentially smaller
+     # than half of the expected target width.
+     for ac_type in int$2_t 'int' 'long int' \
+        'long long int' 'short int' 'signed char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+            enum { N = $2 / 2 - 1 };
+int
+main ()
+{
+static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+               enum { N = $2 / 2 - 1 };
+int
+main ()
+{
+static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
+                < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  case $ac_type in #(
+  int$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       if eval test \"x\$"$3"\" = x"no"; then :
+
+else
+  break
+fi
+     done
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_find_intX_t
+
+# ac_fn_c_find_uintX_t LINENO BITS VAR
+# ------------------------------------
+# Finds an unsigned integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_uintX_t ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
+$as_echo_n "checking for uint$2_t... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     # Order is important - never check a type that is potentially smaller
+     # than half of the expected target width.
+     for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
+        'unsigned long long int' 'unsigned short int' 'unsigned char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  case $ac_type in #(
+  uint$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       if eval test \"x\$"$3"\" = x"no"; then :
+
+else
+  break
+fi
+     done
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_find_uintX_t
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by opencore-amr $as_me 0.1.3, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+       "s/'\''/'\''\\\\'\'''\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=\$$ac_var
+       case $ac_val in
+       *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       esac
+       $as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       # differences in whitespace do not lead to failure.
+       ac_old_val_w=`echo x $ac_old_val`
+       ac_new_val_w=`echo x $ac_new_val`
+       if test "$ac_old_val_w" != "$ac_new_val_w"; then
+         { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+         ac_cache_corrupted=:
+       else
+         { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+         eval $ac_var=\$ac_old_val
+       fi
+       { $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+       { $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_aux_dir=
+for ac_dir in . "$srcdir"/.; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+
+am__api_version='1.11'
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           rm -rf conftest.one conftest.two conftest.dir
+           echo one > conftest.one
+           echo two > conftest.two
+           mkdir conftest.dir
+           if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+             test -s conftest.one && test -s conftest.two &&
+             test -s conftest.dir/conftest.one &&
+             test -s conftest.dir/conftest.two
+           then
+             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+             break 3
+           fi
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+
+  done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \    ]*)
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+  if ${ac_cv_path_mkdir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in mkdir gmkdir; do
+        for ac_exec_ext in '' $ac_executable_extensions; do
+          { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+          case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+            'mkdir (GNU coreutils) '* | \
+            'mkdir (coreutils) '* | \
+            'mkdir (fileutils) '4.1*)
+              ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+              break 3;;
+          esac
+        done
+       done
+  done
+IFS=$as_save_IFS
+
+fi
+
+  test -d ./--version && rmdir ./--version
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+       @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='opencore-amr'
+ VERSION='0.1.3'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5
+$as_echo_n "checking how to create a ustar tar archive... " >&6; }
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar plaintar pax cpio none'
+_am_tools=${am_cv_prog_tar_ustar-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      { echo "$as_me:$LINENO: $_am_tar --version" >&5
+   ($_am_tar --version) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } && break
+    done
+    am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x ustar -w "$$tardir"'
+    am__tar_='pax -L -x ustar -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H ustar -L'
+    am__tar_='find "$tardir" -print | cpio -o -H ustar -L'
+    am__untar='cpio -i -H ustar -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_ustar}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5
+   (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    { echo "$as_me:$LINENO: $am__untar <conftest.tar" >&5
+   ($am__untar <conftest.tar) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+if ${am_cv_prog_tar_ustar+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  am_cv_prog_tar_ustar=$_am_tool
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5
+$as_echo "$am_cv_prog_tar_ustar" >&6; }
+
+
+
+
+
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in
+yes) AM_DEFAULT_VERBOSITY=0;;
+no)  AM_DEFAULT_VERBOSITY=1;;
+*)   AM_DEFAULT_VERBOSITY=0;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+       @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+    # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+   if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+
+  MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+# Cross compiling support
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+# Various options for configure
+# Check whether --enable-compile-c was given.
+if test "${enable_compile_c+set}" = set; then :
+  enableval=$enable_compile_c; compile_as_c=$enableval
+else
+  compile_as_c=yes
+fi
+
+# Check whether --enable-gcc-armv5 was given.
+if test "${enable_gcc_armv5+set}" = set; then :
+  enableval=$enable_gcc_armv5; gcc_armv5=$enableval
+else
+  gcc_armv5=no
+fi
+
+# Check whether --enable-amrnb-encoder was given.
+if test "${enable_amrnb_encoder+set}" = set; then :
+  enableval=$enable_amrnb_encoder; amrnb_encoder=$enableval
+else
+  amrnb_encoder=yes
+fi
+
+# Check whether --enable-amrnb-decoder was given.
+if test "${enable_amrnb_decoder+set}" = set; then :
+  enableval=$enable_amrnb_decoder; amrnb_decoder=$enableval
+else
+  amrnb_decoder=yes
+fi
+
+# Check whether --enable-examples was given.
+if test "${enable_examples+set}" = set; then :
+  enableval=$enable_examples; examples=$enableval
+else
+  examples=no
+fi
+
+
+# Automake conditionals to set
+ if test x$compile_as_c = xyes; then
+  COMPILE_AS_C_TRUE=
+  COMPILE_AS_C_FALSE='#'
+else
+  COMPILE_AS_C_TRUE='#'
+  COMPILE_AS_C_FALSE=
+fi
+
+ if test x$gcc_armv5 = xyes; then
+  GCC_ARMV5_TRUE=
+  GCC_ARMV5_FALSE='#'
+else
+  GCC_ARMV5_TRUE='#'
+  GCC_ARMV5_FALSE=
+fi
+
+ if test x$amrnb_encoder = xyes; then
+  AMRNB_ENCODER_TRUE=
+  AMRNB_ENCODER_FALSE='#'
+else
+  AMRNB_ENCODER_TRUE='#'
+  AMRNB_ENCODER_FALSE=
+fi
+
+ if test x$amrnb_decoder = xyes; then
+  AMRNB_DECODER_TRUE=
+  AMRNB_DECODER_FALSE='#'
+else
+  AMRNB_DECODER_TRUE='#'
+  AMRNB_DECODER_FALSE=
+fi
+
+ if test x$examples = xyes; then
+  EXAMPLES_TRUE=
+  EXAMPLES_FALSE='#'
+else
+  EXAMPLES_TRUE='#'
+  EXAMPLES_FALSE=
+fi
+
+
+# Checks for programs.
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5
+$as_echo_n "checking whether the C++ compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+       if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       then :; else
+          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       fi
+       # We set ac_cv_exeext here because the later test for it is not
+       # safe: cross compilers may not add the suffix if given an `-o'
+       # argument, so we may need to know it at that point already.
+       # Even if this section looks crufty: it has the advantage of
+       # actually working.
+       break;;
+    * )
+       break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C++ compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5
+$as_echo_n "checking for C++ compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if ${ac_cv_prog_cxx_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+        CXXFLAGS="-g"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+  am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+depcc="$CXX"  am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+       @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+# Setup for libtool
+case `pwd` in
+  *\ * | *\    *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4.2'
+macro_revision='1.3337'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO ""
+}
+
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+   then ac_cv_path_FGREP="$GREP -F"
+   else
+     if test -z "$FGREP"; then
+  ac_path_FGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in fgrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+  # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'FGREP' >> "conftest.nl"
+    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_FGREP="$ac_path_FGREP"
+      ac_path_FGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_FGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_FGREP=$FGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       # Tru64's nm complains that /dev/null is an invalid object file
+       case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+       */dev/null* | *'Invalid file or object type'*)
+         lt_cv_path_NM="$tmp_nm -B"
+         break
+         ;;
+       *)
+         case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+         */dev/null*)
+           lt_cv_path_NM="$tmp_nm -p"
+           break
+           ;;
+         *)
+           lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+           continue # so that we can try to find one that supports BSD flags
+           ;;
+         esac
+         ;;
+       esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DUMPBIN"; then
+  ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$DUMPBIN" && break
+  done
+fi
+if test -z "$DUMPBIN"; then
+  ac_ct_DUMPBIN=$DUMPBIN
+  for ac_prog in dumpbin "link -dump"
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DUMPBIN"; then
+  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_DUMPBIN" && break
+done
+
+  if test "x$ac_ct_DUMPBIN" = x; then
+    DUMPBIN=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DUMPBIN=$ac_ct_DUMPBIN
+  fi
+fi
+
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+  cat conftest.out >&5
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536      # usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[         ]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+                = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+             test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OBJDUMP=$ac_ct_OBJDUMP
+  fi
+else
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DLLTOOL=$ac_ct_DLLTOOL
+  fi
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$AR" && break
+  done
+fi
+if test -z "$AR"; then
+  ac_ct_AR=$AR
+  for ac_prog in ar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_AR="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_AR" && break
+done
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+fi
+
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test "$ac_status" -eq 0; then
+       # Ensure the archiver fails upon bogus file names.
+       rm -f conftest.$ac_objext libconftest.a
+       { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+       if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK '"\
+"     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[     ]\($symcode$symcode*\)[         ][      ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+       if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+         # Now generate the symbol file.
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+         cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT_DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+         $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+         cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_globsym_save_LIBS=$LIBS
+         lt_globsym_save_CFLAGS=$CFLAGS
+         LIBS="conftstm.$ac_objext"
+         CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+         if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS=$lt_globsym_save_LIBS
+         CFLAGS=$lt_globsym_save_CFLAGS
+       else
+         echo "cannot find nm_test_func in $nlist" >&5
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot;
+else
+  with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+       HPUX_IA64_MODE="32"
+       ;;
+      *ELF-64*)
+       HPUX_IA64_MODE="64"
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -melf32bsmip"
+         ;;
+       *N32*)
+         LD="${LD-ld} -melf32bmipn32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -melf64bmip"
+       ;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -32"
+         ;;
+       *N32*)
+         LD="${LD-ld} -n32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -64"
+         ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_i386_fbsd"
+           ;;
+         x86_64-*linux*)
+           LD="${LD-ld} -m elf_i386"
+           ;;
+         ppc64-*linux*|powerpc64-*linux*)
+           LD="${LD-ld} -m elf32ppclinux"
+           ;;
+         s390x-*linux*)
+           LD="${LD-ld} -m elf_s390"
+           ;;
+         sparc64-*linux*)
+           LD="${LD-ld} -m elf32_sparc"
+           ;;
+       esac
+       ;;
+      *64-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_x86_64_fbsd"
+           ;;
+         x86_64-*linux*)
+           LD="${LD-ld} -m elf_x86_64"
+           ;;
+         ppc*-*linux*|powerpc*-*linux*)
+           LD="${LD-ld} -m elf64ppc"
+           ;;
+         s390*-*linux*|s390*-*tpf*)
+           LD="${LD-ld} -m elf64_s390"
+           ;;
+         sparc*-*linux*)
+           LD="${LD-ld} -m elf64_sparc"
+           ;;
+       esac
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_cc_needs_belf=yes
+else
+  lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
+      *)
+       if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+         LD="${LD-ld} -64"
+       fi
+       ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+  fi
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+
+
+
+
+
+
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DSYMUTIL=$ac_ct_DSYMUTIL
+  fi
+else
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NMEDIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_NMEDIT="nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    NMEDIT=$ac_ct_NMEDIT
+  fi
+else
+  NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LIPO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$LIPO"; then
+  ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+  ac_ct_LIPO=$LIPO
+  # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_LIPO"; then
+  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_LIPO="lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_LIPO" = x; then
+    LIPO=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    LIPO=$ac_ct_LIPO
+  fi
+else
+  LIPO="$ac_cv_prog_LIPO"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL"; then
+  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+  ac_ct_OTOOL=$OTOOL
+  # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL"; then
+  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL="otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL" = x; then
+    OTOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL=$ac_ct_OTOOL
+  fi
+else
+  OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL64"; then
+  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+  ac_ct_OTOOL64=$OTOOL64
+  # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL64"; then
+  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL64="otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL64" = x; then
+    OTOOL64=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL64=$ac_ct_OTOOL64
+  fi
+else
+  OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+       # By default we will add the -single_module flag. You can override
+       # by either setting the environment variable LT_MULTI_MODULE
+       # non-empty at configure time, or by adding -multi_module to the
+       # link flags.
+       rm -rf libconftest.dylib*
+       echo "int foo(void){return 1;}" > conftest.c
+       echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+       $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+         -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+       # If there is a non-empty error log, and "single_module"
+       # appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+         cat conftest.err >&5
+       # Otherwise, if the output was created with a 0 exit code from
+       # the compiler, it worked.
+       elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+         lt_cv_apple_cc_single_mod=yes
+       else
+         cat conftest.err >&5
+       fi
+       rm -rf libconftest.dylib*
+       rm -f conftest.*
+      fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_ld_exported_symbols_list=yes
+else
+  lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+       LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+       cat conftest.err >&5
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+       lt_cv_ld_force_load=yes
+      else
+       cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[012])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+       10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+         _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+       10.[012]*)
+         _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+       10.*)
+         _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if ${ac_cv_prog_CPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+
+
+
+
+
+# Set options
+
+
+
+        enable_dlopen=no
+
+
+  enable_win32_dll=no
+
+
+            # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+  # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+       IFS="$lt_save_ifs"
+       if test "X$lt_pkg" = "X$lt_p"; then
+         pic_mode=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+  # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+
+
+
+
+
+  lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='-fPIC'
+       ;;
+      esac
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      if test -n "$lt_prog_compiler_pic"; then
+        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+      fi
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      else
+       lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-KPIC'
+       lt_prog_compiler_static='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fPIC'
+       lt_prog_compiler_static='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='--shared'
+       lt_prog_compiler_static='--static'
+       ;;
+      nagfor*)
+       # NAG Fortran compiler
+       lt_prog_compiler_wl='-Wl,-Wl,,'
+       lt_prog_compiler_pic='-PIC'
+       lt_prog_compiler_static='-Bstatic'
+       ;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fpic'
+       lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+       # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-qpic'
+       lt_prog_compiler_static='-qstaticlink'
+       ;;
+      *)
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+         # Sun Fortran 8.3 passes all unrecognized flags to the linker
+         lt_prog_compiler_pic='-KPIC'
+         lt_prog_compiler_static='-Bstatic'
+         lt_prog_compiler_wl=''
+         ;;
+       *Sun\ F* | *Sun*Fortran*)
+         lt_prog_compiler_pic='-KPIC'
+         lt_prog_compiler_static='-Bstatic'
+         lt_prog_compiler_wl='-Qoption ld '
+         ;;
+       *Sun\ C*)
+         # Sun C 5.9
+         lt_prog_compiler_pic='-KPIC'
+         lt_prog_compiler_static='-Bstatic'
+         lt_prog_compiler_wl='-Wl,'
+         ;;
+        *Intel*\ [CF]*Compiler*)
+         lt_prog_compiler_wl='-Wl,'
+         lt_prog_compiler_pic='-fPIC'
+         lt_prog_compiler_static='-static'
+         ;;
+       *Portland\ Group*)
+         lt_prog_compiler_wl='-Wl,'
+         lt_prog_compiler_pic='-fpic'
+         lt_prog_compiler_static='-Bstatic'
+         ;;
+       esac
+       ;;
+      esac
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+       lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+       lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       lt_prog_compiler_pic='-Kconform_pic'
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  always_export_symbols=no
+  archive_cmds=
+  archive_expsym_cmds=
+  compiler_needs_object=no
+  enable_shared_with_static_runtimes=no
+  export_dynamic_flag_spec=
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic=no
+  hardcode_direct=no
+  hardcode_direct_absolute=no
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_separator=
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  inherit_rpath=no
+  link_all_deplibs=unknown
+  module_cmds=
+  module_expsym_cmds=
+  old_archive_from_new_cmds=
+  old_archive_from_expsyms_cmds=
+  thread_safe_flag_spec=
+  whole_archive_flag_spec=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
+    link_all_deplibs=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+       # The AIX port of GNU ld has always aspired to compatibility
+       # with the native linker.  However, as the warning in the GNU ld
+       # block says, versions before 2.19.5* couldn't really create working
+       # shared libraries, regardless of the interface used.
+       case `$LD -v 2>&1` in
+         *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+         *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+         *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+         *)
+           lt_use_gnu_ld_interface=yes
+           ;;
+       esac
+       ;;
+      *)
+       lt_use_gnu_ld_interface=yes
+       ;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+       case $cc_basename in
+         diet\ *) tmp_diet=yes;;       # linux-dietlibc with static linking (!diet-dyn)
+       esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+        && test "$tmp_diet" = no
+      then
+       tmp_addflag=' $pic_flag'
+       tmp_sharedflag='-shared'
+       case $cc_basename,$host_cpu in
+        pgcc*)                         # Portland Group C compiler
+         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95* | pgfortran*)
+                                       # Portland Group f77 and f90 compilers
+         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       lf95*)                          # Lahey Fortran 8.1
+         whole_archive_flag_spec=
+         tmp_sharedflag='--shared' ;;
+       xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+         tmp_sharedflag='-qmkshrobj'
+         tmp_addflag= ;;
+       nvcc*)  # Cuda Compiler Driver 2.2
+         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         compiler_needs_object=yes
+         ;;
+       esac
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ C*)                       # Sun C 5.9
+         whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         compiler_needs_object=yes
+         tmp_sharedflag='-G' ;;
+       *Sun\ F*)                       # Sun Fortran 8.3
+         tmp_sharedflag='-G' ;;
+       esac
+       archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+           cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+           echo "local: *; };" >> $output_objdir/$libname.ver~
+           $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+       case $cc_basename in
+       xlf* | bgf* | bgxlf* | mpixlf*)
+         # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+         whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+         hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+         archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+         if test "x$supports_anon_versioning" = xyes; then
+           archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+             cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+             echo "local: *; };" >> $output_objdir/$libname.ver~
+             $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+         fi
+         ;;
+       esac
+      else
+        ld_shlibs=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         # For security reasons, it is highly recommended that you always
+         # use absolute paths for naming shared libraries, and exclude the
+         # DT_RUNPATH tag from executables and libraries.  But doing so
+         # requires that you compile everything twice, which is a pain.
+         if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+           hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+           archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         else
+           ld_shlibs=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       # Also, AIX nm treats weak defined symbols like other global
+       # defined symbols, whereas GNU nm marks them as "W".
+       if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+         export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_direct_absolute=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      file_list_spec='${wl}-f,'
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[012]|aix4.[012].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" &&
+          strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         :
+         else
+         # We have old collect2
+         hardcode_direct=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L=yes
+         hardcode_libdir_flag_spec='-L$libdir'
+         hardcode_libdir_separator=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+       link_all_deplibs=no
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+         fi
+       fi
+      fi
+
+      export_dynamic_flag_spec='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+         /^0/ {
+             s/^0  *\([^ ]*\) *$/\1/
+             p
+         }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+       if test "$host_cpu" = ia64; then
+         hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag="-z nodefs"
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+         /^0/ {
+             s/^0  *\([^ ]*\) *$/\1/
+             p
+         }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag=' ${wl}-bernotok'
+         allow_undefined_flag=' ${wl}-berok'
+         if test "$with_gnu_ld" = yes; then
+           # We only use this code for GNU lds that support --whole-archive.
+           whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+         else
+           # Exported symbols can be pulled into shared objects from archives
+           whole_archive_flag_spec='$convenience'
+         fi
+         archive_cmds_need_lc=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+       # Native MSVC
+       hardcode_libdir_flag_spec=' '
+       allow_undefined_flag=unsupported
+       always_export_symbols=yes
+       file_list_spec='@'
+       # Tell ltmain to make .lib files, not .a files.
+       libext=lib
+       # Tell ltmain to make .dll files, not .so files.
+       shrext_cmds=".dll"
+       # FIXME: Setting linknames here is a bad hack.
+       archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+       archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+           sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+         else
+           sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+         fi~
+         $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+         linknames='
+       # The linker will not automatically build a static lib if we build a DLL.
+       # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+       enable_shared_with_static_runtimes=yes
+       exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+       export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+       # Don't use ranlib
+       old_postinstall_cmds='chmod 644 $oldlib'
+       postlink_cmds='lt_outputfile="@OUTPUT@"~
+         lt_tool_outputfile="@TOOL_OUTPUT@"~
+         case $lt_outputfile in
+           *.exe|*.EXE) ;;
+           *)
+             lt_outputfile="$lt_outputfile.exe"
+             lt_tool_outputfile="$lt_tool_outputfile.exe"
+             ;;
+         esac~
+         if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+           $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+           $RM "$lt_outputfile.manifest";
+         fi'
+       ;;
+      *)
+       # Assume MSVC wrapper
+       hardcode_libdir_flag_spec=' '
+       allow_undefined_flag=unsupported
+       # Tell ltmain to make .lib files, not .a files.
+       libext=lib
+       # Tell ltmain to make .dll files, not .so files.
+       shrext_cmds=".dll"
+       # FIXME: Setting linknames here is a bad hack.
+       archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+       # The linker will automatically build a .lib file if we build a DLL.
+       old_archive_from_new_cmds='true'
+       # FIXME: Should let the user specify the lib program.
+       old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+       enable_shared_with_static_runtimes=yes
+       ;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc=no
+  hardcode_direct=no
+  hardcode_automatic=yes
+  hardcode_shlibpath_var=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+  else
+    whole_archive_flag_spec=''
+  fi
+  link_all_deplibs=yes
+  allow_undefined_flag="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+  else
+  ld_shlibs=no
+  fi
+
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+       archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator=:
+       hardcode_direct=yes
+       hardcode_direct_absolute=yes
+       export_dynamic_flag_spec='${wl}-E'
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+
+         # Older versions of the 11.00 compiler do not understand -b yet
+         # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+         { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         hardcode_direct=no
+         hardcode_shlibpath_var=no
+         ;;
+       *)
+         hardcode_direct=yes
+         hardcode_direct_absolute=yes
+         export_dynamic_flag_spec='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       # Try to use the -exported_symbol ld option, if it does not
+       # work, assume that -exports_file does not work either and
+       # implicitly export all symbols.
+       # This should be the same for all languages, so no per-tag cache variable.
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+          LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo (void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_irix_exported_symbol=yes
+else
+  lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+       if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+       fi
+      else
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      inherit_rpath=yes
+      link_all_deplibs=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+       hardcode_direct=yes
+       hardcode_shlibpath_var=no
+       hardcode_direct_absolute=yes
+       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+         archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+         hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+         export_dynamic_flag_spec='${wl}-E'
+       else
+         case $host_os in
+          openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+            archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+            hardcode_libdir_flag_spec='-R$libdir'
+            ;;
+          *)
+            archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+            hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+            ;;
+         esac
+       fi
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+       $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z defs'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+       case `$CC -V 2>&1` in
+       *"Compilers 5.0"*)
+         wlarc=''
+         archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+         ;;
+       *)
+         wlarc='${wl}'
+         archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+         ;;
+       esac
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+       # The compiler driver will combine and reorder linker options,
+       # but understands `-z linker_flag'.  GCC discards it without `$wl',
+       # but is careful enough not to reorder.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       if test "$GCC" = yes; then
+         whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+       else
+         whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+       fi
+       ;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds='$CC -r -o $output$reload_objs'
+         hardcode_direct=no
+        ;;
+       motorola)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+       export_dynamic_flag_spec='${wl}-Blargedynsym'
+       ;;
+      esac
+    fi
+  fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+       if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+         soname=conftest
+         lib=conftest
+         libobjs=conftest.$ac_objext
+         deplibs=
+         wl=$lt_prog_compiler_wl
+         pic_flag=$lt_prog_compiler_pic
+         compiler_flags=-v
+         linker_flags=-v
+         verstring=
+         output_objdir=.
+         libname=conftest
+         lt_save_allow_undefined_flag=$allow_undefined_flag
+         allow_undefined_flag=
+         if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+         then
+           lt_cv_archive_cmds_need_lc=no
+         else
+           lt_cv_archive_cmds_need_lc=yes
+         fi
+         allow_undefined_flag=$lt_save_allow_undefined_flag
+       else
+         cat conftest.err 1>&5
+       fi
+       $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+       lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[23].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[3-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux # correct to gnu/linux during the next big refactor
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+        LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[      ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+   test -n "$runpath_var" ||
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+   test "$inherit_rpath" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+  if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+    ;;
+
+  *)
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+  lt_cv_dlopen="shl_load"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_shl_load=yes
+else
+  ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_svld_dlopen=yes
+else
+  ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_dld_link=yes
+else
+  ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+         if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+       }
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+         if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+       }
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+  # Report which library types will actually be built
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[4-9]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+      if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+  if ${ac_cv_prog_CXXCPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+else
+  _lt_caught_CXX_error=yes
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+compiler_needs_object_CXX=no
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_direct_absolute_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+inherit_rpath_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+reload_flag_CXX=$reload_flag
+reload_cmds_CXX=$reload_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+  # save warnings/boilerplate of simple test code
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  compiler_CXX=$CC
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+    else
+      lt_prog_compiler_no_builtin_flag_CXX=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+         $GREP 'no-whole-archive' > /dev/null; then
+          whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          whole_archive_flag_spec_CXX=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+    ld_shlibs_CXX=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+      aix[4-9]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+           for ld_flag in $LDFLAGS; do
+             case $ld_flag in
+             *-brtl*)
+               aix_use_runtimelinking=yes
+               break
+               ;;
+             esac
+           done
+           ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        archive_cmds_CXX=''
+        hardcode_direct_CXX=yes
+        hardcode_direct_absolute_CXX=yes
+        hardcode_libdir_separator_CXX=':'
+        link_all_deplibs_CXX=yes
+        file_list_spec_CXX='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[012]|aix4.[012].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" &&
+            strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+         then
+           # We have reworked collect2
+           :
+         else
+           # We have old collect2
+           hardcode_direct_CXX=unsupported
+           # It fails to find uninstalled libraries when the uninstalled
+           # path is not listed in the libpath.  Setting hardcode_minus_L
+           # to unsupported forces relinking
+           hardcode_minus_L_CXX=yes
+           hardcode_libdir_flag_spec_CXX='-L$libdir'
+           hardcode_libdir_separator_CXX=
+         fi
+          esac
+          shared_flag='-shared'
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag="$shared_flag "'${wl}-G'
+         fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+         # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+         # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+          else
+           if test "$aix_use_runtimelinking" = yes; then
+             shared_flag='${wl}-G'
+           else
+             shared_flag='${wl}-bM:SRE'
+           fi
+          fi
+        fi
+
+        export_dynamic_flag_spec_CXX='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+       # export.
+        always_export_symbols_CXX=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          allow_undefined_flag_CXX='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+         /^0/ {
+             s/^0  *\([^ ]*\) *$/\1/
+             p
+         }
+      }'
+  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath__CXX
+fi
+
+          hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+           hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+           allow_undefined_flag_CXX="-z nodefs"
+           archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+           # Determine the default libpath from the value encoded in an
+           # empty executable.
+           if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+         /^0/ {
+             s/^0  *\([^ ]*\) *$/\1/
+             p
+         }
+      }'
+  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath__CXX
+fi
+
+           hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+           # Warning - without using the other run time loading flags,
+           # -berok will link without error, but may produce a broken library.
+           no_undefined_flag_CXX=' ${wl}-bernotok'
+           allow_undefined_flag_CXX=' ${wl}-berok'
+           if test "$with_gnu_ld" = yes; then
+             # We only use this code for GNU lds that support --whole-archive.
+             whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+           else
+             # Exported symbols can be pulled into shared objects from archives
+             whole_archive_flag_spec_CXX='$convenience'
+           fi
+           archive_cmds_need_lc_CXX=yes
+           # This is similar to how AIX traditionally builds its shared
+           # libraries.
+           archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+         allow_undefined_flag_CXX=unsupported
+         # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+         # support --undefined.  This deserves some investigation.  FIXME
+         archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       else
+         ld_shlibs_CXX=no
+       fi
+       ;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+         ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+       case $GXX,$cc_basename in
+       ,cl* | no,cl*)
+         # Native MSVC
+         # hardcode_libdir_flag_spec is actually meaningless, as there is
+         # no search path for DLLs.
+         hardcode_libdir_flag_spec_CXX=' '
+         allow_undefined_flag_CXX=unsupported
+         always_export_symbols_CXX=yes
+         file_list_spec_CXX='@'
+         # Tell ltmain to make .lib files, not .a files.
+         libext=lib
+         # Tell ltmain to make .dll files, not .so files.
+         shrext_cmds=".dll"
+         # FIXME: Setting linknames here is a bad hack.
+         archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+         archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+             $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+           else
+             $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+           fi~
+           $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+           linknames='
+         # The linker will not automatically build a static lib if we build a DLL.
+         # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'
+         enable_shared_with_static_runtimes_CXX=yes
+         # Don't use ranlib
+         old_postinstall_cmds_CXX='chmod 644 $oldlib'
+         postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~
+           lt_tool_outputfile="@TOOL_OUTPUT@"~
+           case $lt_outputfile in
+             *.exe|*.EXE) ;;
+             *)
+               lt_outputfile="$lt_outputfile.exe"
+               lt_tool_outputfile="$lt_tool_outputfile.exe"
+               ;;
+           esac~
+           func_to_tool_file "$lt_outputfile"~
+           if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+             $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+             $RM "$lt_outputfile.manifest";
+           fi'
+         ;;
+       *)
+         # g++
+         # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+         # as there is no search path for DLLs.
+         hardcode_libdir_flag_spec_CXX='-L$libdir'
+         export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
+         allow_undefined_flag_CXX=unsupported
+         always_export_symbols_CXX=no
+         enable_shared_with_static_runtimes_CXX=yes
+
+         if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+           archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+           # If the export-symbols file already is a .def file (1st line
+           # is EXPORTS), use it as is; otherwise, prepend...
+           archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+             cp $export_symbols $output_objdir/$soname.def;
+           else
+             echo EXPORTS > $output_objdir/$soname.def;
+             cat $export_symbols >> $output_objdir/$soname.def;
+           fi~
+           $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+         else
+           ld_shlibs_CXX=no
+         fi
+         ;;
+       esac
+       ;;
+      darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc_CXX=no
+  hardcode_direct_CXX=no
+  hardcode_automatic_CXX=yes
+  hardcode_shlibpath_var_CXX=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+  else
+    whole_archive_flag_spec_CXX=''
+  fi
+  link_all_deplibs_CXX=yes
+  allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+       if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+
+  else
+  ld_shlibs_CXX=no
+  fi
+
+       ;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          ghcx*)
+           # Green Hills C++ Compiler
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+        esac
+        ;;
+
+      freebsd2.*)
+        # C++ shared libraries reported to be fairly broken before
+       # switch to ELF
+        ld_shlibs_CXX=no
+        ;;
+
+      freebsd-elf*)
+        archive_cmds_need_lc_CXX=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        ld_shlibs_CXX=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        link_all_deplibs_CXX=yes
+        ;;
+
+      hpux9*)
+        hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        export_dynamic_flag_spec_CXX='${wl}-E'
+        hardcode_direct_CXX=yes
+        hardcode_minus_L_CXX=yes # Not in the search PATH,
+                                            # but as the default
+                                            # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            ld_shlibs_CXX=no
+            ;;
+          aCC*)
+            archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              ld_shlibs_CXX=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+         hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+         hardcode_libdir_separator_CXX=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+             export_dynamic_flag_spec_CXX='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct_CXX=no
+            hardcode_shlibpath_var_CXX=no
+            ;;
+          *)
+            hardcode_direct_CXX=yes
+            hardcode_direct_absolute_CXX=yes
+            hardcode_minus_L_CXX=yes # Not in the search PATH,
+                                                # but as the default
+                                                # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          aCC*)
+           case $host_cpu in
+             hppa*64*)
+               archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             ia64*)
+               archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             *)
+               archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+           esac
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           ;;
+          *)
+           if test "$GXX" = yes; then
+             if test $with_gnu_ld = no; then
+               case $host_cpu in
+                 hppa*64*)
+                   archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 ia64*)
+                   archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 *)
+                   archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+               esac
+             fi
+           else
+             # FIXME: insert proper C++ library support
+             ld_shlibs_CXX=no
+           fi
+           ;;
+        esac
+        ;;
+
+      interix[3-9]*)
+       hardcode_direct_CXX=no
+       hardcode_shlibpath_var_CXX=no
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec_CXX='${wl}-E'
+       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+       # Instead, shared libraries are loaded at an image base (0x10000000 by
+       # default) and relocated if they conflict, which is a slow very memory
+       # consuming and fragmenting process.  To avoid this, we pick a random,
+       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+       archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       ;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+           # SGI C++
+           archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+           # Archives containing C++ object files must be created using
+           # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+           ;;
+          *)
+           if test "$GXX" = yes; then
+             if test "$with_gnu_ld" = no; then
+               archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+             else
+               archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+             fi
+           fi
+           link_all_deplibs_CXX=yes
+           ;;
+        esac
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        inherit_rpath_CXX=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+           # KCC will only create a shared library if the output file
+           # ends with ".so" (or ".sl" for HP-UX), so rename the library
+           # to its proper name (with version) after linking.
+           archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+           archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+           hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+           export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+           # Archives containing C++ object files must be created using
+           # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+           old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+           ;;
+         icpc* | ecpc* )
+           # Intel C++
+           with_gnu_ld=yes
+           # version 8.0 and above of icpc choke on multiply defined symbols
+           # if we add $predep_objects and $postdep_objects, however 7.1 and
+           # earlier do not add the objects themselves.
+           case `$CC -V 2>&1` in
+             *"Version 7."*)
+               archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+             *)  # Version 8.0 or newer
+               tmp_idyn=
+               case $host_cpu in
+                 ia64*) tmp_idyn=' -i_dynamic';;
+               esac
+               archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+           esac
+           archive_cmds_need_lc_CXX=no
+           hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+           export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+           whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+           ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+           case `$CC -V` in
+           *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
+             prelink_cmds_CXX='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+               compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+             old_archive_cmds_CXX='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+               $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+               $RANLIB $oldlib'
+             archive_cmds_CXX='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+             archive_expsym_cmds_CXX='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+             ;;
+           *) # Version 6 and above use weak symbols
+             archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+             archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+             ;;
+           esac
+
+           hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+           export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+           whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+         cxx*)
+           # Compaq C++
+           archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+           runpath_var=LD_RUN_PATH
+           hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+           hardcode_libdir_separator_CXX=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+           ;;
+         xl* | mpixl* | bgxl*)
+           # IBM XL 8.0 on PPC, with GNU ld
+           hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+           export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+           archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           if test "x$supports_anon_versioning" = xyes; then
+             archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
+               cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+               echo "local: *; };" >> $output_objdir/$libname.ver~
+               $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+           fi
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             no_undefined_flag_CXX=' -zdefs'
+             archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+             hardcode_libdir_flag_spec_CXX='-R$libdir'
+             whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+             compiler_needs_object_CXX=yes
+
+             # Not sure whether something based on
+             # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+             # would be better.
+             output_verbose_link_cmd='func_echo_all'
+
+             # Archives containing C++ object files must be created using
+             # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+             # necessary to make sure instantiated templates are included
+             # in the archive.
+             old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+       ;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+         *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+       esac
+       ;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+         archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+         wlarc=
+         hardcode_libdir_flag_spec_CXX='-R$libdir'
+         hardcode_direct_CXX=yes
+         hardcode_shlibpath_var_CXX=no
+       fi
+       # Workaround some broken pre-1.5 toolchains
+       output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+       ;;
+
+      *nto* | *qnx*)
+        ld_shlibs_CXX=yes
+       ;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+       ld_shlibs_CXX=no
+       ;;
+
+      openbsd*)
+       if test -f /usr/libexec/ld.so; then
+         hardcode_direct_CXX=yes
+         hardcode_shlibpath_var_CXX=no
+         hardcode_direct_absolute_CXX=yes
+         archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+         hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+         if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+           archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+           export_dynamic_flag_spec_CXX='${wl}-E'
+           whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+         fi
+         output_verbose_link_cmd=func_echo_all
+       else
+         ld_shlibs_CXX=no
+       fi
+       ;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+           # KCC will only create a shared library if the output file
+           # ends with ".so" (or ".sl" for HP-UX), so rename the library
+           # to its proper name (with version) after linking.
+           archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+           hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+           hardcode_libdir_separator_CXX=:
+
+           # Archives containing C++ object files must be created using
+           # the KAI C++ compiler.
+           case $host in
+             osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
+             *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
+           esac
+           ;;
+          RCC*)
+           # Rational C++ 2.4.1
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          cxx*)
+           case $host in
+             osf3*)
+               allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+               archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+               hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+               ;;
+             *)
+               allow_undefined_flag_CXX=' -expect_unresolved \*'
+               archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+               archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+                 echo "-hidden">> $lib.exp~
+                 $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+                 $RM $lib.exp'
+               hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+               ;;
+           esac
+
+           hardcode_libdir_separator_CXX=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           ;;
+         *)
+           if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+             allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+             case $host in
+               osf3*)
+                 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 ;;
+               *)
+                 archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 ;;
+             esac
+
+             hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+             hardcode_libdir_separator_CXX=:
+
+             # Commands to make compiler produce verbose output that lists
+             # what "hidden" libraries, object files and flags are used when
+             # linking a shared library.
+             output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+           else
+             # FIXME: insert proper C++ library support
+             ld_shlibs_CXX=no
+           fi
+           ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+           # Sun C++ 4.x
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          lcc*)
+           # Lucid
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+            archive_cmds_need_lc_CXX=yes
+           no_undefined_flag_CXX=' -zdefs'
+           archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+           archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+             $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+           hardcode_libdir_flag_spec_CXX='-R$libdir'
+           hardcode_shlibpath_var_CXX=no
+           case $host_os in
+             solaris2.[0-5] | solaris2.[0-5].*) ;;
+             *)
+               # The compiler driver will combine and reorder linker options,
+               # but understands `-z linker_flag'.
+               # Supported since Solaris 2.6 (maybe 2.5.1?)
+               whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+               ;;
+           esac
+           link_all_deplibs_CXX=yes
+
+           output_verbose_link_cmd='func_echo_all'
+
+           # Archives containing C++ object files must be created using
+           # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+           ;;
+          gcx*)
+           # Green Hills C++ Compiler
+           archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+           # The C++ compiler must be used to create the archive.
+           old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+           ;;
+          *)
+           # GNU C++ compiler with Solaris linker
+           if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+             no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+             if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+               archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                 $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+             else
+               # g++ 2.7 appears to require `-G' NOT `-shared' on this
+               # platform.
+               archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+             fi
+
+             hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+             case $host_os in
+               solaris2.[0-5] | solaris2.[0-5].*) ;;
+               *)
+                 whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+                 ;;
+             esac
+           fi
+           ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_CXX='${wl}-z,text'
+      archive_cmds_need_lc_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+         archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+       # Note: We can NOT use -z defs as we might desire, because we do not
+       # link with -lc, and that would cause any symbols used from libc to
+       # always be unresolved, which means just about no library would
+       # ever link correctly.  If we're not using GNU ld we use -z text
+       # though, which does catch some bad symbols but isn't as heavy-handed
+       # as -z defs.
+       no_undefined_flag_CXX='${wl}-z,text'
+       allow_undefined_flag_CXX='${wl}-z,nodefs'
+       archive_cmds_need_lc_CXX=no
+       hardcode_shlibpath_var_CXX=no
+       hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
+       hardcode_libdir_separator_CXX=':'
+       link_all_deplibs_CXX=yes
+       export_dynamic_flag_spec_CXX='${wl}-Bexport'
+       runpath_var='LD_RUN_PATH'
+
+       case $cc_basename in
+          CC*)
+           archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
+             '"$old_archive_cmds_CXX"
+           reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
+             '"$reload_cmds_CXX"
+           ;;
+         *)
+           archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           ;;
+       esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+           # NonStop-UX NCC 3.20
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+    esac
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+    test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+    GCC_CXX="$GXX"
+    LD_CXX="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    # Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+        prev=$p
+        continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+        case ${prev} in
+        -L | -R)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$compiler_lib_search_path_CXX"; then
+            compiler_lib_search_path_CXX="${prev}${p}"
+          else
+            compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$postdeps_CXX"; then
+          postdeps_CXX="${prev}${p}"
+        else
+          postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+        fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        if test -z "$predep_objects_CXX"; then
+          predep_objects_CXX="$p"
+        else
+          predep_objects_CXX="$predep_objects_CXX $p"
+        fi
+       else
+        if test -z "$postdep_objects_CXX"; then
+          postdep_objects_CXX="$p"
+        else
+          postdep_objects_CXX="$postdep_objects_CXX $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+ compiler_lib_search_dirs_CXX=
+if test -n "${compiler_lib_search_path_CXX}"; then
+ compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic_CXX='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static_CXX=
+      ;;
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       ;;
+      *)
+       lt_prog_compiler_pic_CXX='-fPIC'
+       ;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_CXX='-fPIC -shared'
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[4-9]*)
+       # All AIX code is PIC.
+       if test "$host_cpu" = ia64; then
+         # AIX 5 now supports IA64 processor
+         lt_prog_compiler_static_CXX='-Bstatic'
+       else
+         lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68*)
+         # Green Hills C++ Compiler
+         # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+       # This hack is so that the source file can tell whether it is being
+       # built for inclusion in a dll (and should export symbols for example).
+       lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++*)
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         ghcx*)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | dragonfly*)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+           if test "$host_cpu" != ia64; then
+             lt_prog_compiler_pic_CXX='+Z'
+           fi
+           ;;
+         aCC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+           case $host_cpu in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             lt_prog_compiler_pic_CXX='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      interix*)
+       # This is c89, which is MS Visual C++ (no shared libs)
+       # Anyone wants to do a port?
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           lt_prog_compiler_pic_CXX='-fPIC'
+           ;;
+         ecpc* )
+           # old Intel C++ for x86_64 which still supported -KPIC.
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-static'
+           ;;
+         icpc* )
+           # Intel C++, used to be incompatible with GCC.
+           # ICC 10 doesn't accept -KPIC any more.
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-fPIC'
+           lt_prog_compiler_static_CXX='-static'
+           ;;
+         pgCC* | pgcpp*)
+           # Portland Group C++ compiler
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-fpic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         cxx*)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
+           # IBM XL 8.0, 9.0 on PPC and BlueGene
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-qpic'
+           lt_prog_compiler_static_CXX='-qstaticlink'
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             lt_prog_compiler_pic_CXX='-KPIC'
+             lt_prog_compiler_static_CXX='-Bstatic'
+             lt_prog_compiler_wl_CXX='-Qoption ld '
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx*)
+           lt_prog_compiler_pic_CXX='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd* | netbsdelf*-gnu)
+       ;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        lt_prog_compiler_pic_CXX='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC*)
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           ;;
+         RCC*)
+           # Rational C++ 2.4.1
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         cxx*)
+           # Digital/Compaq C++
+           lt_prog_compiler_wl_CXX='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC* | sunCC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           lt_prog_compiler_wl_CXX='-Qoption ld '
+           ;;
+         gcx*)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.x
+           lt_prog_compiler_pic_CXX='-pic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         lcc*)
+           # Lucid
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC*)
+           # NonStop-UX NCC 3.20
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      vxworks*)
+       ;;
+      *)
+       lt_prog_compiler_can_build_shared_CXX=no
+       ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; }
+lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works_CXX=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  case $host_os in
+  aix[4-9]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*)
+      exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
+    *)
+      export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+      ;;
+    esac
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
+    link_all_deplibs_CXX=no
+    ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+with_gnu_ld_CXX=$with_gnu_ld
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+       if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+         soname=conftest
+         lib=conftest
+         libobjs=conftest.$ac_objext
+         deplibs=
+         wl=$lt_prog_compiler_wl_CXX
+         pic_flag=$lt_prog_compiler_pic_CXX
+         compiler_flags=-v
+         linker_flags=-v
+         verstring=
+         output_objdir=.
+         libname=conftest
+         lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+         allow_undefined_flag_CXX=
+         if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+         then
+           lt_cv_archive_cmds_need_lc_CXX=no
+         else
+           lt_cv_archive_cmds_need_lc_CXX=yes
+         fi
+         allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+       else
+         cat conftest.err 1>&5
+       fi
+       $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
+      archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[23].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[3-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux # correct to gnu/linux during the next big refactor
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \
+        LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[      ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" ||
+   test -n "$runpath_var_CXX" ||
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink ||
+   test "$inherit_rpath_CXX" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+        ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+
+# Checks for libraries.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5
+$as_echo_n "checking for main in -lm... " >&6; }
+if ${ac_cv_lib_m_main+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_main=yes
+else
+  ac_cv_lib_m_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5
+$as_echo "$ac_cv_lib_m_main" >&6; }
+if test "x$ac_cv_lib_m_main" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+
+
+# Checks for header files.
+for ac_header in stdint.h stdlib.h string.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
+$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
+if ${ac_cv_header_stdbool_h+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdbool.h>
+#ifndef bool
+ "error: bool is not defined"
+#endif
+#ifndef false
+ "error: false is not defined"
+#endif
+#if false
+ "error: false is not 0"
+#endif
+#ifndef true
+ "error: true is not defined"
+#endif
+#if true != 1
+ "error: true is not 1"
+#endif
+#ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+#endif
+
+       struct s { _Bool s: 1; _Bool t; } s;
+
+       char a[true == 1 ? 1 : -1];
+       char b[false == 0 ? 1 : -1];
+       char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+       char d[(bool) 0.5 == true ? 1 : -1];
+       /* See body of main program for 'e'.  */
+       char f[(_Bool) 0.0 == false ? 1 : -1];
+       char g[true];
+       char h[sizeof (_Bool)];
+       char i[sizeof s.t];
+       enum { j = false, k = true, l = false * true, m = true * 256 };
+       /* The following fails for
+          HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+       _Bool n[m];
+       char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+       char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+       /* Catch a bug in an HP-UX C compiler.  See
+          http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+          http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+        */
+       _Bool q = true;
+       _Bool *pq = &q;
+
+int
+main ()
+{
+
+       bool e = &s;
+       *pq |= q;
+       *pq |= ! q;
+       /* Refer to every declared value, to avoid compiler optimizations.  */
+       return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+               + !m + !n + !o + !p + !q + !pq);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdbool_h=yes
+else
+  ac_cv_header_stdbool_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
+$as_echo "$ac_cv_header_stdbool_h" >&6; }
+ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
+if test "x$ac_cv_type__Bool" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+  inline | yes) ;;
+  *)
+    case $ac_cv_c_inline in
+      no) ac_val=;;
+      *) ac_val=$ac_cv_c_inline;;
+    esac
+    cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+    ;;
+esac
+
+ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t"
+case $ac_cv_c_int16_t in #(
+  no|yes) ;; #(
+  *)
+
+cat >>confdefs.h <<_ACEOF
+#define int16_t $ac_cv_c_int16_t
+_ACEOF
+;;
+esac
+
+ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
+case $ac_cv_c_int32_t in #(
+  no|yes) ;; #(
+  *)
+
+cat >>confdefs.h <<_ACEOF
+#define int32_t $ac_cv_c_int32_t
+_ACEOF
+;;
+esac
+
+ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t"
+case $ac_cv_c_int64_t in #(
+  no|yes) ;; #(
+  *)
+
+cat >>confdefs.h <<_ACEOF
+#define int64_t $ac_cv_c_int64_t
+_ACEOF
+;;
+esac
+
+ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t"
+case $ac_cv_c_int8_t in #(
+  no|yes) ;; #(
+  *)
+
+cat >>confdefs.h <<_ACEOF
+#define int8_t $ac_cv_c_int8_t
+_ACEOF
+;;
+esac
+
+ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t"
+case $ac_cv_c_uint16_t in #(
+  no|yes) ;; #(
+  *)
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint16_t $ac_cv_c_uint16_t
+_ACEOF
+;;
+  esac
+
+ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
+case $ac_cv_c_uint32_t in #(
+  no|yes) ;; #(
+  *)
+
+$as_echo "#define _UINT32_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint32_t $ac_cv_c_uint32_t
+_ACEOF
+;;
+  esac
+
+ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t"
+case $ac_cv_c_uint64_t in #(
+  no|yes) ;; #(
+  *)
+
+$as_echo "#define _UINT64_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint64_t $ac_cv_c_uint64_t
+_ACEOF
+;;
+  esac
+
+ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
+case $ac_cv_c_uint8_t in #(
+  no|yes) ;; #(
+  *)
+
+$as_echo "#define _UINT8_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint8_t $ac_cv_c_uint8_t
+_ACEOF
+;;
+  esac
+
+
+# Checks for library functions.
+for ac_header in stdlib.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdlib_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_STDLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
+$as_echo_n "checking for GNU libc compatible malloc... " >&6; }
+if ${ac_cv_func_malloc_0_nonnull+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_malloc_0_nonnull=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+return ! malloc (0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_malloc_0_nonnull=yes
+else
+  ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5
+$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; }
+if test $ac_cv_func_malloc_0_nonnull = yes; then :
+
+$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
+
+else
+  $as_echo "#define HAVE_MALLOC 0" >>confdefs.h
+
+   case " $LIBOBJS " in
+  *" malloc.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS malloc.$ac_objext"
+ ;;
+esac
+
+
+$as_echo "#define malloc rpl_malloc" >>confdefs.h
+
+fi
+
+
+for ac_func in memset
+do :
+  ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset"
+if test "x$ac_cv_func_memset" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMSET 1
+_ACEOF
+
+fi
+done
+
+
+# OpenCORE AMR soname version to use
+# goes by â€˜current[:revision[:age]]’ with the soname ending up as
+# current.age.revision.
+OPENCORE_AMRNB_VERSION=0:3:0
+OPENCORE_AMRWB_VERSION=0:3:0
+
+
+
+ac_config_files="$ac_config_files Makefile amrnb/Makefile amrwb/Makefile test/Makefile amrnb/opencore-amrnb.pc amrwb/opencore-amrwb.pc"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
+      sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    if test "x$cache_file" != "x/dev/null"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+       cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+         mv -f confcache "$cache_file"$$ &&
+         mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+         mv -f confcache "$cache_file" ;;
+       esac
+      fi
+    fi
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+ if test -n "$EXEEXT"; then
+  am__EXEEXT_TRUE=
+  am__EXEEXT_FALSE='#'
+else
+  am__EXEEXT_TRUE='#'
+  am__EXEEXT_FALSE=
+fi
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+  as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${COMPILE_AS_C_TRUE}" && test -z "${COMPILE_AS_C_FALSE}"; then
+  as_fn_error $? "conditional \"COMPILE_AS_C\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GCC_ARMV5_TRUE}" && test -z "${GCC_ARMV5_FALSE}"; then
+  as_fn_error $? "conditional \"GCC_ARMV5\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${AMRNB_ENCODER_TRUE}" && test -z "${AMRNB_ENCODER_FALSE}"; then
+  as_fn_error $? "conditional \"AMRNB_ENCODER\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${AMRNB_DECODER_TRUE}" && test -z "${AMRNB_DECODER_FALSE}"; then
+  as_fn_error $? "conditional \"AMRNB_DECODER\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${EXAMPLES_TRUE}" && test -z "${EXAMPLES_FALSE}"; then
+  as_fn_error $? "conditional \"EXAMPLES\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+       expr "X$arg" : "X\\(.*\\)$as_nl";
+       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='        ';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+       test -d "$1/.";
+      else
+       case $1 in #(
+       -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by opencore-amr $as_me 0.1.3, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <http://sourceforge.net/projects/opencore-amr/>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+opencore-amr config.status 0.1.3
+configured by $0, generated by GNU Autoconf 2.68,
+  with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=?*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
+    esac
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+  --help | --hel | -h )
+    $as_echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+  *) as_fn_append ac_config_targets " $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
+  export CONFIG_SHELL
+  exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
+predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
+postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
+reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+PATH_SEPARATOR \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
+AR \
+AR_FLAGS \
+archiver_list_spec \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+nm_file_list_spec \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_pic \
+lt_prog_compiler_wl \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+MANIFEST_TOOL \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_separator \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib \
+compiler_lib_search_dirs \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+reload_flag_CXX \
+compiler_CXX \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_static_CXX \
+lt_cv_prog_compiler_c_o_CXX \
+export_dynamic_flag_spec_CXX \
+whole_archive_flag_spec_CXX \
+compiler_needs_object_CXX \
+with_gnu_ld_CXX \
+allow_undefined_flag_CXX \
+no_undefined_flag_CXX \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_separator_CXX \
+exclude_expsyms_CXX \
+include_expsyms_CXX \
+file_list_spec_CXX \
+compiler_lib_search_dirs_CXX \
+predep_objects_CXX \
+postdep_objects_CXX \
+predeps_CXX \
+postdeps_CXX \
+compiler_lib_search_path_CXX; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postlink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec \
+reload_cmds_CXX \
+old_archive_cmds_CXX \
+old_archive_from_new_cmds_CXX \
+old_archive_from_expsyms_cmds_CXX \
+archive_cmds_CXX \
+archive_expsym_cmds_CXX \
+module_cmds_CXX \
+module_expsym_cmds_CXX \
+export_symbols_cmds_CXX \
+prelink_cmds_CXX \
+postlink_cmds_CXX; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'
+
+
+
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "amrnb/Makefile") CONFIG_FILES="$CONFIG_FILES amrnb/Makefile" ;;
+    "amrwb/Makefile") CONFIG_FILES="$CONFIG_FILES amrwb/Makefile" ;;
+    "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
+    "amrnb/opencore-amrnb.pc") CONFIG_FILES="$CONFIG_FILES amrnb/opencore-amrnb.pc" ;;
+    "amrwb/opencore-amrwb.pc") CONFIG_FILES="$CONFIG_FILES amrwb/opencore-amrwb.pc" ;;
+
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp= ac_tmp=
+  trap 'exit_status=$?
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+  trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\\r'
+else
+  ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  . ./conf$$subs.sh ||
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = "\a"
+
+}
+{
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
+
+  print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+  cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=[    ]*/{
+h
+s///
+s/^/:/
+s/[     ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[  ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[      ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[    ]*#[    ]*define[       ][      ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[    ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[        ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[    ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[        ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = "\a"
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$ac_tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+        # (if the path is not absolute).  The absolute path cannot be DOS-style,
+        # because $ac_f cannot contain `:'.
+        test -f "$ac_f" ||
+          case $ac_f in
+          [\\/$]*) false;;
+          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+          esac ||
+          as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+      esac
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      as_fn_append ac_file_inputs " '$ac_f'"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input='Generated from '`
+         $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+       `' by configure.'
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+    fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  as_dir="$ac_dir"; as_fn_mkdir_p
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+  s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&2;}
+
+  rm -f "$ac_tmp/stdin"
+  case $ac_file in
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+  esac \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+  if test x"$ac_file" != x-; then
+    {
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f "$ac_file"
+      mv "$ac_tmp/config.h" "$ac_file" \
+       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    fi
+  else
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
+  fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$_am_arg" : 'X\(//\)[^/]' \| \
+        X"$_am_arg" : 'X\(//\)$' \| \
+        X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      as_dir=$dirpart/$fdir; as_fn_mkdir_p
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+ ;;
+    "libtool":C)
+
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags="CXX "
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method = "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
+# The archiver.
+AR=$lt_AR
+
+# Flags to create an archive.
+AR_FLAGS=$lt_AR_FLAGS
+
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
+
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+
+    cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_CXX
+reload_cmds=$lt_reload_cmds_CXX
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
+
+# A language specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_CXX
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute_CXX
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
+
+ ;;
+
+  esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..8b0f504
--- /dev/null
@@ -0,0 +1,93 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_INIT([opencore-amr], [0.1.3], [http://sourceforge.net/projects/opencore-amr/])
+AC_CONFIG_AUX_DIR(.)
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([tar-ustar])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+AC_CONFIG_HEADERS([config.h])
+AM_MAINTAINER_MODE
+
+# Cross compiling support
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+
+# Various options for configure
+AC_ARG_ENABLE([compile-c],
+            [AS_HELP_STRING([--enable-compile-c],
+               [enable compiling as C program (default is yes)])],
+            [compile_as_c=$enableval],
+            [compile_as_c=yes])
+AC_ARG_ENABLE([gcc-armv5],
+            [AS_HELP_STRING([--enable-gcc-armv5],
+               [enable GCC specific ARMv5 assembler (default is no)])],
+            [gcc_armv5=$enableval], [gcc_armv5=no])
+AC_ARG_ENABLE([amrnb-encoder],
+            [AS_HELP_STRING([--enable-amrnb-encoder],
+               [enable AMR-NB encoder (default is yes)])],
+            [amrnb_encoder=$enableval], [amrnb_encoder=yes])
+AC_ARG_ENABLE([amrnb-decoder],
+            [AS_HELP_STRING([--enable-amrnb-decoder],
+               [enable AMR-NB decoder (default is yes)])],
+            [amrnb_decoder=$enableval], [amrnb_decoder=yes])
+AC_ARG_ENABLE([examples],
+            [AS_HELP_STRING([--enable-examples],
+               [enable example encoding/decoding programs (default is no)])],
+            [examples=$enableval], [examples=no])
+
+# Automake conditionals to set
+AM_CONDITIONAL(COMPILE_AS_C, test x$compile_as_c = xyes)
+AM_CONDITIONAL(GCC_ARMV5, test x$gcc_armv5 = xyes)
+AM_CONDITIONAL(AMRNB_ENCODER, test x$amrnb_encoder = xyes)
+AM_CONDITIONAL(AMRNB_DECODER, test x$amrnb_decoder = xyes)
+AM_CONDITIONAL(EXAMPLES, test x$examples = xyes)
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+# Setup for libtool
+AC_PROG_LIBTOOL
+AC_SUBST(LIBTOOL_DEPS)
+
+# Checks for libraries.
+AC_CHECK_LIB([m], [main])
+
+# Checks for header files.
+AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_INLINE
+AC_TYPE_INT16_T
+AC_TYPE_INT32_T
+AC_TYPE_INT64_T
+AC_TYPE_INT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT64_T
+AC_TYPE_UINT8_T
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([memset])
+
+# OpenCORE AMR soname version to use
+# goes by â€˜current[:revision[:age]]’ with the soname ending up as
+# current.age.revision.
+OPENCORE_AMRNB_VERSION=0:3:0
+OPENCORE_AMRWB_VERSION=0:3:0
+AC_SUBST(OPENCORE_AMRNB_VERSION)
+AC_SUBST(OPENCORE_AMRWB_VERSION)
+
+AC_CONFIG_FILES([Makefile
+                 amrnb/Makefile
+                 amrwb/Makefile
+                 test/Makefile
+                 amrnb/opencore-amrnb.pc
+                 amrwb/opencore-amrwb.pc])
+AC_OUTPUT
diff --git a/depcomp b/depcomp
new file mode 100755 (executable)
index 0000000..bd0ac08
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,688 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2011-12-04.11; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
+# 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputting dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+   # This is just like msvisualcpp but w/o cygpath translation.
+   # Just convert the backslash-escaped backslashes to single forward
+   # slashes to satisfy depend.m4
+   cygpath_u='sed s,\\\\,/,g'
+   depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+   # This is just like msvc7 but w/o cygpath translation.
+   # Just convert the backslash-escaped backslashes to single forward
+   # slashes to satisfy depend.m4
+   cygpath_u='sed s,\\\\,/,g'
+   depmode=msvc7
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.  hp depmode also adds that space, but also prefixes the VPATH
+## to the object.  Take care to not repeat it in the output.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+      | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> "$depfile"
+    echo >> "$depfile"
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$base.u
+    tmpdepfile3=$dir.libs/$base.u
+    "$@" -Wc,-M
+  else
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$dir$base.u
+    tmpdepfile3=$dir$base.u
+    "$@" -M
+  fi
+  stat=$?
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+    # That's a tab and a space in the [].
+    sed -e 's,^.*\.[a-z]*:[     ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add `dependent.h:' lines.
+    sed -ne '2,${
+              s/^ *//
+              s/ \\*$//
+              s/$/:/
+              p
+            }' "$tmpdepfile" >> "$depfile"
+  else
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mechanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+msvc7)
+  if test "$libtool" = yes; then
+    showIncludes=-Wc,-showIncludes
+  else
+    showIncludes=-showIncludes
+  fi
+  "$@" $showIncludes > "$tmpdepfile"
+  stat=$?
+  grep -v '^Note: including file: ' "$tmpdepfile"
+  if test "$stat" = 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The first sed program below extracts the file names and escapes
+  # backslashes for cygpath.  The second sed program outputs the file
+  # name when reading, but also accumulates all include files in the
+  # hold buffer in order to output them again at the end.  This only
+  # works with sed implementations that can handle large buffers.
+  sed < "$tmpdepfile" -n '
+/^Note: including file:  *\(.*\)/ {
+  s//\1/
+  s/\\/\\\\/g
+  p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/      \1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+  s/.*/        /
+  G
+  p
+}' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvc7msys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no eat=no
+  for arg
+  do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    if test $eat = yes; then
+      eat=no
+      continue
+    fi
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -arch)
+      eat=yes ;;
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix=`echo "$object" | sed 's/^.*\././'`
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  # makedepend may prepend the VPATH from the source file name to the object.
+  # No need to regex-escape $object, excess matching of '.' is harmless.
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+       set fnord "$@"
+       shift
+       shift
+       ;;
+    *)
+       set fnord "$@" "$arg"
+       shift
+       shift
+       ;;
+    esac
+  done
+  "$@" -E 2>/dev/null |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::     \1 \\:p' >> "$depfile"
+  echo "       " >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvcmsys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/install-sh b/install-sh
new file mode 100755 (executable)
index 0000000..a9244eb
--- /dev/null
@@ -0,0 +1,527 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2011-01-19.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" ""       $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
+
+    -C) copy_on_change=true;;
+
+    -d) dir_arg=true;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+       shift;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+       case $mode in
+         *' '* | *'    '* | *'
+'*       | *'*'* | *'?'* | *'['*)
+           echo "$0: invalid mode: $mode" >&2
+           exit 1;;
+       esac
+       shift;;
+
+    -o) chowncmd="$chownprog $2"
+       shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t) dst_arg=$2
+       # Protect names problematic for `test' and other utilities.
+       case $dst_arg in
+         -* | [=\(\)!]) dst_arg=./$dst_arg;;
+       esac
+       shift;;
+
+    -T) no_target_directory=true;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)        shift
+       break;;
+
+    -*)        echo "$0: invalid option: $1" >&2
+       exit 1;;
+
+    *)  break;;
+  esac
+  shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+    # Protect names problematic for `test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+       u_plus_rw=
+      else
+       u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+       u_plus_rw=
+      else
+       u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names problematic for `test' and other utilities.
+  case $src in
+    -* | [=\(\)!]) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+    dst=$dst_arg
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+       echo "$0: $dst_arg: Is a directory" >&2
+       exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+       (dirname "$dst") 2>/dev/null ||
+       expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+            X"$dst" : 'X\(//\)[^/]' \| \
+            X"$dst" : 'X\(//\)$' \| \
+            X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+       echo X"$dst" |
+           sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\/\)[^/].*/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\/\)$/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\).*/{
+                  s//\1/
+                  q
+                }
+                s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+       # Create intermediate dirs using mode 755 as modified by the umask.
+       # This is like FreeBSD 'install' as of 1997-10-28.
+       umask=`umask`
+       case $stripcmd.$umask in
+         # Optimize common cases.
+         *[2367][2367]) mkdir_umask=$umask;;
+         .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+         *[0-7])
+           mkdir_umask=`expr $umask + 22 \
+             - $umask % 100 % 40 + $umask % 20 \
+             - $umask % 10 % 4 + $umask % 2
+           `;;
+         *) mkdir_umask=$umask,go-w;;
+       esac
+
+       # With -d, create the new directory with the user-specified mode.
+       # Otherwise, rely on $mkdir_umask.
+       if test -n "$dir_arg"; then
+         mkdir_mode=-m$mode
+       else
+         mkdir_mode=
+       fi
+
+       posix_mkdir=false
+       case $umask in
+         *[123567][0-7][0-7])
+           # POSIX mkdir -p sets u+wx bits regardless of umask, which
+           # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+           ;;
+         *)
+           tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+           trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+           if (umask $mkdir_umask &&
+               exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+           then
+             if test -z "$dir_arg" || {
+                  # Check for POSIX incompatibilities with -m.
+                  # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+                  # other-writeable bit of parent directory when it shouldn't.
+                  # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+                  ls_ld_tmpdir=`ls -ld "$tmpdir"`
+                  case $ls_ld_tmpdir in
+                    d????-?r-*) different_mode=700;;
+                    d????-?--*) different_mode=755;;
+                    *) false;;
+                  esac &&
+                  $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+                    ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+                    test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+                  }
+                }
+             then posix_mkdir=:
+             fi
+             rmdir "$tmpdir/d" "$tmpdir"
+           else
+             # Remove any dirs left behind by ancient mkdir implementations.
+             rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+           fi
+           trap '' 0;;
+       esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+       umask $mkdir_umask &&
+       $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+       /*) prefix='/';;
+       [-=\(\)!]*) prefix='./';;
+       *)  prefix='';;
+      esac
+
+      eval "$initialize_posix_glob"
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob set -f
+      set fnord $dstdir
+      shift
+      $posix_glob set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+       test X"$d" = X && continue
+
+       prefix=$prefix$d
+       if test -d "$prefix"; then
+         prefixes=
+       else
+         if $posix_mkdir; then
+           (umask=$mkdir_umask &&
+            $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+           # Don't fail if two instances are running concurrently.
+           test -d "$prefix" || exit 1
+         else
+           case $prefix in
+             *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+             *) qprefix=$prefix;;
+           esac
+           prefixes="$prefixes '$qprefix'"
+         fi
+       fi
+       prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+       # Don't fail if two instances are running concurrently.
+       (umask $mkdir_umask &&
+        eval "\$doit_exec \$mkdirprog $prefixes") ||
+         test -d "$dstdir" || exit 1
+       obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"    2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
+
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+       # Now remove or move aside any old file at destination location.
+       # We try this two ways since rm can't unlink itself on some
+       # systems and the destination file might be busy for other
+       # reasons.  In this case, the final cleanup might fail but the new
+       # file should still install successfully.
+       {
+         test ! -f "$dst" ||
+         $doit $rmcmd -f "$dst" 2>/dev/null ||
+         { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+           { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+         } ||
+         { echo "$0: cannot unlink or rename $dst" >&2
+           (exit 1); exit 1
+         }
+       } &&
+
+       # Now rename the file to the real destination.
+       $doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/ltmain.sh b/ltmain.sh
new file mode 100644 (file)
index 0000000..c7d06c3
--- /dev/null
+++ b/ltmain.sh
@@ -0,0 +1,9661 @@
+
+# libtool (GNU libtool) 2.4.2
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+#       --config             show all configuration variables
+#       --debug              enable verbose shell tracing
+#   -n, --dry-run            display commands without modifying any files
+#       --features           display basic configuration information and exit
+#       --mode=MODE          use operation mode MODE
+#       --preserve-dup-deps  don't remove duplicate dependency libraries
+#       --quiet, --silent    don't print informational messages
+#       --no-quiet, --no-silent
+#                            print informational messages (default)
+#       --no-warn            don't display warning messages
+#       --tag=TAG            use configuration variables from tag TAG
+#   -v, --verbose            print more informational messages than default
+#       --no-verbose         don't print the extra informational messages
+#       --version            print version information
+#   -h, --help, --help-all   print short, long, or detailed help message
+#
+# MODE must be one of the following:
+#
+#         clean              remove files from the build directory
+#         compile            compile a source file into a libtool object
+#         execute            automatically set library path, then run a program
+#         finish             complete the installation of libtool libraries
+#         install            install libraries or executables
+#         link               create a library or an executable
+#         uninstall          remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE.  When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+#         host-triplet:        $host
+#         shell:               $SHELL
+#         compiler:            $LTCC
+#         compiler flags:              $LTCFLAGS
+#         linker:              $LD (gnu? $with_gnu_ld)
+#         $progname:   (GNU libtool) 2.4.2 Debian-2.4.2-1
+#         automake:    $automake_version
+#         autoconf:    $autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION="2.4.2 Debian-2.4.2-1"
+TIMESTAMP=""
+package_revision=1.3337
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# NLS nuisances: We save the old values to restore during execute mode.
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+          save_$lt_var=\$$lt_var
+          $lt_var=C
+         export $lt_var
+         lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+         lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+       fi"
+done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
+
+$lt_unset CDPATH
+
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+
+
+: ${CP="cp -f"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77     # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS="  $lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+    # Extract subdirectory from the argument.
+    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+    case ${2} in
+      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+    esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+               s@/\./@/@g
+               t dotsl
+               s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+#             value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+  # Start from root dir and reassemble the path.
+  func_normal_abspath_result=
+  func_normal_abspath_tpath=$1
+  func_normal_abspath_altnamespace=
+  case $func_normal_abspath_tpath in
+    "")
+      # Empty path, that just means $cwd.
+      func_stripname '' '/' "`pwd`"
+      func_normal_abspath_result=$func_stripname_result
+      return
+    ;;
+    # The next three entries are used to spot a run of precisely
+    # two leading slashes without using negated character classes;
+    # we take advantage of case's first-match behaviour.
+    ///*)
+      # Unusual form of absolute path, do nothing.
+    ;;
+    //*)
+      # Not necessarily an ordinary path; POSIX reserves leading '//'
+      # and for example Cygwin uses it to access remote file shares
+      # over CIFS/SMB, so we conserve a leading double slash if found.
+      func_normal_abspath_altnamespace=/
+    ;;
+    /*)
+      # Absolute path, do nothing.
+    ;;
+    *)
+      # Relative path, prepend $cwd.
+      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+    ;;
+  esac
+  # Cancel out all the simple stuff to save iterations.  We also want
+  # the path to end with a slash for ease of parsing, so make sure
+  # there is one (and only one) here.
+  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+  while :; do
+    # Processed it all yet?
+    if test "$func_normal_abspath_tpath" = / ; then
+      # If we ascended to the root using ".." the result may be empty now.
+      if test -z "$func_normal_abspath_result" ; then
+        func_normal_abspath_result=/
+      fi
+      break
+    fi
+    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcar"`
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcdr"`
+    # Figure out what to do with it
+    case $func_normal_abspath_tcomponent in
+      "")
+        # Trailing empty path component, ignore it.
+      ;;
+      ..)
+        # Parent dir; strip last assembled component from result.
+        func_dirname "$func_normal_abspath_result"
+        func_normal_abspath_result=$func_dirname_result
+      ;;
+      *)
+        # Actual path component, append it.
+        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+      ;;
+    esac
+  done
+  # Restore leading double-slash if one was found on entry.
+  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+#             value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+  func_relative_path_result=
+  func_normal_abspath "$1"
+  func_relative_path_tlibdir=$func_normal_abspath_result
+  func_normal_abspath "$2"
+  func_relative_path_tbindir=$func_normal_abspath_result
+
+  # Ascend the tree starting from libdir
+  while :; do
+    # check if we have found a prefix of bindir
+    case $func_relative_path_tbindir in
+      $func_relative_path_tlibdir)
+        # found an exact match
+        func_relative_path_tcancelled=
+        break
+        ;;
+      $func_relative_path_tlibdir*)
+        # found a matching prefix
+        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+        func_relative_path_tcancelled=$func_stripname_result
+        if test -z "$func_relative_path_result"; then
+          func_relative_path_result=.
+        fi
+        break
+        ;;
+      *)
+        func_dirname $func_relative_path_tlibdir
+        func_relative_path_tlibdir=${func_dirname_result}
+        if test "x$func_relative_path_tlibdir" = x ; then
+          # Have to descend all the way to the root!
+          func_relative_path_result=../$func_relative_path_result
+          func_relative_path_tcancelled=$func_relative_path_tbindir
+          break
+        fi
+        func_relative_path_result=../$func_relative_path_result
+        ;;
+    esac
+  done
+
+  # Now calculate path; take care to avoid doubling-up slashes.
+  func_stripname '' '/' "$func_relative_path_result"
+  func_relative_path_result=$func_stripname_result
+  func_stripname '/' '/' "$func_relative_path_tcancelled"
+  if test "x$func_stripname_result" != x ; then
+    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+  fi
+
+  # Normalisation. If bindir is libdir, return empty string,
+  # else relative path ending with a slash; either way, target
+  # file name can be directly appended.
+  if test ! -z "$func_relative_path_result"; then
+    func_stripname './' '' "$func_relative_path_result/"
+    func_relative_path_result=$func_stripname_result
+  fi
+}
+
+# The name of this program:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+  [\\/]*|[A-Za-z]:\\*) ;;
+  *[\\/]*)
+     progdir=$func_dirname_result
+     progdir=`cd "$progdir" && pwd`
+     progpath="$progdir/$progname"
+     ;;
+  *)
+     save_IFS="$IFS"
+     IFS=${PATH_SEPARATOR-:}
+     for progdir in $PATH; do
+       IFS="$save_IFS"
+       test -x "$progdir/$progname" && break
+     done
+     IFS="$save_IFS"
+     test -n "$progdir" || progdir=`pwd`
+     progpath="$progdir/$progname"
+     ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes.  A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+  s/$bs4/&\\
+/g
+  s/^$bs2$dollar/$bs&/
+  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+  s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $opt_verbose && func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+
+    # bash bug again:
+    :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+    func_error ${1+"$@"}
+    func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information."  ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+    $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+    my_directory_path="$1"
+    my_dir_list=
+
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+      # Protect directory names starting with `-'
+      case $my_directory_path in
+        -*) my_directory_path="./$my_directory_path" ;;
+      esac
+
+      # While some portion of DIR does not yet exist...
+      while test ! -d "$my_directory_path"; do
+        # ...make a list in topmost first order.  Use a colon delimited
+       # list incase some portion of path contains whitespace.
+        my_dir_list="$my_directory_path:$my_dir_list"
+
+        # If the last portion added has no slash in it, the list is done
+        case $my_directory_path in */*) ;; *) break ;; esac
+
+        # ...otherwise throw away the child directory and loop
+        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+      done
+      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+
+      save_mkdir_p_IFS="$IFS"; IFS=':'
+      for my_dir in $my_dir_list; do
+       IFS="$save_mkdir_p_IFS"
+        # mkdir can fail with a `File exist' error if two processes
+        # try to create one of the directories concurrently.  Don't
+        # stop in that case!
+        $MKDIR "$my_dir" 2>/dev/null || :
+      done
+      IFS="$save_mkdir_p_IFS"
+
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
+    fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$opt_dry_run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+        # Failing that, at least try and use $RANDOM to avoid a race
+        my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+        save_mktempdir_umask=`umask`
+        umask 0077
+        $MKDIR "$my_tmpdir"
+        umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || \
+        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+    fi
+
+    $ECHO "$my_tmpdir"
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+    case $1 in
+      *[\\\`\"\$]*)
+       func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+      *)
+        func_quote_for_eval_unquoted_result="$1" ;;
+    esac
+
+    case $func_quote_for_eval_unquoted_result in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting, command substitution and and variable
+      # expansion for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+        ;;
+      *)
+        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+    esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+    case $1 in
+      *[\\\`\"]*)
+       my_arg=`$ECHO "$1" | $SED \
+           -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+      *)
+        my_arg="$1" ;;
+    esac
+
+    case $my_arg in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting and command substitution for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+        my_arg="\"$my_arg\""
+        ;;
+    esac
+
+    func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$my_cmd"
+      my_status=$?
+      if test "$my_status" -eq 0; then :; else
+       eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.  Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$lt_user_locale
+           $my_cmd"
+      my_status=$?
+      eval "$lt_safe_locale"
+      if test "$my_status" -eq 0; then :; else
+       eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+  case $1 in
+  [0-9]* | *[!a-zA-Z0-9_]*)
+    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+    ;;
+  * )
+    func_tr_sh_result=$1
+    ;;
+  esac
+}
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $opt_debug
+
+    $SED -n '/(C)/!b go
+       :more
+       /\./!{
+         N
+         s/\n# / /
+         b more
+       }
+       :go
+       /^# '$PROGRAM' (GNU /,/# warranty; / {
+        s/^# //
+       s/^# *$//
+        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+        p
+     }' < "$progpath"
+     exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/^#  *.*--help/ {
+        s/^# //
+       s/^# *$//
+       s/\$progname/'$progname'/
+       p
+    }' < "$progpath"
+    echo
+    $ECHO "run \`$progname --help | more' for full usage"
+    exit $?
+}
+
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
+func_help ()
+{
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/# Report bugs to/ {
+       :print
+        s/^# //
+       s/^# *$//
+       s*\$progname*'$progname'*
+       s*\$host*'"$host"'*
+       s*\$SHELL*'"$SHELL"'*
+       s*\$LTCC*'"$LTCC"'*
+       s*\$LTCFLAGS*'"$LTCFLAGS"'*
+       s*\$LD*'"$LD"'*
+       s/\$with_gnu_ld/'"$with_gnu_ld"'/
+       s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+       s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
+       p
+       d
+     }
+     /^# .* home page:/b print
+     /^# General help using/b print
+     ' < "$progpath"
+    ret=$?
+    if test -z "$1"; then
+      exit $ret
+    fi
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+    $opt_debug
+
+    func_error "missing argument for $1."
+    exit_cmd=exit
+}
+
+
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
+
+
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+    my_sed_long_arg='1s/^--[^=]*=//'
+
+    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
+
+
+
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+nonopt=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+    eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+    func_quote_for_eval "${2}"
+    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+    func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+    func_error ${1+"$@"}
+    func_error "See the $PACKAGE documentation for more information."
+    func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+    re_begincf='^# ### BEGIN LIBTOOL'
+    re_endcf='^# ### END LIBTOOL'
+
+    # Default configuration.
+    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+    done
+
+    exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+    echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      echo "enable shared libraries"
+    else
+      echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      echo "enable static libraries"
+    else
+      echo "disable static libraries"
+    fi
+
+    exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+  # Global variable:
+  tagname="$1"
+
+  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+  sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+  # Validate tagname.
+  case $tagname in
+    *[!-_A-Za-z0-9,/]*)
+      func_fatal_error "invalid tag name: $tagname"
+      ;;
+  esac
+
+  # Don't test for the "default" C tag, as we know it's
+  # there but not specially marked.
+  case $tagname in
+    CC) ;;
+    *)
+      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+       taglist="$taglist $tagname"
+
+       # Evaluate the configuration.  Be careful to quote the path
+       # and the sed script, to avoid splitting on whitespace, but
+       # also don't use non-portable quotes within backquotes within
+       # quotes we have to do it in 2 steps:
+       extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+       eval "$extractedcf"
+      else
+       func_error "ignoring unknown tag $tagname"
+      fi
+      ;;
+  esac
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+    fi
+
+    exit $EXIT_MISMATCH
+  fi
+}
+
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+  shift; set dummy --mode clean ${1+"$@"}; shift
+  ;;
+compile|compil|compi|comp|com|co|c)
+  shift; set dummy --mode compile ${1+"$@"}; shift
+  ;;
+execute|execut|execu|exec|exe|ex|e)
+  shift; set dummy --mode execute ${1+"$@"}; shift
+  ;;
+finish|finis|fini|fin|fi|f)
+  shift; set dummy --mode finish ${1+"$@"}; shift
+  ;;
+install|instal|insta|inst|ins|in|i)
+  shift; set dummy --mode install ${1+"$@"}; shift
+  ;;
+link|lin|li|l)
+  shift; set dummy --mode link ${1+"$@"}; shift
+  ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+  shift; set dummy --mode uninstall ${1+"$@"}; shift
+  ;;
+esac
+
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_warning=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly.  This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+  # this just eases exit handling
+  while test $# -gt 0; do
+    opt="$1"
+    shift
+    case $opt in
+      --debug|-x)      opt_debug='set -x'
+                       func_echo "enabling shell trace mode"
+                       $opt_debug
+                       ;;
+      --dry-run|--dryrun|-n)
+                       opt_dry_run=:
+                       ;;
+      --config)
+                       opt_config=:
+func_config
+                       ;;
+      --dlopen|-dlopen)
+                       optarg="$1"
+                       opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
+                       shift
+                       ;;
+      --preserve-dup-deps)
+                       opt_preserve_dup_deps=:
+                       ;;
+      --features)
+                       opt_features=:
+func_features
+                       ;;
+      --finish)
+                       opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+                       ;;
+      --help)
+                       opt_help=:
+                       ;;
+      --help-all)
+                       opt_help_all=:
+opt_help=': help-all'
+                       ;;
+      --mode)
+                       test $# = 0 && func_missing_arg $opt && break
+                       optarg="$1"
+                       opt_mode="$optarg"
+case $optarg in
+  # Valid mode arguments:
+  clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+  # Catch anything else as an error
+  *) func_error "invalid argument for $opt"
+     exit_cmd=exit
+     break
+     ;;
+esac
+                       shift
+                       ;;
+      --no-silent|--no-quiet)
+                       opt_silent=false
+func_append preserve_args " $opt"
+                       ;;
+      --no-warning|--no-warn)
+                       opt_warning=false
+func_append preserve_args " $opt"
+                       ;;
+      --no-verbose)
+                       opt_verbose=false
+func_append preserve_args " $opt"
+                       ;;
+      --silent|--quiet)
+                       opt_silent=:
+func_append preserve_args " $opt"
+        opt_verbose=false
+                       ;;
+      --verbose|-v)
+                       opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+                       ;;
+      --tag)
+                       test $# = 0 && func_missing_arg $opt && break
+                       optarg="$1"
+                       opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
+                       shift
+                       ;;
+
+      -\?|-h)          func_usage                              ;;
+      --help)          func_help                               ;;
+      --version)       func_version                            ;;
+
+      # Separate optargs to long options:
+      --*=*)
+                       func_split_long_opt "$opt"
+                       set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+                       shift
+                       ;;
+
+      # Separate non-argument short options:
+      -\?*|-h*|-n*|-v*)
+                       func_split_short_opt "$opt"
+                       set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+                       shift
+                       ;;
+
+      --)              break                                   ;;
+      -*)              func_fatal_help "unrecognized option \`$opt'" ;;
+      *)               set dummy "$opt" ${1+"$@"};     shift; break  ;;
+    esac
+  done
+
+  # Validate options:
+
+  # save first non-option argument
+  if test "$#" -gt 0; then
+    nonopt="$opt"
+    shift
+  fi
+
+  # preserve --debug
+  test "$opt_debug" = : || func_append preserve_args " --debug"
+
+  case $host in
+    *cygwin* | *mingw* | *pw32* | *cegcc*)
+      # don't eliminate duplications in $postdeps and $predeps
+      opt_duplicate_compiler_generated_deps=:
+      ;;
+    *)
+      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+      ;;
+  esac
+
+  $opt_help || {
+    # Sanity checks first:
+    func_check_version_match
+
+    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+      func_fatal_configuration "not configured to build any kind of library"
+    fi
+
+    # Darwin sucks
+    eval std_shrext=\"$shrext_cmds\"
+
+    # Only execute mode is allowed to have -dlopen flags.
+    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+      func_error "unrecognized option \`-dlopen'"
+      $ECHO "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Change the help message to a mode-specific one.
+    generic_help="$help"
+    help="Try \`$progname --help --mode=$opt_mode' for more information."
+  }
+
+
+  # Bail if the options were screwed
+  $exit_cmd $EXIT_FAILURE
+}
+
+
+
+
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+    test -f "$1" &&
+      $SED -e 4q "$1" 2>/dev/null \
+        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs.  To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway.  Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+    lalib_p=no
+    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+       for lalib_p_l in 1 2 3 4
+       do
+           read lalib_p_line
+           case "$lalib_p_line" in
+               \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+           esac
+       done
+       exec 0<&5 5<&-
+    fi
+    test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+    func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+    func_ltwrapper_exec_suffix=
+    case $1 in
+    *.exe) ;;
+    *) func_ltwrapper_exec_suffix=.exe ;;
+    esac
+    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+    func_dirname_and_basename "$1" "" "."
+    func_stripname '' '.exe' "$func_basename_result"
+    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+    $opt_debug
+    save_ifs=$IFS; IFS='~'
+    for cmd in $1; do
+      IFS=$save_ifs
+      eval cmd=\"$cmd\"
+      func_show_eval "$cmd" "${2-:}"
+    done
+    IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)!  Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+    $opt_debug
+    case $1 in
+    */* | *\\*)        . "$1" ;;
+    *)         . "./$1" ;;
+    esac
+}
+
+
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot.  Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+  func_resolve_sysroot_result=$1
+  case $func_resolve_sysroot_result in
+  =*)
+    func_stripname '=' '' "$func_resolve_sysroot_result"
+    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+    ;;
+  esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+  case "$lt_sysroot:$1" in
+  ?*:"$lt_sysroot"*)
+    func_stripname "$lt_sysroot" '' "$1"
+    func_replace_sysroot_result="=$func_stripname_result"
+    ;;
+  *)
+    # Including no sysroot.
+    func_replace_sysroot_result=$1
+    ;;
+  esac
+}
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    $opt_debug
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+       func_append_quoted CC_quoted "$arg"
+      done
+      CC_expanded=`func_echo_all $CC`
+      CC_quoted_expanded=`func_echo_all $CC_quoted`
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+       for z in $available_tags; do
+         if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+           # Evaluate the configuration.
+           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+           CC_quoted=
+           for arg in $CC; do
+             # Double-quote args containing other shell metacharacters.
+             func_append_quoted CC_quoted "$arg"
+           done
+           CC_expanded=`func_echo_all $CC`
+           CC_quoted_expanded=`func_echo_all $CC_quoted`
+           case "$@ " in
+           " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+           " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+             # The compiler in the base compile command matches
+             # the one in the tagged configuration.
+             # Assume this is the tagged configuration we want.
+             tagname=$z
+             break
+             ;;
+           esac
+         fi
+       done
+       # If $tagname still isn't set, then no tagged configuration
+       # was found and let the user know that the "--tag" command
+       # line option must be used.
+       if test -z "$tagname"; then
+         func_echo "unable to infer tagged configuration"
+         func_fatal_error "specify a tag with \`--tag'"
+#      else
+#        func_verbose "using $tagname tagged configuration"
+       fi
+       ;;
+      esac
+    fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+    write_libobj=${1}
+    if test "$build_libtool_libs" = yes; then
+      write_lobj=\'${2}\'
+    else
+      write_lobj=none
+    fi
+
+    if test "$build_old_libs" = yes; then
+      write_oldobj=\'${3}\'
+    else
+      write_oldobj=none
+    fi
+
+    $opt_dry_run || {
+      cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+      $MV "${write_libobj}T" "${write_libobj}"
+    }
+}
+
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+  $opt_debug
+  func_convert_core_file_wine_to_w32_result="$1"
+  if test -n "$1"; then
+    # Unfortunately, winepath does not exit with a non-zero error code, so we
+    # are forced to check the contents of stdout. On the other hand, if the
+    # command is not found, the shell will set an exit code of 127 and print
+    # *an error message* to stdout. So we must check for both error code of
+    # zero AND non-empty stdout, which explains the odd construction:
+    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+        $SED -e "$lt_sed_naive_backslashify"`
+    else
+      func_convert_core_file_wine_to_w32_result=
+    fi
+  fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+  $opt_debug
+  # unfortunately, winepath doesn't convert paths, only file names
+  func_convert_core_path_wine_to_w32_result=""
+  if test -n "$1"; then
+    oldIFS=$IFS
+    IFS=:
+    for func_convert_core_path_wine_to_w32_f in $1; do
+      IFS=$oldIFS
+      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+        if test -z "$func_convert_core_path_wine_to_w32_result"; then
+          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+        else
+          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+        fi
+      fi
+    done
+    IFS=$oldIFS
+  fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+  $opt_debug
+  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+    if test "$?" -ne 0; then
+      # on failure, ensure result is empty
+      func_cygpath_result=
+    fi
+  else
+    func_cygpath_result=
+    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+  fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format.  Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+  $opt_debug
+  # awkward: cmd appends spaces to result
+  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+  $opt_debug
+  if test -z "$2" && test -n "$1" ; then
+    func_error "Could not determine host file name corresponding to"
+    func_error "  \`$1'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback:
+    func_to_host_file_result="$1"
+  fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+  $opt_debug
+  if test -z "$4" && test -n "$3"; then
+    func_error "Could not determine the host path corresponding to"
+    func_error "  \`$3'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback.  This is a deliberately simplistic "conversion" and
+    # should not be "improved".  See libtool.info.
+    if test "x$1" != "x$2"; then
+      lt_replace_pathsep_chars="s|$1|$2|g"
+      func_to_host_path_result=`echo "$3" |
+        $SED -e "$lt_replace_pathsep_chars"`
+    else
+      func_to_host_path_result="$3"
+    fi
+  fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+  $opt_debug
+  case $4 in
+  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+    ;;
+  esac
+  case $4 in
+  $2 ) func_append func_to_host_path_result "$3"
+    ;;
+  esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+  $opt_debug
+  $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result.  If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+  $opt_debug
+  case ,$2, in
+    *,"$to_tool_file_cmd",*)
+      func_to_tool_file_result=$1
+      ;;
+    *)
+      $to_tool_file_cmd "$1"
+      func_to_tool_file_result=$func_to_host_file_result
+      ;;
+  esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+  func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+    # LT_CYGPATH in this case.
+    func_to_host_file_result=`cygpath -m "$1"`
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format.  Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_file_wine_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_msys_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+    func_convert_core_file_wine_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format.  If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+#   file name conversion function    : func_convert_file_X_to_Y ()
+#   path conversion function         : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same.  If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+  $opt_debug
+  if test -z "$to_host_path_cmd"; then
+    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+    to_host_path_cmd="func_convert_path_${func_stripname_result}"
+  fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+  $opt_debug
+  func_init_to_host_path_cmd
+  $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+  func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from ARG.  MSYS
+    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+    # and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format.  Requires a wine environment and
+# a working winepath.  Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from
+    # ARG. msys behavior is inconsistent here, cygpath turns them
+    # into '.;' and ';.', and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+    $opt_debug
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+    pie_flag=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+       # do not "continue".  Instead, add this to base_compile
+       lastarg="$arg"
+       arg_mode=normal
+       ;;
+
+      target )
+       libobj="$arg"
+       arg_mode=normal
+       continue
+       ;;
+
+      normal )
+       # Accept any command-line options.
+       case $arg in
+       -o)
+         test -n "$libobj" && \
+           func_fatal_error "you cannot specify \`-o' more than once"
+         arg_mode=target
+         continue
+         ;;
+
+       -pie | -fpie | -fPIE)
+          func_append pie_flag " $arg"
+         continue
+         ;;
+
+       -shared | -static | -prefer-pic | -prefer-non-pic)
+         func_append later " $arg"
+         continue
+         ;;
+
+       -no-suppress)
+         suppress_opt=no
+         continue
+         ;;
+
+       -Xcompiler)
+         arg_mode=arg  #  the next one goes into the "base_compile" arg list
+         continue      #  The current "srcfile" will either be retained or
+         ;;            #  replaced later.  I would guess that would be a bug.
+
+       -Wc,*)
+         func_stripname '-Wc,' '' "$arg"
+         args=$func_stripname_result
+         lastarg=
+         save_ifs="$IFS"; IFS=','
+         for arg in $args; do
+           IFS="$save_ifs"
+           func_append_quoted lastarg "$arg"
+         done
+         IFS="$save_ifs"
+         func_stripname ' ' '' "$lastarg"
+         lastarg=$func_stripname_result
+
+         # Add the arguments to base_compile.
+         func_append base_compile " $lastarg"
+         continue
+         ;;
+
+       *)
+         # Accept the current argument as the source file.
+         # The previous "srcfile" becomes the current argument.
+         #
+         lastarg="$srcfile"
+         srcfile="$arg"
+         ;;
+       esac  #  case $arg
+       ;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      func_append_quoted base_compile "$lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      func_fatal_error "you must specify an argument for -Xcompile"
+      ;;
+    target)
+      func_fatal_error "you must specify a target with \`-o'"
+      ;;
+    *)
+      # Get the name of the library object.
+      test -z "$libobj" && {
+       func_basename "$srcfile"
+       libobj="$func_basename_result"
+      }
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    case $libobj in
+    *.[cCFSifmso] | \
+    *.ada | *.adb | *.ads | *.asm | \
+    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
+      func_xform "$libobj"
+      libobj=$func_xform_result
+      ;;
+    esac
+
+    case $libobj in
+    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+    *)
+      func_fatal_error "cannot determine name of library object from \`$libobj'"
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -shared)
+       test "$build_libtool_libs" != yes && \
+         func_fatal_configuration "can not build a shared library"
+       build_old_libs=no
+       continue
+       ;;
+
+      -static)
+       build_libtool_libs=no
+       build_old_libs=yes
+       continue
+       ;;
+
+      -prefer-pic)
+       pic_mode=yes
+       continue
+       ;;
+
+      -prefer-non-pic)
+       pic_mode=no
+       continue
+       ;;
+      esac
+    done
+
+    func_quote_for_eval "$libobj"
+    test "X$libobj" != "X$func_quote_for_eval_result" \
+      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'   &()|`$[]' \
+      && func_warning "libobj name \`$libobj' may not contain shell special characters."
+    func_dirname_and_basename "$obj" "/" ""
+    objname="$func_basename_result"
+    xdir="$func_dirname_result"
+    lobj=${xdir}$objdir/$objname
+
+    test -z "$base_compile" && \
+      func_fatal_help "you must specify a compilation command"
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2* | cegcc*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+       func_echo "Waiting for $lockfile to be removed"
+       sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+       $ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $opt_dry_run || $RM $removelist
+       exit $EXIT_FAILURE
+      fi
+      func_append removelist " $output_obj"
+      $ECHO "$srcfile" > "$lockfile"
+    fi
+
+    $opt_dry_run || $RM $removelist
+    func_append removelist " $lockfile"
+    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+    srcfile=$func_to_tool_file_result
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+       command="$base_compile $qsrcfile $pic_flag"
+      else
+       # Don't build PIC code
+       command="$base_compile $qsrcfile"
+      fi
+
+      func_mkdir_p "$xdir$objdir"
+
+      if test -z "$output_obj"; then
+       # Place PIC objects in $objdir
+       func_append command " -o $lobj"
+      fi
+
+      func_show_eval_locale "$command" \
+          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $opt_dry_run || $RM $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+       func_show_eval '$MV "$output_obj" "$lobj"' \
+         'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+       suppress_output=' >/dev/null 2>&1'
+      fi
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+       # Don't build PIC code
+       command="$base_compile $qsrcfile$pie_flag"
+      else
+       command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+       func_append command " -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      func_append command "$suppress_output"
+      func_show_eval_locale "$command" \
+        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $opt_dry_run || $RM $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+       func_show_eval '$MV "$output_obj" "$obj"' \
+         'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+    fi
+
+    $opt_dry_run || {
+      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+      # Unlock the critical section if it was locked
+      if test "$need_locks" != no; then
+       removelist=$lockfile
+        $RM "$lockfile"
+      fi
+    }
+
+    exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+    # We need to display help for each of the modes.
+    case $opt_mode in
+      "")
+        # Generic help is extracted from the usage comments
+        # at the start of this file.
+        func_help
+        ;;
+
+      clean)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      compile)
+      $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -no-suppress      do not suppress compiler output for multiple passes
+  -prefer-pic       try to build PIC objects only
+  -prefer-non-pic   try to build non-PIC objects only
+  -shared           do not build a \`.o' file suitable for static linking
+  -static           only build a \`.o' file suitable for static linking
+  -Wc,FLAG          pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+        ;;
+
+      execute)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+        ;;
+
+      finish)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+        ;;
+
+      install)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+        ;;
+
+      link)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -bindir BINDIR    specify path to binaries directory (for systems where
+                    libraries must be found in the PATH setting at runtime)
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -shared           only do dynamic linking of libtool libraries
+  -shrext SUFFIX    override the standard shared library file extension
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+  -weak LIBNAME     declare that the target provides the LIBNAME interface
+  -Wc,FLAG
+  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
+  -Wl,FLAG
+  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
+  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+        ;;
+
+      uninstall)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      *)
+        func_fatal_help "invalid operation mode \`$opt_mode'"
+        ;;
+    esac
+
+    echo
+    $ECHO "Try \`$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test "$opt_help" = :; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+       func_mode_help
+      done
+    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+       echo
+       func_mode_help
+      done
+    } |
+    sed '1d
+      /^When reporting/,/^Report/{
+       H
+       d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+    $opt_debug
+    # The first argument is the command name.
+    cmd="$nonopt"
+    test -z "$cmd" && \
+      func_fatal_help "you must specify a COMMAND"
+
+    # Handle -dlopen flags immediately.
+    for file in $opt_dlopen; do
+      test -f "$file" \
+       || func_fatal_help "\`$file' is not a file"
+
+      dir=
+      case $file in
+      *.la)
+       func_resolve_sysroot "$file"
+       file=$func_resolve_sysroot_result
+
+       # Check to see that this really is a libtool archive.
+       func_lalib_unsafe_p "$file" \
+         || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+       # Read the libtool library.
+       dlname=
+       library_names=
+       func_source "$file"
+
+       # Skip this library if it cannot be dlopened.
+       if test -z "$dlname"; then
+         # Warn if it was a shared library.
+         test -n "$library_names" && \
+           func_warning "\`$file' was not linked with \`-export-dynamic'"
+         continue
+       fi
+
+       func_dirname "$file" "" "."
+       dir="$func_dirname_result"
+
+       if test -f "$dir/$objdir/$dlname"; then
+         func_append dir "/$objdir"
+       else
+         if test ! -f "$dir/$dlname"; then
+           func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+         fi
+       fi
+       ;;
+
+      *.lo)
+       # Just add the directory containing the .lo file.
+       func_dirname "$file" "" "."
+       dir="$func_dirname_result"
+       ;;
+
+      *)
+       func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+       continue
+       ;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+       eval "$shlibpath_var=\"\$dir\""
+      else
+       eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -* | *.la | *.lo ) ;;
+      *)
+       # Do a test to see if this is really a libtool program.
+       if func_ltwrapper_script_p "$file"; then
+         func_source "$file"
+         # Transform arg to wrapped name.
+         file="$progdir/$program"
+       elif func_ltwrapper_executable_p "$file"; then
+         func_ltwrapper_scriptname "$file"
+         func_source "$func_ltwrapper_scriptname_result"
+         # Transform arg to wrapped name.
+         file="$progdir/$program"
+       fi
+       ;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      func_append_quoted args "$file"
+    done
+
+    if test "X$opt_dry_run" = Xfalse; then
+      if test -n "$shlibpath_var"; then
+       # Export the shlibpath_var.
+       eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+       eval "if test \"\${save_$lt_var+set}\" = set; then
+                $lt_var=\$save_$lt_var; export $lt_var
+             else
+               $lt_unset $lt_var
+             fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+       eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+       echo "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $opt_debug
+    libs=
+    libdirs=
+    admincmds=
+
+    for opt in "$nonopt" ${1+"$@"}
+    do
+      if test -d "$opt"; then
+       func_append libdirs " $opt"
+
+      elif test -f "$opt"; then
+       if func_lalib_unsafe_p "$opt"; then
+         func_append libs " $opt"
+       else
+         func_warning "\`$opt' is not a valid libtool archive"
+       fi
+
+      else
+       func_fatal_error "invalid argument \`$opt'"
+      fi
+    done
+
+    if test -n "$libs"; then
+      if test -n "$lt_sysroot"; then
+        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+      else
+        sysroot_cmd=
+      fi
+
+      # Remove sysroot references
+      if $opt_dry_run; then
+        for lib in $libs; do
+          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+        done
+      else
+        tmpdir=`func_mktempdir`
+        for lib in $libs; do
+         sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+           > $tmpdir/tmp-la
+         mv -f $tmpdir/tmp-la $lib
+       done
+        ${RM}r "$tmpdir"
+      fi
+    fi
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for libdir in $libdirs; do
+       if test -n "$finish_cmds"; then
+         # Do each command in the finish commands.
+         func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+       fi
+       if test -n "$finish_eval"; then
+         # Do the single finish_eval.
+         eval cmds=\"$finish_eval\"
+         $opt_dry_run || eval "$cmds" || func_append admincmds "
+       $cmds"
+       fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    $opt_silent && exit $EXIT_SUCCESS
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      echo "----------------------------------------------------------------------"
+      echo "Libraries have been installed in:"
+      for libdir in $libdirs; do
+       $ECHO "   $libdir"
+      done
+      echo
+      echo "If you ever happen to want to link against installed libraries"
+      echo "in a given directory, LIBDIR, you must either use libtool, and"
+      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+      echo "flag during linking and do at least one of the following:"
+      if test -n "$shlibpath_var"; then
+       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+       echo "     during execution"
+      fi
+      if test -n "$runpath_var"; then
+       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+       echo "     during linking"
+      fi
+      if test -n "$hardcode_libdir_flag_spec"; then
+       libdir=LIBDIR
+       eval flag=\"$hardcode_libdir_flag_spec\"
+
+       $ECHO "   - use the \`$flag' linker flag"
+      fi
+      if test -n "$admincmds"; then
+       $ECHO "   - have your system administrator run these commands:$admincmds"
+      fi
+      if test -f /etc/ld.so.conf; then
+       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+      fi
+      echo
+
+      echo "See any operating system documentation about shared libraries for"
+      case $host in
+       solaris2.[6789]|solaris2.1[0-9])
+         echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+         echo "pages."
+         ;;
+       *)
+         echo "more information, such as the ld(1) and ld.so(8) manual pages."
+         ;;
+      esac
+      echo "----------------------------------------------------------------------"
+    fi
+    exit $EXIT_SUCCESS
+}
+
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+    $opt_debug
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       case $nonopt in *shtool*) :;; *) false;; esac; then
+      # Aesthetically quote it.
+      func_quote_for_eval "$nonopt"
+      install_prog="$func_quote_for_eval_result "
+      arg=$1
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    func_quote_for_eval "$arg"
+    func_append install_prog "$func_quote_for_eval_result"
+    install_shared_prog=$install_prog
+    case " $install_prog " in
+      *[\\\ /]cp\ *) install_cp=: ;;
+      *) install_cp=false ;;
+    esac
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    no_mode=:
+    for arg
+    do
+      arg2=
+      if test -n "$dest"; then
+       func_append files " $dest"
+       dest=$arg
+       continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f)
+       if $install_cp; then :; else
+         prev=$arg
+       fi
+       ;;
+      -g | -m | -o)
+       prev=$arg
+       ;;
+      -s)
+       stripme=" -s"
+       continue
+       ;;
+      -*)
+       ;;
+      *)
+       # If the previous option needed an argument, then skip it.
+       if test -n "$prev"; then
+         if test "x$prev" = x-m && test -n "$install_override_mode"; then
+           arg2=$install_override_mode
+           no_mode=false
+         fi
+         prev=
+       else
+         dest=$arg
+         continue
+       fi
+       ;;
+      esac
+
+      # Aesthetically quote the argument.
+      func_quote_for_eval "$arg"
+      func_append install_prog " $func_quote_for_eval_result"
+      if test -n "$arg2"; then
+       func_quote_for_eval "$arg2"
+      fi
+      func_append install_shared_prog " $func_quote_for_eval_result"
+    done
+
+    test -z "$install_prog" && \
+      func_fatal_help "you must specify an install program"
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prev' option requires an argument"
+
+    if test -n "$install_override_mode" && $no_mode; then
+      if $install_cp; then :; else
+       func_quote_for_eval "$install_override_mode"
+       func_append install_shared_prog " -m $func_quote_for_eval_result"
+      fi
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+       func_fatal_help "no file or destination specified"
+      else
+       func_fatal_help "you must specify a destination"
+      fi
+    fi
+
+    # Strip any trailing slash from the destination.
+    func_stripname '' '/' "$dest"
+    dest=$func_stripname_result
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      func_dirname_and_basename "$dest" "" "."
+      destdir="$func_dirname_result"
+      destname="$func_basename_result"
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files; shift
+      test "$#" -gt 1 && \
+       func_fatal_help "\`$dest' is not a directory"
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+       case $file in
+       *.lo) ;;
+       *)
+         func_fatal_help "\`$destdir' must be an absolute directory name"
+         ;;
+       esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+       # Do the static libraries later.
+       func_append staticlibs " $file"
+       ;;
+
+      *.la)
+       func_resolve_sysroot "$file"
+       file=$func_resolve_sysroot_result
+
+       # Check to see that this really is a libtool archive.
+       func_lalib_unsafe_p "$file" \
+         || func_fatal_help "\`$file' is not a valid libtool archive"
+
+       library_names=
+       old_library=
+       relink_command=
+       func_source "$file"
+
+       # Add the libdir to current_libdirs if it is the destination.
+       if test "X$destdir" = "X$libdir"; then
+         case "$current_libdirs " in
+         *" $libdir "*) ;;
+         *) func_append current_libdirs " $libdir" ;;
+         esac
+       else
+         # Note the libdir as a future libdir.
+         case "$future_libdirs " in
+         *" $libdir "*) ;;
+         *) func_append future_libdirs " $libdir" ;;
+         esac
+       fi
+
+       func_dirname "$file" "/" ""
+       dir="$func_dirname_result"
+       func_append dir "$objdir"
+
+       if test -n "$relink_command"; then
+         # Determine the prefix the user has applied to our future dir.
+         inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+         # Don't allow the user to place us outside of our expected
+         # location b/c this prevents finding dependent libraries that
+         # are installed to the same prefix.
+         # At present, this check doesn't affect windows .dll's that
+         # are installed into $libdir/../bin (currently, that works fine)
+         # but it's something to keep an eye on.
+         test "$inst_prefix_dir" = "$destdir" && \
+           func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+         if test -n "$inst_prefix_dir"; then
+           # Stick the inst_prefix_dir data into the link command.
+           relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+         else
+           relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+         fi
+
+         func_warning "relinking \`$file'"
+         func_show_eval "$relink_command" \
+           'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+       fi
+
+       # See the names of the shared library.
+       set dummy $library_names; shift
+       if test -n "$1"; then
+         realname="$1"
+         shift
+
+         srcname="$realname"
+         test -n "$relink_command" && srcname="$realname"T
+
+         # Install the shared library and build the symlinks.
+         func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+             'exit $?'
+         tstripme="$stripme"
+         case $host_os in
+         cygwin* | mingw* | pw32* | cegcc*)
+           case $realname in
+           *.dll.a)
+             tstripme=""
+             ;;
+           esac
+           ;;
+         esac
+         if test -n "$tstripme" && test -n "$striplib"; then
+           func_show_eval "$striplib $destdir/$realname" 'exit $?'
+         fi
+
+         if test "$#" -gt 0; then
+           # Delete the old symlinks, and create new ones.
+           # Try `ln -sf' first, because the `ln' binary might depend on
+           # the symlink we replace!  Solaris /bin/ln does not understand -f,
+           # so we also need to try rm && ln -s.
+           for linkname
+           do
+             test "$linkname" != "$realname" \
+               && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+           done
+         fi
+
+         # Do each command in the postinstall commands.
+         lib="$destdir/$realname"
+         func_execute_cmds "$postinstall_cmds" 'exit $?'
+       fi
+
+       # Install the pseudo-library for information purposes.
+       func_basename "$file"
+       name="$func_basename_result"
+       instname="$dir/$name"i
+       func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+       # Maybe install the static library, too.
+       test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+       ;;
+
+      *.lo)
+       # Install (i.e. copy) a libtool object.
+
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile="$destdir/$destname"
+       else
+         func_basename "$file"
+         destfile="$func_basename_result"
+         destfile="$destdir/$destfile"
+       fi
+
+       # Deduce the name of the destination old-style object file.
+       case $destfile in
+       *.lo)
+         func_lo2o "$destfile"
+         staticdest=$func_lo2o_result
+         ;;
+       *.$objext)
+         staticdest="$destfile"
+         destfile=
+         ;;
+       *)
+         func_fatal_help "cannot copy a libtool object to \`$destfile'"
+         ;;
+       esac
+
+       # Install the libtool object if requested.
+       test -n "$destfile" && \
+         func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+       # Install the old object if enabled.
+       if test "$build_old_libs" = yes; then
+         # Deduce the name of the old-style object file.
+         func_lo2o "$file"
+         staticobj=$func_lo2o_result
+         func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+       fi
+       exit $EXIT_SUCCESS
+       ;;
+
+      *)
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile="$destdir/$destname"
+       else
+         func_basename "$file"
+         destfile="$func_basename_result"
+         destfile="$destdir/$destfile"
+       fi
+
+       # If the file is missing, and there is a .exe on the end, strip it
+       # because it is most likely a libtool script we actually want to
+       # install
+       stripped_ext=""
+       case $file in
+         *.exe)
+           if test ! -f "$file"; then
+             func_stripname '' '.exe' "$file"
+             file=$func_stripname_result
+             stripped_ext=".exe"
+           fi
+           ;;
+       esac
+
+       # Do a test to see if this is really a libtool program.
+       case $host in
+       *cygwin* | *mingw*)
+           if func_ltwrapper_executable_p "$file"; then
+             func_ltwrapper_scriptname "$file"
+             wrapper=$func_ltwrapper_scriptname_result
+           else
+             func_stripname '' '.exe' "$file"
+             wrapper=$func_stripname_result
+           fi
+           ;;
+       *)
+           wrapper=$file
+           ;;
+       esac
+       if func_ltwrapper_script_p "$wrapper"; then
+         notinst_deplibs=
+         relink_command=
+
+         func_source "$wrapper"
+
+         # Check the variables that should have been set.
+         test -z "$generated_by_libtool_version" && \
+           func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+         finalize=yes
+         for lib in $notinst_deplibs; do
+           # Check to see that each library is installed.
+           libdir=
+           if test -f "$lib"; then
+             func_source "$lib"
+           fi
+           libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+           if test -n "$libdir" && test ! -f "$libfile"; then
+             func_warning "\`$lib' has not been installed in \`$libdir'"
+             finalize=no
+           fi
+         done
+
+         relink_command=
+         func_source "$wrapper"
+
+         outputname=
+         if test "$fast_install" = no && test -n "$relink_command"; then
+           $opt_dry_run || {
+             if test "$finalize" = yes; then
+               tmpdir=`func_mktempdir`
+               func_basename "$file$stripped_ext"
+               file="$func_basename_result"
+               outputname="$tmpdir/$file"
+               # Replace the output file specification.
+               relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+               $opt_silent || {
+                 func_quote_for_expand "$relink_command"
+                 eval "func_echo $func_quote_for_expand_result"
+               }
+               if eval "$relink_command"; then :
+                 else
+                 func_error "error: relink \`$file' with the above command before installing it"
+                 $opt_dry_run || ${RM}r "$tmpdir"
+                 continue
+               fi
+               file="$outputname"
+             else
+               func_warning "cannot relink \`$file'"
+             fi
+           }
+         else
+           # Install the binary that we compiled earlier.
+           file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+         fi
+       fi
+
+       # remove .exe since cygwin /usr/bin/install will append another
+       # one anyway
+       case $install_prog,$host in
+       */usr/bin/install*,*cygwin*)
+         case $file:$destfile in
+         *.exe:*.exe)
+           # this is ok
+           ;;
+         *.exe:*)
+           destfile=$destfile.exe
+           ;;
+         *:*.exe)
+           func_stripname '' '.exe' "$destfile"
+           destfile=$func_stripname_result
+           ;;
+         esac
+         ;;
+       esac
+       func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+       $opt_dry_run || if test -n "$outputname"; then
+         ${RM}r "$tmpdir"
+       fi
+       ;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      func_basename "$file"
+      name="$func_basename_result"
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+      tool_oldlib=$func_to_tool_file_result
+
+      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+       func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
+      fi
+
+      # Do each command in the postinstall commands.
+      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+    done
+
+    test -n "$future_libdirs" && \
+      func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      $opt_dry_run && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+    $opt_debug
+    my_outputname="$1"
+    my_originator="$2"
+    my_pic_p="${3-no}"
+    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    my_dlsyms=
+
+    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+      if test -n "$NM" && test -n "$global_symbol_pipe"; then
+       my_dlsyms="${my_outputname}S.c"
+      else
+       func_error "not configured to extract global symbols from dlpreopened files"
+      fi
+    fi
+
+    if test -n "$my_dlsyms"; then
+      case $my_dlsyms in
+      "") ;;
+      *.c)
+       # Discover the nlist of each of the dlfiles.
+       nlist="$output_objdir/${my_outputname}.nm"
+
+       func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+       # Parse the name list into a source file.
+       func_verbose "creating $output_objdir/$my_dlsyms"
+
+       $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+       if test "$dlself" = yes; then
+         func_verbose "generating symbol list for \`$output'"
+
+         $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+         # Add our own program objects to the symbol list.
+         progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+         for progfile in $progfiles; do
+           func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+           func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+           $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+         done
+
+         if test -n "$exclude_expsyms"; then
+           $opt_dry_run || {
+             eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+           }
+         fi
+
+         if test -n "$export_symbols_regex"; then
+           $opt_dry_run || {
+             eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+           }
+         fi
+
+         # Prepare the list of exported symbols
+         if test -z "$export_symbols"; then
+           export_symbols="$output_objdir/$outputname.exp"
+           $opt_dry_run || {
+             $RM $export_symbols
+             eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+             case $host in
+             *cygwin* | *mingw* | *cegcc* )
+                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+               ;;
+             esac
+           }
+         else
+           $opt_dry_run || {
+             eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+             eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+             case $host in
+               *cygwin* | *mingw* | *cegcc* )
+                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+                 ;;
+             esac
+           }
+         fi
+       fi
+
+       for dlprefile in $dlprefiles; do
+         func_verbose "extracting global C symbols from \`$dlprefile'"
+         func_basename "$dlprefile"
+         name="$func_basename_result"
+          case $host in
+           *cygwin* | *mingw* | *cegcc* )
+             # if an import library, we need to obtain dlname
+             if func_win32_import_lib_p "$dlprefile"; then
+               func_tr_sh "$dlprefile"
+               eval "curr_lafile=\$libfile_$func_tr_sh_result"
+               dlprefile_dlbasename=""
+               if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+                 # Use subshell, to avoid clobbering current variable values
+                 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+                 if test -n "$dlprefile_dlname" ; then
+                   func_basename "$dlprefile_dlname"
+                   dlprefile_dlbasename="$func_basename_result"
+                 else
+                   # no lafile. user explicitly requested -dlpreopen <import library>.
+                   $sharedlib_from_linklib_cmd "$dlprefile"
+                   dlprefile_dlbasename=$sharedlib_from_linklib_result
+                 fi
+               fi
+               $opt_dry_run || {
+                 if test -n "$dlprefile_dlbasename" ; then
+                   eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+                 else
+                   func_warning "Could not compute DLL name from $name"
+                   eval '$ECHO ": $name " >> "$nlist"'
+                 fi
+                 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+                 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+                   $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+               }
+             else # not an import lib
+               $opt_dry_run || {
+                 eval '$ECHO ": $name " >> "$nlist"'
+                 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+                 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+               }
+             fi
+           ;;
+           *)
+             $opt_dry_run || {
+               eval '$ECHO ": $name " >> "$nlist"'
+               func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+               eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+             }
+           ;;
+          esac
+       done
+
+       $opt_dry_run || {
+         # Make sure we have at least an empty file.
+         test -f "$nlist" || : > "$nlist"
+
+         if test -n "$exclude_expsyms"; then
+           $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+           $MV "$nlist"T "$nlist"
+         fi
+
+         # Try sorting and uniquifying the output.
+         if $GREP -v "^: " < "$nlist" |
+             if sort -k 3 </dev/null >/dev/null 2>&1; then
+               sort -k 3
+             else
+               sort +2
+             fi |
+             uniq > "$nlist"S; then
+           :
+         else
+           $GREP -v "^: " < "$nlist" > "$nlist"S
+         fi
+
+         if test -f "$nlist"S; then
+           eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+         else
+           echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+         fi
+
+         echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols.  */
+typedef struct {
+  const char *name;
+  void *address;
+} lt_dlsymlist;
+extern LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+  { \"$my_originator\", (void *) 0 },"
+
+         case $need_lib_prefix in
+         no)
+           eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+           ;;
+         *)
+           eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+           ;;
+         esac
+         echo >> "$output_objdir/$my_dlsyms" "\
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+       } # !$opt_dry_run
+
+       pic_flag_for_symtable=
+       case "$compile_command " in
+       *" -static "*) ;;
+       *)
+         case $host in
+         # compiling the symbol table file with pic_flag works around
+         # a FreeBSD bug that causes programs to crash when -lm is
+         # linked before any other PIC object.  But we must not use
+         # pic_flag when linking with -static.  The problem exists in
+         # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+         *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+           pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+         *-*-hpux*)
+           pic_flag_for_symtable=" $pic_flag"  ;;
+         *)
+           if test "X$my_pic_p" != Xno; then
+             pic_flag_for_symtable=" $pic_flag"
+           fi
+           ;;
+         esac
+         ;;
+       esac
+       symtab_cflags=
+       for arg in $LTCFLAGS; do
+         case $arg in
+         -pie | -fpie | -fPIE) ;;
+         *) func_append symtab_cflags " $arg" ;;
+         esac
+       done
+
+       # Now compile the dynamic symbol file.
+       func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+       # Clean up the generated files.
+       func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+       # Transform the symbol file into the correct name.
+       symfileobj="$output_objdir/${my_outputname}S.$objext"
+       case $host in
+       *cygwin* | *mingw* | *cegcc* )
+         if test -f "$output_objdir/$my_outputname.def"; then
+           compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+           finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+         else
+           compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+           finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+         fi
+         ;;
+       *)
+         compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+         finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+         ;;
+       esac
+       ;;
+      *)
+       func_fatal_error "unknown suffix for \`$my_dlsyms'"
+       ;;
+      esac
+    else
+      # We keep going just in case the user didn't refer to
+      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+      # really was required.
+
+      # Nullify the symbol file.
+      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+    fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+  $opt_debug
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+      func_to_tool_file "$1" func_convert_file_msys_to_w32
+      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+       $SED -n -e '
+           1,100{
+               / I /{
+                   s,.*,import,
+                   p
+                   q
+               }
+           }'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $ECHO "$win32_libid_type"
+}
+
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+  $opt_debug
+  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+  $opt_debug
+  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+    $SED '/^Contents of section '"$match_literal"':/{
+      # Place marker at beginning of archive member dllname section
+      s/.*/====MARK====/
+      p
+      d
+    }
+    # These lines can sometimes be longer than 43 characters, but
+    # are always uninteresting
+    /:[         ]*file format pe[i]\{,1\}-/d
+    /^In archive [^:]*:/d
+    # Ensure marker is printed
+    /^====MARK====/p
+    # Remove all lines with less than 43 characters
+    /^.\{43\}/!d
+    # From remaining lines, remove first 43 characters
+    s/^.\{43\}//' |
+    $SED -n '
+      # Join marker and all lines until next marker into a single line
+      /^====MARK====/ b para
+      H
+      $ b para
+      b
+      :para
+      x
+      s/\n//g
+      # Remove the marker
+      s/^====MARK====//
+      # Remove trailing dots and whitespace
+      s/[\. \t]*$//
+      # Print
+      /./p' |
+    # we now have a list, one entry per line, of the stringified
+    # contents of the appropriate section of all members of the
+    # archive which possess that section. Heuristic: eliminate
+    # all those which have a first or second character that is
+    # a '.' (that is, objdump's representation of an unprintable
+    # character.) This should work for all archives with less than
+    # 0x302f exports -- but will fail for DLLs whose name actually
+    # begins with a literal '.' or a single character followed by
+    # a '.'.
+    #
+    # Of those that remain, print the first one.
+    $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+  test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+  test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+  $opt_debug
+  if func_cygming_gnu_implib_p "$1" ; then
+    # binutils import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+  elif func_cygming_ms_implib_p "$1" ; then
+    # ms-generated import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+  else
+    # unknown
+    sharedlib_from_linklib_result=""
+  fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    $opt_debug
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+    if test "$lock_old_archive_extraction" = yes; then
+      lockfile=$f_ex_an_ar_oldlib.lock
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+       func_echo "Waiting for $lockfile to be removed"
+       sleep 2
+      done
+    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+                  'stat=$?; rm -f "$lockfile"; exit $stat'
+    if test "$lock_old_archive_extraction" = yes; then
+      $opt_dry_run || rm -f "$lockfile"
+    fi
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    $opt_debug
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+       [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+       *) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      func_basename "$my_xlib"
+      my_xlib="$func_basename_result"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+       *" $my_xlib_u "*)
+         func_arith $extracted_serial + 1
+         extracted_serial=$func_arith_result
+         my_xlib_u=lt$extracted_serial-$my_xlib ;;
+       *) break ;;
+       esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
+
+      func_mkdir_p "$my_xdir"
+
+      case $host in
+      *-darwin*)
+       func_verbose "Extracting $my_xabs"
+       # Do not bother doing anything if just a dry run
+       $opt_dry_run || {
+         darwin_orig_dir=`pwd`
+         cd $my_xdir || exit $?
+         darwin_archive=$my_xabs
+         darwin_curdir=`pwd`
+         darwin_base_archive=`basename "$darwin_archive"`
+         darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+         if test -n "$darwin_arches"; then
+           darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+           darwin_arch=
+           func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+           for darwin_arch in  $darwin_arches ; do
+             func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+             $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+             cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+             func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+             cd "$darwin_curdir"
+             $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+           done # $darwin_arches
+            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+           darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+           darwin_file=
+           darwin_files=
+           for darwin_file in $darwin_filelist; do
+             darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+             $LIPO -create -output "$darwin_file" $darwin_files
+           done # $darwin_filelist
+           $RM -rf unfat-$$
+           cd "$darwin_orig_dir"
+         else
+           cd $darwin_orig_dir
+           func_extract_an_archive "$my_xdir" "$my_xabs"
+         fi # $darwin_arches
+       } # !$opt_dry_run
+       ;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+       ;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+    done
+
+    func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+       func_emit_wrapper_arg1=${1-no}
+
+       $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='$macro_version'
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$ECHO are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    file=\"\$0\""
+
+    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+    $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+    ECHO=\"$qECHO\"
+  fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+  lt_script_arg0=\$0
+  shift
+  for lt_opt
+  do
+    case \"\$lt_opt\" in
+    --lt-debug) lt_option_debug=1 ;;
+    --lt-dump-script)
+        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+        cat \"\$lt_dump_D/\$lt_dump_F\"
+        exit 0
+      ;;
+    --lt-*)
+        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+        exit 1
+      ;;
+    esac
+  done
+
+  # Print the debug banner immediately:
+  if test -n \"\$lt_option_debug\"; then
+    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+  fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+  lt_dump_args_N=1;
+  for lt_arg
+  do
+    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+  done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+"
+  case $host in
+  # Backslashes separate directories on plain windows
+  *-*-mingw | *-*-os2* | *-cegcc*)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+    ;;
+
+  *)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+    ;;
+  esac
+  $ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+  case \" \$* \" in
+  *\\ --lt-*)
+    for lt_wr_arg
+    do
+      case \$lt_wr_arg in
+      --lt-*) ;;
+      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+      esac
+      shift
+    done ;;
+  esac
+  func_exec_program_core \${1+\"\$@\"}
+}
+
+  # Parse options
+  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+  done
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+    # special case for '.'
+    if test \"\$thisdir\" = \".\"; then
+      thisdir=\`pwd\`
+    fi
+    # remove .libs from thisdir
+    case \"\$thisdir\" in
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    $objdir )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+       if test "$fast_install" = yes; then
+         $ECHO "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" ||
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $MKDIR \"\$progdir\"
+    else
+      $RM \"\$progdir/\$file\"
+    fi"
+
+         $ECHO "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+       $ECHO \"\$relink_command_output\" >&2
+       $RM \"\$progdir/\$file\"
+       exit 1
+      fi
+    fi
+
+    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $RM \"\$progdir/\$program\";
+      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $RM \"\$progdir/\$file\"
+  fi"
+       else
+         $ECHO "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+       fi
+
+       $ECHO "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+       # fixup the dll searchpath if we need to.
+       #
+       # Fix the DLL searchpath if we need to.  Do this before prepending
+       # to shlibpath, because on Windows, both are PATH and uninstalled
+       # libraries must come first.
+       if test -n "$dllsearchpath"; then
+         $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+       fi
+
+       # Export our shlibpath_var if we have one.
+       if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+         $ECHO "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+       fi
+
+       $ECHO "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+      func_exec_program \${1+\"\$@\"}
+    fi
+  else
+    # The program doesn't exist.
+    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+}
+
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+       cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+*/
+EOF
+           cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+#  include <io.h>
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+#  define _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+       (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
+#else
+static int lt_debug = 0;
+#endif
+
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+           cat <<EOF
+volatile const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+           if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+              func_to_host_path "$temp_rpath"
+             cat <<EOF
+const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
+EOF
+           else
+             cat <<"EOF"
+const char * LIB_PATH_VALUE   = "";
+EOF
+           fi
+
+           if test -n "$dllsearchpath"; then
+              func_to_host_path "$dllsearchpath:"
+             cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
+EOF
+           else
+             cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE   = "";
+EOF
+           fi
+
+           if test "$fast_install" = yes; then
+             cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+           else
+             cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+           fi
+
+
+           cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
+static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int  newargc;
+  char *tmp_pathspec;
+  char *actual_cwrapper_path;
+  char *actual_cwrapper_name;
+  char *target_name;
+  char *lt_argv_zero;
+  intptr_t rval = 127;
+
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  newargz = XMALLOC (char *, argc + 1);
+
+  /* very simple arg parsing; don't want to rely on getopt
+   * also, copy all non cwrapper options to newargz, except
+   * argz[0], which is handled differently
+   */
+  newargc=0;
+  for (i = 1; i < argc; i++)
+    {
+      if (strcmp (argv[i], dumpscript_opt) == 0)
+       {
+EOF
+           case "$host" in
+             *mingw* | *cygwin* )
+               # make stdout use "unix" line endings
+               echo "          setmode(1,_O_BINARY);"
+               ;;
+             esac
+
+           cat <<"EOF"
+         lt_dump_script (stdout);
+         return 0;
+       }
+      if (strcmp (argv[i], debug_opt) == 0)
+       {
+          lt_debug = 1;
+          continue;
+       }
+      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal (__FILE__, __LINE__,
+                   "unrecognized %s option: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
+    }
+  newargz[++newargc] = NULL;
+
+EOF
+           cat <<EOF
+  /* The GNU banner must be the first non-error debug message */
+  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+           cat <<"EOF"
+  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
+
+  tmp_pathspec = find_executable (argv[0]);
+  if (tmp_pathspec == NULL)
+    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (before symlink chase) at: %s\n",
+                 tmp_pathspec);
+
+  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (after symlink chase) at: %s\n",
+                 actual_cwrapper_path);
+  XFREE (tmp_pathspec);
+
+  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+  strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+  /* wrapper name transforms */
+  strendzap (actual_cwrapper_name, ".exe");
+  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+  XFREE (actual_cwrapper_name);
+  actual_cwrapper_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  /* target_name transforms -- use actual target program name; might have lt- prefix */
+  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+  strendzap (target_name, ".exe");
+  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+  XFREE (target_name);
+  target_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(main) libtool target name: %s\n",
+                 target_name);
+EOF
+
+           cat <<EOF
+  newargz[0] =
+    XMALLOC (char, (strlen (actual_cwrapper_path) +
+                   strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+  strcpy (newargz[0], actual_cwrapper_path);
+  strcat (newargz[0], "$objdir");
+  strcat (newargz[0], "/");
+EOF
+
+           cat <<"EOF"
+  /* stop here, and copy so we don't have to do this twice */
+  tmp_pathspec = xstrdup (newargz[0]);
+
+  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+  strcat (newargz[0], actual_cwrapper_name);
+
+  /* DO want the lt- prefix here if it exists, so use target_name */
+  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+  XFREE (tmp_pathspec);
+  tmp_pathspec = NULL;
+EOF
+
+           case $host_os in
+             mingw*)
+           cat <<"EOF"
+  {
+    char* p;
+    while ((p = strchr (newargz[0], '\\')) != NULL)
+      {
+       *p = '/';
+      }
+    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+      {
+       *p = '/';
+      }
+  }
+EOF
+           ;;
+           esac
+
+           cat <<"EOF"
+  XFREE (target_name);
+  XFREE (actual_cwrapper_path);
+  XFREE (actual_cwrapper_name);
+
+  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
+  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
+     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+     because on Windows, both *_VARNAMEs are PATH but uninstalled
+     libraries must come first. */
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+
+  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+                 nonnull (lt_argv_zero));
+  for (i = 0; i < newargc; i++)
+    {
+      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+                     i, nonnull (newargz[i]));
+    }
+
+EOF
+
+           case $host_os in
+             mingw*)
+               cat <<"EOF"
+  /* execv doesn't actually work on mingw as expected on unix */
+  newargz = prepare_spawn (newargz);
+  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+  if (rval == -1)
+    {
+      /* failed to start process */
+      lt_debugprintf (__FILE__, __LINE__,
+                     "(main) failed to launch target \"%s\": %s\n",
+                     lt_argv_zero, nonnull (strerror (errno)));
+      return 127;
+    }
+  return rval;
+EOF
+               ;;
+             *)
+               cat <<"EOF"
+  execv (lt_argv_zero, newargz);
+  return rval; /* =127, but avoids unused variable warning */
+EOF
+               ;;
+           esac
+
+           cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+  void *p = (void *) malloc (num);
+  if (!p)
+    lt_fatal (__FILE__, __LINE__, "memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+                         string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable (const char *path)
+{
+  struct stat st;
+
+  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+                  nonempty (path));
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0)
+      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+    return 1;
+  else
+    return 0;
+}
+
+int
+make_executable (const char *path)
+{
+  int rval = 0;
+  struct stat st;
+
+  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+                  nonempty (path));
+  if ((!path) || (!*path))
+    return 0;
+
+  if (stat (path, &st) >= 0)
+    {
+      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+    }
+  return rval;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise
+   Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+  int has_slash = 0;
+  const char *p;
+  const char *p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char *concat_name;
+
+  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+                  nonempty (wrapper));
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable (concat_name))
+       return concat_name;
+      XFREE (concat_name);
+    }
+  else
+    {
+#endif
+      if (IS_DIR_SEPARATOR (wrapper[0]))
+       {
+         concat_name = xstrdup (wrapper);
+         if (check_executable (concat_name))
+           return concat_name;
+         XFREE (concat_name);
+       }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+    }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+      {
+       has_slash = 1;
+       break;
+      }
+  if (!has_slash)
+    {
+      /* no slashes; search PATH */
+      const char *path = getenv ("PATH");
+      if (path != NULL)
+       {
+         for (p = path; *p; p = p_next)
+           {
+             const char *q;
+             size_t p_len;
+             for (q = p; *q; q++)
+               if (IS_PATH_SEPARATOR (*q))
+                 break;
+             p_len = q - p;
+             p_next = (*q == '\0' ? q : q + 1);
+             if (p_len == 0)
+               {
+                 /* empty path: current directory */
+                 if (getcwd (tmp, LT_PATHMAX) == NULL)
+                   lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+                              nonnull (strerror (errno)));
+                 tmp_len = strlen (tmp);
+                 concat_name =
+                   XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+                 memcpy (concat_name, tmp, tmp_len);
+                 concat_name[tmp_len] = '/';
+                 strcpy (concat_name + tmp_len + 1, wrapper);
+               }
+             else
+               {
+                 concat_name =
+                   XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+                 memcpy (concat_name, p, p_len);
+                 concat_name[p_len] = '/';
+                 strcpy (concat_name + p_len + 1, wrapper);
+               }
+             if (check_executable (concat_name))
+               return concat_name;
+             XFREE (concat_name);
+           }
+       }
+      /* not found in PATH; assume curdir */
+    }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+              nonnull (strerror (errno)));
+  tmp_len = strlen (tmp);
+  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable (concat_name))
+    return concat_name;
+  XFREE (concat_name);
+  return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+  return xstrdup (pathspec);
+#else
+  char buf[LT_PATHMAX];
+  struct stat s;
+  char *tmp_pathspec = xstrdup (pathspec);
+  char *p;
+  int has_symlinks = 0;
+  while (strlen (tmp_pathspec) && !has_symlinks)
+    {
+      lt_debugprintf (__FILE__, __LINE__,
+                     "checking path component for symlinks: %s\n",
+                     tmp_pathspec);
+      if (lstat (tmp_pathspec, &s) == 0)
+       {
+         if (S_ISLNK (s.st_mode) != 0)
+           {
+             has_symlinks = 1;
+             break;
+           }
+
+         /* search backwards for last DIR_SEPARATOR */
+         p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+         while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+           p--;
+         if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+           {
+             /* no more DIR_SEPARATORS left */
+             break;
+           }
+         *p = '\0';
+       }
+      else
+       {
+         lt_fatal (__FILE__, __LINE__,
+                   "error accessing file \"%s\": %s",
+                   tmp_pathspec, nonnull (strerror (errno)));
+       }
+    }
+  XFREE (tmp_pathspec);
+
+  if (!has_symlinks)
+    {
+      return xstrdup (pathspec);
+    }
+
+  tmp_pathspec = realpath (pathspec, buf);
+  if (tmp_pathspec == 0)
+    {
+      lt_fatal (__FILE__, __LINE__,
+               "could not follow symlinks for %s", pathspec);
+    }
+  return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert (str != NULL);
+  assert (pat != NULL);
+
+  len = strlen (str);
+  patlen = strlen (pat);
+
+  if (patlen <= len)
+    {
+      str += len - patlen;
+      if (strcmp (str, pat) == 0)
+       *str = '\0';
+    }
+  return str;
+}
+
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+  va_list args;
+  if (lt_debug)
+    {
+      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+      va_start (args, fmt);
+      (void) vfprintf (stderr, fmt, args);
+      va_end (args);
+    }
+}
+
+static void
+lt_error_core (int exit_status, const char *file,
+              int line, const char *mode,
+              const char *message, va_list ap)
+{
+  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *file, int line, const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+  va_end (ap);
+}
+
+static const char *
+nonnull (const char *s)
+{
+  return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+  return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(lt_setenv) setting '%s' to '%s'\n",
+                  nonnull (name), nonnull (value));
+  {
+#ifdef HAVE_SETENV
+    /* always make a copy, for consistency with !HAVE_SETENV */
+    char *str = xstrdup (value);
+    setenv (name, str, 1);
+#else
+    int len = strlen (name) + 1 + strlen (value) + 1;
+    char *str = XMALLOC (char, len);
+    sprintf (str, "%s=%s", name, value);
+    if (putenv (str) != EXIT_SUCCESS)
+      {
+        XFREE (str);
+      }
+#endif
+  }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+  char *new_value;
+  if (orig_value && *orig_value)
+    {
+      int orig_value_len = strlen (orig_value);
+      int add_len = strlen (add);
+      new_value = XMALLOC (char, add_len + orig_value_len + 1);
+      if (to_end)
+        {
+          strcpy (new_value, orig_value);
+          strcpy (new_value + orig_value_len, add);
+        }
+      else
+        {
+          strcpy (new_value, add);
+          strcpy (new_value + add_len, orig_value);
+        }
+    }
+  else
+    {
+      new_value = xstrdup (add);
+    }
+  return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      /* some systems can't cope with a ':'-terminated path #' */
+      int len = strlen (new_value);
+      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+        {
+          new_value[len-1] = '\0';
+        }
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+EOF
+           case $host_os in
+             mingw*)
+               cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+   Note that spawn() does not by itself call the command interpreter
+     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+         GetVersionEx(&v);
+         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+      }) ? "cmd.exe" : "command.com").
+   Instead it simply concatenates the arguments, separated by ' ', and calls
+   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
+   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+   special way:
+   - Space and tab are interpreted as delimiters. They are not treated as
+     delimiters if they are surrounded by double quotes: "...".
+   - Unescaped double quotes are removed from the input. Their only effect is
+     that within double quotes, space and tab are treated like normal
+     characters.
+   - Backslashes not followed by double quotes are not special.
+   - But 2*n+1 backslashes followed by a double quote become
+     n backslashes followed by a double quote (n >= 0):
+       \" -> "
+       \\\" -> \"
+       \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+  size_t argc;
+  char **new_argv;
+  size_t i;
+
+  /* Count number of arguments.  */
+  for (argc = 0; argv[argc] != NULL; argc++)
+    ;
+
+  /* Allocate new argument vector.  */
+  new_argv = XMALLOC (char *, argc + 1);
+
+  /* Put quoted arguments into the new argument vector.  */
+  for (i = 0; i < argc; i++)
+    {
+      const char *string = argv[i];
+
+      if (string[0] == '\0')
+       new_argv[i] = xstrdup ("\"\"");
+      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+       {
+         int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+         size_t length;
+         unsigned int backslashes;
+         const char *s;
+         char *quoted_string;
+         char *p;
+
+         length = 0;
+         backslashes = 0;
+         if (quote_around)
+           length++;
+         for (s = string; *s != '\0'; s++)
+           {
+             char c = *s;
+             if (c == '"')
+               length += backslashes + 1;
+             length++;
+             if (c == '\\')
+               backslashes++;
+             else
+               backslashes = 0;
+           }
+         if (quote_around)
+           length += backslashes + 1;
+
+         quoted_string = XMALLOC (char, length + 1);
+
+         p = quoted_string;
+         backslashes = 0;
+         if (quote_around)
+           *p++ = '"';
+         for (s = string; *s != '\0'; s++)
+           {
+             char c = *s;
+             if (c == '"')
+               {
+                 unsigned int j;
+                 for (j = backslashes + 1; j > 0; j--)
+                   *p++ = '\\';
+               }
+             *p++ = c;
+             if (c == '\\')
+               backslashes++;
+             else
+               backslashes = 0;
+           }
+         if (quote_around)
+           {
+             unsigned int j;
+             for (j = backslashes; j > 0; j--)
+               *p++ = '\\';
+             *p++ = '"';
+           }
+         *p = '\0';
+
+         new_argv[i] = quoted_string;
+       }
+      else
+       new_argv[i] = (char *) string;
+    }
+  new_argv[argc] = NULL;
+
+  return new_argv;
+}
+EOF
+               ;;
+           esac
+
+            cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+           func_emit_wrapper yes |
+             $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/  fputs ("\1", f);/p
+g
+D'
+            cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+    $opt_debug
+    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+    *import*) : ;;
+    *) false ;;
+    esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+    $opt_debug
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args=$nonopt
+    base_compile="$nonopt $@"
+    compile_command=$nonopt
+    finalize_command=$nonopt
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+    new_inherited_linker_flags=
+
+    avoid_version=no
+    bindir=
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+    weak_libs=
+    single_module="${wl}-single_module"
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -shared)
+       test "$build_libtool_libs" != yes && \
+         func_fatal_configuration "can not build a shared library"
+       build_old_libs=no
+       break
+       ;;
+      -all-static | -static | -static-libtool-libs)
+       case $arg in
+       -all-static)
+         if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+           func_warning "complete static linking is impossible in this configuration"
+         fi
+         if test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=yes
+         ;;
+       -static)
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=built
+         ;;
+       -static-libtool-libs)
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=yes
+         ;;
+       esac
+       build_libtool_libs=no
+       build_old_libs=yes
+       break
+       ;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      func_quote_for_eval "$arg"
+      qarg=$func_quote_for_eval_unquoted_result
+      func_append libtool_args " $func_quote_for_eval_result"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+       case $prev in
+       output)
+         func_append compile_command " @OUTPUT@"
+         func_append finalize_command " @OUTPUT@"
+         ;;
+       esac
+
+       case $prev in
+       bindir)
+         bindir="$arg"
+         prev=
+         continue
+         ;;
+       dlfiles|dlprefiles)
+         if test "$preload" = no; then
+           # Add the symbol object into the linking commands.
+           func_append compile_command " @SYMFILE@"
+           func_append finalize_command " @SYMFILE@"
+           preload=yes
+         fi
+         case $arg in
+         *.la | *.lo) ;;  # We handle these cases below.
+         force)
+           if test "$dlself" = no; then
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         self)
+           if test "$prev" = dlprefiles; then
+             dlself=yes
+           elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+             dlself=yes
+           else
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         *)
+           if test "$prev" = dlfiles; then
+             func_append dlfiles " $arg"
+           else
+             func_append dlprefiles " $arg"
+           fi
+           prev=
+           continue
+           ;;
+         esac
+         ;;
+       expsyms)
+         export_symbols="$arg"
+         test -f "$arg" \
+           || func_fatal_error "symbol file \`$arg' does not exist"
+         prev=
+         continue
+         ;;
+       expsyms_regex)
+         export_symbols_regex="$arg"
+         prev=
+         continue
+         ;;
+       framework)
+         case $host in
+           *-*-darwin*)
+             case "$deplibs " in
+               *" $qarg.ltframework "*) ;;
+               *) func_append deplibs " $qarg.ltframework" # this is fixed later
+                  ;;
+             esac
+             ;;
+         esac
+         prev=
+         continue
+         ;;
+       inst_prefix)
+         inst_prefix_dir="$arg"
+         prev=
+         continue
+         ;;
+       objectlist)
+         if test -f "$arg"; then
+           save_arg=$arg
+           moreargs=
+           for fil in `cat "$save_arg"`
+           do
+#            func_append moreargs " $fil"
+             arg=$fil
+             # A libtool-controlled object.
+
+             # Check to see that this really is a libtool object.
+             if func_lalib_unsafe_p "$arg"; then
+               pic_object=
+               non_pic_object=
+
+               # Read the .lo file
+               func_source "$arg"
+
+               if test -z "$pic_object" ||
+                  test -z "$non_pic_object" ||
+                  test "$pic_object" = none &&
+                  test "$non_pic_object" = none; then
+                 func_fatal_error "cannot find name of object for \`$arg'"
+               fi
+
+               # Extract subdirectory from the argument.
+               func_dirname "$arg" "/" ""
+               xdir="$func_dirname_result"
+
+               if test "$pic_object" != none; then
+                 # Prepend the subdirectory the object is found in.
+                 pic_object="$xdir$pic_object"
+
+                 if test "$prev" = dlfiles; then
+                   if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+                     func_append dlfiles " $pic_object"
+                     prev=
+                     continue
+                   else
+                     # If libtool objects are unsupported, then we need to preload.
+                     prev=dlprefiles
+                   fi
+                 fi
+
+                 # CHECK ME:  I think I busted this.  -Ossama
+                 if test "$prev" = dlprefiles; then
+                   # Preload the old-style object.
+                   func_append dlprefiles " $pic_object"
+                   prev=
+                 fi
+
+                 # A PIC object.
+                 func_append libobjs " $pic_object"
+                 arg="$pic_object"
+               fi
+
+               # Non-PIC object.
+               if test "$non_pic_object" != none; then
+                 # Prepend the subdirectory the object is found in.
+                 non_pic_object="$xdir$non_pic_object"
+
+                 # A standard non-PIC object
+                 func_append non_pic_objects " $non_pic_object"
+                 if test -z "$pic_object" || test "$pic_object" = none ; then
+                   arg="$non_pic_object"
+                 fi
+               else
+                 # If the PIC object exists, use it instead.
+                 # $xdir was prepended to $pic_object above.
+                 non_pic_object="$pic_object"
+                 func_append non_pic_objects " $non_pic_object"
+               fi
+             else
+               # Only an error if not doing a dry-run.
+               if $opt_dry_run; then
+                 # Extract subdirectory from the argument.
+                 func_dirname "$arg" "/" ""
+                 xdir="$func_dirname_result"
+
+                 func_lo2o "$arg"
+                 pic_object=$xdir$objdir/$func_lo2o_result
+                 non_pic_object=$xdir$func_lo2o_result
+                 func_append libobjs " $pic_object"
+                 func_append non_pic_objects " $non_pic_object"
+               else
+                 func_fatal_error "\`$arg' is not a valid libtool object"
+               fi
+             fi
+           done
+         else
+           func_fatal_error "link input file \`$arg' does not exist"
+         fi
+         arg=$save_arg
+         prev=
+         continue
+         ;;
+       precious_regex)
+         precious_files_regex="$arg"
+         prev=
+         continue
+         ;;
+       release)
+         release="-$arg"
+         prev=
+         continue
+         ;;
+       rpath | xrpath)
+         # We need an absolute path.
+         case $arg in
+         [\\/]* | [A-Za-z]:[\\/]*) ;;
+         *)
+           func_fatal_error "only absolute run-paths are allowed"
+           ;;
+         esac
+         if test "$prev" = rpath; then
+           case "$rpath " in
+           *" $arg "*) ;;
+           *) func_append rpath " $arg" ;;
+           esac
+         else
+           case "$xrpath " in
+           *" $arg "*) ;;
+           *) func_append xrpath " $arg" ;;
+           esac
+         fi
+         prev=
+         continue
+         ;;
+       shrext)
+         shrext_cmds="$arg"
+         prev=
+         continue
+         ;;
+       weak)
+         func_append weak_libs " $arg"
+         prev=
+         continue
+         ;;
+       xcclinker)
+         func_append linker_flags " $qarg"
+         func_append compiler_flags " $qarg"
+         prev=
+         func_append compile_command " $qarg"
+         func_append finalize_command " $qarg"
+         continue
+         ;;
+       xcompiler)
+         func_append compiler_flags " $qarg"
+         prev=
+         func_append compile_command " $qarg"
+         func_append finalize_command " $qarg"
+         continue
+         ;;
+       xlinker)
+         func_append linker_flags " $qarg"
+         func_append compiler_flags " $wl$qarg"
+         prev=
+         func_append compile_command " $wl$qarg"
+         func_append finalize_command " $wl$qarg"
+         continue
+         ;;
+       *)
+         eval "$prev=\"\$arg\""
+         prev=
+         continue
+         ;;
+       esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+       if test -n "$link_static_flag"; then
+         # See comment for -static flag below, for more details.
+         func_append compile_command " $link_static_flag"
+         func_append finalize_command " $link_static_flag"
+       fi
+       continue
+       ;;
+
+      -allow-undefined)
+       # FIXME: remove this flag sometime in the future.
+       func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+       ;;
+
+      -avoid-version)
+       avoid_version=yes
+       continue
+       ;;
+
+      -bindir)
+       prev=bindir
+       continue
+       ;;
+
+      -dlopen)
+       prev=dlfiles
+       continue
+       ;;
+
+      -dlpreopen)
+       prev=dlprefiles
+       continue
+       ;;
+
+      -export-dynamic)
+       export_dynamic=yes
+       continue
+       ;;
+
+      -export-symbols | -export-symbols-regex)
+       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+         func_fatal_error "more than one -exported-symbols argument is not allowed"
+       fi
+       if test "X$arg" = "X-export-symbols"; then
+         prev=expsyms
+       else
+         prev=expsyms_regex
+       fi
+       continue
+       ;;
+
+      -framework)
+       prev=framework
+       continue
+       ;;
+
+      -inst-prefix-dir)
+       prev=inst_prefix
+       continue
+       ;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+       case $with_gcc/$host in
+       no/*-*-irix* | /*-*-irix*)
+         func_append compile_command " $arg"
+         func_append finalize_command " $arg"
+         ;;
+       esac
+       continue
+       ;;
+
+      -L*)
+       func_stripname "-L" '' "$arg"
+       if test -z "$func_stripname_result"; then
+         if test "$#" -gt 0; then
+           func_fatal_error "require no space between \`-L' and \`$1'"
+         else
+           func_fatal_error "need path for \`-L' option"
+         fi
+       fi
+       func_resolve_sysroot "$func_stripname_result"
+       dir=$func_resolve_sysroot_result
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       *)
+         absdir=`cd "$dir" && pwd`
+         test -z "$absdir" && \
+           func_fatal_error "cannot determine absolute directory name of \`$dir'"
+         dir="$absdir"
+         ;;
+       esac
+       case "$deplibs " in
+       *" -L$dir "* | *" $arg "*)
+         # Will only happen for absolute or sysroot arguments
+         ;;
+       *)
+         # Preserve sysroot, but never include relative directories
+         case $dir in
+           [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+           *) func_append deplibs " -L$dir" ;;
+         esac
+         func_append lib_search_path " $dir"
+         ;;
+       esac
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+         testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$dir:"*) ;;
+         ::) dllsearchpath=$dir;;
+         *) func_append dllsearchpath ":$dir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
+         ::) dllsearchpath=$testbindir;;
+         *) func_append dllsearchpath ":$testbindir";;
+         esac
+         ;;
+       esac
+       continue
+       ;;
+
+      -l*)
+       if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+           # These systems don't actually have a C or math library (as such)
+           continue
+           ;;
+         *-*-os2*)
+           # These systems don't actually have a C library (as such)
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+           # Do not include libc due to us having libc/libc_r.
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C and math libraries are in the System framework
+           func_append deplibs " System.ltframework"
+           continue
+           ;;
+         *-*-sco3.2v5* | *-*-sco5v6*)
+           # Causes problems with __ctype
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+           # Compiler inserts libc in the correct place for threads to work
+           test "X$arg" = "X-lc" && continue
+           ;;
+         esac
+       elif test "X$arg" = "X-lc_r"; then
+        case $host in
+        *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+          # Do not include libc_r directly, use -pthread flag.
+          continue
+          ;;
+        esac
+       fi
+       func_append deplibs " $arg"
+       continue
+       ;;
+
+      -module)
+       module=yes
+       continue
+       ;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      # Darwin uses the -arch flag to determine output architecture.
+      -model|-arch|-isysroot|--sysroot)
+       func_append compiler_flags " $arg"
+       func_append compile_command " $arg"
+       func_append finalize_command " $arg"
+       prev=xcompiler
+       continue
+       ;;
+
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+       func_append compiler_flags " $arg"
+       func_append compile_command " $arg"
+       func_append finalize_command " $arg"
+       case "$new_inherited_linker_flags " in
+           *" $arg "*) ;;
+           * ) func_append new_inherited_linker_flags " $arg" ;;
+       esac
+       continue
+       ;;
+
+      -multi_module)
+       single_module="${wl}-multi_module"
+       continue
+       ;;
+
+      -no-fast-install)
+       fast_install=no
+       continue
+       ;;
+
+      -no-install)
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+         # The PATH hackery in wrapper scripts is required on Windows
+         # and Darwin in order for the loader to find any dlls it needs.
+         func_warning "\`-no-install' is ignored for $host"
+         func_warning "assuming \`-no-fast-install' instead"
+         fast_install=no
+         ;;
+       *) no_install=yes ;;
+       esac
+       continue
+       ;;
+
+      -no-undefined)
+       allow_undefined=no
+       continue
+       ;;
+
+      -objectlist)
+       prev=objectlist
+       continue
+       ;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+       prev=precious_regex
+       continue
+       ;;
+
+      -release)
+       prev=release
+       continue
+       ;;
+
+      -rpath)
+       prev=rpath
+       continue
+       ;;
+
+      -R)
+       prev=xrpath
+       continue
+       ;;
+
+      -R*)
+       func_stripname '-R' '' "$arg"
+       dir=$func_stripname_result
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       =*)
+         func_stripname '=' '' "$dir"
+         dir=$lt_sysroot$func_stripname_result
+         ;;
+       *)
+         func_fatal_error "only absolute run-paths are allowed"
+         ;;
+       esac
+       case "$xrpath " in
+       *" $dir "*) ;;
+       *) func_append xrpath " $dir" ;;
+       esac
+       continue
+       ;;
+
+      -shared)
+       # The effects of -shared are defined in a previous loop.
+       continue
+       ;;
+
+      -shrext)
+       prev=shrext
+       continue
+       ;;
+
+      -static | -static-libtool-libs)
+       # The effects of -static are defined in a previous loop.
+       # We used to do the same as -all-static on platforms that
+       # didn't have a PIC flag, but the assumption that the effects
+       # would be equivalent was wrong.  It would break on at least
+       # Digital Unix and AIX.
+       continue
+       ;;
+
+      -thread-safe)
+       thread_safe=yes
+       continue
+       ;;
+
+      -version-info)
+       prev=vinfo
+       continue
+       ;;
+
+      -version-number)
+       prev=vinfo
+       vinfo_number=yes
+       continue
+       ;;
+
+      -weak)
+        prev=weak
+       continue
+       ;;
+
+      -Wc,*)
+       func_stripname '-Wc,' '' "$arg"
+       args=$func_stripname_result
+       arg=
+       save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+         func_append arg " $func_quote_for_eval_result"
+         func_append compiler_flags " $func_quote_for_eval_result"
+       done
+       IFS="$save_ifs"
+       func_stripname ' ' '' "$arg"
+       arg=$func_stripname_result
+       ;;
+
+      -Wl,*)
+       func_stripname '-Wl,' '' "$arg"
+       args=$func_stripname_result
+       arg=
+       save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+         func_append arg " $wl$func_quote_for_eval_result"
+         func_append compiler_flags " $wl$func_quote_for_eval_result"
+         func_append linker_flags " $func_quote_for_eval_result"
+       done
+       IFS="$save_ifs"
+       func_stripname ' ' '' "$arg"
+       arg=$func_stripname_result
+       ;;
+
+      -Xcompiler)
+       prev=xcompiler
+       continue
+       ;;
+
+      -Xlinker)
+       prev=xlinker
+       continue
+       ;;
+
+      -XCClinker)
+       prev=xcclinker
+       continue
+       ;;
+
+      # -msg_* for osf cc
+      -msg_*)
+       func_quote_for_eval "$arg"
+       arg="$func_quote_for_eval_result"
+       ;;
+
+      # Flags to be passed through unchanged, with rationale:
+      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
+      # -r[0-9][0-9]*        specify processor for the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+      # +DA*, +DD*           enable 64-bit mode for the HP compiler
+      # -q*                  compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+      # -F/path              path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # @file                GCC response files
+      # -tp=*                Portland pgcc target processor selection
+      # --sysroot=*          for sysroot support
+      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+        func_quote_for_eval "$arg"
+       arg="$func_quote_for_eval_result"
+        func_append compile_command " $arg"
+        func_append finalize_command " $arg"
+        func_append compiler_flags " $arg"
+        continue
+        ;;
+
+      # Some other compiler flag.
+      -* | +*)
+        func_quote_for_eval "$arg"
+       arg="$func_quote_for_eval_result"
+       ;;
+
+      *.$objext)
+       # A standard object.
+       func_append objs " $arg"
+       ;;
+
+      *.lo)
+       # A libtool-controlled object.
+
+       # Check to see that this really is a libtool object.
+       if func_lalib_unsafe_p "$arg"; then
+         pic_object=
+         non_pic_object=
+
+         # Read the .lo file
+         func_source "$arg"
+
+         if test -z "$pic_object" ||
+            test -z "$non_pic_object" ||
+            test "$pic_object" = none &&
+            test "$non_pic_object" = none; then
+           func_fatal_error "cannot find name of object for \`$arg'"
+         fi
+
+         # Extract subdirectory from the argument.
+         func_dirname "$arg" "/" ""
+         xdir="$func_dirname_result"
+
+         if test "$pic_object" != none; then
+           # Prepend the subdirectory the object is found in.
+           pic_object="$xdir$pic_object"
+
+           if test "$prev" = dlfiles; then
+             if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+               func_append dlfiles " $pic_object"
+               prev=
+               continue
+             else
+               # If libtool objects are unsupported, then we need to preload.
+               prev=dlprefiles
+             fi
+           fi
+
+           # CHECK ME:  I think I busted this.  -Ossama
+           if test "$prev" = dlprefiles; then
+             # Preload the old-style object.
+             func_append dlprefiles " $pic_object"
+             prev=
+           fi
+
+           # A PIC object.
+           func_append libobjs " $pic_object"
+           arg="$pic_object"
+         fi
+
+         # Non-PIC object.
+         if test "$non_pic_object" != none; then
+           # Prepend the subdirectory the object is found in.
+           non_pic_object="$xdir$non_pic_object"
+
+           # A standard non-PIC object
+           func_append non_pic_objects " $non_pic_object"
+           if test -z "$pic_object" || test "$pic_object" = none ; then
+             arg="$non_pic_object"
+           fi
+         else
+           # If the PIC object exists, use it instead.
+           # $xdir was prepended to $pic_object above.
+           non_pic_object="$pic_object"
+           func_append non_pic_objects " $non_pic_object"
+         fi
+       else
+         # Only an error if not doing a dry-run.
+         if $opt_dry_run; then
+           # Extract subdirectory from the argument.
+           func_dirname "$arg" "/" ""
+           xdir="$func_dirname_result"
+
+           func_lo2o "$arg"
+           pic_object=$xdir$objdir/$func_lo2o_result
+           non_pic_object=$xdir$func_lo2o_result
+           func_append libobjs " $pic_object"
+           func_append non_pic_objects " $non_pic_object"
+         else
+           func_fatal_error "\`$arg' is not a valid libtool object"
+         fi
+       fi
+       ;;
+
+      *.$libext)
+       # An archive.
+       func_append deplibs " $arg"
+       func_append old_deplibs " $arg"
+       continue
+       ;;
+
+      *.la)
+       # A libtool-controlled library.
+
+       func_resolve_sysroot "$arg"
+       if test "$prev" = dlfiles; then
+         # This library was specified with -dlopen.
+         func_append dlfiles " $func_resolve_sysroot_result"
+         prev=
+       elif test "$prev" = dlprefiles; then
+         # The library was specified with -dlpreopen.
+         func_append dlprefiles " $func_resolve_sysroot_result"
+         prev=
+       else
+         func_append deplibs " $func_resolve_sysroot_result"
+       fi
+       continue
+       ;;
+
+      # Some other compiler argument.
+      *)
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       func_quote_for_eval "$arg"
+       arg="$func_quote_for_eval_result"
+       ;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+       func_append compile_command " $arg"
+       func_append finalize_command " $arg"
+      fi
+    done # argument parsing loop
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prevarg' option requires an argument"
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      func_append compile_command " $arg"
+      func_append finalize_command " $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    func_basename "$output"
+    outputname="$func_basename_result"
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    func_dirname "$output" "/" ""
+    output_objdir="$func_dirname_result$objdir"
+    func_to_tool_file "$output_objdir/"
+    tool_output_objdir=$func_to_tool_file_result
+    # Create the object directory.
+    func_mkdir_p "$output_objdir"
+
+    # Determine the type of output
+    case $output in
+    "")
+      func_fatal_help "you must specify an output file"
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if $opt_preserve_dup_deps ; then
+       case "$libs " in
+       *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+       esac
+      fi
+      func_append libs " $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if $opt_duplicate_compiler_generated_deps; then
+       for pre_post_dep in $predeps $postdeps; do
+         case "$pre_post_deps " in
+         *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+         esac
+         func_append pre_post_deps " $pre_post_dep"
+       done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+
+    case $linkmode in
+    lib)
+       passes="conv dlpreopen link"
+       for file in $dlfiles $dlprefiles; do
+         case $file in
+         *.la) ;;
+         *)
+           func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+           ;;
+         esac
+       done
+       ;;
+    prog)
+       compile_deplibs=
+       finalize_deplibs=
+       alldeplibs=no
+       newdlfiles=
+       newdlprefiles=
+       passes="conv scan dlopen dlpreopen link"
+       ;;
+    *)  passes="conv"
+       ;;
+    esac
+
+    for pass in $passes; do
+      # The preopen pass in lib mode reverses $deplibs; put it back here
+      # so that -L comes before libs that need it for instance...
+      if test "$linkmode,$pass" = "lib,link"; then
+       ## FIXME: Find the place where the list is rebuilt in the wrong
+       ##        order, and fix it there properly
+        tmp_deplibs=
+       for deplib in $deplibs; do
+         tmp_deplibs="$deplib $tmp_deplibs"
+       done
+       deplibs="$tmp_deplibs"
+      fi
+
+      if test "$linkmode,$pass" = "lib,link" ||
+        test "$linkmode,$pass" = "prog,scan"; then
+       libs="$deplibs"
+       deplibs=
+      fi
+      if test "$linkmode" = prog; then
+       case $pass in
+       dlopen) libs="$dlfiles" ;;
+       dlpreopen) libs="$dlprefiles" ;;
+       link)
+         libs="$deplibs %DEPLIBS%"
+         test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+         ;;
+       esac
+      fi
+      if test "$linkmode,$pass" = "lib,dlpreopen"; then
+       # Collect and forward deplibs of preopened libtool libs
+       for lib in $dlprefiles; do
+         # Ignore non-libtool-libs
+         dependency_libs=
+         func_resolve_sysroot "$lib"
+         case $lib in
+         *.la) func_source "$func_resolve_sysroot_result" ;;
+         esac
+
+         # Collect preopened libtool deplibs, except any this library
+         # has declared as weak libs
+         for deplib in $dependency_libs; do
+           func_basename "$deplib"
+            deplib_base=$func_basename_result
+           case " $weak_libs " in
+           *" $deplib_base "*) ;;
+           *) func_append deplibs " $deplib" ;;
+           esac
+         done
+       done
+       libs="$dlprefiles"
+      fi
+      if test "$pass" = dlopen; then
+       # Collect dlpreopened libraries
+       save_deplibs="$deplibs"
+       deplibs=
+      fi
+
+      for deplib in $libs; do
+       lib=
+       found=no
+       case $deplib in
+       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+         if test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$deplib $compile_deplibs"
+           finalize_deplibs="$deplib $finalize_deplibs"
+         else
+           func_append compiler_flags " $deplib"
+           if test "$linkmode" = lib ; then
+               case "$new_inherited_linker_flags " in
+                   *" $deplib "*) ;;
+                   * ) func_append new_inherited_linker_flags " $deplib" ;;
+               esac
+           fi
+         fi
+         continue
+         ;;
+       -l*)
+         if test "$linkmode" != lib && test "$linkmode" != prog; then
+           func_warning "\`-l' is ignored for archives/objects"
+           continue
+         fi
+         func_stripname '-l' '' "$deplib"
+         name=$func_stripname_result
+         if test "$linkmode" = lib; then
+           searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+         else
+           searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+         fi
+         for searchdir in $searchdirs; do
+           for search_ext in .la $std_shrext .so .a; do
+             # Search the libtool library
+             lib="$searchdir/lib${name}${search_ext}"
+             if test -f "$lib"; then
+               if test "$search_ext" = ".la"; then
+                 found=yes
+               else
+                 found=no
+               fi
+               break 2
+             fi
+           done
+         done
+         if test "$found" != yes; then
+           # deplib doesn't seem to be a libtool library
+           if test "$linkmode,$pass" = "prog,link"; then
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             deplibs="$deplib $deplibs"
+             test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+           fi
+           continue
+         else # deplib is a libtool library
+           # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+           # We need to do some special things here, and not later.
+           if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+             case " $predeps $postdeps " in
+             *" $deplib "*)
+               if func_lalib_p "$lib"; then
+                 library_names=
+                 old_library=
+                 func_source "$lib"
+                 for l in $old_library $library_names; do
+                   ll="$l"
+                 done
+                 if test "X$ll" = "X$old_library" ; then # only static version available
+                   found=no
+                   func_dirname "$lib" "" "."
+                   ladir="$func_dirname_result"
+                   lib=$ladir/$old_library
+                   if test "$linkmode,$pass" = "prog,link"; then
+                     compile_deplibs="$deplib $compile_deplibs"
+                     finalize_deplibs="$deplib $finalize_deplibs"
+                   else
+                     deplibs="$deplib $deplibs"
+                     test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+                   fi
+                   continue
+                 fi
+               fi
+               ;;
+             *) ;;
+             esac
+           fi
+         fi
+         ;; # -l
+       *.ltframework)
+         if test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$deplib $compile_deplibs"
+           finalize_deplibs="$deplib $finalize_deplibs"
+         else
+           deplibs="$deplib $deplibs"
+           if test "$linkmode" = lib ; then
+               case "$new_inherited_linker_flags " in
+                   *" $deplib "*) ;;
+                   * ) func_append new_inherited_linker_flags " $deplib" ;;
+               esac
+           fi
+         fi
+         continue
+         ;;
+       -L*)
+         case $linkmode in
+         lib)
+           deplibs="$deplib $deplibs"
+           test "$pass" = conv && continue
+           newdependency_libs="$deplib $newdependency_libs"
+           func_stripname '-L' '' "$deplib"
+           func_resolve_sysroot "$func_stripname_result"
+           func_append newlib_search_path " $func_resolve_sysroot_result"
+           ;;
+         prog)
+           if test "$pass" = conv; then
+             deplibs="$deplib $deplibs"
+             continue
+           fi
+           if test "$pass" = scan; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           func_stripname '-L' '' "$deplib"
+           func_resolve_sysroot "$func_stripname_result"
+           func_append newlib_search_path " $func_resolve_sysroot_result"
+           ;;
+         *)
+           func_warning "\`-L' is ignored for archives/objects"
+           ;;
+         esac # linkmode
+         continue
+         ;; # -L
+       -R*)
+         if test "$pass" = link; then
+           func_stripname '-R' '' "$deplib"
+           func_resolve_sysroot "$func_stripname_result"
+           dir=$func_resolve_sysroot_result
+           # Make sure the xrpath contains only unique directories.
+           case "$xrpath " in
+           *" $dir "*) ;;
+           *) func_append xrpath " $dir" ;;
+           esac
+         fi
+         deplibs="$deplib $deplibs"
+         continue
+         ;;
+       *.la)
+         func_resolve_sysroot "$deplib"
+         lib=$func_resolve_sysroot_result
+         ;;
+       *.$libext)
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+           continue
+         fi
+         case $linkmode in
+         lib)
+           # Linking convenience modules into shared libraries is allowed,
+           # but linking other static libraries is non-portable.
+           case " $dlpreconveniencelibs " in
+           *" $deplib "*) ;;
+           *)
+             valid_a_lib=no
+             case $deplibs_check_method in
+               match_pattern*)
+                 set dummy $deplibs_check_method; shift
+                 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+                 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+                   | $EGREP "$match_pattern_regex" > /dev/null; then
+                   valid_a_lib=yes
+                 fi
+               ;;
+               pass_all)
+                 valid_a_lib=yes
+               ;;
+             esac
+             if test "$valid_a_lib" != yes; then
+               echo
+               $ECHO "*** Warning: Trying to link with static lib archive $deplib."
+               echo "*** I have the capability to make that library automatically link in when"
+               echo "*** you link to this library.  But I can only do this if you have a"
+               echo "*** shared version of the library, which you do not appear to have"
+               echo "*** because the file extensions .$libext of this argument makes me believe"
+               echo "*** that it is just a static archive that I should not use here."
+             else
+               echo
+               $ECHO "*** Warning: Linking the shared library $output against the"
+               $ECHO "*** static library $deplib is not portable!"
+               deplibs="$deplib $deplibs"
+             fi
+             ;;
+           esac
+           continue
+           ;;
+         prog)
+           if test "$pass" != link; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           continue
+           ;;
+         esac # linkmode
+         ;; # *.$libext
+       *.lo | *.$objext)
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+         elif test "$linkmode" = prog; then
+           if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+             # If there is no dlopen support or we're linking statically,
+             # we need to preload.
+             func_append newdlprefiles " $deplib"
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             func_append newdlfiles " $deplib"
+           fi
+         fi
+         continue
+         ;;
+       %DEPLIBS%)
+         alldeplibs=yes
+         continue
+         ;;
+       esac # case $deplib
+
+       if test "$found" = yes || test -f "$lib"; then :
+       else
+         func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+       fi
+
+       # Check to see that this really is a libtool archive.
+       func_lalib_unsafe_p "$lib" \
+         || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+       func_dirname "$lib" "" "."
+       ladir="$func_dirname_result"
+
+       dlname=
+       dlopen=
+       dlpreopen=
+       libdir=
+       library_names=
+       old_library=
+       inherited_linker_flags=
+       # If the library was installed with an old release of libtool,
+       # it will not redefine variables installed, or shouldnotlink
+       installed=yes
+       shouldnotlink=no
+       avoidtemprpath=
+
+
+       # Read the .la file
+       func_source "$lib"
+
+       # Convert "-framework foo" to "foo.ltframework"
+       if test -n "$inherited_linker_flags"; then
+         tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+         for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+           case " $new_inherited_linker_flags " in
+             *" $tmp_inherited_linker_flag "*) ;;
+             *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+           esac
+         done
+       fi
+       dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+       if test "$linkmode,$pass" = "lib,link" ||
+          test "$linkmode,$pass" = "prog,scan" ||
+          { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+         test -n "$dlopen" && func_append dlfiles " $dlopen"
+         test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+       fi
+
+       if test "$pass" = conv; then
+         # Only check for convenience libraries
+         deplibs="$lib $deplibs"
+         if test -z "$libdir"; then
+           if test -z "$old_library"; then
+             func_fatal_error "cannot find name of link library for \`$lib'"
+           fi
+           # It is a libtool convenience library, so add in its objects.
+           func_append convenience " $ladir/$objdir/$old_library"
+           func_append old_convenience " $ladir/$objdir/$old_library"
+           tmp_libs=
+           for deplib in $dependency_libs; do
+             deplibs="$deplib $deplibs"
+             if $opt_preserve_dup_deps ; then
+               case "$tmp_libs " in
+               *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+               esac
+             fi
+             func_append tmp_libs " $deplib"
+           done
+         elif test "$linkmode" != prog && test "$linkmode" != lib; then
+           func_fatal_error "\`$lib' is not a convenience library"
+         fi
+         continue
+       fi # $pass = conv
+
+
+       # Get the name of the library we link against.
+       linklib=
+       if test -n "$old_library" &&
+          { test "$prefer_static_libs" = yes ||
+            test "$prefer_static_libs,$installed" = "built,no"; }; then
+         linklib=$old_library
+       else
+         for l in $old_library $library_names; do
+           linklib="$l"
+         done
+       fi
+       if test -z "$linklib"; then
+         func_fatal_error "cannot find name of link library for \`$lib'"
+       fi
+
+       # This library was specified with -dlopen.
+       if test "$pass" = dlopen; then
+         if test -z "$libdir"; then
+           func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+         fi
+         if test -z "$dlname" ||
+            test "$dlopen_support" != yes ||
+            test "$build_libtool_libs" = no; then
+           # If there is no dlname, no dlopen support or we're linking
+           # statically, we need to preload.  We also need to preload any
+           # dependent libraries so libltdl's deplib preloader doesn't
+           # bomb out in the load deplibs phase.
+           func_append dlprefiles " $lib $dependency_libs"
+         else
+           func_append newdlfiles " $lib"
+         fi
+         continue
+       fi # $pass = dlopen
+
+       # We need an absolute path.
+       case $ladir in
+       [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+       *)
+         abs_ladir=`cd "$ladir" && pwd`
+         if test -z "$abs_ladir"; then
+           func_warning "cannot determine absolute directory name of \`$ladir'"
+           func_warning "passing it literally to the linker, although it might fail"
+           abs_ladir="$ladir"
+         fi
+         ;;
+       esac
+       func_basename "$lib"
+       laname="$func_basename_result"
+
+       # Find the relevant object directory and library name.
+       if test "X$installed" = Xyes; then
+         if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           func_warning "library \`$lib' was moved."
+           dir="$ladir"
+           absdir="$abs_ladir"
+           libdir="$abs_ladir"
+         else
+           dir="$lt_sysroot$libdir"
+           absdir="$lt_sysroot$libdir"
+         fi
+         test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+       else
+         if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           dir="$ladir"
+           absdir="$abs_ladir"
+           # Remove this search path later
+           func_append notinst_path " $abs_ladir"
+         else
+           dir="$ladir/$objdir"
+           absdir="$abs_ladir/$objdir"
+           # Remove this search path later
+           func_append notinst_path " $abs_ladir"
+         fi
+       fi # $installed = yes
+       func_stripname 'lib' '.la' "$laname"
+       name=$func_stripname_result
+
+       # This library was specified with -dlpreopen.
+       if test "$pass" = dlpreopen; then
+         if test -z "$libdir" && test "$linkmode" = prog; then
+           func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+         fi
+         case "$host" in
+           # special handling for platforms with PE-DLLs.
+           *cygwin* | *mingw* | *cegcc* )
+             # Linker will automatically link against shared library if both
+             # static and shared are present.  Therefore, ensure we extract
+             # symbols from the import library if a shared library is present
+             # (otherwise, the dlopen module name will be incorrect).  We do
+             # this by putting the import library name into $newdlprefiles.
+             # We recover the dlopen module name by 'saving' the la file
+             # name in a special purpose variable, and (later) extracting the
+             # dlname from the la file.
+             if test -n "$dlname"; then
+               func_tr_sh "$dir/$linklib"
+               eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+               func_append newdlprefiles " $dir/$linklib"
+             else
+               func_append newdlprefiles " $dir/$old_library"
+               # Keep a list of preopened convenience libraries to check
+               # that they are being used correctly in the link pass.
+               test -z "$libdir" && \
+                 func_append dlpreconveniencelibs " $dir/$old_library"
+             fi
+           ;;
+           * )
+             # Prefer using a static library (so that no silly _DYNAMIC symbols
+             # are required to link).
+             if test -n "$old_library"; then
+               func_append newdlprefiles " $dir/$old_library"
+               # Keep a list of preopened convenience libraries to check
+               # that they are being used correctly in the link pass.
+               test -z "$libdir" && \
+                 func_append dlpreconveniencelibs " $dir/$old_library"
+             # Otherwise, use the dlname, so that lt_dlopen finds it.
+             elif test -n "$dlname"; then
+               func_append newdlprefiles " $dir/$dlname"
+             else
+               func_append newdlprefiles " $dir/$linklib"
+             fi
+           ;;
+         esac
+       fi # $pass = dlpreopen
+
+       if test -z "$libdir"; then
+         # Link the convenience library
+         if test "$linkmode" = lib; then
+           deplibs="$dir/$old_library $deplibs"
+         elif test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$dir/$old_library $compile_deplibs"
+           finalize_deplibs="$dir/$old_library $finalize_deplibs"
+         else
+           deplibs="$lib $deplibs" # used for prog,scan pass
+         fi
+         continue
+       fi
+
+
+       if test "$linkmode" = prog && test "$pass" != link; then
+         func_append newlib_search_path " $ladir"
+         deplibs="$lib $deplibs"
+
+         linkalldeplibs=no
+         if test "$link_all_deplibs" != no || test -z "$library_names" ||
+            test "$build_libtool_libs" = no; then
+           linkalldeplibs=yes
+         fi
+
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           case $deplib in
+           -L*) func_stripname '-L' '' "$deplib"
+                func_resolve_sysroot "$func_stripname_result"
+                func_append newlib_search_path " $func_resolve_sysroot_result"
+                ;;
+           esac
+           # Need to link against all dependency_libs?
+           if test "$linkalldeplibs" = yes; then
+             deplibs="$deplib $deplibs"
+           else
+             # Need to hardcode shared library paths
+             # or/and link against static libraries
+             newdependency_libs="$deplib $newdependency_libs"
+           fi
+           if $opt_preserve_dup_deps ; then
+             case "$tmp_libs " in
+             *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+             esac
+           fi
+           func_append tmp_libs " $deplib"
+         done # for deplib
+         continue
+       fi # $linkmode = prog...
+
+       if test "$linkmode,$pass" = "prog,link"; then
+         if test -n "$library_names" &&
+            { { test "$prefer_static_libs" = no ||
+                test "$prefer_static_libs,$installed" = "built,yes"; } ||
+              test -z "$old_library"; }; then
+           # We need to hardcode the library path
+           if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+             # Make sure the rpath contains only unique directories.
+             case "$temp_rpath:" in
+             *"$absdir:"*) ;;
+             *) func_append temp_rpath "$absdir:" ;;
+             esac
+           fi
+
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) func_append compile_rpath " $absdir" ;;
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) func_append finalize_rpath " $libdir" ;;
+             esac
+             ;;
+           esac
+         fi # $linkmode,$pass = prog,link...
+
+         if test "$alldeplibs" = yes &&
+            { test "$deplibs_check_method" = pass_all ||
+              { test "$build_libtool_libs" = yes &&
+                test -n "$library_names"; }; }; then
+           # We only need to search for static libraries
+           continue
+         fi
+       fi
+
+       link_static=no # Whether the deplib will be linked statically
+       use_static_libs=$prefer_static_libs
+       if test "$use_static_libs" = built && test "$installed" = yes; then
+         use_static_libs=no
+       fi
+       if test -n "$library_names" &&
+          { test "$use_static_libs" = no || test -z "$old_library"; }; then
+         case $host in
+         *cygwin* | *mingw* | *cegcc*)
+             # No point in relinking DLLs because paths are not encoded
+             func_append notinst_deplibs " $lib"
+             need_relink=no
+           ;;
+         *)
+           if test "$installed" = no; then
+             func_append notinst_deplibs " $lib"
+             need_relink=yes
+           fi
+           ;;
+         esac
+         # This is a shared library
+
+         # Warn about portability, can't link against -module's on some
+         # systems (darwin).  Don't bleat about dlopened modules though!
+         dlopenmodule=""
+         for dlpremoduletest in $dlprefiles; do
+           if test "X$dlpremoduletest" = "X$lib"; then
+             dlopenmodule="$dlpremoduletest"
+             break
+           fi
+         done
+         if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+           echo
+           if test "$linkmode" = prog; then
+             $ECHO "*** Warning: Linking the executable $output against the loadable module"
+           else
+             $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+           fi
+           $ECHO "*** $linklib is not portable!"
+         fi
+         if test "$linkmode" = lib &&
+            test "$hardcode_into_libs" = yes; then
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) func_append compile_rpath " $absdir" ;;
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) func_append finalize_rpath " $libdir" ;;
+             esac
+             ;;
+           esac
+         fi
+
+         if test -n "$old_archive_from_expsyms_cmds"; then
+           # figure out the soname
+           set dummy $library_names
+           shift
+           realname="$1"
+           shift
+           libname=`eval "\\$ECHO \"$libname_spec\""`
+           # use dlname if we got it. it's perfectly good, no?
+           if test -n "$dlname"; then
+             soname="$dlname"
+           elif test -n "$soname_spec"; then
+             # bleh windows
+             case $host in
+             *cygwin* | mingw* | *cegcc*)
+               func_arith $current - $age
+               major=$func_arith_result
+               versuffix="-$major"
+               ;;
+             esac
+             eval soname=\"$soname_spec\"
+           else
+             soname="$realname"
+           fi
+
+           # Make a new name for the extract_expsyms_cmds to use
+           soroot="$soname"
+           func_basename "$soroot"
+           soname="$func_basename_result"
+           func_stripname 'lib' '.dll' "$soname"
+           newlib=libimp-$func_stripname_result.a
+
+           # If the library has no export list, then create one now
+           if test -f "$output_objdir/$soname-def"; then :
+           else
+             func_verbose "extracting exported symbol list from \`$soname'"
+             func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+           fi
+
+           # Create $newlib
+           if test -f "$output_objdir/$newlib"; then :; else
+             func_verbose "generating import library for \`$soname'"
+             func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+           fi
+           # make sure the library variables are pointing to the new library
+           dir=$output_objdir
+           linklib=$newlib
+         fi # test -n "$old_archive_from_expsyms_cmds"
+
+         if test "$linkmode" = prog || test "$opt_mode" != relink; then
+           add_shlibpath=
+           add_dir=
+           add=
+           lib_linked=yes
+           case $hardcode_action in
+           immediate | unsupported)
+             if test "$hardcode_direct" = no; then
+               add="$dir/$linklib"
+               case $host in
+                 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+                 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+                 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+                   *-*-unixware7*) add_dir="-L$dir" ;;
+                 *-*-darwin* )
+                   # if the lib is a (non-dlopened) module then we can not
+                   # link against it, someone is ignoring the earlier warnings
+                   if /usr/bin/file -L $add 2> /dev/null |
+                        $GREP ": [^:]* bundle" >/dev/null ; then
+                     if test "X$dlopenmodule" != "X$lib"; then
+                       $ECHO "*** Warning: lib $linklib is a module, not a shared library"
+                       if test -z "$old_library" ; then
+                         echo
+                         echo "*** And there doesn't seem to be a static archive available"
+                         echo "*** The link will probably fail, sorry"
+                       else
+                         add="$dir/$old_library"
+                       fi
+                     elif test -n "$old_library"; then
+                       add="$dir/$old_library"
+                     fi
+                   fi
+               esac
+             elif test "$hardcode_minus_L" = no; then
+               case $host in
+               *-*-sunos*) add_shlibpath="$dir" ;;
+               esac
+               add_dir="-L$dir"
+               add="-l$name"
+             elif test "$hardcode_shlibpath_var" = no; then
+               add_shlibpath="$dir"
+               add="-l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           relink)
+             if test "$hardcode_direct" = yes &&
+                test "$hardcode_direct_absolute" = no; then
+               add="$dir/$linklib"
+             elif test "$hardcode_minus_L" = yes; then
+               add_dir="-L$absdir"
+               # Try looking first in the location we're being installed to.
+               if test -n "$inst_prefix_dir"; then
+                 case $libdir in
+                   [\\/]*)
+                     func_append add_dir " -L$inst_prefix_dir$libdir"
+                     ;;
+                 esac
+               fi
+               add="-l$name"
+             elif test "$hardcode_shlibpath_var" = yes; then
+               add_shlibpath="$dir"
+               add="-l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           *) lib_linked=no ;;
+           esac
+
+           if test "$lib_linked" != yes; then
+             func_fatal_configuration "unsupported hardcode properties"
+           fi
+
+           if test -n "$add_shlibpath"; then
+             case :$compile_shlibpath: in
+             *":$add_shlibpath:"*) ;;
+             *) func_append compile_shlibpath "$add_shlibpath:" ;;
+             esac
+           fi
+           if test "$linkmode" = prog; then
+             test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+             test -n "$add" && compile_deplibs="$add $compile_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+             if test "$hardcode_direct" != yes &&
+                test "$hardcode_minus_L" != yes &&
+                test "$hardcode_shlibpath_var" = yes; then
+               case :$finalize_shlibpath: in
+               *":$libdir:"*) ;;
+               *) func_append finalize_shlibpath "$libdir:" ;;
+               esac
+             fi
+           fi
+         fi
+
+         if test "$linkmode" = prog || test "$opt_mode" = relink; then
+           add_shlibpath=
+           add_dir=
+           add=
+           # Finalize command for both is simple: just hardcode it.
+           if test "$hardcode_direct" = yes &&
+              test "$hardcode_direct_absolute" = no; then
+             add="$libdir/$linklib"
+           elif test "$hardcode_minus_L" = yes; then
+             add_dir="-L$libdir"
+             add="-l$name"
+           elif test "$hardcode_shlibpath_var" = yes; then
+             case :$finalize_shlibpath: in
+             *":$libdir:"*) ;;
+             *) func_append finalize_shlibpath "$libdir:" ;;
+             esac
+             add="-l$name"
+           elif test "$hardcode_automatic" = yes; then
+             if test -n "$inst_prefix_dir" &&
+                test -f "$inst_prefix_dir$libdir/$linklib" ; then
+               add="$inst_prefix_dir$libdir/$linklib"
+             else
+               add="$libdir/$linklib"
+             fi
+           else
+             # We cannot seem to hardcode it, guess we'll fake it.
+             add_dir="-L$libdir"
+             # Try looking first in the location we're being installed to.
+             if test -n "$inst_prefix_dir"; then
+               case $libdir in
+                 [\\/]*)
+                   func_append add_dir " -L$inst_prefix_dir$libdir"
+                   ;;
+               esac
+             fi
+             add="-l$name"
+           fi
+
+           if test "$linkmode" = prog; then
+             test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+             test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+           fi
+         fi
+       elif test "$linkmode" = prog; then
+         # Here we assume that one of hardcode_direct or hardcode_minus_L
+         # is not unsupported.  This is valid on all known static and
+         # shared platforms.
+         if test "$hardcode_direct" != unsupported; then
+           test -n "$old_library" && linklib="$old_library"
+           compile_deplibs="$dir/$linklib $compile_deplibs"
+           finalize_deplibs="$dir/$linklib $finalize_deplibs"
+         else
+           compile_deplibs="-l$name -L$dir $compile_deplibs"
+           finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+         fi
+       elif test "$build_libtool_libs" = yes; then
+         # Not a shared library
+         if test "$deplibs_check_method" != pass_all; then
+           # We're trying link a shared library against a static one
+           # but the system doesn't support it.
+
+           # Just print a warning and add the library to dependency_libs so
+           # that the program can be linked against the static library.
+           echo
+           $ECHO "*** Warning: This system can not link to static lib archive $lib."
+           echo "*** I have the capability to make that library automatically link in when"
+           echo "*** you link to this library.  But I can only do this if you have a"
+           echo "*** shared version of the library, which you do not appear to have."
+           if test "$module" = yes; then
+             echo "*** But as you try to build a module library, libtool will still create "
+             echo "*** a static module, that should work as long as the dlopening application"
+             echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+             if test -z "$global_symbol_pipe"; then
+               echo
+               echo "*** However, this would only work if libtool was able to extract symbol"
+               echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+               echo "*** not find such a program.  So, this module is probably useless."
+               echo "*** \`nm' from GNU binutils and a full rebuild may help."
+             fi
+             if test "$build_old_libs" = no; then
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         else
+           deplibs="$dir/$old_library $deplibs"
+           link_static=yes
+         fi
+       fi # link shared/static library?
+
+       if test "$linkmode" = lib; then
+         if test -n "$dependency_libs" &&
+            { test "$hardcode_into_libs" != yes ||
+              test "$build_old_libs" = yes ||
+              test "$link_static" = yes; }; then
+           # Extract -R from dependency_libs
+           temp_deplibs=
+           for libdir in $dependency_libs; do
+             case $libdir in
+             -R*) func_stripname '-R' '' "$libdir"
+                  temp_xrpath=$func_stripname_result
+                  case " $xrpath " in
+                  *" $temp_xrpath "*) ;;
+                  *) func_append xrpath " $temp_xrpath";;
+                  esac;;
+             *) func_append temp_deplibs " $libdir";;
+             esac
+           done
+           dependency_libs="$temp_deplibs"
+         fi
+
+         func_append newlib_search_path " $absdir"
+         # Link against this library
+         test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+         # ... and its dependency_libs
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           newdependency_libs="$deplib $newdependency_libs"
+           case $deplib in
+              -L*) func_stripname '-L' '' "$deplib"
+                   func_resolve_sysroot "$func_stripname_result";;
+              *) func_resolve_sysroot "$deplib" ;;
+            esac
+           if $opt_preserve_dup_deps ; then
+             case "$tmp_libs " in
+             *" $func_resolve_sysroot_result "*)
+                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+             esac
+           fi
+           func_append tmp_libs " $func_resolve_sysroot_result"
+         done
+
+         if test "$link_all_deplibs" != no; then
+           # Add the search paths of all dependency libraries
+           for deplib in $dependency_libs; do
+             path=
+             case $deplib in
+             -L*) path="$deplib" ;;
+             *.la)
+               func_resolve_sysroot "$deplib"
+               deplib=$func_resolve_sysroot_result
+               func_dirname "$deplib" "" "."
+               dir=$func_dirname_result
+               # We need an absolute path.
+               case $dir in
+               [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+               *)
+                 absdir=`cd "$dir" && pwd`
+                 if test -z "$absdir"; then
+                   func_warning "cannot determine absolute directory name of \`$dir'"
+                   absdir="$dir"
+                 fi
+                 ;;
+               esac
+               if $GREP "^installed=no" $deplib > /dev/null; then
+               case $host in
+               *-*-darwin*)
+                 depdepl=
+                 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+                 if test -n "$deplibrary_names" ; then
+                   for tmp in $deplibrary_names ; do
+                     depdepl=$tmp
+                   done
+                   if test -f "$absdir/$objdir/$depdepl" ; then
+                     depdepl="$absdir/$objdir/$depdepl"
+                     darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+                      if test -z "$darwin_install_name"; then
+                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
+                      fi
+                     func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+                     func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+                     path=
+                   fi
+                 fi
+                 ;;
+               *)
+                 path="-L$absdir/$objdir"
+                 ;;
+               esac
+               else
+                 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+                 test -z "$libdir" && \
+                   func_fatal_error "\`$deplib' is not a valid libtool archive"
+                 test "$absdir" != "$libdir" && \
+                   func_warning "\`$deplib' seems to be moved"
+
+                 path="-L$absdir"
+               fi
+               ;;
+             esac
+             case " $deplibs " in
+             *" $path "*) ;;
+             *) deplibs="$path $deplibs" ;;
+             esac
+           done
+         fi # link_all_deplibs != no
+       fi # linkmode = lib
+      done # for deplib in $libs
+      if test "$pass" = link; then
+       if test "$linkmode" = "prog"; then
+         compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+         finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+       else
+         compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+       fi
+      fi
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+       # Link the dlpreopened libraries before other libraries
+       for deplib in $save_deplibs; do
+         deplibs="$deplib $deplibs"
+       done
+      fi
+      if test "$pass" != dlopen; then
+       if test "$pass" != conv; then
+         # Make sure lib_search_path contains only unique directories.
+         lib_search_path=
+         for dir in $newlib_search_path; do
+           case "$lib_search_path " in
+           *" $dir "*) ;;
+           *) func_append lib_search_path " $dir" ;;
+           esac
+         done
+         newlib_search_path=
+       fi
+
+       if test "$linkmode,$pass" != "prog,link"; then
+         vars="deplibs"
+       else
+         vars="compile_deplibs finalize_deplibs"
+       fi
+       for var in $vars dependency_libs; do
+         # Add libraries to $var in reverse order
+         eval tmp_libs=\"\$$var\"
+         new_libs=
+         for deplib in $tmp_libs; do
+           # FIXME: Pedantically, this is the right thing to do, so
+           #        that some nasty dependency loop isn't accidentally
+           #        broken:
+           #new_libs="$deplib $new_libs"
+           # Pragmatically, this seems to cause very few problems in
+           # practice:
+           case $deplib in
+           -L*) new_libs="$deplib $new_libs" ;;
+           -R*) ;;
+           *)
+             # And here is the reason: when a library appears more
+             # than once as an explicit dependence of a library, or
+             # is implicitly linked in more than once by the
+             # compiler, it is considered special, and multiple
+             # occurrences thereof are not removed.  Compare this
+             # with having the same library being listed as a
+             # dependency of multiple other libraries: in this case,
+             # we know (pedantically, we assume) the library does not
+             # need to be listed more than once, so we keep only the
+             # last copy.  This is not always right, but it is rare
+             # enough that we require users that really mean to play
+             # such unportable linking tricks to link the library
+             # using -Wl,-lname, so that libtool does not consider it
+             # for duplicate removal.
+             case " $specialdeplibs " in
+             *" $deplib "*) new_libs="$deplib $new_libs" ;;
+             *)
+               case " $new_libs " in
+               *" $deplib "*) ;;
+               *) new_libs="$deplib $new_libs" ;;
+               esac
+               ;;
+             esac
+             ;;
+           esac
+         done
+         tmp_libs=
+         for deplib in $new_libs; do
+           case $deplib in
+           -L*)
+             case " $tmp_libs " in
+             *" $deplib "*) ;;
+             *) func_append tmp_libs " $deplib" ;;
+             esac
+             ;;
+           *) func_append tmp_libs " $deplib" ;;
+           esac
+         done
+         eval $var=\"$tmp_libs\"
+       done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+       case " $predeps $postdeps $compiler_lib_search_path " in
+       *" $i "*)
+         i=""
+         ;;
+       esac
+       if test -n "$i" ; then
+         func_append tmp_libs " $i"
+       fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+    fi
+    if test "$linkmode" = prog || test "$linkmode" = lib; then
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       func_warning "\`-dlopen' is ignored for archives"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+       func_warning "\`-l' and \`-L' are ignored for archives" ;;
+      esac
+
+      test -n "$rpath" && \
+       func_warning "\`-rpath' is ignored for archives"
+
+      test -n "$xrpath" && \
+       func_warning "\`-R' is ignored for archives"
+
+      test -n "$vinfo" && \
+       func_warning "\`-version-info/-version-number' is ignored for archives"
+
+      test -n "$release" && \
+       func_warning "\`-release' is ignored for archives"
+
+      test -n "$export_symbols$export_symbols_regex" && \
+       func_warning "\`-export-symbols' is ignored for archives"
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      func_append objs "$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+       func_stripname 'lib' '.la' "$outputname"
+       name=$func_stripname_result
+       eval shared_ext=\"$shrext_cmds\"
+       eval libname=\"$libname_spec\"
+       ;;
+      *)
+       test "$module" = no && \
+         func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+       if test "$need_lib_prefix" != no; then
+         # Add the "lib" prefix for modules if required
+         func_stripname '' '.la' "$outputname"
+         name=$func_stripname_result
+         eval shared_ext=\"$shrext_cmds\"
+         eval libname=\"$libname_spec\"
+       else
+         func_stripname '' '.la' "$outputname"
+         libname=$func_stripname_result
+       fi
+       ;;
+      esac
+
+      if test -n "$objs"; then
+       if test "$deplibs_check_method" != pass_all; then
+         func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+       else
+         echo
+         $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+         $ECHO "*** objects $objs is not portable!"
+         func_append libobjs " $objs"
+       fi
+      fi
+
+      test "$dlself" != no && \
+       func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+      set dummy $rpath
+      shift
+      test "$#" -gt 1 && \
+       func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+      install_libdir="$1"
+
+      oldlibs=
+      if test -z "$rpath"; then
+       if test "$build_libtool_libs" = yes; then
+         # Building a libtool convenience library.
+         # Some compilers have problems with a `.al' extension so
+         # convenience libraries should have the same extension an
+         # archive normally would.
+         oldlibs="$output_objdir/$libname.$libext $oldlibs"
+         build_libtool_libs=convenience
+         build_old_libs=yes
+       fi
+
+       test -n "$vinfo" && \
+         func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+       test -n "$release" && \
+         func_warning "\`-release' is ignored for convenience libraries"
+      else
+
+       # Parse the version information argument.
+       save_ifs="$IFS"; IFS=':'
+       set dummy $vinfo 0 0 0
+       shift
+       IFS="$save_ifs"
+
+       test -n "$7" && \
+         func_fatal_help "too many parameters to \`-version-info'"
+
+       # convert absolute version numbers to libtool ages
+       # this retains compatibility with .la files and attempts
+       # to make the code below a bit more comprehensible
+
+       case $vinfo_number in
+       yes)
+         number_major="$1"
+         number_minor="$2"
+         number_revision="$3"
+         #
+         # There are really only two kinds -- those that
+         # use the current revision as the major version
+         # and those that subtract age and use age as
+         # a minor version.  But, then there is irix
+         # which has an extra 1 added just for fun
+         #
+         case $version_type in
+         # correct linux to gnu/linux during the next big refactor
+         darwin|linux|osf|windows|none)
+           func_arith $number_major + $number_minor
+           current=$func_arith_result
+           age="$number_minor"
+           revision="$number_revision"
+           ;;
+         freebsd-aout|freebsd-elf|qnx|sunos)
+           current="$number_major"
+           revision="$number_minor"
+           age="0"
+           ;;
+         irix|nonstopux)
+           func_arith $number_major + $number_minor
+           current=$func_arith_result
+           age="$number_minor"
+           revision="$number_minor"
+           lt_irix_increment=no
+           ;;
+         *)
+           func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+           ;;
+         esac
+         ;;
+       no)
+         current="$1"
+         revision="$2"
+         age="$3"
+         ;;
+       esac
+
+       # Check that each of the things are valid numbers.
+       case $current in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         func_error "CURRENT \`$current' must be a nonnegative integer"
+         func_fatal_error "\`$vinfo' is not valid version information"
+         ;;
+       esac
+
+       case $revision in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         func_error "REVISION \`$revision' must be a nonnegative integer"
+         func_fatal_error "\`$vinfo' is not valid version information"
+         ;;
+       esac
+
+       case $age in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         func_error "AGE \`$age' must be a nonnegative integer"
+         func_fatal_error "\`$vinfo' is not valid version information"
+         ;;
+       esac
+
+       if test "$age" -gt "$current"; then
+         func_error "AGE \`$age' is greater than the current interface number \`$current'"
+         func_fatal_error "\`$vinfo' is not valid version information"
+       fi
+
+       # Calculate the version variables.
+       major=
+       versuffix=
+       verstring=
+       case $version_type in
+       none) ;;
+
+       darwin)
+         # Like Linux, but with the current version available in
+         # verstring for coding it into the library header
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix="$major.$age.$revision"
+         # Darwin ld doesn't like 0 for these options...
+         func_arith $current + 1
+         minor_current=$func_arith_result
+         xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+         verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+         ;;
+
+       freebsd-aout)
+         major=".$current"
+         versuffix=".$current.$revision";
+         ;;
+
+       freebsd-elf)
+         major=".$current"
+         versuffix=".$current"
+         ;;
+
+       irix | nonstopux)
+         if test "X$lt_irix_increment" = "Xno"; then
+           func_arith $current - $age
+         else
+           func_arith $current - $age + 1
+         fi
+         major=$func_arith_result
+
+         case $version_type in
+           nonstopux) verstring_prefix=nonstopux ;;
+           *)         verstring_prefix=sgi ;;
+         esac
+         verstring="$verstring_prefix$major.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$revision
+         while test "$loop" -ne 0; do
+           func_arith $revision - $loop
+           iface=$func_arith_result
+           func_arith $loop - 1
+           loop=$func_arith_result
+           verstring="$verstring_prefix$major.$iface:$verstring"
+         done
+
+         # Before this point, $major must not contain `.'.
+         major=.$major
+         versuffix="$major.$revision"
+         ;;
+
+       linux) # correct to gnu/linux during the next big refactor
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix="$major.$age.$revision"
+         ;;
+
+       osf)
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix=".$current.$age.$revision"
+         verstring="$current.$age.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$age
+         while test "$loop" -ne 0; do
+           func_arith $current - $loop
+           iface=$func_arith_result
+           func_arith $loop - 1
+           loop=$func_arith_result
+           verstring="$verstring:${iface}.0"
+         done
+
+         # Make executables depend on our current version.
+         func_append verstring ":${current}.0"
+         ;;
+
+       qnx)
+         major=".$current"
+         versuffix=".$current"
+         ;;
+
+       sunos)
+         major=".$current"
+         versuffix=".$current.$revision"
+         ;;
+
+       windows)
+         # Use '-' rather than '.', since we only want one
+         # extension on DOS 8.3 filesystems.
+         func_arith $current - $age
+         major=$func_arith_result
+         versuffix="-$major"
+         ;;
+
+       *)
+         func_fatal_configuration "unknown library version type \`$version_type'"
+         ;;
+       esac
+
+       # Clear the version info if we defaulted, and they specified a release.
+       if test -z "$vinfo" && test -n "$release"; then
+         major=
+         case $version_type in
+         darwin)
+           # we can't check for "0.0" in archive_cmds due to quoting
+           # problems, so we reset it completely
+           verstring=
+           ;;
+         *)
+           verstring="0.0"
+           ;;
+         esac
+         if test "$need_version" = no; then
+           versuffix=
+         else
+           versuffix=".0.0"
+         fi
+       fi
+
+       # Remove version info from name if versioning should be avoided
+       if test "$avoid_version" = yes && test "$need_version" = no; then
+         major=
+         versuffix=
+         verstring=""
+       fi
+
+       # Check to see if the archive will have undefined symbols.
+       if test "$allow_undefined" = yes; then
+         if test "$allow_undefined_flag" = unsupported; then
+           func_warning "undefined symbols not allowed in $host shared libraries"
+           build_libtool_libs=no
+           build_old_libs=yes
+         fi
+       else
+         # Don't allow undefined symbols.
+         allow_undefined_flag="$no_undefined_flag"
+       fi
+
+      fi
+
+      func_generate_dlsyms "$libname" "$libname" "yes"
+      func_append libobjs " $symfileobj"
+      test "X$libobjs" = "X " && libobjs=
+
+      if test "$opt_mode" != relink; then
+       # Remove our outputs, but don't remove object files since they
+       # may have been created when compiling PIC objects.
+       removelist=
+       tempremovelist=`$ECHO "$output_objdir/*"`
+       for p in $tempremovelist; do
+         case $p in
+           *.$objext | *.gcno)
+              ;;
+           $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+              if test "X$precious_files_regex" != "X"; then
+                if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+                then
+                  continue
+                fi
+              fi
+              func_append removelist " $p"
+              ;;
+           *) ;;
+         esac
+       done
+       test -n "$removelist" && \
+         func_show_eval "${RM}r \$removelist"
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+       func_append oldlibs " $output_objdir/$libname.$libext"
+
+       # Transform .lo files to .o files.
+       oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #        lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+      #        deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+      #        dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       temp_xrpath=
+       for libdir in $xrpath; do
+         func_replace_sysroot "$libdir"
+         func_append temp_xrpath " -R$func_replace_sysroot_result"
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) func_append finalize_rpath " $libdir" ;;
+         esac
+       done
+       if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+         dependency_libs="$temp_xrpath $dependency_libs"
+       fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+       case " $dlprefiles $dlfiles " in
+       *" $lib "*) ;;
+       *) func_append dlfiles " $lib" ;;
+       esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+       case "$dlprefiles " in
+       *" $lib "*) ;;
+       *) func_append dlprefiles " $lib" ;;
+       esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+       if test -n "$rpath"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+           # these systems don't actually have a c library (as such)!
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C library is in the System framework
+           func_append deplibs " System.ltframework"
+           ;;
+         *-*-netbsd*)
+           # Don't link with libc until the a.out ld.so is fixed.
+           ;;
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+           # Do not include libc due to us having libc/libc_r.
+           ;;
+         *-*-sco3.2v5* | *-*-sco5v6*)
+           # Causes problems with __ctype
+           ;;
+         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+           # Compiler inserts libc in the correct place for threads to work
+           ;;
+         *)
+           # Add libc to deplibs on all other systems if necessary.
+           if test "$build_libtool_need_lc" = "yes"; then
+             func_append deplibs " -lc"
+           fi
+           ;;
+         esac
+       fi
+
+       # Transform deplibs into only deplibs that can be linked in shared.
+       name_save=$name
+       libname_save=$libname
+       release_save=$release
+       versuffix_save=$versuffix
+       major_save=$major
+       # I'm not sure if I'm treating the release correctly.  I think
+       # release should show up in the -l (ie -lgmp5) so we don't want to
+       # add it in twice.  Is that correct?
+       release=""
+       versuffix=""
+       major=""
+       newdeplibs=
+       droppeddeps=no
+       case $deplibs_check_method in
+       pass_all)
+         # Don't check for shared/static.  Everything works.
+         # This might be a little naive.  We might want to check
+         # whether the library exists or not.  But this is on
+         # osf3 & osf4 and I'm not really sure... Just
+         # implementing what was already the behavior.
+         newdeplibs=$deplibs
+         ;;
+       test_compile)
+         # This code stresses the "libraries are programs" paradigm to its
+         # limits. Maybe even breaks it.  We compile a program, linking it
+         # against the deplibs as a proxy for the library.  Then we can check
+         # whether they linked in statically or dynamically with ldd.
+         $opt_dry_run || $RM conftest.c
+         cat > conftest.c <<EOF
+         int main() { return 0; }
+EOF
+         $opt_dry_run || $RM conftest
+         if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+           ldd_output=`ldd conftest`
+           for i in $deplibs; do
+             case $i in
+             -l*)
+               func_stripname -l '' "$i"
+               name=$func_stripname_result
+               if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                 case " $predeps $postdeps " in
+                 *" $i "*)
+                   func_append newdeplibs " $i"
+                   i=""
+                   ;;
+                 esac
+               fi
+               if test -n "$i" ; then
+                 libname=`eval "\\$ECHO \"$libname_spec\""`
+                 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+                 set dummy $deplib_matches; shift
+                 deplib_match=$1
+                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                   func_append newdeplibs " $i"
+                 else
+                   droppeddeps=yes
+                   echo
+                   $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+                   echo "*** I have the capability to make that library automatically link in when"
+                   echo "*** you link to this library.  But I can only do this if you have a"
+                   echo "*** shared version of the library, which I believe you do not have"
+                   echo "*** because a test_compile did reveal that the linker did not use it for"
+                   echo "*** its dynamic dependency list that programs get resolved with at runtime."
+                 fi
+               fi
+               ;;
+             *)
+               func_append newdeplibs " $i"
+               ;;
+             esac
+           done
+         else
+           # Error occurred in the first compile.  Let's try to salvage
+           # the situation: Compile a separate program for each library.
+           for i in $deplibs; do
+             case $i in
+             -l*)
+               func_stripname -l '' "$i"
+               name=$func_stripname_result
+               $opt_dry_run || $RM conftest
+               if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+                 ldd_output=`ldd conftest`
+                 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                   case " $predeps $postdeps " in
+                   *" $i "*)
+                     func_append newdeplibs " $i"
+                     i=""
+                     ;;
+                   esac
+                 fi
+                 if test -n "$i" ; then
+                   libname=`eval "\\$ECHO \"$libname_spec\""`
+                   deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+                   set dummy $deplib_matches; shift
+                   deplib_match=$1
+                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                     func_append newdeplibs " $i"
+                   else
+                     droppeddeps=yes
+                     echo
+                     $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+                     echo "*** I have the capability to make that library automatically link in when"
+                     echo "*** you link to this library.  But I can only do this if you have a"
+                     echo "*** shared version of the library, which you do not appear to have"
+                     echo "*** because a test_compile did reveal that the linker did not use this one"
+                     echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+                   fi
+                 fi
+               else
+                 droppeddeps=yes
+                 echo
+                 $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
+                 echo "*** make it link in!  You will probably need to install it or some"
+                 echo "*** library that it depends on before this library will be fully"
+                 echo "*** functional.  Installing it before continuing would be even better."
+               fi
+               ;;
+             *)
+               func_append newdeplibs " $i"
+               ;;
+             esac
+           done
+         fi
+         ;;
+       file_magic*)
+         set dummy $deplibs_check_method; shift
+         file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+         for a_deplib in $deplibs; do
+           case $a_deplib in
+           -l*)
+             func_stripname -l '' "$a_deplib"
+             name=$func_stripname_result
+             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 func_append newdeplibs " $a_deplib"
+                 a_deplib=""
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval "\\$ECHO \"$libname_spec\""`
+               if test -n "$file_magic_glob"; then
+                 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+               else
+                 libnameglob=$libname
+               fi
+               test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 if test "$want_nocaseglob" = yes; then
+                   shopt -s nocaseglob
+                   potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+                   $nocaseglob
+                 else
+                   potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+                 fi
+                 for potent_lib in $potential_libs; do
+                     # Follow soft links.
+                     if ls -lLd "$potent_lib" 2>/dev/null |
+                        $GREP " -> " >/dev/null; then
+                       continue
+                     fi
+                     # The statement above tries to avoid entering an
+                     # endless loop below, in case of cyclic links.
+                     # We might still enter an endless loop, since a link
+                     # loop can be closed while we follow links,
+                     # but so what?
+                     potlib="$potent_lib"
+                     while test -h "$potlib" 2>/dev/null; do
+                       potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+                       case $potliblink in
+                       [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+                       *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+                       esac
+                     done
+                     if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+                        $SED -e 10q |
+                        $EGREP "$file_magic_regex" > /dev/null; then
+                       func_append newdeplibs " $a_deplib"
+                       a_deplib=""
+                       break 2
+                     fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib" ; then
+               droppeddeps=yes
+               echo
+               $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+               echo "*** I have the capability to make that library automatically link in when"
+               echo "*** you link to this library.  But I can only do this if you have a"
+               echo "*** shared version of the library, which you do not appear to have"
+               echo "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib" ; then
+                 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+               else
+                 $ECHO "*** with $libname and none of the candidates passed a file format test"
+                 $ECHO "*** using a file magic. Last file checked: $potlib"
+               fi
+             fi
+             ;;
+           *)
+             # Add a -L argument.
+             func_append newdeplibs " $a_deplib"
+             ;;
+           esac
+         done # Gone through all deplibs.
+         ;;
+       match_pattern*)
+         set dummy $deplibs_check_method; shift
+         match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+         for a_deplib in $deplibs; do
+           case $a_deplib in
+           -l*)
+             func_stripname -l '' "$a_deplib"
+             name=$func_stripname_result
+             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 func_append newdeplibs " $a_deplib"
+                 a_deplib=""
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval "\\$ECHO \"$libname_spec\""`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                   potlib="$potent_lib" # see symlink-check above in file_magic test
+                   if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+                      $EGREP "$match_pattern_regex" > /dev/null; then
+                     func_append newdeplibs " $a_deplib"
+                     a_deplib=""
+                     break 2
+                   fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib" ; then
+               droppeddeps=yes
+               echo
+               $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+               echo "*** I have the capability to make that library automatically link in when"
+               echo "*** you link to this library.  But I can only do this if you have a"
+               echo "*** shared version of the library, which you do not appear to have"
+               echo "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib" ; then
+                 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+               else
+                 $ECHO "*** with $libname and none of the candidates passed a file format test"
+                 $ECHO "*** using a regex pattern. Last file checked: $potlib"
+               fi
+             fi
+             ;;
+           *)
+             # Add a -L argument.
+             func_append newdeplibs " $a_deplib"
+             ;;
+           esac
+         done # Gone through all deplibs.
+         ;;
+       none | unknown | *)
+         newdeplibs=""
+         tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+         if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+           for i in $predeps $postdeps ; do
+             # can't use Xsed below, because $i might contain '/'
+             tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+           done
+         fi
+         case $tmp_deplibs in
+         *[!\  \ ]*)
+           echo
+           if test "X$deplibs_check_method" = "Xnone"; then
+             echo "*** Warning: inter-library dependencies are not supported in this platform."
+           else
+             echo "*** Warning: inter-library dependencies are not known to be supported."
+           fi
+           echo "*** All declared inter-library dependencies are being dropped."
+           droppeddeps=yes
+           ;;
+         esac
+         ;;
+       esac
+       versuffix=$versuffix_save
+       major=$major_save
+       release=$release_save
+       libname=$libname_save
+       name=$name_save
+
+       case $host in
+       *-*-rhapsody* | *-*-darwin1.[012])
+         # On Rhapsody replace the C library with the System framework
+         newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+         ;;
+       esac
+
+       if test "$droppeddeps" = yes; then
+         if test "$module" = yes; then
+           echo
+           echo "*** Warning: libtool could not satisfy all declared inter-library"
+           $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
+           echo "*** a static module, that should work as long as the dlopening"
+           echo "*** application is linked with the -dlopen flag."
+           if test -z "$global_symbol_pipe"; then
+             echo
+             echo "*** However, this would only work if libtool was able to extract symbol"
+             echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+             echo "*** not find such a program.  So, this module is probably useless."
+             echo "*** \`nm' from GNU binutils and a full rebuild may help."
+           fi
+           if test "$build_old_libs" = no; then
+             oldlibs="$output_objdir/$libname.$libext"
+             build_libtool_libs=module
+             build_old_libs=yes
+           else
+             build_libtool_libs=no
+           fi
+         else
+           echo "*** The inter-library dependencies that have been dropped here will be"
+           echo "*** automatically added whenever a program is linked with this library"
+           echo "*** or is declared to -dlopen it."
+
+           if test "$allow_undefined" = no; then
+             echo
+             echo "*** Since this library must not contain undefined symbols,"
+             echo "*** because either the platform does not support them or"
+             echo "*** it was explicitly requested with -no-undefined,"
+             echo "*** libtool will only create a static version of it."
+             if test "$build_old_libs" = no; then
+               oldlibs="$output_objdir/$libname.$libext"
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         fi
+       fi
+       # Done checking deplibs!
+       deplibs=$newdeplibs
+      fi
+      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+      case $host in
+       *-*-darwin*)
+         newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+         new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+         deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+         ;;
+      esac
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $deplibs " in
+         *" -L$path/$objdir "*)
+           func_append new_libs " -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) func_append new_libs " $deplib" ;;
+         esac
+         ;;
+       *) func_append new_libs " $deplib" ;;
+       esac
+      done
+      deplibs="$new_libs"
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+       # Remove ${wl} instances when linking with ld.
+       # FIXME: should test the right _cmds variable.
+       case $archive_cmds in
+         *\$LD\ *) wl= ;;
+        esac
+       if test "$hardcode_into_libs" = yes; then
+         # Hardcode the library paths
+         hardcode_libdirs=
+         dep_rpath=
+         rpath="$finalize_rpath"
+         test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+         for libdir in $rpath; do
+           if test -n "$hardcode_libdir_flag_spec"; then
+             if test -n "$hardcode_libdir_separator"; then
+               func_replace_sysroot "$libdir"
+               libdir=$func_replace_sysroot_result
+               if test -z "$hardcode_libdirs"; then
+                 hardcode_libdirs="$libdir"
+               else
+                 # Just accumulate the unique libdirs.
+                 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+                 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+                   ;;
+                 *)
+                   func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+                   ;;
+                 esac
+               fi
+             else
+               eval flag=\"$hardcode_libdir_flag_spec\"
+               func_append dep_rpath " $flag"
+             fi
+           elif test -n "$runpath_var"; then
+             case "$perm_rpath " in
+             *" $libdir "*) ;;
+             *) func_append perm_rpath " $libdir" ;;
+             esac
+           fi
+         done
+         # Substitute the hardcoded libdirs into the rpath.
+         if test -n "$hardcode_libdir_separator" &&
+            test -n "$hardcode_libdirs"; then
+           libdir="$hardcode_libdirs"
+           eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+         fi
+         if test -n "$runpath_var" && test -n "$perm_rpath"; then
+           # We should set the runpath_var.
+           rpath=
+           for dir in $perm_rpath; do
+             func_append rpath "$dir:"
+           done
+           eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+         fi
+         test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+       fi
+
+       shlibpath="$finalize_shlibpath"
+       test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+       if test -n "$shlibpath"; then
+         eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+       fi
+
+       # Get the real and link names of the library.
+       eval shared_ext=\"$shrext_cmds\"
+       eval library_names=\"$library_names_spec\"
+       set dummy $library_names
+       shift
+       realname="$1"
+       shift
+
+       if test -n "$soname_spec"; then
+         eval soname=\"$soname_spec\"
+       else
+         soname="$realname"
+       fi
+       if test -z "$dlname"; then
+         dlname=$soname
+       fi
+
+       lib="$output_objdir/$realname"
+       linknames=
+       for link
+       do
+         func_append linknames " $link"
+       done
+
+       # Use standard objects if they are pic
+       test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+       test "X$libobjs" = "X " && libobjs=
+
+       delfiles=
+       if test -n "$export_symbols" && test -n "$include_expsyms"; then
+         $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+         export_symbols="$output_objdir/$libname.uexp"
+         func_append delfiles " $export_symbols"
+       fi
+
+       orig_export_symbols=
+       case $host_os in
+       cygwin* | mingw* | cegcc*)
+         if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+           # exporting using user supplied symfile
+           if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+             # and it's NOT already a .def file. Must figure out
+             # which of the given symbols are data symbols and tag
+             # them as such. So, trigger use of export_symbols_cmds.
+             # export_symbols gets reassigned inside the "prepare
+             # the list of exported symbols" if statement, so the
+             # include_expsyms logic still works.
+             orig_export_symbols="$export_symbols"
+             export_symbols=
+             always_export_symbols=yes
+           fi
+         fi
+         ;;
+       esac
+
+       # Prepare the list of exported symbols
+       if test -z "$export_symbols"; then
+         if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+           func_verbose "generating symbol list for \`$libname.la'"
+           export_symbols="$output_objdir/$libname.exp"
+           $opt_dry_run || $RM $export_symbols
+           cmds=$export_symbols_cmds
+           save_ifs="$IFS"; IFS='~'
+           for cmd1 in $cmds; do
+             IFS="$save_ifs"
+             # Take the normal branch if the nm_file_list_spec branch
+             # doesn't work or if tool conversion is not needed.
+             case $nm_file_list_spec~$to_tool_file_cmd in
+               *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+                 try_normal_branch=yes
+                 eval cmd=\"$cmd1\"
+                 func_len " $cmd"
+                 len=$func_len_result
+                 ;;
+               *)
+                 try_normal_branch=no
+                 ;;
+             esac
+             if test "$try_normal_branch" = yes \
+                && { test "$len" -lt "$max_cmd_len" \
+                     || test "$max_cmd_len" -le -1; }
+             then
+               func_show_eval "$cmd" 'exit $?'
+               skipped_export=false
+             elif test -n "$nm_file_list_spec"; then
+               func_basename "$output"
+               output_la=$func_basename_result
+               save_libobjs=$libobjs
+               save_output=$output
+               output=${output_objdir}/${output_la}.nm
+               func_to_tool_file "$output"
+               libobjs=$nm_file_list_spec$func_to_tool_file_result
+               func_append delfiles " $output"
+               func_verbose "creating $NM input file list: $output"
+               for obj in $save_libobjs; do
+                 func_to_tool_file "$obj"
+                 $ECHO "$func_to_tool_file_result"
+               done > "$output"
+               eval cmd=\"$cmd1\"
+               func_show_eval "$cmd" 'exit $?'
+               output=$save_output
+               libobjs=$save_libobjs
+               skipped_export=false
+             else
+               # The command line is too long to execute in one step.
+               func_verbose "using reloadable object file for export list..."
+               skipped_export=:
+               # Break out early, otherwise skipped_export may be
+               # set to false by a later but shorter cmd.
+               break
+             fi
+           done
+           IFS="$save_ifs"
+           if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+             func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+           fi
+         fi
+       fi
+
+       if test -n "$export_symbols" && test -n "$include_expsyms"; then
+         tmp_export_symbols="$export_symbols"
+         test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+         $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+       fi
+
+       if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+         # The given exports_symbols file has to be filtered, so filter it.
+         func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+         # FIXME: $output_objdir/$libname.filter potentially contains lots of
+         # 's' commands which not all seds can handle. GNU sed should be fine
+         # though. Also, the filter scales superlinearly with the number of
+         # global variables. join(1) would be nice here, but unfortunately
+         # isn't a blessed tool.
+         $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+         func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+         export_symbols=$output_objdir/$libname.def
+         $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+       fi
+
+       tmp_deplibs=
+       for test_deplib in $deplibs; do
+         case " $convenience " in
+         *" $test_deplib "*) ;;
+         *)
+           func_append tmp_deplibs " $test_deplib"
+           ;;
+         esac
+       done
+       deplibs="$tmp_deplibs"
+
+       if test -n "$convenience"; then
+         if test -n "$whole_archive_flag_spec" &&
+           test "$compiler_needs_object" = yes &&
+           test -z "$libobjs"; then
+           # extract the archives, so we have objects to list.
+           # TODO: could optimize this to just extract one archive.
+           whole_archive_flag_spec=
+         fi
+         if test -n "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+           test "X$libobjs" = "X " && libobjs=
+         else
+           gentop="$output_objdir/${outputname}x"
+           func_append generated " $gentop"
+
+           func_extract_archives $gentop $convenience
+           func_append libobjs " $func_extract_archives_result"
+           test "X$libobjs" = "X " && libobjs=
+         fi
+       fi
+
+       if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+         eval flag=\"$thread_safe_flag_spec\"
+         func_append linker_flags " $flag"
+       fi
+
+       # Make a backup of the uninstalled library when relinking
+       if test "$opt_mode" = relink; then
+         $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+       fi
+
+       # Do each of the archive commands.
+       if test "$module" = yes && test -n "$module_cmds" ; then
+         if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+           eval test_cmds=\"$module_expsym_cmds\"
+           cmds=$module_expsym_cmds
+         else
+           eval test_cmds=\"$module_cmds\"
+           cmds=$module_cmds
+         fi
+       else
+         if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+           eval test_cmds=\"$archive_expsym_cmds\"
+           cmds=$archive_expsym_cmds
+         else
+           eval test_cmds=\"$archive_cmds\"
+           cmds=$archive_cmds
+         fi
+       fi
+
+       if test "X$skipped_export" != "X:" &&
+          func_len " $test_cmds" &&
+          len=$func_len_result &&
+          test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         :
+       else
+         # The command line is too long to link in one step, link piecewise
+         # or, if using GNU ld and skipped_export is not :, use a linker
+         # script.
+
+         # Save the value of $output and $libobjs because we want to
+         # use them later.  If we have whole_archive_flag_spec, we
+         # want to use save_libobjs as it was before
+         # whole_archive_flag_spec was expanded, because we can't
+         # assume the linker understands whole_archive_flag_spec.
+         # This may have to be revisited, in case too many
+         # convenience libraries get linked in and end up exceeding
+         # the spec.
+         if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+         fi
+         save_output=$output
+         func_basename "$output"
+         output_la=$func_basename_result
+
+         # Clear the reloadable object creation command queue and
+         # initialize k to one.
+         test_cmds=
+         concat_cmds=
+         objlist=
+         last_robj=
+         k=1
+
+         if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+           output=${output_objdir}/${output_la}.lnkscript
+           func_verbose "creating GNU ld script: $output"
+           echo 'INPUT (' > $output
+           for obj in $save_libobjs
+           do
+             func_to_tool_file "$obj"
+             $ECHO "$func_to_tool_file_result" >> $output
+           done
+           echo ')' >> $output
+           func_append delfiles " $output"
+           func_to_tool_file "$output"
+           output=$func_to_tool_file_result
+         elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+           output=${output_objdir}/${output_la}.lnk
+           func_verbose "creating linker input file list: $output"
+           : > $output
+           set x $save_libobjs
+           shift
+           firstobj=
+           if test "$compiler_needs_object" = yes; then
+             firstobj="$1 "
+             shift
+           fi
+           for obj
+           do
+             func_to_tool_file "$obj"
+             $ECHO "$func_to_tool_file_result" >> $output
+           done
+           func_append delfiles " $output"
+           func_to_tool_file "$output"
+           output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+         else
+           if test -n "$save_libobjs"; then
+             func_verbose "creating reloadable object files..."
+             output=$output_objdir/$output_la-${k}.$objext
+             eval test_cmds=\"$reload_cmds\"
+             func_len " $test_cmds"
+             len0=$func_len_result
+             len=$len0
+
+             # Loop over the list of objects to be linked.
+             for obj in $save_libobjs
+             do
+               func_len " $obj"
+               func_arith $len + $func_len_result
+               len=$func_arith_result
+               if test "X$objlist" = X ||
+                  test "$len" -lt "$max_cmd_len"; then
+                 func_append objlist " $obj"
+               else
+                 # The command $test_cmds is almost too long, add a
+                 # command to the queue.
+                 if test "$k" -eq 1 ; then
+                   # The first file doesn't have a previous command to add.
+                   reload_objs=$objlist
+                   eval concat_cmds=\"$reload_cmds\"
+                 else
+                   # All subsequent reloadable object files will link in
+                   # the last one created.
+                   reload_objs="$objlist $last_robj"
+                   eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+                 fi
+                 last_robj=$output_objdir/$output_la-${k}.$objext
+                 func_arith $k + 1
+                 k=$func_arith_result
+                 output=$output_objdir/$output_la-${k}.$objext
+                 objlist=" $obj"
+                 func_len " $last_robj"
+                 func_arith $len0 + $func_len_result
+                 len=$func_arith_result
+               fi
+             done
+             # Handle the remaining objects by creating one last
+             # reloadable object file.  All subsequent reloadable object
+             # files will link in the last one created.
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             reload_objs="$objlist $last_robj"
+             eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+             if test -n "$last_robj"; then
+               eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+             fi
+             func_append delfiles " $output"
+
+           else
+             output=
+           fi
+
+           if ${skipped_export-false}; then
+             func_verbose "generating symbol list for \`$libname.la'"
+             export_symbols="$output_objdir/$libname.exp"
+             $opt_dry_run || $RM $export_symbols
+             libobjs=$output
+             # Append the command to create the export file.
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+             if test -n "$last_robj"; then
+               eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+             fi
+           fi
+
+           test -n "$save_libobjs" &&
+             func_verbose "creating a temporary reloadable object file: $output"
+
+           # Loop through the commands generated above and execute them.
+           save_ifs="$IFS"; IFS='~'
+           for cmd in $concat_cmds; do
+             IFS="$save_ifs"
+             $opt_silent || {
+                 func_quote_for_expand "$cmd"
+                 eval "func_echo $func_quote_for_expand_result"
+             }
+             $opt_dry_run || eval "$cmd" || {
+               lt_exit=$?
+
+               # Restore the uninstalled library and exit
+               if test "$opt_mode" = relink; then
+                 ( cd "$output_objdir" && \
+                   $RM "${realname}T" && \
+                   $MV "${realname}U" "$realname" )
+               fi
+
+               exit $lt_exit
+             }
+           done
+           IFS="$save_ifs"
+
+           if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+             func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+           fi
+         fi
+
+          if ${skipped_export-false}; then
+           if test -n "$export_symbols" && test -n "$include_expsyms"; then
+             tmp_export_symbols="$export_symbols"
+             test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+             $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+           fi
+
+           if test -n "$orig_export_symbols"; then
+             # The given exports_symbols file has to be filtered, so filter it.
+             func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+             # FIXME: $output_objdir/$libname.filter potentially contains lots of
+             # 's' commands which not all seds can handle. GNU sed should be fine
+             # though. Also, the filter scales superlinearly with the number of
+             # global variables. join(1) would be nice here, but unfortunately
+             # isn't a blessed tool.
+             $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+             func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+             export_symbols=$output_objdir/$libname.def
+             $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+           fi
+         fi
+
+         libobjs=$output
+         # Restore the value of output.
+         output=$save_output
+
+         if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+           test "X$libobjs" = "X " && libobjs=
+         fi
+         # Expand the library linking commands again to reset the
+         # value of $libobjs for piecewise linking.
+
+         # Do each of the archive commands.
+         if test "$module" = yes && test -n "$module_cmds" ; then
+           if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+             cmds=$module_expsym_cmds
+           else
+             cmds=$module_cmds
+           fi
+         else
+           if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+             cmds=$archive_expsym_cmds
+           else
+             cmds=$archive_cmds
+           fi
+         fi
+       fi
+
+       if test -n "$delfiles"; then
+         # Append the command to remove temporary files to $cmds.
+         eval cmds=\"\$cmds~\$RM $delfiles\"
+       fi
+
+       # Add any objects from preloaded convenience libraries
+       if test -n "$dlprefiles"; then
+         gentop="$output_objdir/${outputname}x"
+         func_append generated " $gentop"
+
+         func_extract_archives $gentop $dlprefiles
+         func_append libobjs " $func_extract_archives_result"
+         test "X$libobjs" = "X " && libobjs=
+       fi
+
+       save_ifs="$IFS"; IFS='~'
+       for cmd in $cmds; do
+         IFS="$save_ifs"
+         eval cmd=\"$cmd\"
+         $opt_silent || {
+           func_quote_for_expand "$cmd"
+           eval "func_echo $func_quote_for_expand_result"
+         }
+         $opt_dry_run || eval "$cmd" || {
+           lt_exit=$?
+
+           # Restore the uninstalled library and exit
+           if test "$opt_mode" = relink; then
+             ( cd "$output_objdir" && \
+               $RM "${realname}T" && \
+               $MV "${realname}U" "$realname" )
+           fi
+
+           exit $lt_exit
+         }
+       done
+       IFS="$save_ifs"
+
+       # Restore the uninstalled library and exit
+       if test "$opt_mode" = relink; then
+         $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+         if test -n "$convenience"; then
+           if test -z "$whole_archive_flag_spec"; then
+             func_show_eval '${RM}r "$gentop"'
+           fi
+         fi
+
+         exit $EXIT_SUCCESS
+       fi
+
+       # Create links to the real library.
+       for linkname in $linknames; do
+         if test "$realname" != "$linkname"; then
+           func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+         fi
+       done
+
+       # If -module or -export-dynamic was specified, set the dlname.
+       if test "$module" = yes || test "$export_dynamic" = yes; then
+         # On all known operating systems, these are identical.
+         dlname="$soname"
+       fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       func_warning "\`-dlopen' is ignored for objects"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+       func_warning "\`-l' and \`-L' are ignored for objects" ;;
+      esac
+
+      test -n "$rpath" && \
+       func_warning "\`-rpath' is ignored for objects"
+
+      test -n "$xrpath" && \
+       func_warning "\`-R' is ignored for objects"
+
+      test -n "$vinfo" && \
+       func_warning "\`-version-info' is ignored for objects"
+
+      test -n "$release" && \
+       func_warning "\`-release' is ignored for objects"
+
+      case $output in
+      *.lo)
+       test -n "$objs$old_deplibs" && \
+         func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+       libobj=$output
+       func_lo2o "$libobj"
+       obj=$func_lo2o_result
+       ;;
+      *)
+       libobj=
+       obj="$output"
+       ;;
+      esac
+
+      # Delete the old objects.
+      $opt_dry_run || $RM $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
+      wl=
+
+      if test -n "$convenience"; then
+       if test -n "$whole_archive_flag_spec"; then
+         eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+         reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+       else
+         gentop="$output_objdir/${obj}x"
+         func_append generated " $gentop"
+
+         func_extract_archives $gentop $convenience
+         reload_conv_objs="$reload_objs $func_extract_archives_result"
+       fi
+      fi
+
+      # If we're not building shared, we need to use non_pic_objs
+      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      func_execute_cmds "$reload_cmds" 'exit $?'
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+       if test -n "$gentop"; then
+         func_show_eval '${RM}r "$gentop"'
+       fi
+
+       exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+       if test -n "$gentop"; then
+         func_show_eval '${RM}r "$gentop"'
+       fi
+
+       # Create an invalid libtool object if no PIC, so that we don't
+       # accidentally link it into a program.
+       # $show "echo timestamp > $libobj"
+       # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+       exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+       # Only do commands if we really have different PIC objects.
+       reload_objs="$libobjs $reload_conv_objs"
+       output="$libobj"
+       func_execute_cmds "$reload_cmds" 'exit $?'
+      fi
+
+      if test -n "$gentop"; then
+       func_show_eval '${RM}r "$gentop"'
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+       *cygwin*) func_stripname '' '.exe' "$output"
+                 output=$func_stripname_result.exe;;
+      esac
+      test -n "$vinfo" && \
+       func_warning "\`-version-info' is ignored for programs"
+
+      test -n "$release" && \
+       func_warning "\`-release' is ignored for programs"
+
+      test "$preload" = yes \
+        && test "$dlopen_support" = unknown \
+       && test "$dlopen_self" = unknown \
+       && test "$dlopen_self_static" = unknown && \
+         func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+       # On Rhapsody replace the C library is the System framework
+       compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+       finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+       ;;
+      esac
+
+      case $host in
+      *-*-darwin*)
+       # Don't allow lazy linking, it breaks C++ global constructors
+       # But is supposedly fixed on 10.4 or later (yay!).
+       if test "$tagname" = CXX ; then
+         case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+           10.[0123])
+             func_append compile_command " ${wl}-bind_at_load"
+             func_append finalize_command " ${wl}-bind_at_load"
+           ;;
+         esac
+       fi
+       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+       compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+       finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+       ;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $compile_deplibs " in
+         *" -L$path/$objdir "*)
+           func_append new_libs " -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $compile_deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) func_append new_libs " $deplib" ;;
+         esac
+         ;;
+       *) func_append new_libs " $deplib" ;;
+       esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      func_append compile_command " $compile_deplibs"
+      func_append finalize_command " $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       for libdir in $rpath $xrpath; do
+         # This is the magic to use -rpath.
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) func_append finalize_rpath " $libdir" ;;
+         esac
+       done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs="$libdir"
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           func_append rpath " $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$perm_rpath " in
+         *" $libdir "*) ;;
+         *) func_append perm_rpath " $libdir" ;;
+         esac
+       fi
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+         testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$libdir:"*) ;;
+         ::) dllsearchpath=$libdir;;
+         *) func_append dllsearchpath ":$libdir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
+         ::) dllsearchpath=$testbindir;;
+         *) func_append dllsearchpath ":$testbindir";;
+         esac
+         ;;
+       esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir="$hardcode_libdirs"
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs="$libdir"
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           func_append rpath " $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$finalize_perm_rpath " in
+         *" $libdir "*) ;;
+         *) func_append finalize_perm_rpath " $libdir" ;;
+         esac
+       fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir="$hardcode_libdirs"
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+       # Transform all the library objects into standard objects.
+       compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+       finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+      fi
+
+      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+      # template prelinking step
+      if test -n "$prelink_cmds"; then
+       func_execute_cmds "$prelink_cmds" 'exit $?'
+      fi
+
+      wrappers_required=yes
+      case $host in
+      *cegcc* | *mingw32ce*)
+        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
+      *cygwin* | *mingw* )
+        if test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      *)
+        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      esac
+      if test "$wrappers_required" = no; then
+       # Replace the output file specification.
+       compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+       link_command="$compile_command$compile_rpath"
+
+       # We have no uninstalled library dependencies, so finalize right now.
+       exit_status=0
+       func_show_eval "$link_command" 'exit_status=$?'
+
+       if test -n "$postlink_cmds"; then
+         func_to_tool_file "$output"
+         postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+         func_execute_cmds "$postlink_cmds" 'exit $?'
+       fi
+
+       # Delete the generated files.
+       if test -f "$output_objdir/${outputname}S.${objext}"; then
+         func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+       fi
+
+       exit $exit_status
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+       compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+       finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+       if test -n "$perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $perm_rpath; do
+           func_append rpath "$dir:"
+         done
+         compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+       if test -n "$finalize_perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $finalize_perm_rpath; do
+           func_append rpath "$dir:"
+         done
+         finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+      fi
+
+      if test "$no_install" = yes; then
+       # We don't need to create a wrapper script.
+       link_command="$compile_var$compile_command$compile_rpath"
+       # Replace the output file specification.
+       link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+       # Delete the old output file.
+       $opt_dry_run || $RM $output
+       # Link the executable and exit
+       func_show_eval "$link_command" 'exit $?'
+
+       if test -n "$postlink_cmds"; then
+         func_to_tool_file "$output"
+         postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+         func_execute_cmds "$postlink_cmds" 'exit $?'
+       fi
+
+       exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+       # Fast installation is not supported
+       link_command="$compile_var$compile_command$compile_rpath"
+       relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+       func_warning "this platform does not like uninstalled shared libraries"
+       func_warning "\`$output' will be relinked during installation"
+      else
+       if test "$fast_install" != no; then
+         link_command="$finalize_var$compile_command$finalize_rpath"
+         if test "$fast_install" = yes; then
+           relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+         else
+           # fast_install is set to needless
+           relink_command=
+         fi
+       else
+         link_command="$compile_var$compile_command$compile_rpath"
+         relink_command="$finalize_var$finalize_command$finalize_rpath"
+       fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      func_show_eval "$link_command" 'exit $?'
+
+      if test -n "$postlink_cmds"; then
+       func_to_tool_file "$output_objdir/$outputname"
+       postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+       func_execute_cmds "$postlink_cmds" 'exit $?'
+      fi
+
+      # Now create the wrapper script.
+      func_verbose "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+       # Preserve any variables that may affect compiler behavior
+       for var in $variables_saved_for_relink; do
+         if eval test -z \"\${$var+set}\"; then
+           relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+         elif eval var_value=\$$var; test -z "$var_value"; then
+           relink_command="$var=; export $var; $relink_command"
+         else
+           func_quote_for_eval "$var_value"
+           relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+         fi
+       done
+       relink_command="(cd `pwd`; $relink_command)"
+       relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if not in dry run mode.
+      $opt_dry_run || {
+       # win32 will think the script is a binary if it has
+       # a .exe suffix, so we strip it off here.
+       case $output in
+         *.exe) func_stripname '' '.exe' "$output"
+                output=$func_stripname_result ;;
+       esac
+       # test for cygwin because mv fails w/o .exe extensions
+       case $host in
+         *cygwin*)
+           exeext=.exe
+           func_stripname '' '.exe' "$outputname"
+           outputname=$func_stripname_result ;;
+         *) exeext= ;;
+       esac
+       case $host in
+         *cygwin* | *mingw* )
+           func_dirname_and_basename "$output" "" "."
+           output_name=$func_basename_result
+           output_path=$func_dirname_result
+           cwrappersource="$output_path/$objdir/lt-$output_name.c"
+           cwrapper="$output_path/$output_name.exe"
+           $RM $cwrappersource $cwrapper
+           trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+           func_emit_cwrapperexe_src > $cwrappersource
+
+           # The wrapper executable is built using the $host compiler,
+           # because it contains $host paths and files. If cross-
+           # compiling, it, like the target executable, must be
+           # executed on the $host or under an emulation environment.
+           $opt_dry_run || {
+             $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+             $STRIP $cwrapper
+           }
+
+           # Now, create the wrapper script for func_source use:
+           func_ltwrapper_scriptname $cwrapper
+           $RM $func_ltwrapper_scriptname_result
+           trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+           $opt_dry_run || {
+             # note: this script will not be executed, so do not chmod.
+             if test "x$build" = "x$host" ; then
+               $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+             else
+               func_emit_wrapper no > $func_ltwrapper_scriptname_result
+             fi
+           }
+         ;;
+         * )
+           $RM $output
+           trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+           func_emit_wrapper no > $output
+           chmod +x $output
+         ;;
+       esac
+      }
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+       oldobjs="$libobjs_save $symfileobj"
+       addlibs="$convenience"
+       build_libtool_libs=no
+      else
+       if test "$build_libtool_libs" = module; then
+         oldobjs="$libobjs_save"
+         build_libtool_libs=no
+       else
+         oldobjs="$old_deplibs $non_pic_objects"
+         if test "$preload" = yes && test -f "$symfileobj"; then
+           func_append oldobjs " $symfileobj"
+         fi
+       fi
+       addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+       gentop="$output_objdir/${outputname}x"
+       func_append generated " $gentop"
+
+       func_extract_archives $gentop $addlibs
+       func_append oldobjs " $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+       cmds=$old_archive_from_new_cmds
+      else
+
+       # Add any objects from preloaded convenience libraries
+       if test -n "$dlprefiles"; then
+         gentop="$output_objdir/${outputname}x"
+         func_append generated " $gentop"
+
+         func_extract_archives $gentop $dlprefiles
+         func_append oldobjs " $func_extract_archives_result"
+       fi
+
+       # POSIX demands no paths to be encoded in archives.  We have
+       # to avoid creating archives with duplicate basenames if we
+       # might have to extract them afterwards, e.g., when creating a
+       # static archive out of a convenience library, or when linking
+       # the entirety of a libtool archive into another (currently
+       # not supported by libtool).
+       if (for obj in $oldobjs
+           do
+             func_basename "$obj"
+             $ECHO "$func_basename_result"
+           done | sort | sort -uc >/dev/null 2>&1); then
+         :
+       else
+         echo "copying selected object files to avoid basename conflicts..."
+         gentop="$output_objdir/${outputname}x"
+         func_append generated " $gentop"
+         func_mkdir_p "$gentop"
+         save_oldobjs=$oldobjs
+         oldobjs=
+         counter=1
+         for obj in $save_oldobjs
+         do
+           func_basename "$obj"
+           objbase="$func_basename_result"
+           case " $oldobjs " in
+           " ") oldobjs=$obj ;;
+           *[\ /]"$objbase "*)
+             while :; do
+               # Make sure we don't pick an alternate name that also
+               # overlaps.
+               newobj=lt$counter-$objbase
+               func_arith $counter + 1
+               counter=$func_arith_result
+               case " $oldobjs " in
+               *[\ /]"$newobj "*) ;;
+               *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+               esac
+             done
+             func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+             func_append oldobjs " $gentop/$newobj"
+             ;;
+           *) func_append oldobjs " $obj" ;;
+           esac
+         done
+       fi
+       func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+       tool_oldlib=$func_to_tool_file_result
+       eval cmds=\"$old_archive_cmds\"
+
+       func_len " $cmds"
+       len=$func_len_result
+       if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         cmds=$old_archive_cmds
+       elif test -n "$archiver_list_spec"; then
+         func_verbose "using command file archive linking..."
+         for obj in $oldobjs
+         do
+           func_to_tool_file "$obj"
+           $ECHO "$func_to_tool_file_result"
+         done > $output_objdir/$libname.libcmd
+         func_to_tool_file "$output_objdir/$libname.libcmd"
+         oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+         cmds=$old_archive_cmds
+       else
+         # the command line is too long to link in one step, link in parts
+         func_verbose "using piecewise archive linking..."
+         save_RANLIB=$RANLIB
+         RANLIB=:
+         objlist=
+         concat_cmds=
+         save_oldobjs=$oldobjs
+         oldobjs=
+         # Is there a better way of finding the last object in the list?
+         for obj in $save_oldobjs
+         do
+           last_oldobj=$obj
+         done
+         eval test_cmds=\"$old_archive_cmds\"
+         func_len " $test_cmds"
+         len0=$func_len_result
+         len=$len0
+         for obj in $save_oldobjs
+         do
+           func_len " $obj"
+           func_arith $len + $func_len_result
+           len=$func_arith_result
+           func_append objlist " $obj"
+           if test "$len" -lt "$max_cmd_len"; then
+             :
+           else
+             # the above command should be used before it gets too long
+             oldobjs=$objlist
+             if test "$obj" = "$last_oldobj" ; then
+               RANLIB=$save_RANLIB
+             fi
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+             objlist=
+             len=$len0
+           fi
+         done
+         RANLIB=$save_RANLIB
+         oldobjs=$objlist
+         if test "X$oldobjs" = "X" ; then
+           eval cmds=\"\$concat_cmds\"
+         else
+           eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+         fi
+       fi
+      fi
+      func_execute_cmds "$cmds" 'exit $?'
+    done
+
+    test -n "$generated" && \
+      func_show_eval "${RM}r$generated"
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      func_verbose "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+       if eval test -z \"\${$var+set}\"; then
+         relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+       elif eval var_value=\$$var; test -z "$var_value"; then
+         relink_command="$var=; export $var; $relink_command"
+       else
+         func_quote_for_eval "$var_value"
+         relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+       fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+       relink_command=
+      fi
+
+      # Only create the output if not a dry run.
+      $opt_dry_run || {
+       for installed in no yes; do
+         if test "$installed" = yes; then
+           if test -z "$install_libdir"; then
+             break
+           fi
+           output="$output_objdir/$outputname"i
+           # Replace all uninstalled libtool libraries with the installed ones
+           newdependency_libs=
+           for deplib in $dependency_libs; do
+             case $deplib in
+             *.la)
+               func_basename "$deplib"
+               name="$func_basename_result"
+               func_resolve_sysroot "$deplib"
+               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+               test -z "$libdir" && \
+                 func_fatal_error "\`$deplib' is not a valid libtool archive"
+               func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+               ;;
+             -L*)
+               func_stripname -L '' "$deplib"
+               func_replace_sysroot "$func_stripname_result"
+               func_append newdependency_libs " -L$func_replace_sysroot_result"
+               ;;
+             -R*)
+               func_stripname -R '' "$deplib"
+               func_replace_sysroot "$func_stripname_result"
+               func_append newdependency_libs " -R$func_replace_sysroot_result"
+               ;;
+             *) func_append newdependency_libs " $deplib" ;;
+             esac
+           done
+           dependency_libs="$newdependency_libs"
+           newdlfiles=
+
+           for lib in $dlfiles; do
+             case $lib in
+             *.la)
+               func_basename "$lib"
+               name="$func_basename_result"
+               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+               test -z "$libdir" && \
+                 func_fatal_error "\`$lib' is not a valid libtool archive"
+               func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+               ;;
+             *) func_append newdlfiles " $lib" ;;
+             esac
+           done
+           dlfiles="$newdlfiles"
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             case $lib in
+             *.la)
+               # Only pass preopened files to the pseudo-archive (for
+               # eventual linking with the app. that links it) if we
+               # didn't already link the preopened objects directly into
+               # the library:
+               func_basename "$lib"
+               name="$func_basename_result"
+               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+               test -z "$libdir" && \
+                 func_fatal_error "\`$lib' is not a valid libtool archive"
+               func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+               ;;
+             esac
+           done
+           dlprefiles="$newdlprefiles"
+         else
+           newdlfiles=
+           for lib in $dlfiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             func_append newdlfiles " $abs"
+           done
+           dlfiles="$newdlfiles"
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             func_append newdlprefiles " $abs"
+           done
+           dlprefiles="$newdlprefiles"
+         fi
+         $RM $output
+         # place dlname in correct position for cygwin
+         # In fact, it would be nice if we could use this code for all target
+         # systems that can't hard-code library paths into their executables
+         # and that have no shared library path variable independent of PATH,
+         # but it turns out we can't easily determine that from inspecting
+         # libtool variables, so we have to hard-code the OSs to which it
+         # applies here; at the moment, that means platforms that use the PE
+         # object format with DLL files.  See the long comment at the top of
+         # tests/bindir.at for full details.
+         tdlname=$dlname
+         case $host,$output,$installed,$module,$dlname in
+           *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+             # If a -bindir argument was supplied, place the dll there.
+             if test "x$bindir" != x ;
+             then
+               func_relative_path "$install_libdir" "$bindir"
+               tdlname=$func_relative_path_result$dlname
+             else
+               # Otherwise fall back on heuristic.
+               tdlname=../bin/$dlname
+             fi
+             ;;
+         esac
+         $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+         if test "$installed" = no && test "$need_relink" = yes; then
+           $ECHO >> $output "\
+relink_command=\"$relink_command\""
+         fi
+       done
+      }
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+}
+
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+    func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+    $opt_debug
+    RM="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) func_append RM " $arg"; rmforce=yes ;;
+      -*) func_append RM " $arg" ;;
+      *) func_append files " $arg" ;;
+      esac
+    done
+
+    test -z "$RM" && \
+      func_fatal_help "you must specify an RM program"
+
+    rmdirs=
+
+    for file in $files; do
+      func_dirname "$file" "" "."
+      dir="$func_dirname_result"
+      if test "X$dir" = X.; then
+       odir="$objdir"
+      else
+       odir="$dir/$objdir"
+      fi
+      func_basename "$file"
+      name="$func_basename_result"
+      test "$opt_mode" = uninstall && odir="$dir"
+
+      # Remember odir for removal later, being careful to avoid duplicates
+      if test "$opt_mode" = clean; then
+       case " $rmdirs " in
+         *" $odir "*) ;;
+         *) func_append rmdirs " $odir" ;;
+       esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if { test -L "$file"; } >/dev/null 2>&1 ||
+        { test -h "$file"; } >/dev/null 2>&1 ||
+        test -f "$file"; then
+       :
+      elif test -d "$file"; then
+       exit_status=1
+       continue
+      elif test "$rmforce" = yes; then
+       continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+       # Possibly a libtool archive, so verify it.
+       if func_lalib_p "$file"; then
+         func_source $dir/$name
+
+         # Delete the libtool libraries and symlinks.
+         for n in $library_names; do
+           func_append rmfiles " $odir/$n"
+         done
+         test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+
+         case "$opt_mode" in
+         clean)
+           case " $library_names " in
+           *" $dlname "*) ;;
+           *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+           esac
+           test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+           ;;
+         uninstall)
+           if test -n "$library_names"; then
+             # Do each command in the postuninstall commands.
+             func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+           fi
+
+           if test -n "$old_library"; then
+             # Do each command in the old_postuninstall commands.
+             func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+           fi
+           # FIXME: should reinstall the best remaining shared library.
+           ;;
+         esac
+       fi
+       ;;
+
+      *.lo)
+       # Possibly a libtool object, so verify it.
+       if func_lalib_p "$file"; then
+
+         # Read the .lo file
+         func_source $dir/$name
+
+         # Add PIC object to the list of files to remove.
+         if test -n "$pic_object" &&
+            test "$pic_object" != none; then
+           func_append rmfiles " $dir/$pic_object"
+         fi
+
+         # Add non-PIC object to the list of files to remove.
+         if test -n "$non_pic_object" &&
+            test "$non_pic_object" != none; then
+           func_append rmfiles " $dir/$non_pic_object"
+         fi
+       fi
+       ;;
+
+      *)
+       if test "$opt_mode" = clean ; then
+         noexename=$name
+         case $file in
+         *.exe)
+           func_stripname '' '.exe' "$file"
+           file=$func_stripname_result
+           func_stripname '' '.exe' "$name"
+           noexename=$func_stripname_result
+           # $file with .exe has already been added to rmfiles,
+           # add $file without .exe
+           func_append rmfiles " $file"
+           ;;
+         esac
+         # Do a test to see if this is a libtool program.
+         if func_ltwrapper_p "$file"; then
+           if func_ltwrapper_executable_p "$file"; then
+             func_ltwrapper_scriptname "$file"
+             relink_command=
+             func_source $func_ltwrapper_scriptname_result
+             func_append rmfiles " $func_ltwrapper_scriptname_result"
+           else
+             relink_command=
+             func_source $dir/$noexename
+           fi
+
+           # note $name still contains .exe if it was in $file originally
+           # as does the version of $file that was added into $rmfiles
+           func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+           if test "$fast_install" = yes && test -n "$relink_command"; then
+             func_append rmfiles " $odir/lt-$name"
+           fi
+           if test "X$noexename" != "X$name" ; then
+             func_append rmfiles " $odir/lt-${noexename}.c"
+           fi
+         fi
+       fi
+       ;;
+      esac
+      func_show_eval "$RM $rmfiles" 'exit_status=1'
+    done
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+       func_show_eval "rmdir $dir >/dev/null 2>&1"
+      fi
+    done
+
+    exit $exit_status
+}
+
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+    func_mode_uninstall ${1+"$@"}
+
+test -z "$opt_mode" && {
+  help="$generic_help"
+  func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+  func_fatal_help "invalid operation mode \`$opt_mode'"
+
+if test -n "$exec_cmd"; then
+  eval exec "$exec_cmd"
+  exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
diff --git a/m4/libtool.m4 b/m4/libtool.m4
new file mode 100644 (file)
index 0000000..828104c
--- /dev/null
@@ -0,0 +1,8001 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+                  [m4_fatal([Libtool version $1 or higher is required],
+                            63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\    *)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+       [m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+       [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+       [tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+          m4_quote(lt_decl_varnames),
+       m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+                       lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+                                          [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+       dnl If the libtool generation code has been placed in $CONFIG_LT,
+       dnl instead of duplicating it all over again into config.status,
+       dnl then we will have config.status run $CONFIG_LT later, so it
+       dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_REPLACE_SHELLFNS
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],                 [_LT_LANG(C)],
+  [C++],               [_LT_LANG(CXX)],
+  [Go],                        [_LT_LANG(GO)],
+  [Java],              [_LT_LANG(GCJ)],
+  [Fortran 77],                [_LT_LANG(F77)],
+  [Fortran],           [_LT_LANG(FC)],
+  [Windows Resource],  [_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+m4_ifndef([AC_PROG_GO], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC],     [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+  fi
+fi
+if test -z "$GOC"; then
+  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+       [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+       [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+       [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+  [LT_LANG(GO)],
+  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+       # By default we will add the -single_module flag. You can override
+       # by either setting the environment variable LT_MULTI_MODULE
+       # non-empty at configure time, or by adding -multi_module to the
+       # link flags.
+       rm -rf libconftest.dylib*
+       echo "int foo(void){return 1;}" > conftest.c
+       echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+       $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+         -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+       # If there is a non-empty error log, and "single_module"
+       # appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+         cat conftest.err >&AS_MESSAGE_LOG_FD
+       # Otherwise, if the output was created with a 0 exit code from
+       # the compiler, it worked.
+       elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+         lt_cv_apple_cc_single_mod=yes
+       else
+         cat conftest.err >&AS_MESSAGE_LOG_FD
+       fi
+       rm -rf libconftest.dylib*
+       rm -f conftest.*
+      fi])
+
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+       [lt_cv_ld_exported_symbols_list=yes],
+       [lt_cv_ld_exported_symbols_list=no])
+       LDFLAGS="$save_LDFLAGS"
+    ])
+
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+       cat conftest.err >&AS_MESSAGE_LOG_FD
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+       lt_cv_ld_force_load=yes
+      else
+       cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[012]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+       10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+         _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+       10.[[012]]*)
+         _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+       10.*)
+         _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    m4_if([$1], [CXX],
+[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+         /^0/ {
+             s/^0  *\([^ ]*\) *$/\1/
+             p
+         }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
+
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+       HPUX_IA64_MODE="32"
+       ;;
+      *ELF-64*)
+       HPUX_IA64_MODE="64"
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -melf32bsmip"
+         ;;
+       *N32*)
+         LD="${LD-ld} -melf32bmipn32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -melf64bmip"
+       ;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -32"
+         ;;
+       *N32*)
+         LD="${LD-ld} -n32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -64"
+         ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_i386_fbsd"
+           ;;
+         x86_64-*linux*)
+           LD="${LD-ld} -m elf_i386"
+           ;;
+         ppc64-*linux*|powerpc64-*linux*)
+           LD="${LD-ld} -m elf32ppclinux"
+           ;;
+         s390x-*linux*)
+           LD="${LD-ld} -m elf_s390"
+           ;;
+         sparc64-*linux*)
+           LD="${LD-ld} -m elf32_sparc"
+           ;;
+       esac
+       ;;
+      *64-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_x86_64_fbsd"
+           ;;
+         x86_64-*linux*)
+           LD="${LD-ld} -m elf_x86_64"
+           ;;
+         ppc*-*linux*|powerpc*-*linux*)
+           LD="${LD-ld} -m elf64ppc"
+           ;;
+         s390*-*linux*|s390*-*tpf*)
+           LD="${LD-ld} -m elf64_s390"
+           ;;
+         sparc*-*linux*)
+           LD="${LD-ld} -m elf64_sparc"
+           ;;
+       esac
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
+      *)
+       if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+         LD="${LD-ld} -64"
+       fi
+       ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test "$ac_status" -eq 0; then
+       # Ensure the archiver fails upon bogus file names.
+       rm -f conftest.$ac_objext libconftest.a
+       AC_TRY_EVAL([lt_ar_try])
+       if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#              [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536      # usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[        ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+                = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+             test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+         if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+       }
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+         [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+           [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+       [AC_CHECK_FUNC([dlopen],
+             [lt_cv_dlopen="dlopen"],
+         [AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+           [AC_CHECK_LIB([svld], [dlopen],
+                 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+             [AC_CHECK_LIB([dld], [dld_link],
+                   [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+             ])
+           ])
+         ])
+       ])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+         lt_cv_dlopen_self, [dnl
+         _LT_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+           lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+         lt_cv_dlopen_self_static, [dnl
+         _LT_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+           lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+        [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+        [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+        [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+       [Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+       [], [
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+       lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[23]].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux # correct to gnu/linux during the next big refactor
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+        LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+        [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[  ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+        [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+       [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       # Tru64's nm complains that /dev/null is an invalid object file
+       case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+       */dev/null* | *'Invalid file or object type'*)
+         lt_cv_path_NM="$tmp_nm -B"
+         break
+         ;;
+       *)
+         case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+         */dev/null*)
+           lt_cv_path_NM="$tmp_nm -p"
+           break
+           ;;
+         *)
+           lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+           continue # so that we can try to find one that supports BSD flags
+           ;;
+         esac
+         ;;
+       esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+       [Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[    ]]\($symcode$symcode*\)[[       ]][[    ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+       if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t@_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t@_DLSYM_CONST
+#else
+# define LT@&t@_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+         # Now generate the symbol file.
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+         cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT@&t@_DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+         $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+         cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_globsym_save_LIBS=$LIBS
+         lt_globsym_save_CFLAGS=$CFLAGS
+         LIBS="conftstm.$ac_objext"
+         CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+         if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS=$lt_globsym_save_LIBS
+         CFLAGS=$lt_globsym_save_CFLAGS
+       else
+         echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+       [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+       # All AIX code is PIC.
+       if test "$host_cpu" = ia64; then
+         # AIX 5 now supports IA64 processor
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+       else
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68*)
+         # Green Hills C++ Compiler
+         # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+       # This hack is so that the source file can tell whether it is being
+       # built for inclusion in a dll (and should export symbols for example).
+       m4_if([$1], [GCJ], [],
+         [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++*)
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         ghcx*)
+           # Green Hills C++ Compiler
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | dragonfly*)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+           if test "$host_cpu" != ia64; then
+             _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+           fi
+           ;;
+         aCC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+           case $host_cpu in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      interix*)
+       # This is c89, which is MS Visual C++ (no shared libs)
+       # Anyone wants to do a port?
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           ;;
+         ecpc* )
+           # old Intel C++ for x86_64 which still supported -KPIC.
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
+         icpc* )
+           # Intel C++, used to be incompatible with GCC.
+           # ICC 10 doesn't accept -KPIC any more.
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
+         pgCC* | pgcpp*)
+           # Portland Group C++ compiler
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         cxx*)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+           # IBM XL 8.0, 9.0 on PPC and BlueGene
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+             _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+             _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx*)
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd* | netbsdelf*-gnu)
+       ;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           ;;
+         RCC*)
+           # Rational C++ 2.4.1
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         cxx*)
+           # Digital/Compaq C++
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC* | sunCC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+           ;;
+         gcx*)
+           # Green Hills C++ Compiler
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.x
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         lcc*)
+           # Lucid
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+       case $cc_basename in
+         CC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC*)
+           # NonStop-UX NCC 3.20
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      vxworks*)
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+       ;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+       [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+      fi
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+       [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+       ;;
+      nagfor*)
+       # NAG Fortran compiler
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+       ;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+       # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+       ;;
+      *)
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
+         # Sun Fortran 8.3 passes all unrecognized flags to the linker
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+         ;;
+       *Sun\ F* | *Sun*Fortran*)
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+         ;;
+       *Sun\ C*)
+         # Sun C 5.9
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         ;;
+        *Intel*\ [[CF]]*Compiler*)
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+         ;;
+       *Portland\ Group*)
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+         ;;
+       esac
+       ;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+       [Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+       [How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+       [Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*)
+      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    esac
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+       # The AIX port of GNU ld has always aspired to compatibility
+       # with the native linker.  However, as the warning in the GNU ld
+       # block says, versions before 2.19.5* couldn't really create working
+       # shared libraries, regardless of the interface used.
+       case `$LD -v 2>&1` in
+         *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+         *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+         *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+         *)
+           lt_use_gnu_ld_interface=yes
+           ;;
+       esac
+       ;;
+      *)
+       lt_use_gnu_ld_interface=yes
+       ;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+       case $cc_basename in
+         diet\ *) tmp_diet=yes;;       # linux-dietlibc with static linking (!diet-dyn)
+       esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+        && test "$tmp_diet" = no
+      then
+       tmp_addflag=' $pic_flag'
+       tmp_sharedflag='-shared'
+       case $cc_basename,$host_cpu in
+        pgcc*)                         # Portland Group C compiler
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95* | pgfortran*)
+                                       # Portland Group f77 and f90 compilers
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       lf95*)                          # Lahey Fortran 8.1
+         _LT_TAGVAR(whole_archive_flag_spec, $1)=
+         tmp_sharedflag='--shared' ;;
+       xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+         tmp_sharedflag='-qmkshrobj'
+         tmp_addflag= ;;
+       nvcc*)  # Cuda Compiler Driver 2.2
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(compiler_needs_object, $1)=yes
+         ;;
+       esac
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ C*)                       # Sun C 5.9
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(compiler_needs_object, $1)=yes
+         tmp_sharedflag='-G' ;;
+       *Sun\ F*)                       # Sun Fortran 8.3
+         tmp_sharedflag='-G' ;;
+       esac
+       _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+           cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+           echo "local: *; };" >> $output_objdir/$libname.ver~
+           $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+       case $cc_basename in
+       xlf* | bgf* | bgxlf* | mpixlf*)
+         # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+         _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+         if test "x$supports_anon_versioning" = xyes; then
+           _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+             cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+             echo "local: *; };" >> $output_objdir/$libname.ver~
+             $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+         fi
+         ;;
+       esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         # For security reasons, it is highly recommended that you always
+         # use absolute paths for naming shared libraries, and exclude the
+         # DT_RUNPATH tag from executables and libraries.  But doing so
+         # requires that you compile everything twice, which is a pain.
+         if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         else
+           _LT_TAGVAR(ld_shlibs, $1)=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       _LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       # Also, AIX nm treats weak defined symbols like other global
+       # defined symbols, whereas GNU nm marks them as "W".
+       if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+         _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+       else
+         _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[[012]]|aix4.[[012]].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" &&
+          strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         :
+         else
+         # We have old collect2
+         _LT_TAGVAR(hardcode_direct, $1)=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         _LT_TAGVAR(hardcode_minus_L, $1)=yes
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_TAGVAR(hardcode_libdir_separator, $1)=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+       _LT_TAGVAR(link_all_deplibs, $1)=no
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+         fi
+       fi
+      fi
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+       if test "$host_cpu" = ia64; then
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+         _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+         _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+         _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+         if test "$with_gnu_ld" = yes; then
+           # We only use this code for GNU lds that support --whole-archive.
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+         else
+           # Exported symbols can be pulled into shared objects from archives
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+         fi
+         _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+       # Native MSVC
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+       _LT_TAGVAR(always_export_symbols, $1)=yes
+       _LT_TAGVAR(file_list_spec, $1)='@'
+       # Tell ltmain to make .lib files, not .a files.
+       libext=lib
+       # Tell ltmain to make .dll files, not .so files.
+       shrext_cmds=".dll"
+       # FIXME: Setting linknames here is a bad hack.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+       _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+           sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+         else
+           sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+         fi~
+         $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+         linknames='
+       # The linker will not automatically build a static lib if we build a DLL.
+       # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+       _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+       _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+       # Don't use ranlib
+       _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+       _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+         lt_tool_outputfile="@TOOL_OUTPUT@"~
+         case $lt_outputfile in
+           *.exe|*.EXE) ;;
+           *)
+             lt_outputfile="$lt_outputfile.exe"
+             lt_tool_outputfile="$lt_tool_outputfile.exe"
+             ;;
+         esac~
+         if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+           $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+           $RM "$lt_outputfile.manifest";
+         fi'
+       ;;
+      *)
+       # Assume MSVC wrapper
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+       # Tell ltmain to make .lib files, not .a files.
+       libext=lib
+       # Tell ltmain to make .dll files, not .so files.
+       shrext_cmds=".dll"
+       # FIXME: Setting linknames here is a bad hack.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+       # The linker will automatically build a .lib file if we build a DLL.
+       _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+       # FIXME: Should let the user specify the lib program.
+       _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+       ;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+       _LT_TAGVAR(hardcode_direct, $1)=yes
+       _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+       m4_if($1, [], [
+         # Older versions of the 11.00 compiler do not understand -b yet
+         # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+         _LT_LINKER_OPTION([if $CC understands -b],
+           _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+           [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+           [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+         [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         _LT_TAGVAR(hardcode_direct, $1)=no
+         _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+         ;;
+       *)
+         _LT_TAGVAR(hardcode_direct, $1)=yes
+         _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         _LT_TAGVAR(hardcode_minus_L, $1)=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       # Try to use the -exported_symbol ld option, if it does not
+       # work, assume that -exports_file does not work either and
+       # implicitly export all symbols.
+       # This should be the same for all languages, so no per-tag cache variable.
+       AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+         [lt_cv_irix_exported_symbol],
+         [save_LDFLAGS="$LDFLAGS"
+          LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+          AC_LINK_IFELSE(
+            [AC_LANG_SOURCE(
+               [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+                             [C++], [[int foo (void) { return 0; }]],
+                             [Fortran 77], [[
+      subroutine foo
+      end]],
+                             [Fortran], [[
+      subroutine foo
+      end]])])],
+             [lt_cv_irix_exported_symbol=yes],
+             [lt_cv_irix_exported_symbol=no])
+           LDFLAGS="$save_LDFLAGS"])
+       if test "$lt_cv_irix_exported_symbol" = yes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+       fi
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+       _LT_TAGVAR(hardcode_direct, $1)=yes
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+       else
+         case $host_os in
+          openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+            _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+            ;;
+          *)
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+            ;;
+         esac
+       fi
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+       _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+       $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+       case `$CC -V 2>&1` in
+       *"Compilers 5.0"*)
+         wlarc=''
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+         ;;
+       *)
+         wlarc='${wl}'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+         ;;
+       esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+       # The compiler driver will combine and reorder linker options,
+       # but understands `-z linker_flag'.  GCC discards it without `$wl',
+       # but is careful enough not to reorder.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       if test "$GCC" = yes; then
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+       else
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+       fi
+       ;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+         _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+       motorola)
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       _LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+       ;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+       [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+       [$RM conftest*
+       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+       if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+         soname=conftest
+         lib=conftest
+         libobjs=conftest.$ac_objext
+         deplibs=
+         wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+         pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+         compiler_flags=-v
+         linker_flags=-v
+         verstring=
+         output_objdir=.
+         libname=conftest
+         lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+         _LT_TAGVAR(allow_undefined_flag, $1)=
+         if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+         then
+           lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+         else
+           lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+         fi
+         _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+       else
+         cat conftest.err 1>&5
+       fi
+       $RM conftest*
+       ])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[[4-9]]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+         $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+           for ld_flag in $LDFLAGS; do
+             case $ld_flag in
+             *-brtl*)
+               aix_use_runtimelinking=yes
+               break
+               ;;
+             esac
+           done
+           ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" &&
+            strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+         then
+           # We have reworked collect2
+           :
+         else
+           # We have old collect2
+           _LT_TAGVAR(hardcode_direct, $1)=unsupported
+           # It fails to find uninstalled libraries when the uninstalled
+           # path is not listed in the libpath.  Setting hardcode_minus_L
+           # to unsupported forces relinking
+           _LT_TAGVAR(hardcode_minus_L, $1)=yes
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=
+         fi
+          esac
+          shared_flag='-shared'
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag="$shared_flag "'${wl}-G'
+         fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+         # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+         # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+          else
+           if test "$aix_use_runtimelinking" = yes; then
+             shared_flag='${wl}-G'
+           else
+             shared_flag='${wl}-bM:SRE'
+           fi
+          fi
+        fi
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+       # export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+           _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+           _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+           # Determine the default libpath from the value encoded in an
+           # empty executable.
+           _LT_SYS_MODULE_PATH_AIX([$1])
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+           # Warning - without using the other run time loading flags,
+           # -berok will link without error, but may produce a broken library.
+           _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+           _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+           if test "$with_gnu_ld" = yes; then
+             # We only use this code for GNU lds that support --whole-archive.
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+           else
+             # Exported symbols can be pulled into shared objects from archives
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+           fi
+           _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+           # This is similar to how AIX traditionally builds its shared
+           # libraries.
+           _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+         _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+         # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+         # support --undefined.  This deserves some investigation.  FIXME
+         _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       else
+         _LT_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+         # FIXME: insert proper C++ library support
+         _LT_TAGVAR(ld_shlibs, $1)=no
+         ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+       case $GXX,$cc_basename in
+       ,cl* | no,cl*)
+         # Native MSVC
+         # hardcode_libdir_flag_spec is actually meaningless, as there is
+         # no search path for DLLs.
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+         _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+         _LT_TAGVAR(always_export_symbols, $1)=yes
+         _LT_TAGVAR(file_list_spec, $1)='@'
+         # Tell ltmain to make .lib files, not .a files.
+         libext=lib
+         # Tell ltmain to make .dll files, not .so files.
+         shrext_cmds=".dll"
+         # FIXME: Setting linknames here is a bad hack.
+         _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+         _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+             $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+           else
+             $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+           fi~
+           $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+           linknames='
+         # The linker will not automatically build a static lib if we build a DLL.
+         # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+         _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+         # Don't use ranlib
+         _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+         _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+           lt_tool_outputfile="@TOOL_OUTPUT@"~
+           case $lt_outputfile in
+             *.exe|*.EXE) ;;
+             *)
+               lt_outputfile="$lt_outputfile.exe"
+               lt_tool_outputfile="$lt_tool_outputfile.exe"
+               ;;
+           esac~
+           func_to_tool_file "$lt_outputfile"~
+           if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+             $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+             $RM "$lt_outputfile.manifest";
+           fi'
+         ;;
+       *)
+         # g++
+         # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+         # as there is no search path for DLLs.
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+         _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+         _LT_TAGVAR(always_export_symbols, $1)=no
+         _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+         if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+           # If the export-symbols file already is a .def file (1st line
+           # is EXPORTS), use it as is; otherwise, prepend...
+           _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+             cp $export_symbols $output_objdir/$soname.def;
+           else
+             echo EXPORTS > $output_objdir/$soname.def;
+             cat $export_symbols >> $output_objdir/$soname.def;
+           fi~
+           $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+         else
+           _LT_TAGVAR(ld_shlibs, $1)=no
+         fi
+         ;;
+       esac
+       ;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+       ;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          ghcx*)
+           # Green Hills C++ Compiler
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+        esac
+        ;;
+
+      freebsd2.*)
+        # C++ shared libraries reported to be fairly broken before
+       # switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                                            # but as the default
+                                            # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+             _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                                                # but as the default
+                                                # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          aCC*)
+           case $host_cpu in
+             hppa*64*)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             ia64*)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             *)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+           esac
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           ;;
+          *)
+           if test "$GXX" = yes; then
+             if test $with_gnu_ld = no; then
+               case $host_cpu in
+                 hppa*64*)
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 ia64*)
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 *)
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+               esac
+             fi
+           else
+             # FIXME: insert proper C++ library support
+             _LT_TAGVAR(ld_shlibs, $1)=no
+           fi
+           ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+       _LT_TAGVAR(hardcode_direct, $1)=no
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+       # Instead, shared libraries are loaded at an image base (0x10000000 by
+       # default) and relocated if they conflict, which is a slow very memory
+       # consuming and fragmenting process.  To avoid this, we pick a random,
+       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       ;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+           # SGI C++
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+           # Archives containing C++ object files must be created using
+           # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+           ;;
+          *)
+           if test "$GXX" = yes; then
+             if test "$with_gnu_ld" = no; then
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+             else
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+             fi
+           fi
+           _LT_TAGVAR(link_all_deplibs, $1)=yes
+           ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+           # KCC will only create a shared library if the output file
+           # ends with ".so" (or ".sl" for HP-UX), so rename the library
+           # to its proper name (with version) after linking.
+           _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+           # Archives containing C++ object files must be created using
+           # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+           ;;
+         icpc* | ecpc* )
+           # Intel C++
+           with_gnu_ld=yes
+           # version 8.0 and above of icpc choke on multiply defined symbols
+           # if we add $predep_objects and $postdep_objects, however 7.1 and
+           # earlier do not add the objects themselves.
+           case `$CC -V 2>&1` in
+             *"Version 7."*)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+             *)  # Version 8.0 or newer
+               tmp_idyn=
+               case $host_cpu in
+                 ia64*) tmp_idyn=' -i_dynamic';;
+               esac
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+           esac
+           _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+           ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+           case `$CC -V` in
+           *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+             _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+               compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+             _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+               $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+               $RANLIB $oldlib'
+             _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+             ;;
+           *) # Version 6 and above use weak symbols
+             _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+             ;;
+           esac
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+         cxx*)
+           # Compaq C++
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+           runpath_var=LD_RUN_PATH
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+           ;;
+         xl* | mpixl* | bgxl*)
+           # IBM XL 8.0 on PPC, with GNU ld
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           if test "x$supports_anon_versioning" = xyes; then
+             _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+               cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+               echo "local: *; };" >> $output_objdir/$libname.ver~
+               $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+           fi
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+             _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+             _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+             # Not sure whether something based on
+             # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+             # would be better.
+             output_verbose_link_cmd='func_echo_all'
+
+             # Archives containing C++ object files must be created using
+             # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+             # necessary to make sure instantiated templates are included
+             # in the archive.
+             _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       ;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+       ;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+         *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+       esac
+       ;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+         _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+         wlarc=
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+         _LT_TAGVAR(hardcode_direct, $1)=yes
+         _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       fi
+       # Workaround some broken pre-1.5 toolchains
+       output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+       ;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+       ;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       ;;
+
+      openbsd*)
+       if test -f /usr/libexec/ld.so; then
+         _LT_TAGVAR(hardcode_direct, $1)=yes
+         _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+         _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+         if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+         fi
+         output_verbose_link_cmd=func_echo_all
+       else
+         _LT_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+           # KCC will only create a shared library if the output file
+           # ends with ".so" (or ".sl" for HP-UX), so rename the library
+           # to its proper name (with version) after linking.
+           _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+           # Archives containing C++ object files must be created using
+           # the KAI C++ compiler.
+           case $host in
+             osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+             *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+           esac
+           ;;
+          RCC*)
+           # Rational C++ 2.4.1
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          cxx*)
+           case $host in
+             osf3*)
+               _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+               _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+               ;;
+             *)
+               _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+                 echo "-hidden">> $lib.exp~
+                 $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+                 $RM $lib.exp'
+               _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+               ;;
+           esac
+
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           ;;
+         *)
+           if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+             _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+             case $host in
+               osf3*)
+                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 ;;
+               *)
+                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 ;;
+             esac
+
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+             _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+             # Commands to make compiler produce verbose output that lists
+             # what "hidden" libraries, object files and flags are used when
+             # linking a shared library.
+             output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+           else
+             # FIXME: insert proper C++ library support
+             _LT_TAGVAR(ld_shlibs, $1)=no
+           fi
+           ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+           # Sun C++ 4.x
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          lcc*)
+           # Lucid
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+           _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+             $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+           _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+           case $host_os in
+             solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+             *)
+               # The compiler driver will combine and reorder linker options,
+               # but understands `-z linker_flag'.
+               # Supported since Solaris 2.6 (maybe 2.5.1?)
+               _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+               ;;
+           esac
+           _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+           output_verbose_link_cmd='func_echo_all'
+
+           # Archives containing C++ object files must be created using
+           # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+           ;;
+          gcx*)
+           # Green Hills C++ Compiler
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+           # The C++ compiler must be used to create the archive.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+           ;;
+          *)
+           # GNU C++ compiler with Solaris linker
+           if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+             _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+             if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                 $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+             else
+               # g++ 2.7 appears to require `-G' NOT `-shared' on this
+               # platform.
+               _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+             fi
+
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+             case $host_os in
+               solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+               *)
+                 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+                 ;;
+             esac
+           fi
+           ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+       # Note: We can NOT use -z defs as we might desire, because we do not
+       # link with -lc, and that would cause any symbols used from libc to
+       # always be unresolved, which means just about no library would
+       # ever link correctly.  If we're not using GNU ld we use -z text
+       # though, which does catch some bad symbols but isn't as heavy-handed
+       # as -z defs.
+       _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+       _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+       _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+       _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+       _LT_TAGVAR(link_all_deplibs, $1)=yes
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+       runpath_var='LD_RUN_PATH'
+
+       case $cc_basename in
+          CC*)
+           _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+             '"$_LT_TAGVAR(old_archive_cmds, $1)"
+           _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+             '"$_LT_TAGVAR(reload_cmds, $1)"
+           ;;
+         *)
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           ;;
+       esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+           # NonStop-UX NCC 3.20
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+        prev=$p
+        continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+        case ${prev} in
+        -L | -R)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+            _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+          else
+            _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+          _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+        else
+          _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+        fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+          _LT_TAGVAR(predep_objects, $1)="$p"
+        else
+          _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+        fi
+       else
+        if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+          _LT_TAGVAR(postdep_objects, $1)="$p"
+        else
+          _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+       if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+         test "$enable_shared" = yes && enable_static=no
+       fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+       if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+         test "$enable_shared" = yes && enable_static=no
+       fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([    ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary parameter first.
+    func_stripname_result=${3}
+    func_stripname_result=${func_stripname_result#"${1}"}
+    func_stripname_result=${func_stripname_result%"${2}"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+    func_split_long_opt_name=${1%%=*}
+    func_split_long_opt_arg=${1#*=}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+    func_split_short_opt_arg=${1#??}
+    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+    case ${1} in
+      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+      *)    func_lo2o_result=${1} ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
+
+  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
+
+  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+    func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
new file mode 100644 (file)
index 0000000..5d9acd8
--- /dev/null
@@ -0,0 +1,384 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+           [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+                     [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+                  [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+       [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+       [Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+       [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+       [Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+        [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
+       [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+       IFS="$lt_save_ifs"
+       if test "X$lt_pkg" = "X$lt_p"; then
+         pic_mode=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+                [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+                [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+                [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+                [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+                [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
new file mode 100644 (file)
index 0000000..9000a05
--- /dev/null
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+          m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+            [m4_foreach([_Lt_suffix],
+               ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+       [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+         [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+                [lt_append([$1], [$2], [$3])$4],
+                [$5])],
+         [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+       m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+       [$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+                     [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
new file mode 100644 (file)
index 0000000..07a8602
--- /dev/null
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers                      -*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 3337 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4.2'
+macro_revision='1.3337'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
new file mode 100644 (file)
index 0000000..c573da9
--- /dev/null
@@ -0,0 +1,98 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],  [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],             [AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],        [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],         [AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],    [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],           [AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],             [AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],    [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],           [AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],       [AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],               [AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],        [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],    [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],    [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],         [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],            [AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],  [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],             [AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],            [AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],    [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],   [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],          [AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],            [AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],           [AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],  [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],    [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],          [AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],          [AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],                [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],     [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],          [AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],   [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],           [AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],           [AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],           [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],  [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],      [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],        [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],    [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],        [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],    [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],        [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],    [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],     [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],         [AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],       [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],        [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],                [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],        [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],   [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],              [AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
diff --git a/missing b/missing
new file mode 100755 (executable)
index 0000000..86a8fc3
--- /dev/null
+++ b/missing
@@ -0,0 +1,331 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2012-01-06.13; # UTC
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  autom4te     touch the output file, or create a stub one
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+  s/^gnu-//; t
+  s/^gnu//; t
+  s/^g//; t'`
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).  This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+  lex*|yacc*)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case $f in
+      *:*) touch_files="$touch_files "`echo "$f" |
+                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+          sed 's/\.am$/.in/' |
+          while read f; do touch "$f"; done
+    ;;
+
+  autom4te*)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo "#! /bin/sh"
+       echo "# Created by GNU Automake missing as a replacement of"
+       echo "#  $ $@"
+       echo "exit 0"
+       chmod +x $file
+       exit 1
+    fi
+    ;;
+
+  bison*|yacc*)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if test $# -ne 1; then
+        eval LASTARG=\${$#}
+       case $LASTARG in
+       *.y)
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+           if test -f "$SRCFILE"; then
+                cp "$SRCFILE" y.tab.c
+           fi
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+           if test -f "$SRCFILE"; then
+                cp "$SRCFILE" y.tab.h
+           fi
+         ;;
+       esac
+    fi
+    if test ! -f y.tab.h; then
+       echo >y.tab.h
+    fi
+    if test ! -f y.tab.c; then
+       echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex*|flex*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if test $# -ne 1; then
+        eval LASTARG=\${$#}
+       case $LASTARG in
+       *.l)
+           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+           if test -f "$SRCFILE"; then
+                cp "$SRCFILE" lex.yy.c
+           fi
+         ;;
+       esac
+    fi
+    if test ! -f lex.yy.c; then
+       echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+        you modified a dependency of a manual page.  You may need the
+        \`Help2man' package in order for those modifications to take
+        effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo ".ab help2man is required to generate this page"
+       exit $?
+    fi
+    ;;
+
+  makeinfo*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '
+       /^@setfilename/{
+         s/.* \([^ ]*\) *$/\1/
+         p
+         q
+       }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/opencore-amr.manifest b/opencore-amr.manifest
new file mode 100644 (file)
index 0000000..a76fdba
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
diff --git a/opencore/ChangeLog b/opencore/ChangeLog
new file mode 100644 (file)
index 0000000..4558f96
--- /dev/null
@@ -0,0 +1,1328 @@
+===============================================================================
+2010-06-25  OpenCORE 2.50
+
+New Features
+- Mediascanner-albumart support
+- Add new player engine test case for HTTP streaming transfer mode
+- Adding BGR support for CC16 in codecs
+- Provide a runtime setting to prioritize SW codecs over HW codecs in the case 
+of thumbnail retrieval.
+- Addition of DLNA specific 'byte-seek' support for Pause/Resume and Seek cases.
+- Player engine test configuration modifications
+- Add profiling capability to OMX AVC/MPEG4/AAC encoder components.
+- Add support for the PSSH Atom to the mp4 composer, as specified in the 
+Protected Interoperable File Format (PIFF) Specification
+- Timestamp smoothing for incoming audio timestamps
+- Add support for the boxes 'enca', 'encv', 'enct', 'sinf' and 'frma' to the 
+mp4 composer
+- Add SetParameter as an extension command to Android MediaPlayer
+- Adding support of forward playback with rendering only I-frames
+- Modify the mp4 composer to verify the existence of entries in the mfra box 
+before rendering it.
+- Updates to DRM interfaces and test cases
+- Initialize iSkipToIDR to false for OMX AVC decoder.
+- Gapless and playlist support for MP4, MP3, and WMA
+- Framework support for MPEG-2 FF Parser
+- Changes at the PE Node and mp4 parser node to support PDL random position of 
+fragmented clips with out-of-band mfra information
+- Allowing scrubbing inside playerengine
+- MP4 Parser/composer mods to improve metadata support
+- Graceful degradation phase 1 (Key-frame-only mode in case of many late frames)
+- Makefile feature to build static aggregate
+- Add support for building against Android eclair
+- Add integration support for 3rd party audio library
+- AAC lib - Add new message that signals back change of Mode (new PCE)
+- Allow reconfig of MIOs for playlist scenarios
+- Android makefile segment separation / refactoring
+- Addition of new event PVMFInfoSourceFormatUpdated
+- Support for AAC multichannel contents to be partially decoded (output 
+only 2 channels).
+- Implement PVMFOMXEncNode::GetProfileAndLevel() to query for the final 
+profile/level after intialize.
+- Add support for changing bit rate/frame rate/intra refresh rate to OMXEncNode.
+- Allow local.mk file for applications to define steps for running target
+- Support for m4b file format
+- New ARM macros in build make system.
+- Add a target in module level unit test to display the list of available 
+targets
+- Support M4V bitstream with short header mode.
+- Support the PIFF Enhancements in the mp4 parser library
+- Metadata updates for mp3 parser
+- Added an utility function to set RTSP proxy server information 
+(https://review.source.android.com/#change,14369)
+- Build changes to support a restricted Main Profile AVC decoder optimized for 
+ARMv6
+- Adding scaling support for YUV422toYUV420.
+- When initialization error occurs to one of the selected tracks, allow the 
+playback of remaining tracks without a complete shut down.
+- Add progressive playback support in MP4 movie fragment playback
+- Add stdout from engine unit test output to junit xml logs
+- Large File Support in MP4 PDL and PPB
+- Added the test cases in PVME and FMU for protected test content
+- New Common Parser Node for AMR and WAV
+
+Improvements
+- H264 raw support for PVMI MIO file input / output
+- Retrieve "duration" metadata in mediascanner through metadataretriever
+- Fix for compiler warnings in mediaoutputnode and player engine test app.
+- Base node should add itself to Scheduler only in a valid Created state.
+- Codesize reduction for FMU
+- Implemented additional APIs in CPM plugin.
+- AAC lib - Enable redundant PCE syntax element on a raw bitstream
+- Add metadata support for aac, amr, awb and wav files.
+- Change logger levels to appropriate values in android video mio and jb node 
+for certain log statements
+- H264 raw support for PVMI MIO file input / output
+- Add Extended Atom types to the mp4 composer
+- Add test for receiving data in 2way engine unit tests.
+- Remove unused KVPs from engine and codecs
+- Changes made to API of a CPM plugin.
+- OMXConfigParser is modified to differentiate VC1 component from WMV component 
+so that WMV7 and WMV8 get rejected by VC1 component.
+- OMX Encoder node needs to save SPS/PPS for its possible query in the case of 
+H264_RAW format
+- If the encoder node marks the frame as keyframe, there is no need to sniff 
+the bitstream
+- Update source duration for video playlists
+- Build OMX wrappers in thumb mode in Android
+- Add a new 2way engine unit test.
+- Port File Output node to new base node interface design.
+- Removal of 2way VideoParser Node
+- Copyright date in OpenCORE source code should reflect the last time the file 
+was modified
+- Deprecate support for platforms without native 64-bit functionality.
+- Modify media layer node to use the base node framework
+- Add full metadata support for OMX MPEG4/H263 decoders - 
+profile/level/post-processing
+- Replace numeric values in code with enum
+- Add command line configurable timeout for pvplayer_engine_test
+- Some CML2 rules related to so_name can create errors with "n" symbol used as 
+module name
+- Watchdog timer to monitor start of data reception
+- Update the priority of some log messages
+- Use parseID3Tag for aac files
+- Node commands should succeed if the node is already in the resultant state in 
+the base node.
+- Miscellaneous DRM-related modifications
+- Modify jitter buffer node to use the base node framework
+- Refactor Media Output node
+- Remove linker warnings w.r.t. libopencore_player and libopencore_net_support
+- PVMFMediaClock takes care of device latency. Remove the device latency 
+processing in AMIO.
+- Port PVMP4FFComposerNode with the new Node Interface
+- Port Protocol Engine node to new node design
+- Refactor Media Output node to use new node interface
+- Changes to a DRM utility
+- Deprecate (and defunct) support for non-OMX nodes and builds
+- Introduce authoring clock for recording AV sync
+- Allow a single MIO to act as both compressed and uncompressed for the author 
+engine
+- Separating registration of ClockStateObserver and the latency in 
+PVMFMediaClock
+- Add API in PVMp4H263EncExtensionInterface to set H.263 GOB header interval
+- New constructor and parse method overloads for node interface implementation
+- OMX call error handling
+- Handle end of track event in player engine testcase for I-frame mode playback
+- Add RTSP return error code to the PVMF status return code
+- Remove PVMFDummyFileOutputNode
+- Clear the playback intent in PVME to avoid incorrect consumption of rights
+- Based on most recent Khronos clarifications - partially consumed buffers are 
+not allowed in OMX
+- Modify socket node to use the base node framework
+- Adding support for RTSPT tests for new server
+- Addition of Large File Support in MP4 Parser Library
+- Dynamically calculate omx encoder output buffer sizes instead of hard-coding 
+the size
+- Cleanup of 2way engine code.
+- Add warning logger message in the NegotiateComponentParameters functions for 
+2-way
+- Update OMX test app to test creation/destruction of the same component 
+multiple times in a row (especially useful for dynamic loading)
+- Remove dependency of fileoutputnode on pvPlayer SDK
+- cleanup of old Keys from MIOs
+- Remove API QueryUUID from all interfaces
+- Remove usage of USE_CML2_CONFIG since all the builds have been converted to 
+CML2
+- Change MPEG4 encoder OMX component to generate VOL header before getting 
+any input frames.
+- Fix gcc 4.4.1 compiler warnings
+- Remove unnecessary makefile templates from OpenCORE
+- Support for raw compressed headers in track meta data
+- Add a 2way engine unit test for when buffers are provided by MIO.
+- Remove dependency on oscl string from oscl_uuid.
+- Cleanup of 2way engine code.
+- NDEBUG and OSCL_RELEASE_BUILD macro consolidation
+- Use GetEventExtensionInterface to pass indication details from pv2way
+- Bypass pasp atom box in mp4 parser 
+(https://review.source.android.com/#change,12330)
+- CPM cleanup
+- Add mp3 track support in mp4 parser 
+(https://review.source.android.com/#change,12329)
+- Separate variable XCFLAGS to hold C-compiler flags
+- Use openssl crypto library within pvcrypto
+- Process the config data in the omx decoder components even if there are no 
+output buffers available
+- Add support for multichannel aac clips with no channel distribution 
+information
+- Add test duration to junit-like XML log output from test framework
+- Makefile update for new module
+- Change component library name in makefile
+- Move amr and avc common libraries from opencore_common into omx_sharedlibrary
+- Move libpvmioaviwavfileinput.a libavifileparser.a out of libopencore_common.so
+- Deprecate GetMetadataKeys, GetNodeMetadataKeys, GetNumMetadataKeys, and 
+ReleaseNodeMetadataKeys APIs.
+- Improvement in an internal build and the export of some additional methods
+- Move amr_common and avc_common lib to libomx_sharedlibrary.so
+- Print out time taken to complete each OMX test case.
+- Check for INTRA frames in the MPPTYPE box when the H263 frames are using the 
+extended PTYPE header
+- Introduce new KVP string
+- Improve the check for GLOBAL_CPU_ARCH_VERSION in codecs lib makefile to make 
+it scalable to higher version of ARM architecture.
+- Move ResetData() function in android surface output inside Reset()
+- Improve buffer negotiation with 3rd party omx components, as it will  let 
+them have the final say in the number of buffers.
+- Set release level logging to 1 for all platforms
+- Sending position status update before SetPlaybackRange command completion.
+- Improving the current logic in player engine for video scrubbing
+- Improve color conversion unit test
+- Remove unnecessary check in PEUT PS and SS testcases for the number of 
+buffering complete events.
+- Improved error reporting in DRM plugin.
+- Added player test cases for DRM
+- Changes to deal with use-cases when sdcard/phone memory gets full while 
+recording
+- Reset PaddingFrameInfo in MP3 parser after retrieving frame data
+- Cleaned up DRM plugin interface
+- PEUT for shoutcast shall check playback session to verify if it is valid 
+shoutcast session.
+- Modify AVCConfigParser to handle multiple SPSs/PPSs, AUD and SEI NALs.
+- Add profile and channel metadata support in AAC and AMR parsers
+- Modified CPM plugin data structure
+- Modify AVCConfigParser to handle multiple SPSs/PPSs, AUD and SEI NALs.
+- Fix for repositioning large offsets during MP4 PS
+- Add more metadata support in MP3 Parser and ID3 Parcom
+
+Bugs Fixed
+- Unit test fixes for CPM plugin
+- Improved handling of some MP4 Poison clips
+- Modify MP4 parser to not send EOS if duration available from content is 0
+- Fix for deadlock between player engine and OMX component threads caused by a 
+mismatched queue depth and number of new output AVC buffers during port 
+reconfiguration
+- Player hangs on normal playback under certain test conditions
+- Adjust the AVC decoder to handle non-compliant bitstreams which have a 
+non-zero frame_num for IDRs
+- Failure in InitNextValidClipInPlaylist( ) should report a command failure.
+- Change to support additional argument in constructor of base node interface 
+implementation
+- Initialization of display width and display height in the mp4 parser node
+- Reset PaddingFrameInfo in MP3 parser after retrieving frame data
+- Handle PVMFErrProcessing condition in case wrong URL is specified in PS or 
+shoutcast
+- New CommonParserPort needs to derive from 
+PvmiCapabilityAndConfigPortFormatImpl
+- Fix for proper handling of MP4 clips with invalid edit list atoms
+- Audio timestamp was not initialized properly for LATM case.
+- Fix for test PEUT 425 by making sure that the state transition in the test 
+code from STATE_UPDATEDATASOURCE to STATE_GETMETADATAVALUESLIST is serialized.
+- Separate clock for rendering MIOs for 2way lipsync
+- This work fixes infinite loop when OMX InitDecoder fails
+- MP4 recognizer has been modified to further check the brand information 
+inside "ftyp" atom and not declare OMA2 DCF files as mp4.
+- If the AVC decoder reports an error in the last frame of a sequence, the 
+OpenMAX component does not flush the decoder's output
+- MP3 http playback reports error for low bitrate connection.
+- Fix for running a test number multiple times in makefile target for running 
+parallel player engine tests
+- Fixed OMX base dec node to handle 0 sample size and updated FMU to retrieve 
+metadata for new file extension
+- MediaOutputNode module unit test failure
+- Add dependency of librt to Android x86 builds
+- Data type inconsistency in code of OMX test app
+- Wrong thumbnails retrieved for Mp4 contents
+- Incorrect time stamps with B frames in H264 high profile
+- Conditionally support -Wno-psabi compiler flag for Android simulator
+- For AVC clips with more number of SPS/PPS than the number of buffers 
+allocated, the node returns error and the clip cannot be played.
+- Specific test mp3 content cannot be played on streaming with HTTP Progressive 
+protocol
+- Inconsistent Keep-Alive timer during RTSP streaming
+- Adding the missing Metadata functionality in the omx audio dec node.
+- Memory leak in 2way proxy adapter
+- Use clock_gettime(MONOTONIC) instead of gettimeofday() on linux platform to 
+have a consistent clock
+- Fix for playback progress not being reported correctly for sessions in which 
+the duration is not known upfront.
+- MP3 duration is not calculated when there is a CPM plugin
+- Seek on Mp3 PS for contents without having any XING or VBRI headers results 
+in No-op
+- Add support of "YUV 420 Semi Planer" in Encoder Node.
+- Completely eliminate logging from omx proxy and omx component unless 
+explicitly enabled
+- Fix for hang in player engine test case 862
+- Issue with seek sample number when repositioning near the beginning of a 
+recorded file.
+- Disable setting OMX_Video_ControlRateMax to OmxComponent
+- Unreleased array causing memory leaks in mp4 parser node
+- MP3 parser does not recover from invalid frame embedded on mp3 stream
+- Disabling outgoing skew indication messages
+- AVC Sample entry not parsed correctly for picture parameter set
+- Fix Assert failure in player engine TC 941
+- Fix memory leak in Android extension media player APIs
+- Add OMX AVC support to 2way
+- Set pre-defined VOL header for PV2Way
+- Logic to detect end of track for Mp4 FF having moof atoms need to modified
+- Fix get_ISO8601_str_time api on certain platforms
+- parseMP4() in mediascanner.cpp couldn't detect unknown type correctly.
+- RTSP streaming start time always start from zero
+- Failure in PlayerEngine Unit testcase
+- EOS Timestamp is invalid from mp3 source node
+- Support for multiple frames in a single data block of AAC ADTS parser
+- Check for NULL ptr access in CPV324m2Way::HandleNodeErrorEvent
+- Fix seek failure when seek to almost end of one mp4 content
+- Protocol engine node download auto resume algorithm simplification
+- Conditionally convert compiler warnings to errors in android folder
+- Fix for possible race condition in FMU's thumbnail retrieval
+- PS/MP3 unable to set start playback time when duration is unknown
+- Fix for out-of-bound array access in m4v config parser function.
+- Fix for thumbnail retrieval when using file handle in Android
+- Remove unnecessary code from android logger config
+- Bug for Size limitation in case of streaming
+- Change ParseM4VFSI to be more lenient to profile/level error and add SPL4a 
+and SPL5 support to m4vencoder.
+- Set/GetDataSinkFormatType
+- Thumbnail loading take much more time in all video content
+- memory access violation occurs -3g2 content containing moof atom
+- OMX Decoder Node Scheduling may be affected due to node refactoring change
+- Close the MetadataDriver semaphore to prevent an assert.
+- Fix an RTSP tunneling url problem
+- Choppy audio after pausing and resuming 2way call
+- EOS message being overwritten by BOS in the mediaoutputnode
+- Do not access iTimestampVec.back() if the vector is empty.
+- 2way's h223LCtest and h223test are failing.
+- Use config parser information to configure OMX AAC component. Still expect to 
+get Port settings changed event in case of implicit AAC+
+- Calling UpdateDataSource before calling AddDataSource() could result in a 
+crash
+- Allow SDKINFO Header to use environment variables if set
+- Fix 2way unit test assertion failure.
+- Fix socket communication scenario for 2way
+- Out of bounds access during CPM Register Content for MP4 and MP3 clips
+- Fix MP3 gapless playback EOC message iFramesToFollowEOC calculation
+- Removed OsclThread::EnableKill, added OsclThread::CanTerminate
+- Delaying the release of a source node until after the engine command completes
+- PVMFInfoStartOfData and PVMFInfoEndOfData events need to be serialized at the 
+mediaoutputnode during clip transition
+- Ensure that PVOMXRegistry calls OsclSharedLibrary LoadLib and Close only once.
+- Fix player engine test cases 48 and 49
+- Datasource being removed prematurely
+- Change some of the time related variables in M4venc and AmrEnc  OMX component 
+from uint32 to OMX_TICKS or int64.
+- Fix for incorrect display dimensions under certain conditions.
+- Add a new testcase for Pause - Skip - Resume
+- Use Wno-psabi flag when building against eclair SDK
+- In OMX decoder node -  In case of an invalid input NAL or empty input 
+message, input OMX buffer needs to be released
+- Music app crashes and gallery application is not present on android-2.1_r1 
+emulator
+- Bug in ColorConvert lib (RGB16 to yuv420 conversion)
+- Memory access violation occurs
+- Player engine changes to add a log line and remove regular decoder node 
+reference
+- Incoming user input messages are not passed to application
+- Check semaphore before closing
+- Timed Text file playback issue
+- Fix pv_config_selected.mk in opencore_value_add for 2way changes.
+- Add stub definitions to fix korg master branch build for newly declared 
+functions
+- MP4 Fileformat Edit List storing offset in wrong timescale.
+- AAC lib - colored noise produced when decoding file with clipped levels
+- ReleaseMetadataValues resulting in a hang when called without GetMetadataKeys
+- Update the thread safe queue to handle events from multiple threads
+- Fix MP4 source node metadata retrieval for playlist
+- Fix PEUT TC 400-455 playlist input file path
+- Make audio MIOs for gapless tests active so that samples are not dropped for 
+being late
+- Fix problem with using external buffers for OMX encoder for 2way.
+- Check if CPM object exists before creating one in MP4 parser node
+- PVME unable to retrieve metadata for DRM protected content
+- Cleanup 2way local.mk
+- OMX audio dec node should process multiple BOS (BOC/EOC) messages correctly 
+in case of LATM format
+- Multiplexed data gets corrupted when is there is no data in logical channel
+- Prevent redundant oscl file cache writeupdate calls when closing file
+- OSCL SetSize() implementation
+- Changed logfile appenders to take boolean flag indicating whether or not 
+(default) to flush after every write. Add 'fsync' to linux oscl file 
+implementation
+- Fix broken build due to pvmedia_io_fileoutput
+- Move implementation of some 2-way methods from header file into C file
+- Player engine not using the source node capconfig interface for all engine 
+capconfig calls
+- Fix for TC 21 on MP3 clips
+- TC 414 (FullPlaylistPauseSkipToNextTrackResumeTest) failing with full logging 
+turned ON
+- Handling for packets received after RTSP PLAY response with timestamps less 
+than the advertised rtpbase
+- Modify the AMR Enc OMX component to take timestamp from the OMX client and 
+remove logic to detect gaps or overlaps.
+- Sometimes cancelall command is not executed on all the data sinks in 
+cancellation process by the engine.
+- AAC lib - Fix for random crash under certain test condition
+- Additional changes in the AAC lib to support redundant PCE
+- Memory leaks when using PVMP4FF_USE_EXTN_UDTA mode in MP4 Composer library
+- If the ERecognizerStart command is canceled, do not queue a ERecognizerClose.
+- Fix issue where an RTSP server returns a start NPT that is non-zero despite 
+the application's request for a zero NPT
+- MP4 parser node fixes for retrieving key-value pairs without a track index in 
+the input string
+- Re-issue commands in 2way engine to be run later.
+- correct rtpinfo was not used while deciding ts
+- OMX Decoder Node Scheduling may be affected due to node refactoring change
+- Duration was not converted to millisec timescale properly
+- Remove unneeded dependency on header files in mediaoutputnode
+- Linux oscl time converts time differrently depending on whether or not zulu 
+is set
+- Add check to prevent engine clock from starting if engine is not in started 
+state
+- Protect oscl file native seek and read operations on the same file handle
+- A flag needs to be initialized correctly for decoder node codec config data 
+not to be affected by inserting a pause command
+- Fix for eAAC clips seek resulting in wrong speed
+- AAC lib - Audio artifacts when decoding clip with continue saturated levels
+- Missing metadata key "writer" in metadatadriver.cpp
+- TARGET_ARCH_VERSION missing from Config.mk
+- AAC-lib  Compiler bug on Android build creates the wrong assembly code
+- Disconnect-Seek mode support for pause/resume
+- Fix for MP3 parser returning incorrect value for bitrate key
+- When outgoing user input message is deleted, VT crashes
+- Fixing media scanner inappropriate removal of media files 
+(https://review.source.android.com/#change,14161)
+- Change to return engine state as prepared (not started) if the engine 
+has moved into auto_pause after prepare state, without being started.
+- Updating out-of-order packets handling logic
+- Added support to handle multiple 'elst' entries in MP4 FF. That improved AV 
+sync while playing the content which has multiple edit list.
+- Remove empty OSCL source files and add comment to empty 2way makefile
+- This record fixed a streaming module unit test problem
+- PVME test crashes while running .mp4 files
+- Oscl file cache read error for large block sizes
+- Update the mp3ffparser node to handle the cancel command in init.
+- Null-terminate the string sent as part of PVMFInfoSourceFormatUpdated event
+- PV_CFLAGS set to wrong value in Config.mk
+- OMX unit test modifications
+- AAC recognizer - fails by qualifying valid extension-less MP3 clip as AAC
+- Fix parsing of certain HTTP URLs.
+- Initialize _currentPlaybackSampleTimestamp to zero in 
+SampleTableAtom::resetTrackByTime()
+- Use threadsafe callback AO in camera input MIO to reschedule the AO
+- Modified PVME to handle the failures from SetSourceInitializationData in 
+SourceNode
+- Check EOS buffer flag if in the middle of partial frame assembly in omx 
+component
+- Fix for AAC silence insertion for the mono case and the AAC+ case
+- Disable filewriter thread in composer node
+- test_adts_x.pcm
+- Peeking samples from an mp4 fragmented files may return wrong information
+- Fixed timestamp conversion for B-frames.
+- Fix live RTSP streaming issue
+- MP4 Source node doesnt resets FirstValidClip's index after Stop/Reset
+- OMX AVCDec output buffer calculation for cropped output could be smaller than 
+required. Hence, the buffer calculation part must be modified.
+- Fix an assert involving iStride and iSliceHeight in omx video decoder node
+- A 64-bit overflow when computing energy levels was incorrectly saturated with 
+a 32-bit max., instead of a 64-bit max in the AAC decoder
+- Fix live RTSP streaming issue
+- Passing the call ReleaseNodeMetadataValues from the source node to the CPM 
+plugin.
+- Add robustness to AAC SBR with silence insertion.
+- Fix BOS and EOS timestamps for MP3
+- Fix player engine playlist unit test 414
+- Change implementation of XML escape() for memory leak analysis
+- Improvements at the Download Manager, PE Node and mp4 parser in order to 
+accomodate new Progressive Streaming protocols.
+- Incorrect duration for AAC ADIF file
+- Call failure when two TCS are received
+- Allow repositioning in mp4 files without stss atoms
+- Update the description of setParametersSync API
+- Fix multiple repositioning usecases with MP3 gapless playlists
+- Audio distortion heard in AMR-NB audio clip
+- AAC multichannel decoder robustness improvement to prevent crash.
+- Export GetRemoteCodecCapability method for 2-way
+- Fix logical error in error handling
+- Corrected intialization of ParserObject and ClipIndex for Metadata parsing in 
+MP3FF.
+- resolve player engine test RELEASE Linux build compilation errors on gcc 4.3
+- Recognizer fails to recognize file but file is larger than minimum needed.
+- Improvements at the Download Manager, Protocol Engine node in order to 
+accomodate new Progressive Streaming protocols
+- Error events from the audio thread are not handled correctly
+- OSCL Unicode to UTF8 modification
+- Fix deadlock in mp3 parser and node for mp3 files that are smaller than the 
+minimum desired for recognition
+- Fix parsing of certain RTSP URLs.
+- VT TC-58 failure
+- OsclMemPoolResizableAllocator does not allocate memory in a circular way, 
+causes fragmentation.
+- Fix out-of-bounds array index issue in 2way-stack.
+- Changed bitmask in oscl_UTF8ToUnicode function so sign extension with 32-bit 
+wchars is handled properly.
+- cleanup of old Keys from MIOs
+- Fixed memory leak on file trackfragmentatom.cpp
+- Corrected SkipMediaTS calculation and FrameDuration for Backward playback
+- Node shall not set async flag for sync command on CPM.
+- Follow-on RIO-7292 to fix PV_CPU_ARCH_VERSION value in Android.mk files.
+- Handle PVMFInfoErrorHandlingComplete info events in the FMU
+- Fixed track fragment atom parsing to allow UUID atom
+- BaseNode shall use the logger tag supplied by node and enable complete node 
+logging.
+- Incorrect handling of INSUFFICIENT_DATA error when parsing mp4 movie fragment 
+clip
+- Fixed bug in player engine error-handling code.
+- Media Output Node sync margins are not being set for video tracks
+
+
+===============================================================================
+2009-12-08  OpenCORE 2.07
+
+New Features
+- Support 3GPP fast content switch
+- Player engine changes and new interfaces for gapless playback
+- Player unit test additions
+- Add KVP mechanism to set max/min UDP port number
+- Support PE node feature selection for static builds
+- SetFSIParam( ) extension interface is implemented. It was previously stubbed 
+out. FSI (VOL header or SPS/PPS) is sent to the encoder as preferred encoding 
+parameters.
+- Introduce ASM and condition support for arm in tool generated project files.
+- GetActualAACConfig - add mime type as input to process properly RFC 3016 type 
+streams
+- Updates to player engine and media output node for gapless playback
+- Implement support for I-frame request in OMX encoder node
+- Add support for AAC Dual Mono
+- Add a new KVP to control audio output in trickplay mode.
+- CPM changes and new player engine unit test cases.
+- Add Track ID as input parameter to the addTrack mp4 composer API
+
+Improvements
+- Added pvlogger_empty_layout.h as an optional logger output string format that 
+appends nothing to the output string.
+- Code cleanup in MP4 decoder vop code 
+- AAC lib - improve ADTS searching capabilities - needed for applications not 
+using aac parser
+- Change to use audio output buffer size calculation to be based on time as in 
+the OMX audio dec node rather than based on a fixed number of samples as in the 
+OMX components default.
+- Handle more non-standard OMX component state transition errors
+- Removal of 2way VideoParser Node
+- Update MediaIONodeRepositionDuringPreparedTest test case to run till EOS
+- Improve FillBufferDoneProcessing and ParseAVCFullFrameIntoNALs in OMX encoder 
+nodes
+- Add support for linking against eclair-specific libraries
+- Adding a new api to turn silence insertion logic on or off (engine->omx 
+decoder node->omx audio component).
+- Introduce -Wno-psabi into android makefiles
+- Modify logging in PVME Test so that it's consistent with the other logging
+- Cleanup in the android folder (logging, whitespace, etc)
+- Changes in android folder to sync-up with eclair changes
+- Removed unused code oscl_mempool_allocator.h/.cpp
+- Include pvlogger library in oscl build
+- Updating run_ae_test make target for logging
+- Minor bug fix to support movie fragments MP4 files with empty sample 
+description tables and common PE Node code refactoring
+
+Bugs Fixed
+- Video and timer gets stuck on repositioning while the audio continues
+- A/V Sync Issue on Simple playback and timer goes beyond the limit with Video 
+playback only (Audio Stops)
+- Fix for redundant rule to copy getactualaacconfig.h
+- MP4 file parser and parser node modified to support a very large value of 
+timescale
+- Improvements in AAC file parser for ADTS recognition
+- Code cleanup in pvmf_node_interface
+- Failures in Java-based mediaframework unit test cases.
+- Fix for failure on resumption from long pauses during RTSP streaming.
+- Remove an extra call of ResetData from ThreadLogoff in AndroidSurfaceOutput
+- Mp4 composer node File writer hang issue
+- Typo in the OMX node log statements
+- Uninitialized variable iPlayElementIndex of structure PVPPlaybackPosition 
+causing repositioning problems
+- In AAC and AMR parser nodes, UsageComplete should be called only when the 
+content is protected
+- MP4 parser node returning the same command twice
+- Hang in Player engine when cancel called in prepare
+- Use clock_gettime(MONOTONIC) instead of gettimeofday() on linux platform to 
+have a consistent clock
+- In PVPlayerEngine::DoVerifyAndSetPlayerParameter, hard-coded enum value is 
+wrong
+- OMX encoder node bug in processing SPS PPS for components that produce NAL 
+start codes
+- Classes with virtual methods should have virtual destructors too
+- Fix for crash in AAC Decoder unit test app
+- Map key 'track-info/track-number' to 'tracknumber' for Android MediaScanner 
+to recognize the key.
+- MP3 FF parser should not pass the Xing/LAME header frame to dec node
+- AMR file parser improvements
+- Removed parsing support for WMF AMR tracks from MP4 file parser.
+- Improvements in OMX test application
+- Fix crash in 2way stack unit test
+- Change in oscl statfs to accomodate blank paths
+- Add Error handling at buffer memory allocation error
+- Fix rebuffering after PVMFInfoBufferingComplete at mp4 PPB
+- AVC configuration modifications
+- Using sample duration in addition to timestamp for syncronization
+- FMU video MIO does not set video subformat type correctly
+- Fix uninitialized memory in 2way engine unit tests
+- Updated PVPlayerEngine::ReleaseMetadataValues to properly handle clip index 
+argument
+- Fix for running a test number multiple times in makefile target for running
+parallel player engine tests
+- OMX Encoder node returns failure if OMX components returns Failure for 
+"OMX_IndexConfigCommonRotate" parameter
+- Remove tests not applicable for OpenCORE
+- MediaScanner has some API calls which are missing the interface
+- Cap lower bound player engine watchdog timer duration to default value
+- Enable File-writer for Mp4 composer node
+- Early and Late Sync Margins changed for better AV Sync
+
+
+===============================================================================
+2009-11-08  OpenCORE 2.06
+
+New Features
+- Add support for the PLS playlist file format for use with Shoutcast
+- Adding code to benchmark encoding/decoding operation in the OMX component
+- Add support for junit-like XML log output to test framework
+- AAC utility getaacaudioinfo - add support for adts clips parsing
+- Add support in playerdriver for RTSP streaming based on an input SDP file.
+- Player engine unit test needs to support a list of test case ranges
+- Add support for authoring btrt atom in mp4 composer to record bitrate 
+information.
+- Unit test logger option unification
+- Add SetDuration capability and new command status code in the base node
+- Add build macro for turning compiler warnings into errors in Android.mk files
+- New color conversion library suite for YUV420 to YUV422 conversion; supports 
+basic conversion as well as 90 and 270 degree rotation
+- Add communication between OMXEncNode and Composer node for MaxBitRate and 
+DecodingBufferDB
+- Support PVMF_MIME_H264_RAW where decoder config info is not always available 
+before the actual decoding start
+- Support for YUV422 to OMX encoder components (M4V and AVC)
+- Enable track selection helper to choose the OMX component used for each track
+- Changes in PlayerEngine, FMU, and source nodes to allow retrieval of 
+thumbnails for protected content 
+- Gapless audio support at the file format and source node level
+
+Improvements
+- Change the default behavior of the local makefiles to flag compiler warnings
+as errors and provide a new flag to disable it
+- AMR-NB modifications from AOSP
+https://review.source.android.com/10904
+https://review.source.android.com/10905
+https://review.source.android.com/10906
+- Eliminate memcopies of output buffers in omx components (where possible)
+- Move helper functions ( MoveCmdToCurrentQueue and MoveCmdToCancelQueue ) to 
+base node
+- Add logic to the OMX encoder to choose another component if one fails
+- Update the logic in the encoder node when choosing an OMX encoder
+- Track selection metadata ("track-info/selected") needs to be added in AAC/AMR
+ and MP3 nodes
+- Code size reduction
+- Ignore pause and seek for live streaming
+- New player engine test content
+- Add API to 2Way engine to support selection of codecs and their preference 
+order
+- Port OMXBaseNode, OMXVideoNode and OMXAudioNode to new Node Interface
+- Build system support for ARM_GCC_V4 from AOSP
+https://review.source.android.com/9668
+- Add ID3V2 metadata support in mp4 parser libary defined by 3GPP Rel 7. Move 
+all metadata related operations from MP4 PN to library
+- Variable _mp4ErrorCode to UNSUPPORTED_FILE_TYPE for any brand type in 
+mpeg4file.cpp should not be set
+- Encoder nodes should be added only for uncompressed MIO in 2way engine
+- PV OMX component returns invalid supported profile/level pair
+- Removing memory leaks in MDBS
+- Create Generic 2Way Pause/Resume unit test
+- Add insert_element() and clear() methods to OSCL linked list 
+- Update Player developers guide for CancelCommand and CancelAllCommands error 
+return values
+- Remove a check in sliding_window_process to make avc decoder tolerate an 
+error condition and continue decoding 
+- Remove YUV buffer alignment calculations from the OMX decoder node. This is 
+currently done in the OMX components
+- Add the ability to report info and error events from the author MIOs 
+- Modifying current command queue and cancel command queue to a single command 
+in the base node
+- Refactor RTSP client engine node for cleaner interfacing with streaming 
+manager node
+- Adding support for configuring the number of output buffers as a part of 
+dynamic port reconfiguration in omx test app
+- Refactor MP3FFParserNode to use the base node implementation
+- Refactor DownloadManager Node to use the base node implementation
+- Refactor MP4 FF Parser Node to use the base node implementation
+- Add CallNativeSetSize() API for OSCL File 
+- Change H.263 encoding default GOB header interval to 0 
+
+Bugs Fixed
+- Track IDs are huge in particular mp4 clip causing crash
+- Source node's handling of CPM cmds in Reset is incorrect
+- [PDL] Download resume doesn't work if server response doesn't include the 
+Content-Length header.
+- Android_camera_input.cpp method statusUpdate returns unhandled exception
+- Hardcoded values in mp4a atom in the composer. (2030968)
+- Download manager node uses shoutcast support by default
+- atom 'meta' is not skipped 
+- Video playback is distorted (not normal) during playback for somes clips
+- Need the ability to disable CPM in source nodes
+- Crash in OsclTimer 
+- Nodes getting schedule extra number of times
+- Update Android MIO to use authoring clock to achieve better AV sync in 
+encoding 
+- Implementation of trick play support
+- Modify player engine's QueryInterface implementation
+- Not able to play InValidId3Tags.mp3 content
+- Fixes for building OpenCORE on android-x86
+- Streaming Manager node modification to make feature specific plugins 
+dynamically loadable
+- Memory leak in video telephony engine
+- OsclMemPoolResizableAllocator has been modified to take into account the 
+size specified via setMaxSzForNewMemPoolBuffer while expanding the mempool
+- OMX AMR component fixed to support 3 Role strings properly
+- Crash in video telephony engine
+- PVAuthor Developer's Guide has been updated to clarify 3GP vs MP4 file 
+authoring
+- RTSP amr-nb streaming can not start playback, need to seek then playback 
+start
+- Fix the issues in Table of Contents implementation in Mp3 Parser
+- Hang in one accepted/negotiated format 2way engine unit test
+- Fix a problem where a node based on the base node implementation was not 
+getting resheduled to process the next command when multiple commands 
+(RequestPort in this case) were queued. 
+- PVMFRecognizer improvements, including multi-pass recognition etc.
+- Send correct YUV format to the VMIO instead of PVMF_MIME_FORMAT_UNKNOWN
+- By default, use current system time as creation & modification date in MP4 
+composer node
+- Audio issue in RTSP streaming caused by AMR decoder problem.
+- Fix an issue where PVPlayerEngine::Prepare() never completes. If server 
+sends OPTIONS request to the PVPlayer, PVPlayer does not send SETUP request 
+to the server and PVPlayerEngine::Prepare() never completes
+- Fix for reading from files using a file descriptor with an non-zero offset
+- Fix potential crash during streaming session with multiple frames per packet 
+- Minor refactoring of integer datatype use
+- Fix issue where an incorrect VOL header for MPEG4 video content results in 
+no video playback
+- Add an extra condition for the multi-line check in an HTTP response header
+- Move inlined code from header to cpp file for pvmf_event_handling 
+- Update the omx decoder node to reject a component if 
+iOMXComponentUsesFullAVCFrames is false
+- Crash in video telephony engine cleanup
+- Report a more appropriate failure status via the author engine when 
+underlying node commands fails
+- Fix the fileoutput MIO to take into account the 422 UYVY format
+- Fix for opening shared asset file handles multiple times
+- Fileformat parser changes to support some specific mp4 content
+- Limit the max size of album art to 3MB
+- Changes in sending the Buffering Status
+- Adding support for authoring moof clips for live sessions in mp4 composer 
+library
+- PVPlayer crashes when trying to do Progressive Streaming of a specific 
+MP4 Clip
+- Incorrect mime string comparision in pv2way datapath
+- Fix for memory leak in mp4 local playback at GetMetaDataValue
+- Implement HandleExtensionAPICommands for OMXDecNode
+- Change OMX enc node Reset() to return success even OMX comp GetState() 
+fails or returns bad states
+- Treat OMX_EventError with OMX_ErrorInvalidState as if OMX client get an 
+OMX_EventCmdComplete indicating state transition failure
+- Add CTOR in RepositionRequestStruct to init the members 
+- Fix for testcase 805 with local content
+- Logging in PVME Test not working properly for threaded mode
+- Thumbnail extraction when no sample present in stss atom
+- MP3 frames may have different sampling rate or number of channels. So, 
+in the omx mp3 component, logic has been added to ensure that only decoding of 
+consistent frames is sent as output and silence will replace mismatched frames
+- Content truncated while seeking specific YouTube clip
+- Player Engine should not fail playback if the Source node does not support 
+Playback control interface
+- Cleanup test input and output filenames used in 2way tests
+- Error in video display while playing minimum size content (48*48)
+- Valgrind error fixes
+- Fix a bug in SPS length calculation
+- PVME doesn't retrieve metadata properly if file has an invalid extension
+- Wrong sequence numbers from video parser node
+- Using RTCP SR reports to perform AV sync once, if server does not provide 
+rtp-info in PLAY response. 
+- Mp3 parsernode should pass source context to CPM plugins 
+
+
+===============================================================================
+2009-08-06  OpenCORE 2.05
+
+New Features
+- Helper function to retrieve extended messages from command responses.
+- Support for eAAC+ encode in the pvAuthor engine.
+- Add conversion operations to OSCL_String classes.
+- RTSPT support (3GPP streaming over TCP). To test, replace "rtsp" with "rtspt"
+in the control URL (in source URL or SDP file). It is assumed that the user has
+access to a server with TCP streaming capability.
+- PV Metadata Engine (ME). This engine is targeted at applications that want
+to retrieve metadata for any given clip in a generic manner. Typically, a lot
+of these applications would like to scan large batches of content. Since ME 
+is mainly targeted at apps like mediascanner, where speed is the most important
+factor, thumbnail extraction is not supported. For applications that do want 
+to extract thumbnails in a generic manner along with the metadata, PV's 
+FrameAndMetadata Utility (FMU) is recommended instead.
+- 2way Lip-Sync unit test cases.
+
+Improvements
+- A new base node implementation is introduced for the purpose of 
+  refactoring and consolidating common logic in the nodes. The changes
+  will improve maintainability and make it easier to create new nodes.
+  Further documentation will be released in the future providing guidelines
+  for authoring nodes.
+- The following existing nodes were refactored to utilize the base node 
+  implementation mentioned above: AAC, AMR, and WAV parser nodes.
+- Replace CodecSpecifier with PVMFFormatType.
+- Move EventHandlerProcessing method to PVMFOMXBaseDecNode class.
+- Change method type from "protected" to "private" in OMX derived classes
+(videodec node and audiodec node).
+- Adding robustness to avcdecoder to verify PPS and SPS parameters.
+- Display status of every test case after it finishes in 2way unit test app.
+- Add support to H.245 version 10.
+- OMX node - Implement interleaved NAL sizes (to replace NAL start codes) in 
+omx buffers carrying AVC frames.
+- AMR-WB contributions to enable building in "C":
+https://review.source.android.com/10014 
+https://review.source.android.com/10015
+https://review.source.android.com/10016 
+https://review.source.android.com/10017 
+https://review.source.android.com/10018 
+- AMR-NB contributions to enable building in "C":
+https://review.source.android.com/10297 
+https://review.source.android.com/10301 
+https://review.source.android.com/10302 
+https://review.source.android.com/10303 
+- Update OsclFileStats to track total time taken instead of only the 
+maximum time per operation.
+- Rename OMX master core methods to avoid linking conflicts.
+- Pass key MOUT_VIDEO_SUBFORMAT_KEY to the video MIO of FMU.
+- Remove Direct Render Mode from mp4 composer library. 
+- AMR-NB and AMR-WB inline assembly is being re-enabled after a bug
+in the QEMU assembly translation has been fixed.
+- Modification of MIOs to take all configuration parameters at once.
+- Move OMX input and output buffer ctrl structure away from data buffers.
+- Enable byte-stream (H264-RAW) format decoding in OMX dec node.
+- PVMFInfoTrackDisable information event should be report to java application.
+- Retrieve the PLATFORM version at run time for the Android UserAgent string.
+- OMX audio and video dec nodes need to be able to handle PortSettingsChanged
+event with argument OMX_ALL.
+- PVMFMediaClock latency handling improvement.
+- AAC decoder creates artifacts when decoding clip.
+- Modify MP4 composer node to do sample adds to mp4 composer lib in a separate
+thread.
+- Add support for VIDEO_ENCODER_H264 in authordriver.
+- Author major brand "3gp5" if 3gp clip has TIMED-TEXT track.
+- No interleaving of mp4 files for just one track.
+https://review.source.android.com/10510 
+- Return non-zero code when we detect a memory leak during unit tests.
+- Add "3g2a", "3g2b" and "3g2c" as compatible branch in all content authored
+by PvAuthor SDK.
+- Add support for OMX_COLOR_FormatYCbYCr.
+- Remove unneeded libraries being linked against individual shared libraries.
+- Exclude empty directories and unncessary build files from OpenCORE.
+- In OMX base node, turn the InputBufCtrlStruct from a struct into a class
+- Updates to pvmf_return_codes.pdf, pvplayer_developers_guide.pdf,
+omx_decoder_test_app_guide.pdf, and omx_encoder_test_app_guide.pdf.
+
+Bugs Fixed
+- Repositioning takes a long time for YouTube videos after a few
+repositions.
+- Crash in CPVH223Multiplex::Stop().
+- PlayerEngine cannot finish a playback session after repeated pause
+and resume near EndOfStream.
+- Allow file path to be passed to the pvPlayer SDK on Android.
+- Add a new constructor for the AVCSampleEntry to be used when parsing the 
+encv atom
+https://review.source.android.com/9683
+- MP3 DurationCalcAO logic needs to moved to a place during Prepare and not 
+Init.
+- Change PV_GET_ROW definition in M4V decoder. 
+- Player Engine unit test TC 55 and 56 has memory leaks
+- Crash in authordriver if InitializeForThread fails.
+- Crash in playerdriver if InitializeForThread fails.
+- Potential memory leak in OMX encoder node.
+- Memory leaks in AAC file parser node & lib
+- FindFirst returns wrong element type when find a directory in android
+- Intermittent timeouts on 2way unit tests
+- Incorrect DeBlocking logic
+- AVC Clip Specific Issue: (Play till EOS) OR (Reposition to near EOS) The 
+video gets stuck at near EOS 
+- iTunes genre is not parsed correctly
+- Youtube : AV sync is lost after a seek when playing youtube contents
+- Crash after recording one minute of Video when duration is specified
+- Tracknumber metadata key string should be consistent through out all nodes
+- Possible race condition in singleton lock in omx_init 
+- CPV2WayDatapath::GetPortFormatType() selects least preferred type 
+- AAC OMX decoder component needs to process whole audio config buffer
+- Modify MP3Parser to make seek to 0 a special case and do not use XING header
+for calculating file offset
+- AAC Decoder should not try decode any AAC+ clip whose final sampling freq 
+is > 48 KHz. Should default to AAC in these cases.
+- Update OMX encoder node to calculate the correct output buffer size in case
+the encoder has multiple roles.
+- OMX Encoder MPEG4 unit test fix
+- Setting AMR_NB bitrate to GSM_AMR_4_75 will fail prepare. 
+- AuthorEngine should return Success incase Stop is called in
+PVAE_STATE_INITIALIZED state.
+- OMX M4V encoding drops the first I-frame
+- VIDEO_INTERLEAVE_BUFFER_SIZE is too short for some buffers when encoding 
+D1 resolutions 
+- Occasional audio glitch in MP3 parser during repositioning
+- OMX tests for AMR give seg fault on android
+- pvPlayer sends incorrect HTTP Range header
+http://code.google.com/p/android/issues/detail?id=3031
+- PDL/PS - Fix the Mp4 Parser node to pass the correct timestamp to PE node 
+in RequestResumeNotification during Underflow condition 
+- H.245 TerminalCapabilitySet (TCS) and MasterSlaveDetermination (MSD) 
+requests must be sent before any other H.245 messages. 
+- Logic to set iKeepDroppingMsgsUntilMarkerBit to false in AMR RTSP streaming 
+- 2way tests hanging when run in Android emulator
+- Sound Recorder: Incorrect Duration of clip sometimes observed when sdcard is
+full
+- Memory leak in PV2WayMIO
+- Playerengine needs to be updated to return success even if there are no keys
+for GetMetadataValue
+- Correct the Android RTSP UserAgent string
+- Author Engine : Don't access the queue element without checking its queue
+size
+- If SSRC is not provided in setup response, then pvplayer cleint doesn't send
+firewall packets to the server
+- GetMetadataValues returns invalid number of entries
+- Modify AUT to parse authored files and validate the files as much as possible
+- Eliminate media layer node in case of RTSP streaming
+- AAC timestamps provided to OMX component may be wrong
+- Clean up warnings and some negotiate parameter changes from omx dec & enc
+test apps
+- Fix valgrind issue reported with android simulator in omx base node
+- Add more supported rate control types in pv_video_encnode_extension.h
+- Memory leak in player engine test case 807
+- Addressed compiler warnings in PVME
+- nBufferAlignment of OMX_PARAM_PORTDEFINITIONTYPE is initialized to negative
+value when playing clip on android using qcom decoders
+- MP3 parser crash
+- pvplayer_engine_test is detecting 'rtspt_test.sdp' as a url instead a local
+file
+- Count of command line arguments being read in PVME Test App is incorrect
+- Player engine test case 1307 fails when run with a mp4 file containing 3GPP 
+timed text track 
+- PVMFInfoDataReady event being sent to the engine after the unit test calls
+stop
+- PlayerEngine doesn't free reference to PVMFDataSourceNodeRegistryInitInterface
+- Combine the AMR if statement in pv_omxmastercore.cpp
+- Player Engine unit test case 154 fails on execution 
+- Author Engine unit test cases 101-105 fail
+- Add new return code PVMFErrContentInvalidForProgressivePlayback for a
+NOT_PROGRESSIVE_STREAMABLE content 
+- Add USE (AL2, AL3) to 2way test files
+- H223 2way test not being run 
+- Avoid calling CCYUV422toYUV420::New() for each thumbnail
+- Author engine unit test case 101 fails
+- Ignore encoding flaw, which generates aspec_ratio of value 0 in file
+codecs_v2\video\m4v_h263\dec\src
+- Memory leaks in pvmf_mio_fileinput.cpp and performance improvement in mp4
+composer node
+- Do not cancel Init() immediately in case of 3gpp streaming 
+- Transferring MP3 with invalid ID2 tags crashes mediaScanner
+
+
+===============================================================================
+2009-05-17  OpenCORE 2.04
+
+New Features
+- Create external download datastream An external download datastream is
+introduced to allow for an external entity to pass a datastream interface 
+to the player SDK.  The external entity is responsible for doing the actual 
+download of the media data.  Full support in Android is not complete until 
+playerdriver changes and more unit testing is done.
+- Fixed cache option in Oscl_File
+Adding an option to configure the Oscl file cache to use one or more fixed
+caches in addition to the movable cache.
+- Modify author engine to contain a notion of "authoring clock"
+Author engine has the option to pass an "authoring clock" to media input
+components so that they can use this to sync audio and video timestamps.  
+Author engine has been modified to own a PVMFMediaClock.  Author engine 
+provides a pointer to its to data source node (media input node typically) 
+at the end of author engine Init cycle, using PVMF_AUTHORING_CLOCK_KEY.  
+No media input component changes were done. All media input components 
+used in author engine unit test currently operate from a file and have no
+need for such a clock, but some device media input components can make use 
+of the clock if needed in the future, since author engine will pass the 
+clock pointer all the time to data sources.
+- Shoutcast (of MP3) support
+Shoutcast support of MP3 and internet radio streaming is added.
+- Enable AAC PDL Support 
+More robust support of PDL of AAC content, including underflow handling.
+- Add support for 3GPP2 speech (EVRC, QCELP etc) in MP4 FF library
+Support for the 3GPP2 speech codecs is added at the file format library
+level.  No 3GPP2 speech codecs are added.
+- OpenMAX encoder and decoder unit test suite
+- Use external filehandle in Android
+- Introduce new macro to android makefiles to enable 2way
+
+Improvements
+- Add support for "all" metadata key in CPM plugins.  This feature provides 
+  a single key to request that all available metadata be returned.
+- Add support for OMX_ColorFormatCbYCrY 
+- OMX video dec node now sets the codec parameters (width/height etc.) in the 
+  output port of the omx component.
+- A loadable module for the OMA1 passthru CPM plugin now exists.  It serves 
+  as an example for creating a loadable CPM plugin.
+- Compressed testcases have been added in Authior Engine unit tests to 
+  author 3gp file from AVC and M4V and AAC bitstreams
+- Added checks to verify that the PCM output of the mp3 frame will not exceed
+  the output buffer size, so the mp3 decoder / OMX component is nore robust.
+- Removed unnecessary "ComponentGetRolesOfComponent" methods from OMX 
+  components.
+- Restored "/x-pvmf/ff-mux/mp4" MIME Type in Author engine. 
+- Modified the Initial AVC buffers so that the image that appears initially 
+  is black (not green/pink) if I-frame is missing. 
+- Fixed the IFrameInterval setting in the OpenMAX video encoder node. 
+- Added the ability to pass a peer PvmiCapabilityAndConfig interface to 
+  the Media I/O (MIO) components using the Capability Exchange.  The purpose 
+  is to allow the MIO components to set and get parameters (i.e., drive the 
+  process) rather than on relying on the media output node to do it.
+- Added checks to the OMX components to verify that the buffer size 
+  (in allocate/use buffer) (nAllocLen) is adequate (i.e. >= than nBufferSize)
+- Updated OMX components so that standard component roles can be queried as 
+  well as set.
+- AMR-NB common library modified to mark the proper symbol exports and moved
+  some functions to encoder and decoder libraries instead of common. 
+- Updated h264 decoder to take advantage of the fact that there will be no 
+  in-band SPS/PPS NALs for the mime Video dec node prevents in-band SPS/PPS 
+  for the format PVMF_MIME_H264_VIDEO_MP4
+- Add macro for enabling build of pv test engine executables in Android 
+- Remove 12-bit, 24-bit, and 32-bit routines from Android libraries 
+- Modified OMX timestamps to be in in microseconds rather than milliseconds
+  as specified in the OMX spec 1.1.2.
+- Improvements and workarounds for non-compliant OMX components
+- Replace OPEN_FILE_ONCE_PER_TRACK macro with member variable 
+aOpenFileOncePerTrack in mp4ffparser lib
+- 2way: send data fragment by fragment from parser side
+- Added a new function to convert PVMFStatus to human friendly strings
+- Implement logic to choose correct OMX component when decoding streaming 
+H264
+- OMX dec nodes should report error and not even call config parser if 
+config data is missing (but is required by the format)
+- Update playerdriver.cpp to send "disable-firewall-packets" KVP key based 
+on system Android property
+
+Bugs Fixed
+- Moov atom is not being written into .3gp file if Author driver does not 
+  close file handle.
+- omx mp4 component in no-marker-bit mode crashes when playing a certain clip
+- Error handling incase of input other then 8K AMR 
+- Add PVReleaseInterface method to OMX shared library interfaces 
+  (components + main)
+- pull sdcard while recording causes media server to crash 
+- Changes to buffering status notifications while streaming 
+- OMX nodes should not send repositioning request to OMX component until 
+  config data has been processed by OMX components 
+- Crash in the author SDK as part of engine Reset 
+- If SSRC is not provided in setup response, then pvplayer client doesn't 
+  send firewall packets to the server 
+- PVAuthorEngineNodeUtility::NodeCommandCompleted does not check whether 
+  iCmdQueue is empty 
+- AMR Local Playback -> FF to EOS when repeat song is on will cause a force 
+  crash 
+- some source nodes will put same timestamp for DataTS in old stream id 
+  and DiscardTS
+- Change pv omx encoder node to default iOMXComponentNeedsNALStartCodes to 
+  false and do sanity check
+- When reconfig happen,SinkNode should send reconfig notification with 
+  FormatSpecificInfo to MIO 
+- Race condition - If port settings event and node stop command arrive 
+  simultaneously - omx component may fail port flush command 
+- Mp3FFParserNode: Memory leak in Duration Calculator 
+- Playback clock starts even before PlayerEngine Start( ) is issued 
+- Clip plays beyond EOS.  Fixed setting of the actual normal play time (NPT)
+  when repositioning. 
+- Modified OSCL and player driver handling of external file handles in the 
+  player.
+- MP3 PS - Repositioning is not working properly 
+- MP3 Parser needs to validate consecutive mp3 headers before parsing starts
+- Crash in MIO component due to setPeer(NULL) is not called 
+- Improvements and robustness in thumbnail generation from normal and 
+  corrupted clips
+- Improvements in stability of Author Engine Unit tests when using OMX 
+  encoder node
+- Modify OSCL Mempool to assert when a buffer is deallocated back to 
+  mempool twice in a row 
+- Fix a possible race condition in omx proxy threads. 
+- H263 decoder (OMX version) needs to remove the DEFAULT width-height 
+  initialization 
+- Oscl file cache assert when reading binary file in text mode 
+- AAC and MP3 decoders have ARMv4 incorrect defines on normalization routines.
+  (see https://review.source.android.com/Gerrit#change,9668)
+- AMR component roles do not distinguish between AMR_NB and AMR_WB 
+- OSCL shared library avoid dlopen() leaking in case of failure(dlsym() fails)
+- Mp3 Clip hangs for some time when repositioned near to the end
+- PV_atof will return a value that is larger than it should be if the input 
+string has a CR at the end
+- Sequence number rollover in RTP info param during prolonged RTSP streaming
+
+
+===============================================================================
+2009-03-31  OpenCORE 2.03
+
+Improvements
+- Enable OpenCORE on master - part 2
+
+===============================================================================
+2009-03-10  OpenCORE 2.02
+
+********
+   There is minor version number nomenclature change where the 
+   minor version is now two digits.  So the previous releases 
+   in the new nomenclature are 2.00 (2.0) and 2.01 (2.1).  The 
+   new release is 2.02, which is a minor version increment beyond
+   the previous release.
+********
+
+New Features
+- AMR-WB support added to the OMX encoder node so that it can utilize 
+  an OMX AMR-WB encoder component if it is part of the OMX core. 
+- Buffer allocator mechanism allowing the Media I/O components to 
+  supply buffers to the OMX decoders.  This method is especially useful
+  as an alternative way to allocate video buffers.  Details can be 
+  found in the new document "Guide to Supplying Decoder Buffers from 
+  the MIO Component" in the file mio_decoder_buffer_allocation_guide.pdf
+  in the top-level doc directory.
+
+Improvements
+- Resolution of Valgrind and static analysis warnings in player and author
+- Improvements in support for .mov files in MP4 FF Parser(relaxed some checks).
+- Modified OMX encoder node to allow setting the AMR bitrate 
+  based on an extension interface value.
+- Fix inconsistencies in OSCL find method related to inclusion of the 
+  directory name with the filename.
+- Improvement in PVMFInfoErrorHandlingComplete in the player datapath
+- Refactor of the Protocol Engine node to support a plugin architecture.  
+  This improves extensibility of the module for new features in the future.
+- Introduce QueryInterfaceSync in PVMFNodeInterface and "all" metadata key
+- AMR NB and WB have conflicting meaning for frame_type and mode elements
+- Change the default settings related to caching for Oscl_File when 
+  using PVFile within the fileformat parsers.
+- Replace test.mp4 with interop clip
+- Update of tests for support for progressive download of AMR
+- OMX Khronos header files (Omx_Core.h, Omx_Component.h) capitalization 
+  changed to match that from the Khronos (previously they were all lowercase).
+
+Bugs Fixed
+- Memory leak when running GCF TC212 (2way-related)
+- MediaClockConverter divided by zero caused by timescale 0
+- MP4 composer node destructor memory corruption fixed.
+- Fix for intermittent crash in player engine TC 105
+- OMX dec node did not reset all the internal state during 
+  Reset processing.  
+
+
+===============================================================================
+2009-02-26  OpenCORE 2.1 (2.01)
+
+New Features
+* OpenMAX Codec-related:
+  - Introduced the OMXConfigParser API to help in determining
+    which OpenMAX components can support the input bitstream.
+    It is used to narrow the list of candidate OpenMAX components
+    to be used for playback.  See the OpenMAX Core Integration Guide
+    document in the doc directory for more information.
+  - Added OMX AAC encoder support in the OMX encoder.
+  - Modified to use separate component roles for AMR-NB and AMR-WB as
+    described in the OpenMAX IL spec version 1.1.2.
+  - Added support for a new buffer format for H.264/AVC decode and
+    encode to allow passing multiple NALs in a single buffer.  
+    The format uses OMX_OTHER_EXTRADATA structure defined in 
+    section 4.2.33 of the OpenMAX IL spec version 1.1.2 to pass 
+    NAL lengths.  See the OpenMAX Core Integration Guide document 
+    in the doc directory for more information.
+* Author-related:
+  - Added support for authoring files with AAC audio.
+  - Added support for authoring AMR-WB audio to MP4/3GP files and
+    IETF storage format.
+  - Added support for writing to an open file descriptor as an option
+    instead of simply providing a filename.  The file descriptor
+    option is useful for cases where another process needs to open 
+    the file because of permissions.
+* Added large file support in OSCL (i.e., 64-bit file size/offset
+    support) to handle files greater than 2 GiB on filesystems that 
+  support it.
+* Added rotation support in the 32-bit color-conversion class.
+
+Improvements
+* Removed dynamically loaded modules from the prelink map to avoid
+  clutter and to make both the prelink map and loadable modules 
+  easier to manage.  There may be an issue if a single instance of 
+  a process tries to load libraries not in the prelink map more than 
+  256 times
+  (See http://code.google.com/p/android/issues/detail?id=2042).
+* Update to the MP3 Decoder to fix security issue (oCERT_2009-002,
+  CVE-2009-0475)
+* Renamed the OSCL config directory linux_nj to android to match the
+  platform name.  Replaced all references of nj with android in the 
+  codebase.
+* General security improvements found from static analysis in the
+  following areas:
+  - Buffer and type overruns and underruns
+  - Null pointer references
+* Refactored the jitter buffer node into a more modular architecture
+  for better support of different streaming use-cases and protocols.
+* Fixed an issue in the MP3 decoder when decoding for very of long
+  durations (over 2 GiB of data).
+* General improvements found during 3GPP packet-switched streaming
+  interoperability testing.
+* General improvements and resolution of issues found from module
+  level and engine (player, author, 2-way) level unit testing.
+
+New APIs / Behaviors
+* Added support in the player engine to cancel a single pending
+  command using the CancelCommand API.  See the player engine API 
+  document for details.
+* Renumbered the author test cases to avoid issues with
+  preprocessor conditionals changing the test numbers based on 
+  settings.  Now the test numbers shouldn't change.
+* In the case of 3rd party OMX components that support multiple roles,
+  returns an error if the component cannot set the role parameter
+* OMX components need to explicitly set nPortIndex parameter for
+  all appropriate parameters
+* Added fix for buffering percentage notification in streaming
+  scenario (see https://review.source.android.com/Gerrit#change,8699)
+* Updated omx shared library build configuration to separate component
+  registration from component build
+* Added methods in baselibs to serialize and deserialize the UTF-16,
+  UTF-16LE, UTF-16BE strings
+* Removed the iUseCPMPluginRegistry flag from the source data that was
+  previously used to enable the content policy manager.  
+  Since the CPM pluginsare dynamically loaded, the flag is not 
+  needed and was removed.  See the playerdriver.cpp for details
+  of the change. 
+
+
+===============================================================================
+2009-01-26  OpenCORE 2.0 (2.00)
+
+New Features
+- Consolidation of the clock logic into a common clock object
+  (PVMFMediaClock).  More details will be provided in a 
+  Tech note at a later time.
+- Refactor MP4 Composer library
+- omx component refactoring (Introducing base omx component class)
+- OMX Encoder Support
+- Check URIs for illegal characters and run escaping algorithm if any
+  are found.
+- Support for 3GPP AssetInfo Metadata in Author SDK
+- MP3 Dynamic TOC Construction
+- Modify MPEG4/H.263 node/library to support arbitrary Decoder
+  Configuration Information (DCI)
+- backward playback support for MP4
+- Refactoring Colorconversion from mpeg4 encoder and adding support
+  for YUV420SemiPlanar
+- Refactor streaming manager node into feature specifc plugins
+- Thread Safe Player Engine APIs and Thread Safe queue
+- Adding capability to turn off AC prediction and change
+  IntraDCVlcThreshold for MPEG4 encoder library
+- Dynamically populate recognizer registry
+- add 2way support for OpenCORE
+- Combine OMX audio dec node and Video Dec node
+- OMX MasterCore
+- Apply new RGB to YUV color conversion libraries to OMX encoder
+  components
+- Use loadable modules in CPM
+- Adding support for YUV420Semiplanar to avc encoder, m4v encoder and
+  author
+- introduce dynamic loading of individual omx components
+
+Improvements
+- Removal of all compiler warnings reported by Android compiler
+  Exception: unit test app code
+- Module-level unit test fixes
+- Various Valgrind errors and fixes
+- Various Codesonar warnings and fixes
+- various security audit and fixes
+- various memory leak fixes
+- various crash, hang fixes for specific test content or test cases
+- Re-work Oscl Scheduler semaphore & lock
+- Author Engine Error Handling Robustness
+- Player Engine Error Handling Robustness
+- Add capability of assembling partial frames and inserting NAL start
+  codes to OMX node
+- The media I/O component configuration process needs to be improved.
+- Fundamental change in behavior of repositioning during 3GPP
+  streaming
+- Improvements to the PV FrameMetadataUtility [FMU]
+- mp3 parser - duration calculation by walking file in background
+- IOT merges from 2-way team
+- Longevity issues with live streaming
+- Local Playback MP3 file does not display attached art work
+- Issues with Oscl Leave, Panic, and Assert
+- Modify allocators to not leave in case of an alloc failure, but
+  instead have them return OsclErrNoMemory
+- Conversion of strcmp and strstr usage to strncmp for non null
+  terminated Strings
+- Change Oscl memory auditing from TLS-based to Singleton-based
+- Buffer status report in a periodical manner to improve the app
+  awareness about how engine is running in low bandwidth for PDL/PS
+- AVC Encoder Improved Rate Control
+- State Transition: Remove implicit ThreadLogoff() from Nodes
+- Include aac recognizer for Android
+- Audit MP4 parser against new iTunes spec
+- Replace PVMFSMSharedBufferAllocWithReSize allocator with
+  OsclMemPoolResizableAllocator
+- Player Engine registry re-work
+
+New KVPs / APIs / API behaviors
+- Change Download Manager Stop Command to Stop Download
+- Add a KVP to configure jitter buffer inactivity run time from the
+  app
+- OSCL Critical Error Handling
+- Adding kvp in SM node to set rtsp_timeout timer in rtsp engine node
+- Get rid of "getTrackOTIType" API in parser lib and switch mp4 parser
+  node to use "getTrackMIMEType".
+- Adding capability to turn off AC prediction and change
+  IntraDCVlcThreshold for MPEG4 encoder library
+- Deprecate PVMFCPMPluginLocalSyncAccessInterface
+- Introduce new API in Engine to Release MetaData Values
+- Use of PVMF format types in player registries
+- Introduce new kvp key to set jitter buffer size
+- Add a new meta data key to Mp3ParserNode to support channel mode
+  retrieval
+- Support for taking in video bitrate and other params from a config
+  file, for uncompressed AVI test cases.
+- Deprecate TLS-based memory audit
+- Use KVP "nodedataqueuing_timeout" instead of compile time tuneable
+  "SYNC_POINT_DIFF_THRESHOLD"
+- Please apply "mode=" for "x-pvmf/net/user-agent;valtype=char*" key.
+- Change libpv*.so to libopencore_*.so
+- Singleton and lock/unlock mechanism needed for OMX master core
+  globals
+- In case of 3rd party OMX components that support multiple roles -
+  input dec format and output enc format needs to be specified
+- OMX Core plugin code (for 3rd party omx cores integration)
+
+Known Issues
+- Had to temporarily remove the doc directory because of conflicts
+  with Gerrit and PDF files. These will be uploaded again now that
+  Gerrit is updated.
+- Additional documentation will be released as soon as possible.
+- The OpenMAX encoder node is configuring the OpenMAX component with
+  the wrong format for AMR. It is using
+  OMX_AUDIO_AMRFrameFormatRTPPayload when it should be
+  OMX_AUDIO_AMRFrameFormatFSF.
+- The OpenMAX encoder node is not handling Reset correctly in all
+  cases. 
+
+===============================================================================
+2008-10-21  OpenCORE 1.0 (1.00)
+
+OpenCORE 1.0 is the initial contribution to AOSP.  It has both release-1.0
+and android-1.0 tags.
diff --git a/opencore/NOTICE b/opencore/NOTICE
new file mode 100644 (file)
index 0000000..9d5d01c
--- /dev/null
@@ -0,0 +1,269 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+Portions of the PacketVideo supplied code contain contributions which may be
+covered by the following copyright statements:
+
+
+/*     -------------------------------------------------------------------       *
+ *                    MPEG-4 Simple Profile Video Decoder
+ *     -------------------------------------------------------------------       *
+ *
+ * This software module was originally developed and/or edited by
+ *
+ *   Paulo Nunes (IST / ACTS-MoMuSyS)
+ *   Robert Danielsen (Telenor / ACTS-MoMuSyS)
+ *   Luis Ducla-Soares (IST / ACTS-MoMuSys).
+ *   Cor Quist (KPN / ACTS-MoMuSys).
+ *   Minhua Zhou (HHI / ACTS-MoMuSys).
+ *
+ * in the course of development of the MPEG-4 Video (ISO/IEC 14496-2) standard.
+ * This software module is an implementation of a part of one or more MPEG-4
+ * Video (ISO/IEC 14496-2) tools as specified by the MPEG-4 Video (ISO/IEC
+ * 14496-2) standard.
+ *
+ * ISO/IEC gives users of the MPEG-4 Video (ISO/IEC 14496-2) standard free
+ * license to this software module or modifications thereof for use in hardware
+ * or software products claiming conformance to the MPEG-4 Video (ISO/IEC
+ * 14496-2) standard.
+ *
+ * Those intending to use this software module in hardware or software products
+ * are advised that its use may infringe existing patents. The original
+ * developer of this software module and his/her company, the subsequent
+ * editors and their companies, and ISO/IEC have no liability for use of this
+ * software module or modifications thereof in an implementation. Copyright is
+ * not released for non MPEG-4 Video (ISO/IEC 14496-2) Standard conforming
+ * products.
+ *
+ * ACTS-MoMuSys partners retain full right to use the code for his/her own
+ * purpose, assign or donate the code to a third party and to inhibit third
+ * parties from using the code for non MPEG-4 Video (ISO/IEC 14496-2) Standard
+ * conforming products. This copyright notice must be included in all copies or
+ * derivative works.
+ *
+ * Copyright (c) 1996, 1997
+ *
+ *****************************************************************************/
+
+
+
+/****************************************************************************
+
+SC 29 Software Copyright Licencing Disclaimer:
+
+This software module was originally developed by
+  Coding Technologies
+
+and edited by
+  -
+
+in the course of development of the ISO/IEC 13818-7 and ISO/IEC 14496-3 
+standards for reference purposes and its performance may not have been 
+optimized. This software module is an implementation of one or more tools as 
+specified by the ISO/IEC 13818-7 and ISO/IEC 14496-3 standards.
+ISO/IEC gives users free license to this software module or modifications 
+thereof for use in products claiming conformance to audiovisual and 
+image-coding related ITU Recommendations and/or ISO/IEC International 
+Standards. ISO/IEC gives users the same free license to this software module or 
+modifications thereof for research purposes and further ISO/IEC standardisation.
+Those intending to use this software module in products are advised that its 
+use may infringe existing patents. ISO/IEC have no liability for use of this 
+software module or modifications thereof. Copyright is not released for 
+products that do not conform to audiovisual and image-coding related ITU 
+Recommendations and/or ISO/IEC International Standards.
+The original developer retains full right to modify and use the code for its 
+own purpose, assign or donate the code to a third party and to inhibit third 
+parties from using the code for products that do not conform to audiovisual and 
+image-coding related ITU Recommendations and/or ISO/IEC International Standards.
+This copyright notice must be included in all copies or derivative works.
+Copyright (c) ISO/IEC 2003.
+
+*******************************************************************************/
+
+
+/**************************************************************************
+
+This software module was originally developed by
+
+Mikko Suonio (Nokia)
+
+in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard
+ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an
+implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools
+as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives
+users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this
+software module or modifications thereof for use in hardware or
+software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio
+standards. Those intending to use this software module in hardware or
+software products are advised that this use may infringe existing
+patents. The original developer of this software module and his/her
+company, the subsequent editors and their companies, and ISO/IEC have
+no liability for use of this software module or modifications thereof
+in an implementation. Copyright is not released for non MPEG-2
+NBC/MPEG-4 Audio conforming products. The original developer retains
+full right to use the code for his/her own purpose, assign or donate
+the code to a third party and to inhibit third party from using the
+code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This
+copyright notice must be included in all copies or derivative works.
+
+Copyright (c) 1997.
+
+***************************************************************************/
+
+
+/**************************************************************************
+
+This software module was originally developed by
+Nokia in the course of development of the MPEG-2 AAC/MPEG-4 
+Audio standard ISO/IEC13818-7, 14496-1, 2 and 3.
+This software module is an implementation of a part
+of one or more MPEG-2 AAC/MPEG-4 Audio tools as specified by the
+MPEG-2 aac/MPEG-4 Audio standard. ISO/IEC  gives users of the
+MPEG-2aac/MPEG-4 Audio standards free license to this software module
+or modifications thereof for use in hardware or software products
+claiming conformance to the MPEG-2 aac/MPEG-4 Audio  standards. Those
+intending to use this software module in hardware or software products
+are advised that this use may infringe existing patents. The original
+developer of this software module, the subsequent
+editors and their companies, and ISO/IEC have no liability for use of
+this software module or modifications thereof in an
+implementation. Copyright is not released for non MPEG-2 aac/MPEG-4
+Audio conforming products. The original developer retains full right to
+use the code for the developer's own purpose, assign or donate the code to a
+third party and to inhibit third party from using the code for non
+MPEG-2 aac/MPEG-4 Audio conforming products. This copyright notice
+must be included in all copies or derivative works.
+Copyright (c)1997.  
+
+***************************************************************************/
+
+
+------------------------------------------------------------------------------
+
+MPEG-2 NBC Audio Decoder
+   "This software module was originally developed by AT&T, Dolby
+   Laboratories, Fraunhofer Gesellschaft IIS in the course of development
+   of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and
+   3. This software module is an implementation of a part of one or more
+   MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4
+   Audio standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio
+   standards free license to this software module or modifications thereof
+   for use in hardware or software products claiming conformance to the
+   MPEG-2 NBC/MPEG-4 Audio  standards. Those intending to use this software
+   module in hardware or software products are advised that this use may
+   infringe existing patents. The original developer of this software
+   module and his/her company, the subsequent editors and their companies,
+   and ISO/IEC have no liability for use of this software module or
+   modifications thereof in an implementation. Copyright is not released
+   for non MPEG-2 NBC/MPEG-4 Audio conforming products.The original
+   developer retains full right to use the code for his/her own purpose,
+   assign or donate the code to a third party and to inhibit third party
+   from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products.
+   This copyright notice must be included in all copies or derivative
+   works." 
+   Copyright(c)1996.
+
+------------------------------------------------------------------------------
+
+
+/*
+ * snprintf.c - a portable implementation of snprintf
+ *
+ * AUTHOR
+ *   Mark Martinec <mark.martinec@ijs.si>, April 1999.
+ *
+ *   Copyright 1999, Mark Martinec. All rights reserved.
+ *
+ * TERMS AND CONDITIONS
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the "Frontier Artistic License" which comes
+ *   with this Kit.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty
+ *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *   See the Frontier Artistic License for more details.
+ *
+ *
+ */
+
+The "Frontier Artistic License" may be found at
+ http://www.spinwardstars.com/frontier/fal.html
+
+
+/*---------------------------------------------------------------------------*/
+
+/*
+ * Copyright (c) 2005 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/*---------------------------------------------------------------------------*/
+
+/**@@@+++@@@@****************************************************************** 
+** 
+** Microsoft Windows Media 
+** Copyright (C) Microsoft Corporation. All rights reserved. 
+** 
+***@@@---@@@@****************************************************************** 
+*/ 
+
+
+-------------------------------------------------------------------------------
+Portions of this file are derived from the following 3GPP standard:
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+-------------------------------------------------------------------------------
+
+
+-------------------------------------------------------------------------------
+Portions of this file are derived from the following 3GPP standard:
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+-------------------------------------------------------------------------------
+
diff --git a/opencore/README b/opencore/README
new file mode 100644 (file)
index 0000000..d63d0f9
--- /dev/null
@@ -0,0 +1,60 @@
+                            Welcome to OpenCORE
+
+                          http://www.opencore.net/
+
+OpenCORE is the multimedia framework of Android originally contributed by
+PacketVideo.  It provides an extensible framework for multimedia rendering and
+authoring and video telephony (3G-324M).
+
+The following an overview of the directory structure which includes a list of
+the top-level directories along with a brief note describing the contents.
+
+__
+  |-- android  [Contains the components the interface OpenCORE with 
+  |             other parts of Android]   
+  |-- baselibs [Contains basic libraries for data containers, MIME string
+  |             handling, messaging across thread boundaries, etc]
+  |-- build_config [Contains top-level build files used to build the libraries
+  |                 outside of Android]
+  |-- codecs_v2 [Contains the implementations of PV's audio and video 
+  |              codecs as well as the OpenMax IL interface layer]
+  |-- doc       [Contains the documentation required to interface with
+  |              OpenCORE]
+  |-- engines   [Contains the implementation of the player and author 
+  |              engines as well as a utility for metadata]
+  |-- extern_libs_v2 [Contains 3rd-party libraries used by OpenCORE. 
+  |                   Currently this directory contains header files 
+  |                   defining the Khronos OpenMax IL interface]
+  |-- extern_tools_v2 [Contains 3rd-party tools used to build OpenCORE
+  |                    indpendently of the Android build system]
+  |-- fileformats  [Contains the libraries for parsing a variety of
+  |                 fileformats including mp4/3gp,mp3,wav,aac]
+  |-- modules [Contains build files for aggregating low-level libraries]
+  |-- nodes     [Contains the OpenCORE framework "nodes", which is 
+  |              the abstraction used to implement independent multimedia 
+  |              processing units that can be connected in a flow graph]
+  |-- oscl      [This is the Operating System Compatibility Layer which 
+  |              provides the mapping OS APIs as well as some basic 
+  |              data structures and utilities]
+  |-- protocols [Contains parsers and composers for a variety of network
+  |              protocols such as HTTP, RTP/RTCP, RTSP, and SDP]
+  |-- pvmi     [Contains fundamental definitions that make up OpenCORE.
+  |             The directory name is an abbreviation of PacketVideo 
+  |             Multimedia Infrastructure]
+  |-- tools_v2  [Contains tools used to build the libraries outside of Android]
+
+Within each library, the following directory structure, with a few exceptions,
+is implemented to organize the files:
+
+__
+  |-- build
+    |-- make    <- makefile to build outside of Android is here       
+  |-- doc       <- directory for any documentation specific to this lib
+  |-- include   <- header files that are part of the external interface go here
+  |-- src       <- source and internal header files of the library
+  |-- test      <- test code (follows a similar structure)
+    |-- build
+      |-- make
+    |-- include
+    |-- src
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk
new file mode 100644 (file)
index 0000000..d978dbe
--- /dev/null
@@ -0,0 +1,76 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+       src/add.cpp \
+       src/az_lsp.cpp \
+       src/bitno_tab.cpp \
+       src/bitreorder_tab.cpp \
+       src/c2_9pf_tab.cpp \
+       src/div_s.cpp \
+       src/gains_tbl.cpp \
+       src/gc_pred.cpp \
+       src/get_const_tbls.cpp \
+       src/gmed_n.cpp \
+       src/grid_tbl.cpp \
+       src/gray_tbl.cpp \
+       src/int_lpc.cpp \
+       src/inv_sqrt.cpp \
+       src/inv_sqrt_tbl.cpp \
+       src/l_shr_r.cpp \
+       src/log2.cpp \
+       src/log2_norm.cpp \
+       src/log2_tbl.cpp \
+       src/lsfwt.cpp \
+       src/lsp.cpp \
+       src/lsp_az.cpp \
+       src/lsp_lsf.cpp \
+       src/lsp_lsf_tbl.cpp \
+       src/lsp_tab.cpp \
+       src/mult_r.cpp \
+       src/norm_l.cpp \
+       src/norm_s.cpp \
+       src/overflow_tbl.cpp \
+       src/ph_disp_tab.cpp \
+       src/pow2.cpp \
+       src/pow2_tbl.cpp \
+       src/pred_lt.cpp \
+       src/q_plsf.cpp \
+       src/q_plsf_3.cpp \
+       src/q_plsf_3_tbl.cpp \
+       src/q_plsf_5.cpp \
+       src/q_plsf_5_tbl.cpp \
+       src/qua_gain_tbl.cpp \
+       src/reorder.cpp \
+       src/residu.cpp \
+       src/round.cpp \
+       src/shr.cpp \
+       src/shr_r.cpp \
+       src/sqrt_l.cpp \
+       src/sqrt_l_tbl.cpp \
+       src/sub.cpp \
+       src/syn_filt.cpp \
+       src/weight_a.cpp \
+       src/window_tab.cpp
+
+
+LOCAL_MODULE := libpv_amr_nb_common_lib
+
+LOCAL_CFLAGS :=   $(PV_CFLAGS)
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := 
+
+LOCAL_SHARED_LIBRARIES := 
+
+LOCAL_C_INCLUDES := \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/src \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/include \
+       $(PV_INCLUDES)
+
+LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO)
+
+LOCAL_COPY_HEADERS := \
+       
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build/make/local.mk b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build/make/local.mk
new file mode 100644 (file)
index 0000000..92b3f5e
--- /dev/null
@@ -0,0 +1,68 @@
+# Get the current local path as the first operation
+LOCAL_PATH := $(call get_makefile_dir)
+
+# Clear out the variables used in the local makefiles
+include $(MK)/clear.mk
+
+TARGET := pv_amr_nb_common_lib
+
+
+OPTIMIZE_FOR_PERFORMANCE_OVER_SIZE := true
+
+SRCDIR := ../../src
+INCSRCDIR := ../../include
+
+SRCS := add.cpp \
+       az_lsp.cpp \
+       bitno_tab.cpp \
+       bitreorder_tab.cpp \
+       c2_9pf_tab.cpp \
+       div_s.cpp \
+       gains_tbl.cpp \
+       gc_pred.cpp \
+       get_const_tbls.cpp \
+       gmed_n.cpp \
+       grid_tbl.cpp \
+       gray_tbl.cpp \
+       int_lpc.cpp \
+       inv_sqrt.cpp \
+       inv_sqrt_tbl.cpp \
+       l_shr_r.cpp \
+       log2.cpp \
+       log2_norm.cpp \
+       log2_tbl.cpp \
+       lsfwt.cpp \
+       lsp.cpp \
+       lsp_az.cpp \
+       lsp_lsf.cpp \
+       lsp_lsf_tbl.cpp \
+       lsp_tab.cpp \
+       mult_r.cpp \
+       norm_l.cpp \
+       norm_s.cpp \
+       overflow_tbl.cpp \
+       ph_disp_tab.cpp \
+       pow2.cpp \
+       pow2_tbl.cpp \
+       pred_lt.cpp \
+       q_plsf.cpp \
+       q_plsf_3.cpp \
+       q_plsf_3_tbl.cpp \
+       q_plsf_5.cpp \
+       q_plsf_5_tbl.cpp \
+       qua_gain_tbl.cpp \
+       reorder.cpp \
+       residu.cpp \
+       round.cpp \
+       shr.cpp \
+       shr_r.cpp \
+       sqrt_l.cpp \
+       sqrt_l_tbl.cpp \
+       sub.cpp \
+       syn_filt.cpp \
+       weight_a.cpp \
+       window_tab.cpp
+
+include $(MK)/library.mk
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/abs_s.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/abs_s.h
new file mode 100644 (file)
index 0000000..04e383a
--- /dev/null
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: abs_s.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the abs_s function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef ABS_S_H
+#define ABS_S_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 abs_s(Word16 var1);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* ABS_S_H */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/add.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/add.h
new file mode 100644 (file)
index 0000000..18fdcee
--- /dev/null
@@ -0,0 +1,97 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: add.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the add function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef ADD_H
+#define ADD_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF Word16 add_16(Word16 var1, Word16 var2, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ADD_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/az_lsp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/az_lsp.h
new file mode 100644 (file)
index 0000000..cd2e91f
--- /dev/null
@@ -0,0 +1,105 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: az_lsp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the function Az_lsp()
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef AZ_LSP_H
+#define AZ_LSP_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include  "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define grid_points 60
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 grid[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void Az_lsp(
+        Word16 a[],         /* (i)  : predictor coefficients (MP1)               */
+        Word16 lsp[],       /* (o)  : line spectral pairs (M)                    */
+        Word16 old_lsp[],   /* (i)  : old lsp[] (in case not found 10 roots) (M) */
+        Flag   *pOverflow   /* (i/o): overflow flag                              */
+    );
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _AZ_LSP_H */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h
new file mode 100644 (file)
index 0000000..fd66e9a
--- /dev/null
@@ -0,0 +1,422 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: basic_op.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file includes all the basicop2.c functions' header files.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BASIC_OP_H
+#define BASIC_OP_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))
+#include "basic_op_arm_gcc_v5.h"
+
+#else
+#include "basic_op_c_equivalent.h"
+
+#endif
+
+
+
+#include    "add.h"
+#include    "div_s.h"
+#include    "l_shr_r.h"
+#include    "mult_r.h"
+#include    "norm_l.h"
+#include    "norm_s.h"
+#include    "round.h"
+#include    "shr_r.h"
+#include    "sub.h"
+#include    "shr.h"
+#include    "l_negate.h"
+#include    "l_extract.h"
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: mac_32
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var3 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+        L_var1_hi = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        L_var1_lo = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+        L_var2_hi = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        L_var2_lo = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit mac operation resulted in overflow
+
+     Returns:
+        L_var3 = 32-bit result of L_var3 + (L_var1 * L_var2)(Word32)
+
+    */
+    static inline Word32 Mac_32(Word32 L_var3,
+    Word16 L_var1_hi,
+    Word16 L_var1_lo,
+    Word16 L_var2_hi,
+    Word16 L_var2_lo,
+    Flag *pOverflow)
+    {
+        Word16  product;
+
+        L_var3 = L_mac(L_var3, L_var1_hi, L_var2_hi, pOverflow);
+
+        product = mult(L_var1_hi, L_var2_lo, pOverflow);
+        L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+        product = mult(L_var1_lo, L_var2_hi, pOverflow);
+        L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+        return (L_var3);
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: mac_32_16
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var3 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+        L_var1_hi = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        L_var1_lo = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+        var2= 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit mac operation resulted in overflow
+
+     Returns:
+        L_var3 = 32-bit result of L_var3 + (L_var1 * var2)(Word32)
+    */
+
+    static inline Word32 Mac_32_16(Word32 L_var3,
+                                   Word16 L_var1_hi,
+                                   Word16 L_var1_lo,
+                                   Word16 var2,
+                                   Flag  *pOverflow)
+    {
+        Word16  product;
+
+        L_var3 = L_mac(L_var3, L_var1_hi, var2, pOverflow);
+
+        product = mult(L_var1_lo, var2, pOverflow);
+        L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+        return (L_var3);
+    }
+
+
+    /*----------------------------------------------------------------------------
+         Function Name : negate
+
+         Negate var1 with saturation, saturate in the case where input is -32768:
+                      negate(var1) = sub(0,var1).
+
+         Inputs :
+          var1
+                   16 bit short signed integer (Word16) whose value falls in the
+                   range : 0x8000 <= var1 <= 0x7fff.
+
+         Outputs :
+          none
+
+         Return Value :
+                   16 bit short signed integer (Word16) whose value falls in the
+                   range : 0x8000 <= var_out <= 0x7fff.
+     ----------------------------------------------------------------------------*/
+
+    static inline Word16 negate(Word16 var1)
+    {
+        return (((var1 == MIN_16) ? MAX_16 : -var1));
+    }
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : shl
+
+         Arithmetically shift the 16 bit input var1 left var2 positions.Zero fill
+         the var2 LSB of the result. If var2 is negative, arithmetically shift
+         var1 right by -var2 with sign extension. Saturate the result in case of
+         underflows or overflows.
+
+         Inputs :
+          var1
+                   16 bit short signed integer (Word16) whose value falls in the
+                   range : 0x8000 <= var1 <= 0x7fff.
+
+          var2
+                   16 bit short signed integer (Word16) whose value falls in the
+                   range : 0x8000 <= var1 <= 0x7fff.
+
+          pOverflow : pointer to overflow (Flag)
+
+         Return Value :
+          var_out
+                   16 bit short signed integer (Word16) whose value falls in the
+                   range : 0x8000 <= var_out <= 0x7fff.
+     ----------------------------------------------------------------------------*/
+
+    static inline Word16 shl(Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        Word16 var_out = 0;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        if (var2 < 0)
+        {
+            var2 = -var2;
+            if (var2 < 15)
+            {
+                var_out = var1 >> var2;
+            }
+
+        }
+        else
+        {
+            var_out = var1 << var2;
+            if (var_out >> var2 != var1)
+            {
+                var_out = (var1 >> 15) ^ MAX_16;
+            }
+        }
+        return (var_out);
+    }
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : L_shl
+
+         Arithmetically shift the 32 bit input L_var1 left var2 positions. Zero
+         fill the var2 LSB of the result. If var2 is negative, arithmetically
+         shift L_var1 right by -var2 with sign extension. Saturate the result in
+         case of underflows or overflows.
+
+         Inputs :
+          L_var1   32 bit long signed integer (Word32) whose value falls in the
+                   range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+          var2
+                   16 bit short signed integer (Word16) whose value falls in the
+                   range :  8000 <= var2 <= 7fff.
+
+          pOverflow : pointer to overflow (Flag)
+
+         Return Value :
+                   32 bit long signed integer (Word32) whose value falls in the
+                   range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+     ----------------------------------------------------------------------------*/
+
+    static inline Word32 L_shl(Word32 L_var1, Word16 var2, Flag *pOverflow)
+    {
+        Word32 L_var_out = 0;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        if (var2 > 0)
+        {
+            L_var_out = L_var1 << var2;
+            if (L_var_out >> var2 != L_var1)
+            {
+                L_var_out = (L_var1 >> 31) ^ MAX_32;
+            }
+        }
+        else
+        {
+            var2 = -var2;
+            if (var2 < 31)
+            {
+                L_var_out = L_var1 >> var2;
+            }
+
+        }
+
+        return (L_var_out);
+    }
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : L_shr
+
+         Arithmetically shift the 32 bit input L_var1 right var2 positions with
+         sign extension. If var2 is negative, arithmetically shift L_var1 left
+         by -var2 and zero fill the -var2 LSB of the result. Saturate the result
+         in case of underflows or overflows.
+
+         Inputs :
+          L_var1   32 bit long signed integer (Word32) whose value falls in the
+                   range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+          var2
+                   16 bit short signed integer (Word16) whose value falls in the
+                   range :  8000 <= var2 <= 7fff.
+
+          pOverflow : pointer to overflow (Flag)
+
+         Return Value :
+                   32 bit long signed integer (Word32) whose value falls in the
+                   range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+     ----------------------------------------------------------------------------*/
+
+    static inline Word32 L_shr(Word32 L_var1, Word16 var2, Flag *pOverflow)
+    {
+        Word32 L_var_out = 0;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        if (var2 > 0)
+        {
+            if (var2 < 31)
+            {
+                L_var_out = L_var1 >> var2;
+            }
+        }
+        else
+        {
+            var2 = -var2;
+
+            L_var_out = L_var1 << (var2) ;
+            if ((L_var_out >> (var2)) != L_var1)
+            {
+                L_var_out = (L_var1 >> 31) ^ MAX_32;
+            }
+
+        }
+
+        return (L_var_out);
+    }
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : abs_s
+
+          Absolute value of var1; abs_s(-32768) = 32767.
+
+         Inputs :
+          var1
+                   16 bit short signed integer (Word16) whose value falls in the
+                   range : 0x8000 <= var1 <= 0x7fff.
+
+          pOverflow : pointer to overflow (Flag)
+
+         Outputs :
+          none
+
+         Return Value :
+                   16 bit short signed integer (Word16) whose value falls in the
+                   range : 0x0000 <= var_out <= 0x7fff.
+
+     ----------------------------------------------------------------------------*/
+
+    static inline Word16 abs_s(Word16 var1)
+    {
+
+        Word16 y = var1 - (var1 < 0);
+        y = y ^(y >> 15);
+        return (y);
+
+    }
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* BASIC_OP_H */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h
new file mode 100644 (file)
index 0000000..5752171
--- /dev/null
@@ -0,0 +1,537 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: basic_op_arm_gcc_v5.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file includes all the GCC-ARM V5 basicop.c functions.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BASIC_OP_ARM_GCC_V5_H
+#define BASIC_OP_ARM_GCC_V5_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: L_add
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var1 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+        L_var2 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+     Returns:
+        L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
+    */
+
+    static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
+    {
+        register Word32 ra = L_var1;
+        register Word32 rb = L_var2;
+        Word32 result;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        __asm__ volatile("qadd %0, %1, %2"
+             : "=r"(result)
+                             : "r"(ra), "r"(rb)
+                            );
+        return (result);
+
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: L_sub
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var1 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+        L_var2 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+     Returns:
+        L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
+    */
+    static inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
+{
+        register Word32 ra = L_var1;
+        register Word32 rb = L_var2;
+        Word32 result;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        __asm__ volatile("qsub %0, %1, %2"
+             : "=r"(result)
+                             : "r"(ra), "r"(rb)
+                            );
+
+        return (result);
+    }
+
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: L_mac
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var3 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+        var1 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+     Returns:
+        result = 32-bit result of L_var3 + (var1 * var2)(Word32)
+    */
+    static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+{
+        register Word32 ra = L_var3;
+        register Word32 rb = var1;
+        register Word32 rc = var2;
+        Word32 result;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        __asm__ volatile("smulbb %0, %1, %2"
+             : "=r"(result)
+                             : "r"(rb), "r"(rc)
+                            );
+
+        __asm__ volatile("qdadd %0, %1, %2"
+             : "=r"(rc)
+                             : "r"(ra), "r"(result)
+                            );
+
+        return (rc);
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: L_mult
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var1 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+        L_var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+     Returns:
+        L_product = 32-bit product of L_var1 and L_var2 (Word32)
+    */
+
+    static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
+{
+        register Word32 ra = var1;
+        register Word32 rb = var2;
+        Word32 result;
+        Word32 product;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        __asm__ volatile("smulbb %0, %1, %2"
+             : "=r"(product)
+                             : "r"(ra), "r"(rb)
+                            );
+
+        __asm__ volatile("qadd %0, %1, %2"
+             : "=r"(result)
+                             : "r"(product), "r"(product)
+                            );
+
+        return(result);
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: L_msu
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var3 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+
+        var1 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit operation resulted in overflow
+
+     Returns:
+        result = 32-bit result of L_var3 - (var1 * var2)
+    */
+    static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+{
+        register Word32 ra = L_var3;
+        register Word32 rb = var1;
+        register Word32 rc = var2;
+        Word32 product;
+        Word32 result;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        __asm__ volatile("smulbb %0, %1, %2"
+             : "=r"(product)
+                             : "r"(rb), "r"(rc)
+                            );
+
+        __asm__ volatile("qdsub %0, %1, %2"
+             : "=r"(result)
+                             : "r"(ra), "r"(product)
+                            );
+
+        return (result);
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: Mpy_32
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var1_hi = most significant word of first input (Word16).
+        L_var1_lo = least significant word of first input (Word16).
+        L_var2_hi = most significant word of second input (Word16).
+        L_var2_lo = least significant word of second input (Word16).
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit multiply operation resulted in overflow
+
+     Returns:
+        L_product = 32-bit product of L_var1 and L_var2 (Word32)
+    */
+    static inline Word32 Mpy_32(Word16 L_var1_hi,
+                                Word16 L_var1_lo,
+                                Word16 L_var2_hi,
+                                Word16 L_var2_lo,
+                                Flag   *pOverflow)
+{
+        register Word32 product32;
+        register Word32 L_sum;
+        register Word32 L_product, result;
+        register Word32 ra = L_var1_hi;
+        register Word32 rb = L_var1_lo;
+        register Word32 rc = L_var2_hi;
+        register Word32 rd = L_var2_lo;
+
+
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        __asm__ volatile("smulbb %0, %1, %2"
+             : "=r"(L_product)
+                             : "r"(ra), "r"(rc)
+                            );
+        __asm__ volatile("mov %0, #0"
+             : "=r"(result)
+                    );
+
+        __asm__ volatile("qdadd %0, %1, %2"
+             : "=r"(L_sum)
+                             : "r"(result), "r"(L_product)
+                            );
+
+        __asm__ volatile("smulbb %0, %1, %2"
+             : "=r"(product32)
+                             : "r"(ra), "r"(rd)
+                            );
+
+        __asm__ volatile("mov %0, %1, ASR #15"
+             : "=r"(ra)
+                             : "r"(product32)
+                            );
+        __asm__ volatile("qdadd %0, %1, %2"
+             : "=r"(L_product)
+                             : "r"(L_sum), "r"(ra)
+                            );
+
+        __asm__ volatile("smulbb %0, %1, %2"
+             : "=r"(product32)
+                             : "r"(rb), "r"(rc)
+                            );
+
+        __asm__ volatile("mov %0, %1, ASR #15"
+             : "=r"(rb)
+                             : "r"(product32)
+                            );
+
+        __asm__ volatile("qdadd %0, %1, %2"
+             : "=r"(L_sum)
+                             : "r"(L_product), "r"(rb)
+                            );
+
+        return (L_sum);
+    }
+
+
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: Mpy_32_16
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var1_hi = most significant 16 bits of 32-bit input (Word16).
+        L_var1_lo = least significant 16 bits of 32-bit input (Word16).
+        var2  = 16-bit signed integer (Word16).
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit product operation resulted in overflow
+
+     Returns:
+        product = 32-bit product of the 32-bit L_var1 and 16-bit var1 (Word32)
+    */
+    static inline Word32 Mpy_32_16(Word16 L_var1_hi,
+                                   Word16 L_var1_lo,
+                                   Word16 var2,
+                                   Flag *pOverflow)
+{
+
+        register Word32 ra = L_var1_hi;
+        register Word32 rb = L_var1_lo;
+        register Word32 rc = var2;
+        Word32 result, L_product;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        __asm__ volatile("smulbb %0, %1, %2"
+             : "=r"(L_product)
+                             : "r"(ra), "r"(rc)
+                            );
+        __asm__ volatile("mov %0, #0"
+             : "=r"(result)
+                    );
+
+        __asm__ volatile("qdadd %0, %1, %2"
+             : "=r"(L_product)
+                             : "r"(result), "r"(L_product)
+                            );
+
+        __asm__ volatile("smulbb %0, %1, %2"
+             : "=r"(result)
+                             : "r"(rb), "r"(rc)
+                            );
+
+        __asm__ volatile("mov %0, %1, ASR #15"
+             : "=r"(ra)
+                             : "r"(result)
+                            );
+        __asm__ volatile("qdadd %0, %1, %2"
+             : "=r"(result)
+                             : "r"(L_product), "r"(ra)
+                            );
+
+        return (result);
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: mult
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        var1 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+        var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the add operation resulted in overflow
+
+     Returns:
+        product = 16-bit limited product of var1 and var2 (Word16)
+    */
+    static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
+{
+        register Word32 ra = var1;
+        register Word32 rb = var2;
+        Word32 product;
+        Word32 temp;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        __asm__ volatile(
+            "smulbb %0, %1, %2"
+    : "=r"(temp)
+                    : "r"(ra), "r"(rb)
+                );
+        __asm__ volatile(
+            "qadd %0, %1, %2\n\t"
+            "mov %0, %0, asr #16"
+    : "=&r*i"(product)
+                    : "r"(temp), "r"(temp)
+                );
+
+        return ((Word16) product);
+    }
+
+    static inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
+{
+        register Word32 ra = L_var1;
+        register Word32 rb = L_var2;
+        register Word32 rc = L_var3;
+        Word32 result;
+
+        __asm__ volatile("smlabb %0, %1, %2, %3"
+             : "=r"(result)
+                             : "r"(ra), "r"(rb), "r"(rc)
+                            );
+        return (result);
+    }
+
+    static inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
+{
+        register Word32 ra = L_var1;
+        register Word32 rb = L_var2;
+        register Word32 rc = L_var3;
+        Word32 result;
+
+        __asm__ volatile("rsb %0, %1, #0"
+             : "=r"(ra)
+                             : "r"(ra)
+                            );
+
+        __asm__ volatile("smlabb %0, %1, %2, %3"
+             : "=r"(result)
+                             : "r"(ra), "r"(rb), "r"(rc)
+                            );
+        return (result);
+    }
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BASIC_OP_ARM_GCC_V5_H */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h
new file mode 100644 (file)
index 0000000..62072a5
--- /dev/null
@@ -0,0 +1,499 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: basic_op_c_equivalent.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file includes all the C-Equivalent basicop.c functions.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BASIC_OP_C_EQUIVALENT_H
+#define BASIC_OP_C_EQUIVALENT_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: L_add
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var1 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+        L_var2 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+     Returns:
+        L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
+    */
+    static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
+    {
+        Word32 L_sum;
+
+        L_sum = L_var1 + L_var2;
+
+        if ((L_var1 ^ L_var2) >= 0)
+        {
+            if ((L_sum ^ L_var1) >> 31)
+            {
+                L_sum = (L_var1 >> 31) ? MIN_32 : MAX_32;
+                *pOverflow = 1;
+            }
+        }
+
+        return (L_sum);
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: L_sub
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var1 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+        L_var2 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+     Returns:
+        L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
+    */
+    static inline Word32 L_sub(register Word32 L_var1, register Word32 L_var2,
+                               register Flag *pOverflow)
+    {
+        Word32 L_diff;
+
+        L_diff = L_var1 - L_var2;
+
+        if ((L_var1 ^ L_var2) >> 31)
+        {
+            if ((L_diff ^ L_var1) & MIN_32)
+            {
+                L_diff = (L_var1 >> 31) ? MIN_32 : MAX_32;
+                *pOverflow = 1;
+            }
+        }
+
+        return (L_diff);
+    }
+
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: L_mac
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var3 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+        var1 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+     Returns:
+        result = 32-bit result of L_var3 + (var1 * var2)(Word32)
+    */
+    static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        Word32 result;
+        Word32 L_sum;
+        result = (Word32) var1 * var2;
+        if (result != (Word32) 0x40000000L)
+        {
+            L_sum = (result << 1) + L_var3;
+
+            /* Check if L_sum and L_var_3 share the same sign */
+            if ((L_var3 ^ result) > 0)
+            {
+                if ((L_sum ^ L_var3) >> 31)
+                {
+                    L_sum = (L_var3 >> 31) ? MIN_32 : MAX_32;
+                    *pOverflow = 1;
+                }
+            }
+        }
+        else
+        {
+            *pOverflow = 1;
+            L_sum = MAX_32;
+        }
+        return (L_sum);
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: L_mult
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var1 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+        L_var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+     Returns:
+        L_product = 32-bit product of L_var1 and L_var2 (Word32)
+    */
+    static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        register Word32 L_product;
+
+        L_product = (Word32) var1 * var2;
+
+        if (L_product != (Word32) 0x40000000L)
+        {
+            L_product <<= 1;          /* Multiply by 2 */
+        }
+        else
+        {
+            *pOverflow = 1;
+            L_product = MAX_32;
+        }
+
+        return (L_product);
+    }
+
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: L_msu
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var3 = 32 bit long signed integer (Word32) whose value falls
+                 in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+
+        var1 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit operation resulted in overflow
+
+     Returns:
+        result = 32-bit result of L_var3 - (var1 * var2)
+    */
+
+    static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        Word32 result;
+
+        result = L_mult(var1, var2, pOverflow);
+        result = L_sub(L_var3, result, pOverflow);
+
+        return (result);
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: Mpy_32
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var1_hi = most significant word of first input (Word16).
+        L_var1_lo = least significant word of first input (Word16).
+        L_var2_hi = most significant word of second input (Word16).
+        L_var2_lo = least significant word of second input (Word16).
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit multiply operation resulted in overflow
+
+     Returns:
+        L_product = 32-bit product of L_var1 and L_var2 (Word32)
+    */
+    static inline Word32 Mpy_32(Word16 L_var1_hi,
+                                Word16 L_var1_lo,
+                                Word16 L_var2_hi,
+                                Word16 L_var2_lo,
+                                Flag   *pOverflow)
+    {
+        Word32 L_product;
+        Word32 L_sum;
+        Word32 product32;
+
+        OSCL_UNUSED_ARG(pOverflow);
+        L_product = (Word32) L_var1_hi * L_var2_hi;
+
+        if (L_product != (Word32) 0x40000000L)
+        {
+            L_product <<= 1;
+        }
+        else
+        {
+            L_product = MAX_32;
+        }
+
+        /* result = mult (L_var1_hi, L_var2_lo, pOverflow); */
+        product32 = ((Word32) L_var1_hi * L_var2_lo) >> 15;
+
+        /* L_product = L_mac (L_product, result, 1, pOverflow); */
+        L_sum = L_product + (product32 << 1);
+
+        if ((L_product ^ product32) > 0)
+        {
+            if ((L_sum ^ L_product) >> 31)
+            {
+                L_sum = (L_product >> 31) ? MIN_32 : MAX_32;
+            }
+        }
+
+        L_product = L_sum;
+
+        /* result = mult (L_var1_lo, L_var2_hi, pOverflow); */
+        product32 = ((Word32) L_var1_lo * L_var2_hi) >> 15;
+
+        /* L_product = L_mac (L_product, result, 1, pOverflow); */
+        L_sum = L_product + (product32 << 1);
+
+        if ((L_product ^ product32) > 0)
+        {
+            if ((L_sum ^ L_product) >> 31)
+            {
+                L_sum = (L_product >> 31) ? MIN_32 : MAX_32;
+            }
+        }
+        return (L_sum);
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: Mpy_32_16
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        L_var1_hi = most significant 16 bits of 32-bit input (Word16).
+        L_var1_lo = least significant 16 bits of 32-bit input (Word16).
+        var2  = 16-bit signed integer (Word16).
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the 32 bit product operation resulted in overflow
+
+     Returns:
+        product = 32-bit product of the 32-bit L_var1 and 16-bit var1 (Word32)
+    */
+
+    static inline Word32 Mpy_32_16(Word16 L_var1_hi,
+                                   Word16 L_var1_lo,
+                                   Word16 var2,
+                                   Flag *pOverflow)
+    {
+
+        Word32 L_product;
+        Word32 L_sum;
+        Word32 result;
+        L_product = (Word32) L_var1_hi * var2;
+
+        if (L_product != (Word32) 0x40000000L)
+        {
+            L_product <<= 1;
+        }
+        else
+        {
+            *pOverflow = 1;
+            L_product = MAX_32;
+        }
+
+        result = ((Word32)L_var1_lo * var2) >> 15;
+
+        L_sum  =  L_product + (result << 1);
+
+        if ((L_product ^ result) > 0)
+        {
+            if ((L_sum ^ L_product) >> 31)
+            {
+                L_sum = (L_product >> 31) ? MIN_32 : MAX_32;
+                *pOverflow = 1;
+            }
+        }
+        return (L_sum);
+
+    }
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: mult
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        var1 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+        var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+        pOverflow = pointer to overflow (Flag)
+
+     Outputs:
+        pOverflow -> 1 if the add operation resulted in overflow
+
+     Returns:
+        product = 16-bit limited product of var1 and var2 (Word16)
+    */
+    static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        register Word32 product;
+
+        product = ((Word32) var1 * var2) >> 15;
+
+        /* Saturate result (if necessary). */
+        /* var1 * var2 >0x00007fff is the only case */
+        /* that saturation occurs. */
+
+        if (product > 0x00007fffL)
+        {
+            *pOverflow = 1;
+            product = (Word32) MAX_16;
+        }
+
+
+        /* Return the product as a 16 bit value by type casting Word32 to Word16 */
+
+        return ((Word16) product);
+    }
+
+
+    static inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
+    {
+        Word32 result;
+
+        result = L_var3 + L_var1 * L_var2;
+
+        return result;
+    }
+
+    static inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
+    {
+        Word32 result;
+
+        result = L_var3 - L_var1 * L_var2;
+
+        return result;
+    }
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BASIC_OP_C_EQUIVALENT_H */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basicop_malloc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basicop_malloc.h
new file mode 100644 (file)
index 0000000..4d94c4c
--- /dev/null
@@ -0,0 +1,107 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: basicop_malloc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains constant definitions and external references to the stores
+ used by any arithmetic function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BASICOP_MALLOC_H
+#define BASICOP_MALLOC_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define MAX_32 (Word32)0x7fffffffL
+#define MIN_32 (Word32)0x80000000L
+
+#define MAX_16 (Word16)0x7fff
+#define MIN_16 (Word16)0x8000
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern  Flag Overflow;
+    extern  Flag Carry;
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitno_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitno_tab.h
new file mode 100644 (file)
index 0000000..b071c71
--- /dev/null
@@ -0,0 +1,134 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: bitno_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a tables in bitno_tab.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BITNO_TAB_H
+#define BITNO_TAB_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define BIT_0      0
+#define BIT_1      1
+
+#define PRMNO_MR475 17
+#define PRMNO_MR515 19
+#define PRMNO_MR59  19
+#define PRMNO_MR67  19
+#define PRMNO_MR74  19
+#define PRMNO_MR795 23
+#define PRMNO_MR102 39
+#define PRMNO_MR122 57
+#define PRMNO_MRDTX 5
+
+    /* number of parameters to first subframe */
+#define PRMNOFSF_MR475 7
+#define PRMNOFSF_MR515 7
+#define PRMNOFSF_MR59  7
+#define PRMNOFSF_MR67  7
+#define PRMNOFSF_MR74  7
+#define PRMNOFSF_MR795 8
+#define PRMNOFSF_MR102 12
+#define PRMNOFSF_MR122 18
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 prmno[];
+    extern const Word16 prmnofsf[];
+    extern const Word16 bitno_MR475[];
+    extern const Word16 bitno_MR515[];
+    extern const Word16 bitno_MR59[];
+    extern const Word16 bitno_MR67[];
+    extern const Word16 bitno_MR74[];
+    extern const Word16 bitno_MR95[];
+    extern const Word16 bitno_MR102[];
+    extern const Word16 bitno_MR122[];
+    extern const Word16 bitno_MRDTX[];
+    extern const Word16 *const bitno[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitreorder_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitreorder_tab.h
new file mode 100644 (file)
index 0000000..48d8e08
--- /dev/null
@@ -0,0 +1,112 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: bitreorder_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a tables in bitreorder.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BITREORDER_H
+#define BITREORDER_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 numOfBits[];
+    extern const Word16 reorderBits_MR475[];
+    extern const Word16 reorderBits_MR515[];
+    extern const Word16 reorderBits_MR59[];
+    extern const Word16 reorderBits_MR67[];
+    extern const Word16 reorderBits_MR74[];
+    extern const Word16 reorderBits_MR795[];
+    extern const Word16 reorderBits_MR102[];
+    extern const Word16 reorderBits_MR122[];
+
+    extern const Word16 *const reorderBits[];
+    extern const Word16 numCompressedBytes[];
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h
new file mode 100644 (file)
index 0000000..f97beae
--- /dev/null
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: bytesused.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a table BytesUsed.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BYTESUSED_H
+#define BYTESUSED_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const short BytesUsed[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst.h
new file mode 100644 (file)
index 0000000..b648eb7
--- /dev/null
@@ -0,0 +1,129 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ INCLUDE DESCRIPTION
+
+ This file contains the Speech code (encoder, decoder, and postfilter)
+ constant parameters.
+
+ NOTE: This file must be synchronized with /gsm-amr/asm/include/cnst.inc file.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef _CNST_H_
+#define _CNST_H_
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define L_TOTAL      320       /* Total size of speech buffer.             */
+#define L_WINDOW     240       /* Window size in LP analysis               */
+#define L_FRAME      160       /* Frame size                               */
+#define L_FRAME_BY2  80        /* Frame size divided by 2                  */
+#define L_SUBFR      40        /* Subframe size                            */
+#define L_CODE       40        /* codevector length                        */
+#define NB_TRACK     5         /* number of tracks                         */
+#define STEP         5         /* codebook step size                       */
+#define NB_TRACK_MR102  4      /* number of tracks mode mr102              */
+#define STEP_MR102      4      /* codebook step size mode mr102            */
+#define M            10        /* Order of LP filter                       */
+#define MP1          (M+1)     /* Order of LP filter + 1                   */
+#define LSF_GAP      205       /* Minimum distance between LSF after quan- */
+    /* tization; 50 Hz = 205                    */
+#define LSP_PRED_FAC_MR122 21299 /* MR122 LSP prediction factor (0.65 Q15) */
+#define AZ_SIZE       (4*M+4)  /* Size of array of LP filters in 4 subfr.s */
+#define PIT_MIN_MR122 18       /* Minimum pitch lag (MR122 mode)           */
+#define PIT_MIN       20       /* Minimum pitch lag (all other modes)      */
+#define PIT_MAX       143      /* Maximum pitch lag                        */
+#define L_INTERPOL    (10+1)   /* Length of filter for interpolation       */
+#define L_INTER_SRCH  4        /* Length of filter for CL LTP search       */
+    /* interpolation                            */
+
+#define MU       26214         /* Factor for tilt compensation filter 0.8  */
+#define AGC_FAC  29491         /* Factor for automatic gain control 0.9    */
+
+#define L_NEXT       40        /* Overhead in LP analysis                  */
+#define SHARPMAX  13017        /* Maximum value of pitch sharpening        */
+#define SHARPMIN  0            /* Minimum value of pitch sharpening        */
+
+
+#define MAX_PRM_SIZE    57     /* max. num. of params                      */
+#define MAX_SERIAL_SIZE 244    /* max. num. of serial bits                 */
+
+#define GP_CLIP   15565        /* Pitch gain clipping = 0.95               */
+#define N_FRAME   7            /* old pitch gains in average calculation   */
+
+#define EHF_MASK 0x0008        /* encoder homing frame pattern             */
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _CNST_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst_vad.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst_vad.h
new file mode 100644 (file)
index 0000000..6877a1b
--- /dev/null
@@ -0,0 +1,133 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+**-------------------------------------------------------------------------**
+**                                                                         **
+**     GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001       **
+**                               R99   Version 3.2.0                       **
+**                               REL-4 Version 4.0.0                       **
+**                                                                         **
+**-------------------------------------------------------------------------**
+********************************************************************************
+*
+*      File             : cnst_vad.h
+*      Purpose          : Constants and definitions for VAD
+*
+********************************************************************************
+*/
+#ifndef cnst_vad_h
+#define cnst_vad_h "$Id $"
+
+#define FRAME_LEN 160    /* Length (samples) of the input frame          */
+#define COMPLEN 9        /* Number of sub-bands used by VAD              */
+#define INV_COMPLEN 3641 /* 1.0/COMPLEN*2^15                             */
+#define LOOKAHEAD 40     /* length of the lookahead used by speech coder */
+
+#define UNITY 512        /* Scaling used with SNR calculation            */
+#define UNIRSHFT 6       /* = log2(MAX_16/UNITY)                         */
+
+#define TONE_THR (Word16)(0.65*MAX_16) /* Threshold for tone detection   */
+
+/* Constants for background spectrum update */
+#define ALPHA_UP1   (Word16)((1.0 - 0.95)*MAX_16)  /* Normal update, upwards:   */
+#define ALPHA_DOWN1 (Word16)((1.0 - 0.936)*MAX_16) /* Normal update, downwards  */
+#define ALPHA_UP2   (Word16)((1.0 - 0.985)*MAX_16) /* Forced update, upwards    */
+#define ALPHA_DOWN2 (Word16)((1.0 - 0.943)*MAX_16) /* Forced update, downwards  */
+#define ALPHA3      (Word16)((1.0 - 0.95)*MAX_16)  /* Update downwards          */
+#define ALPHA4      (Word16)((1.0 - 0.9)*MAX_16)   /* For stationary estimation */
+#define ALPHA5      (Word16)((1.0 - 0.5)*MAX_16)   /* For stationary estimation */
+
+/* Constants for VAD threshold */
+#define VAD_THR_HIGH 1260 /* Highest threshold                 */
+#define VAD_THR_LOW  720  /* Lowest threshold                  */
+#define VAD_P1 0          /* Noise level for highest threshold */
+#define VAD_P2 6300       /* Noise level for lowest threshold  */
+#define VAD_SLOPE (Word16)(MAX_16*(float)(VAD_THR_LOW-VAD_THR_HIGH)/(float)(VAD_P2-VAD_P1))
+
+/* Parameters for background spectrum recovery function */
+#define STAT_COUNT 20         /* threshold of stationary detection counter         */
+#define STAT_COUNT_BY_2 10    /* threshold of stationary detection counter         */
+#define CAD_MIN_STAT_COUNT 5  /* threshold of stationary detection counter         */
+
+#define STAT_THR_LEVEL 184    /* Threshold level for stationarity detection        */
+#define STAT_THR 1000         /* Threshold for stationarity detection              */
+
+/* Limits for background noise estimate */
+#define NOISE_MIN 40          /* minimum */
+#define NOISE_MAX 16000       /* maximum */
+#define NOISE_INIT 150        /* initial */
+
+/* Constants for VAD hangover addition */
+#define HANG_NOISE_THR 100
+#define BURST_LEN_HIGH_NOISE 4
+#define HANG_LEN_HIGH_NOISE 7
+#define BURST_LEN_LOW_NOISE 5
+#define HANG_LEN_LOW_NOISE 4
+
+/* Thresholds for signal power */
+#define VAD_POW_LOW (Word32)15000     /* If input power is lower,                    */
+/*     VAD is set to 0                         */
+#define POW_PITCH_THR (Word32)343040  /* If input power is lower, pitch              */
+/*     detection is ignored                    */
+
+#define POW_COMPLEX_THR (Word32)15000 /* If input power is lower, complex            */
+/* flags  value for previous frame  is un-set  */
+
+
+/* Constants for the filter bank */
+#define LEVEL_SHIFT 0      /* scaling                                  */
+#define COEFF3   13363     /* coefficient for the 3rd order filter     */
+#define COEFF5_1 21955     /* 1st coefficient the for 5th order filter */
+#define COEFF5_2 6390      /* 2nd coefficient the for 5th order filter */
+
+/* Constants for pitch detection */
+#define LTHRESH 4
+#define NTHRESH 4
+
+/* Constants for complex signal VAD  */
+#define CVAD_THRESH_ADAPT_HIGH  (Word16)(0.6 * MAX_16) /* threshold for adapt stopping high    */
+#define CVAD_THRESH_ADAPT_LOW  (Word16)(0.5 * MAX_16)  /* threshold for adapt stopping low     */
+#define CVAD_THRESH_IN_NOISE  (Word16)(0.65 * MAX_16)  /* threshold going into speech on       */
+/* a short term basis                   */
+
+#define CVAD_THRESH_HANG  (Word16)(0.70 * MAX_16)      /* threshold                            */
+#define CVAD_HANG_LIMIT  (Word16)(100)                 /* 2 second estimation time             */
+#define CVAD_HANG_LENGTH  (Word16)(250)                /* 5 second hangover                    */
+
+#define CVAD_LOWPOW_RESET (Word16) (0.40 * MAX_16)     /* init in low power segment            */
+#define CVAD_MIN_CORR (Word16) (0.40 * MAX_16)         /* lowest adaptation value              */
+
+#define CVAD_BURST 20                                  /* speech burst length for speech reset */
+#define CVAD_ADAPT_SLOW (Word16)(( 1.0 - 0.98) * MAX_16)        /* threshold for slow adaption */
+#define CVAD_ADAPT_FAST (Word16)((1.0 - 0.92) * MAX_16)         /* threshold for fast adaption */
+#define CVAD_ADAPT_REALLY_FAST (Word16)((1.0 - 0.80) * MAX_16)  /* threshold for really fast   */
+/* adaption                    */
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_c.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_c.h
new file mode 100644 (file)
index 0000000..99c2540
--- /dev/null
@@ -0,0 +1,118 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: d_gain_c.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File          : d_gain_c.h
+      Purpose       : Decode the fixed codebook gain using the received index.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _D_GAIN_C_H_
+#define _D_GAIN_C_H_
+#define d_gain_c_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "gc_pred.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    /*
+     *  Function    : d_gain_code
+     *  Purpose     : Decode the fixed codebook gain using the received index.
+     *  Description : The received index gives the gain correction factor
+     *                gamma. The quantized gain is given by   g_q = g0 * gamma
+     *                where g0 is the predicted gain. To find g0, 4th order
+     *                MA prediction is applied to the mean-removed innovation
+     *                energy in dB.
+     *  Returns     : void
+     */
+    void d_gain_code(
+        gc_predState *pred_state, /* i/o : MA predictor state               */
+        enum Mode mode,           /* i   : AMR mode                         */
+        Word16 index,             /* i   : received quantization index      */
+        Word16 code[],            /* i   : innovation codevector            */
+        const Word16* qua_gain_code_ptr, /* i : Pointer to read-only table      */
+        Word16 *gain_code,        /* o   : decoded innovation gain          */
+        Flag   *pOverflow
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _D_GAIN_C_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_p.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_p.h
new file mode 100644 (file)
index 0000000..04babd9
--- /dev/null
@@ -0,0 +1,81 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : d_gain_p.h
+*      Purpose          : Decodes the pitch gain using the received index.
+*
+********************************************************************************
+*/
+#ifndef d_gain_p_h
+#define d_gain_p_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+#include "mode.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : d_gain_pitch
+    *  Purpose     : Decodes the pitch gain using the received index.
+    *  Description : In case of no frame erasure, the gain is obtained
+    *                from the quantization table at the given index;
+    *                otherwise, a downscaled past gain is used.
+    *  Returns     : Quantized pitch gain
+    *
+    **************************************************************************
+    */
+    Word16 d_gain_pitch(       /* return value: gain (Q14)                */
+        enum Mode mode,        /* i : AMR mode                            */
+        Word16 index,          /* i   : index of quantization             */
+        const Word16* qua_gain_pitch_ptr /* i : pointer to read-only tables   */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_plsf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_plsf.h
new file mode 100644 (file)
index 0000000..dbefcba
--- /dev/null
@@ -0,0 +1,190 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: d_plsf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the d_plsf_3.c and d_plsf_5.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef d_plsf_h
+#define d_plsf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "mode.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 past_r_q[M];   /* Past quantized prediction error, Q15 */
+        Word16 past_lsf_q[M]; /* Past dequantized lsfs,           Q15 */
+    } D_plsfState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : D_plsf_reset
+    *  Purpose     : Resets state memory
+    *  Returns     : 0 on success
+    *
+    **************************************************************************
+    */
+    Word16 D_plsf_reset(D_plsfState *st, const Word16* mean_lsf_5_ptr);
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : D_plsf_exit
+    *  Purpose     : The memory used for state memory is freed
+    *  Description : Stores NULL in *st
+    *  Returns     : void
+    *
+    **************************************************************************
+    */
+    void D_plsf_exit(D_plsfState **st);
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : D_plsf_5
+    *  Purpose     : Decodes the 2 sets of LSP parameters in a frame
+    *                using the received quantization indices.
+    *  Description : The two sets of LSFs are quantized using split by
+    *                5 matrix quantization (split-MQ) with 1st order MA
+    *                prediction.
+    *                See "q_plsf_5.c" for more details about the
+    *                quantization procedure
+    *  Returns     : 0
+    *
+    **************************************************************************
+    */
+    void D_plsf_5(
+        D_plsfState *st,  /* i/o: State variables                            */
+        Word16 bfi,       /* i  : bad frame indicator (set to 1 if a bad
+                              frame is received)                         */
+        Word16 *indice,   /* i  : quantization indices of 5 submatrices, Q0  */
+        CommonAmrTbls* common_amr_tbls, /* i : structure containing ptrs to read-only tables */
+        Word16 *lsp1_q,   /* o  : quantized 1st LSP vector (M)           Q15 */
+        Word16 *lsp2_q,   /* o  : quantized 2nd LSP vector (M)           Q15 */
+        Flag  *pOverflow  /* o : Flag set when overflow occurs               */
+    );
+
+    /*************************************************************************
+     *
+     *  FUNCTION:   D_plsf_3()
+     *
+     *  PURPOSE: Decodes the LSP parameters using the received quantization
+     *           indices.1st order MA prediction and split by 3 matrix
+     *           quantization (split-MQ)
+     *
+     *************************************************************************/
+
+    void D_plsf_3(
+        D_plsfState *st,  /* i/o: State struct                               */
+        enum Mode mode,   /* i  : coder mode                                 */
+        Word16 bfi,       /* i  : bad frame indicator (set to 1 if a         */
+        /*      bad frame is received)                     */
+        Word16 * indice,  /* i  : quantization indices of 3 submatrices, Q0  */
+        CommonAmrTbls* common_amr_tbls, /* i : structure containing ptrs to read-only tables */
+        Word16 * lsp1_q,  /* o  : quantized 1st LSP vector,              Q15 */
+        Flag  *pOverflow  /* o : Flag set when overflow occurs               */
+    );
+
+    /*************************************************************************
+     *
+     *  FUNCTION:   Init_D_plsf_3()
+     *
+     *  PURPOSE: Set the past_r_q[M] vector to one of the eight
+     *           past_rq_init vectors.
+     *
+     *************************************************************************/
+    void Init_D_plsf_3(D_plsfState *st,  /* i/o: State struct                */
+                       Word16 index,     /* i  : past_rq_init[] index [0, 7] */
+                       const Word16* past_rq_init_ptr /* ptr to read-only table */
+                      );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Q_PLSF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_s.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_s.h
new file mode 100644 (file)
index 0000000..98aa0f9
--- /dev/null
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: div_s.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the div_s function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef DIV_S_H
+#define DIV_S_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF Word16 div_s(Word16 var1, Word16 var2);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/dtx_common_def.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/dtx_common_def.h
new file mode 100644 (file)
index 0000000..0daa965
--- /dev/null
@@ -0,0 +1,96 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: dtx_common_def.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+    File             : dtx_common_def.h
+    Purpose          : DTX definitions common to encoder and decoder
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef DTX_COMMON_DEF_H
+#define DTX_COMMON_DEF_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define DTX_MAX_EMPTY_THRESH 50
+#define DTX_HIST_SIZE 8
+#define DTX_ELAPSED_FRAMES_THRESH (24 + 7 -1)
+#define DTX_HANG_CONST 7             /* yields eight frames of SP HANGOVER  */
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DTX_COMMON_DEF_H */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame.h
new file mode 100644 (file)
index 0000000..1d0c6c1
--- /dev/null
@@ -0,0 +1,114 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+*****************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+*****************************************************************************
+*
+*      File             : frame.h
+*      Purpose          : Declaration of received and transmitted frame types
+*
+*****************************************************************************
+*/
+#ifndef frame_h
+#define frame_h "$Id $"
+
+/*
+*****************************************************************************
+*                         INCLUDE FILES
+*****************************************************************************
+*/
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    *****************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    *****************************************************************************
+    * Note: The order of the TX and RX_Type identifiers has been chosen in
+    *       the way below to be compatible to an earlier version of the
+    *       AMR-NB C reference program.
+    *****************************************************************************
+    */
+
+    enum RXFrameType { RX_SPEECH_GOOD = 0,
+        RX_SPEECH_DEGRADED,
+        RX_ONSET,
+        RX_SPEECH_BAD,
+        RX_SID_FIRST,
+        RX_SID_UPDATE,
+        RX_SID_BAD,
+        RX_NO_DATA,
+        RX_N_FRAMETYPES     /* number of frame types */
+    };
+
+    enum TXFrameType { TX_SPEECH_GOOD = 0,
+                       TX_SID_FIRST,
+                       TX_SID_UPDATE,
+                       TX_NO_DATA,
+                       TX_SPEECH_DEGRADED,
+                       TX_SPEECH_BAD,
+                       TX_SID_BAD,
+                       TX_ONSET,
+                       TX_N_FRAMETYPES     /* number of frame types */
+                     };
+
+
+    /* Channel decoded frame type */
+    enum CHDECFrameType { CHDEC_SID_FIRST = 0,
+                          CHDEC_SID_FIRST_INCOMPLETE,
+                          CHDEC_SID_UPDATE_INCOMPLETE,
+                          CHDEC_SID_UPDATE,
+                          CHDEC_SPEECH,
+                          CHDEC_SPEECH_ONSET,
+                          CHDEC_ESCAPE_MARKER,
+                          CHDEC_ESCAPE_DATA,
+                          CHDEC_NO_DATA
+                        };
+
+    /* Channel decoded frame quality */
+    enum CHDECFrameQuality { CHDEC_GOOD = 0,
+                             CHDEC_PROBABLY_DEGRADED,
+                             CHDEC_PROBABLY_BAD,
+                             CHDEC_BAD
+                           };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame_type_3gpp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame_type_3gpp.h
new file mode 100644 (file)
index 0000000..f82ec46
--- /dev/null
@@ -0,0 +1,113 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: frame_type_3gpp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the definition of the 3GPP frame types.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef FRAME_TYPE_3GPP_H
+#define FRAME_TYPE_3GPP_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    enum Frame_Type_3GPP
+    {
+        AMR_475 = 0,
+        AMR_515,
+        AMR_59,
+        AMR_67,
+        AMR_74,
+        AMR_795,
+        AMR_102,
+        AMR_122,
+        AMR_SID,
+        GSM_EFR_SID,
+        TDMA_EFR_SID,
+        PDC_EFR_SID,
+        FOR_FUTURE_USE1,
+        FOR_FUTURE_USE2,
+        FOR_FUTURE_USE3,
+        AMR_NO_DATA
+    };
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* _FRAME_TYPE_3GPP_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gc_pred.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gc_pred.h
new file mode 100644 (file)
index 0000000..f2c1f55
--- /dev/null
@@ -0,0 +1,166 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: gc_pred.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : gc_pred.h
+      Purpose          : codebook gain MA prediction
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _GC_PRED_H_
+#define _GC_PRED_H_
+#define gc_pred_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 past_qua_en[4];         /* normal MA predictor memory,         Q10 */
+        /* (contains 20*log10(qua_err))            */
+        Word16 past_qua_en_MR122[4];   /* MA predictor memory for MR122 mode, Q10 */
+        /* (contains log2(qua_err))                */
+    } gc_predState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    OSCL_IMPORT_REF Word16 gc_pred_reset(gc_predState *st);
+    /* reset of codebook gain MA predictor state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+    void gc_pred_exit(gc_predState **st);
+    /* de-initialize codebook gain MA predictor state (i.e. free state struct)
+       stores NULL in *st
+     */
+
+    void
+    gc_pred_copy(
+        gc_predState *st_src,  /* i : State struct                           */
+        gc_predState *st_dest  /* o : State struct                           */
+    );
+
+    /*
+     * FUNCTION:  gc_pred()
+     * PURPOSE: MA prediction of the innovation energy
+     *          (in dB/(20*log10(2))) with mean  removed).
+     */
+    OSCL_IMPORT_REF void gc_pred(
+        gc_predState *st,   /* i/o: State struct                           */
+        enum Mode mode,     /* i  : AMR mode                               */
+        Word16 *code,       /* i  : innovative codebook vector (L_SUBFR)   */
+        /*      MR122: Q12, other modes: Q13           */
+        Word16 *exp_gcode0, /* o  : exponent of predicted gain factor, Q0  */
+        Word16 *frac_gcode0,/* o  : fraction of predicted gain factor  Q15 */
+        Word16 *exp_en,     /* o  : exponent of innovation energy,     Q0  */
+        /*      (only calculated for MR795)            */
+        Word16 *frac_en,    /* o  : fraction of innovation energy,     Q15 */
+        /*      (only calculated for MR795)            */
+        Flag   *pOverflow
+    );
+
+    /*
+     * FUNCTION:  gc_pred_update()
+     * PURPOSE: update MA predictor with last quantized energy
+     */
+    OSCL_IMPORT_REF void gc_pred_update(
+        gc_predState *st,      /* i/o: State struct                     */
+        Word16 qua_ener_MR122, /* i  : quantized energy for update, Q10 */
+        /*      (log2(qua_err))                  */
+        Word16 qua_ener        /* i  : quantized energy for update, Q10 */
+        /*      (20*log10(qua_err))              */
+    );
+
+    /*
+     * FUNCTION:  gc_pred_average_limited()
+     * PURPOSE: get average of MA predictor state values (with a lower limit)
+     *          [used in error concealment]
+     */
+    OSCL_IMPORT_REF void gc_pred_average_limited(
+        gc_predState *st,       /* i: State struct                    */
+        Word16 *ener_avg_MR122, /* o: averaged quantized energy,  Q10 */
+        /*    (log2(qua_err))                 */
+        Word16 *ener_avg,       /* o: averaged quantized energy,  Q10 */
+        /*    (20*log10(qua_err))             */
+        Flag   *pOverflow
+    );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _GC_PRED_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/get_const_tbls.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/get_const_tbls.h
new file mode 100644 (file)
index 0000000..cb617b5
--- /dev/null
@@ -0,0 +1,72 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+#ifndef GET_CONST_TBLS_H
+#define GET_CONST_TBLS_H
+
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+    typedef struct
+    {
+        const Word16* dgray_ptr;
+        const Word16* dico1_lsf_3_ptr;
+        const Word16* dico1_lsf_5_ptr;
+        const Word16* dico2_lsf_3_ptr;
+        const Word16* dico2_lsf_5_ptr;
+        const Word16* dico3_lsf_3_ptr;
+        const Word16* dico3_lsf_5_ptr;
+        const Word16* dico4_lsf_5_ptr;
+        const Word16* dico5_lsf_5_ptr;
+        const Word16* gray_ptr;
+        const Word16* lsp_init_data_ptr;
+        const Word16* mean_lsf_3_ptr;
+        const Word16* mean_lsf_5_ptr;
+        const Word16* mr515_3_lsf_ptr;
+        const Word16* mr795_1_lsf_ptr;
+        const Word16* past_rq_init_ptr;
+        const Word16* pred_fac_3_ptr;
+        const Word16* qua_gain_code_ptr;
+        const Word16* qua_gain_pitch_ptr;
+        const Word16* startPos_ptr;
+        const Word16* table_gain_lowrates_ptr;
+        const Word16* table_gain_highrates_ptr;
+        const Word16* prmno_ptr;
+        const Word16* const* bitno_ptr;
+        const Word16* numOfBits_ptr;
+        const Word16* const* reorderBits_ptr;
+        const Word16* numCompressedBytes_ptr;
+        const Word16* window_200_40_ptr;
+        const Word16* window_160_80_ptr;
+        const Word16* window_232_8_ptr;
+        const Word16* ph_imp_low_MR795_ptr;
+        const Word16* ph_imp_mid_MR795_ptr;
+        const Word16* ph_imp_low_ptr;
+        const Word16* ph_imp_mid_ptr;
+    } CommonAmrTbls;
+
+    OSCL_IMPORT_REF void get_const_tbls(CommonAmrTbls* tbl_struct_ptr);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gmed_n.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gmed_n.h
new file mode 100644 (file)
index 0000000..49f4c51
--- /dev/null
@@ -0,0 +1,80 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : gmed_n.h
+*      Purpose          : calculates N-point median.
+*
+********************************************************************************
+*/
+#ifndef gmed_n_h
+#define gmed_n_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    ********************************************************************************
+    */
+
+    /*
+    ********************************************************************************
+    *                         DECLARATION OF PROTOTYPES
+    ********************************************************************************
+    */
+    OSCL_IMPORT_REF Word16 gmed_n(    /* o : index of the median value (0...N-1)      */
+        Word16 ind[], /* i : Past gain values                         */
+        Word16 n      /* i : The number of gains; this routine        */
+        /*     is only valid for a odd number of gains  */
+    );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gsm_amr_typedefs.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gsm_amr_typedefs.h
new file mode 100644 (file)
index 0000000..465e705
--- /dev/null
@@ -0,0 +1,147 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: gsm_amr_typedefs.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the definition of the amr codec types.
+
+------------------------------------------------------------------------------
+*/
+#ifndef GSM_AMR_TYPEDEFS_H
+#define GSM_AMR_TYPEDEFS_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include    "oscl_base.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+#ifndef Word8
+typedef int8        Word8;
+#endif
+
+#ifndef UWord8
+typedef uint8       UWord8;
+#endif
+
+
+/*----------------------------------------------------------------------------
+; Define 16 bit signed and unsigned words
+----------------------------------------------------------------------------*/
+
+#ifndef Word16
+typedef int16       Word16;
+
+#endif
+
+#ifndef UWord16
+typedef uint16      UWord16;
+
+#endif
+
+/*----------------------------------------------------------------------------
+; Define 32 bit signed and unsigned words
+----------------------------------------------------------------------------*/
+
+#ifndef Word32
+typedef int32       Word32;
+#endif
+
+#ifndef UWord32
+typedef uint32      UWord32;
+#endif
+
+
+/*----------------------------------------------------------------------------
+; Define boolean type
+----------------------------------------------------------------------------*/
+#ifndef Bool
+typedef int     Bool;
+#endif
+
+#ifndef FALSE
+#define FALSE       0
+#endif
+
+#ifndef TRUE
+#define TRUE        1
+#endif
+
+#ifndef OFF
+#define OFF     0
+#endif
+
+#ifndef ON
+#define ON      1
+#endif
+
+#ifndef NO
+#define NO      0
+#endif
+
+#ifndef YES
+#define YES     1
+#endif
+
+#ifndef SUCCESS
+#define SUCCESS     0
+#endif
+
+#ifndef  NULL
+#define  NULL       0
+#endif
+
+#ifndef Flag
+typedef int32     Flag;
+#endif
+
+#endif   /*  GSM_AMR_TYPEDEFS_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lpc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lpc.h
new file mode 100644 (file)
index 0000000..3f241cb
--- /dev/null
@@ -0,0 +1,201 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: int_lpc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsp_avg.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef int_lpc_h
+#define int_lpc_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : Int_lpc_1and3
+    *  Purpose     : Interpolates the LSPs and converts to LPC parameters
+    *                to get a different LP filter in each subframe.
+    *  Description : The 20 ms speech frame is divided into 4 subframes.
+    *                The LSPs are quantized and transmitted at the 2nd and
+    *                4th subframes (twice per frame) and interpolated at the
+    *                1st and 3rd subframe.
+    *
+    *                      |------|------|------|------|
+    *                         sf1    sf2    sf3    sf4
+    *                   F0            Fm            F1
+    *
+    *                 sf1:   1/2 Fm + 1/2 F0         sf3:   1/2 F1 + 1/2 Fm
+    *                 sf2:       Fm                  sf4:       F1
+    *  Returns     : void
+    *
+    **************************************************************************
+    */
+    OSCL_IMPORT_REF void Int_lpc_1and3(
+        Word16 lsp_old[],  /* i : LSP vector at the 4th subfr. of past frame (M) */
+        Word16 lsp_mid[],  /* i : LSP vector at the 2nd subfr. of
+                              present frame (M)                              */
+        Word16 lsp_new[],  /* i : LSP vector at the 4th subfr. of
+                              present frame (M)                              */
+        Word16 Az[],       /* o : interpolated LP parameters in all subfr.
+                              (AZ_SIZE)                                      */
+        Flag   *pOverflow
+    );
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : Int_lpc_1and3_2
+    *  Purpose     : Interpolation of the LPC parameters. Same as the Int_lpc
+    *                function but we do not recompute Az() for subframe 2 and
+    *                4 because it is already available.
+    *  Returns     : void
+    *
+    **************************************************************************
+    */
+    void Int_lpc_1and3_2(
+        Word16 lsp_old[],  /* i : LSP vector at the 4th subfr. of past frame (M) */
+        Word16 lsp_mid[],  /* i : LSP vector at the 2nd subframe of
+                             present frame (M)                                  */
+        Word16 lsp_new[],  /* i : LSP vector at the 4th subframe of
+                             present frame (M)                                  */
+        Word16 Az[],       /* o :interpolated LP parameters
+                             in subframes 1 and 3 (AZ_SIZE)                     */
+        Flag   *pOverflow
+    );
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : Int_lpc_1to3
+    *  Purpose     : Interpolates the LSPs and converts to LPC parameters
+    *                to get a different LP filter in each subframe.
+    *  Description : The 20 ms speech frame is divided into 4 subframes.
+    *                The LSPs are quantized and transmitted at the 4th
+    *                subframes (once per frame) and interpolated at the
+    *                1st, 2nd and 3rd subframe.
+    *
+    *                      |------|------|------|------|
+    *                         sf1    sf2    sf3    sf4
+    *                   F0                          F1
+    *
+    *                 sf1:   3/4 F0 + 1/4 F1         sf3:   1/4 F0 + 3/4 F1
+    *                 sf2:   1/2 F0 + 1/2 F1         sf4:       F1
+    *  Returns     : void
+    *
+    **************************************************************************
+    */
+    OSCL_IMPORT_REF void Int_lpc_1to3(
+        Word16 lsp_old[], /* i : LSP vector at the 4th SF of past frame (M)      */
+        Word16 lsp_new[], /* i : LSP vector at the 4th SF of present frame (M)   */
+        Word16 Az[],      /* o : interpolated LP parameters in all SFs (AZ_SIZE) */
+        Flag   *pOverflow
+    );
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : Int_lpc_1to3_2
+    *  Purpose     : Interpolation of the LPC parameters. Same as the Int_lpc
+    *                function but we do not recompute Az() for subframe 4
+    *                because it is already available.
+    *  Returns     : void
+    *
+    **************************************************************************
+    */
+    void Int_lpc_1to3_2(
+        Word16 lsp_old[],  /* i : LSP vector at the 4th SF of past frame (M) */
+        Word16 lsp_new[],  /* i : LSP vector at the 4th SF present frame (M) */
+        Word16 Az[],       /* o :interpolated LP parameters in SFs 1, 2, 3
+                             (AZ_SIZE)                                   */
+        Flag   *pOverflow
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INT_LPC_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lsf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lsf.h
new file mode 100644 (file)
index 0000000..2ee9e71
--- /dev/null
@@ -0,0 +1,105 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: int_lsf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the int_lsf function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef int_lsf_h
+#define int_lsf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void Int_lsf(
+        Word16 lsf_old[], /* i : LSF vector at the 4th SF of past frame         */
+        Word16 lsf_new[], /* i : LSF vector at the 4th SF of present frame      */
+        Word16 i_subfr,   /* i : Current sf (equal to 0,40,80 or 120)           */
+        Word16 lsf_out[], /* o : interpolated LSF parameters for current sf     */
+        Flag  *pOverflow  /* o : flag set if overflow occurs                    */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INT_LSF_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/inv_sqrt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/inv_sqrt.h
new file mode 100644 (file)
index 0000000..937a417
--- /dev/null
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: inv_sqrt.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the inv_sqrt() function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef INV_SQRT_H
+#define INV_SQRT_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 inv_sqrt_tbl[];
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF Word32 Inv_sqrt(        /* (o) : output value   */
+        Word32 L_x,         /* (i) : input value    */
+        Flag   *pOverflow  /* (i) : pointer to overflow flag */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INV_SQRT_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h
new file mode 100644 (file)
index 0000000..ac72c31
--- /dev/null
@@ -0,0 +1,137 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_add.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_add function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_ADD_H
+#define L_ADD_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
+    __inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
+    {
+        register Word32 ra = L_var1;
+        register Word32 rb = L_var2;
+        Word32 result;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        asm volatile("qadd %0, %1, %2"
+             : "=r"(result)
+                             : "r"(ra), "r"(rb)
+                            );
+        return (result);
+
+    }
+
+#else /* C EQUIVALENT */
+
+
+    static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
+    {
+        Word32 L_sum;
+
+        L_sum = L_var1 + L_var2;
+
+        if ((L_var1 ^ L_var2) >= 0)
+        {
+            if ((L_sum ^ L_var1) < 0)
+            {
+                L_sum = (L_var1 < 0) ? MIN_32 : MAX_32;
+                *pOverflow = 1;
+            }
+        }
+
+        return (L_sum);
+    }
+
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_ADD_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add_c.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add_c.h
new file mode 100644 (file)
index 0000000..7af7cdc
--- /dev/null
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_add_c.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_add_c function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_ADD_C_H
+#define L_ADD_C_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word32 L_add_c(Word32 L_var1, Word32 L_var2, Flag *pOverflow, Flag *pCarry);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_ADD_C_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_comp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_comp.h
new file mode 100644 (file)
index 0000000..7738ad2
--- /dev/null
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_comp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_comp function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_COMP_H
+#define L_COMP_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include        "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word32 L_Comp(Word16 hi, Word16 lo, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_extract.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_extract.h
new file mode 100644 (file)
index 0000000..2816f83
--- /dev/null
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_extract.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_extract function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_EXTRACT_H
+#define L_EXTRACT_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include        "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void L_Extract(Word32 L_var,
+    Word16 *pL_var_hi,
+    Word16 *pL_var_lo,
+    Flag   *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_EXTRACT_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h
new file mode 100644 (file)
index 0000000..f672428
--- /dev/null
@@ -0,0 +1,152 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_mac.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_mac function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_MAC_H
+#define L_MAC_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
+
+    static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        register Word32 ra = L_var3;
+        register Word32 rb = var1;
+        register Word32 rc = var2;
+        Word32 result;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        asm volatile("smulbb %0, %1, %2"
+             : "=r"(result)
+                             : "r"(rb), "r"(rc)
+                            );
+
+        asm volatile("qdadd %0, %1, %2"
+             : "=r"(rc)
+                             : "r"(ra), "r"(result)
+                            );
+
+        return (rc);
+    }
+
+#else /* C_EQUIVALENT */
+
+    __inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        Word32 result;
+        Word32 L_sum;
+        result = (Word32) var1 * var2;
+        if (result != (Word32) 0x40000000L)
+        {
+            L_sum = (result << 1) + L_var3;
+
+            /* Check if L_sum and L_var_3 share the same sign */
+            if ((L_var3 ^ result) > 0)
+            {
+                if ((L_sum ^ L_var3) < 0)
+                {
+                    L_sum = (L_var3 < 0) ? MIN_32 : MAX_32;
+                    *pOverflow = 1;
+                }
+            }
+        }
+        else
+        {
+            *pOverflow = 1;
+            L_sum = MAX_32;
+        }
+        return (L_sum);
+    }
+
+#endif
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_MAC_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h
new file mode 100644 (file)
index 0000000..86c5735
--- /dev/null
@@ -0,0 +1,137 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_msu.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_msu function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_MSU_H
+#define L_MSU_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+#include    "l_mult.h"
+#include    "l_sub.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
+
+    __inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        register Word32 ra = L_var3;
+        register Word32 rb = var1;
+        register Word32 rc = var2;
+        Word32 product;
+        Word32 result;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        asm volatile("smulbb %0, %1, %2"
+             : "=r"(product)
+                             : "r"(rb), "r"(rc)
+                            );
+
+        asm volatile("qdsub %0, %1, %2"
+             : "=r"(result)
+                             : "r"(ra), "r"(product)
+                            );
+
+        return (result);
+    }
+
+#else /* C EQUIVALENT */
+
+    static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        Word32 result;
+
+        result = L_mult(var1, var2, pOverflow);
+        result = L_sub(L_var3, result, pOverflow);
+
+        return (result);
+    }
+
+#endif
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_MSU_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h
new file mode 100644 (file)
index 0000000..33fedb1
--- /dev/null
@@ -0,0 +1,143 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_mult.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_mult function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_MULT_H
+#define L_MULT_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
+
+    __inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        register Word32 ra = var1;
+        register Word32 rb = var2;
+        Word32 result;
+        Word32 product;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        asm volatile("smulbb %0, %1, %2"
+             : "=r"(product)
+                             : "r"(ra), "r"(rb)
+                            );
+
+        asm volatile("qadd %0, %1, %2"
+             : "=r"(result)
+                             : "r"(product), "r"(product)
+                            );
+
+        return(result);
+    }
+
+#else /* C EQUIVALENT */
+
+    static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        register Word32 L_product;
+
+        L_product = (Word32) var1 * var2;
+
+        if (L_product != (Word32) 0x40000000L)
+        {
+            L_product <<= 1;          /* Multiply by 2 */
+        }
+        else
+        {
+            *pOverflow = 1;
+            L_product = MAX_32;
+        }
+
+        return (L_product);
+    }
+#endif
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_MULT_H */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_negate.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_negate.h
new file mode 100644 (file)
index 0000000..e406bb8
--- /dev/null
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_negate.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_negate function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_NEGATE_H
+#define L_NEGATE_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word32 L_negate(Word32 L_var1);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shl.h
new file mode 100644 (file)
index 0000000..5430bc7
--- /dev/null
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_shl.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_shl function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_SHL_H
+#define L_SHL_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word32 L_shl(Word32 L_var1, Word16 var2, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_SHL_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr.h
new file mode 100644 (file)
index 0000000..424c948
--- /dev/null
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_shr.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_shr function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_SHR_H
+#define L_SHR_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word32 L_shr(Word32 L_var1, Word16 var2, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_SHR_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr_r.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr_r.h
new file mode 100644 (file)
index 0000000..29d99da
--- /dev/null
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_shr_r.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_shr_r function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_SHR_R_H
+#define L_SHR_R_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF Word32 L_shr_r(Word32 L_var1, Word16 var2, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_SHR_R_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h
new file mode 100644 (file)
index 0000000..88d86ca
--- /dev/null
@@ -0,0 +1,141 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_sub.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_sub function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_SUB_H
+#define L_SUB_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC)) /* Instructions for ARM-linux cross-compiler*/
+
+    __inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
+    {
+        register Word32 ra = L_var1;
+        register Word32 rb = L_var2;
+        Word32 result;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        asm volatile("qsub %0, %1, %2"
+             : "=r"(result)
+                             : "r"(ra), "r"(rb)
+                            );
+
+        return (result);
+    }
+
+#else /* C EQUIVALENT */
+
+    static inline Word32 L_sub(register Word32 L_var1, register Word32 L_var2,
+                               register Flag *pOverflow)
+    {
+        Word32 L_diff;
+
+        L_diff = L_var1 - L_var2;
+
+        if ((L_var1 ^ L_var2) < 0)
+        {
+            if ((L_diff ^ L_var1) & MIN_32)
+            {
+                L_diff = (L_var1 < 0L) ? MIN_32 : MAX_32;
+                *pOverflow = 1;
+            }
+        }
+
+        return (L_diff);
+    }
+
+#endif
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_SUB_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2.h
new file mode 100644 (file)
index 0000000..ce27dba
--- /dev/null
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: log2.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the function prototype definition for Log2 function.
+
+------------------------------------------------------------------------------
+*/
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef LOG2_H
+#define LOG2_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "typedef.h"
+
+#include    "log2_norm.h"           /* Used by legacy files */
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF void Log2(
+        Word32 L_x,         /* (i) : input value                                */
+        Word16 *pExponent,  /* (o) : Integer part of Log2.   (range: 0<=val<=30)*/
+        Word16 *pFraction,  /* (o) : Fractional part of Log2. (range: 0<=val<1) */
+        Flag   *pOverflow   /* (i/o) : overflow flag                            */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LOG2_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2_norm.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2_norm.h
new file mode 100644 (file)
index 0000000..3b06244
--- /dev/null
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: log2_norm.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the prototype declaration for Log2_norm function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef LOG2_NORM_H
+#define LOG2_NORM_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 log2_tbl[];
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void Log2_norm(
+        Word32 L_x,        /* (i) : input value (normalized)                    */
+        Word16 exp,        /* (i) : norm_l (L_x)                                */
+        Word16 *exponent,  /* (o) : Integer part of Log2.   (range: 0<=val<=30) */
+        Word16 *fraction   /* (o) : Fractional part of Log2. (range: 0<=val<1)  */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LOG2_NORM_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsfwt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsfwt.h
new file mode 100644 (file)
index 0000000..cca36d4
--- /dev/null
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lsfwt.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsfwt.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef lsfwt_h
+#define lsfwt_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void Lsf_wt(
+        Word16 *lsf,          /* input : LSF vector                    */
+        Word16 *wf,           /* output: square of weighting factors   */
+        Flag   * pOverflow);  /* o : Flag set when overflow occurs     */
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LSF_WT_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp.h
new file mode 100644 (file)
index 0000000..99b6151
--- /dev/null
@@ -0,0 +1,173 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lsp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsp.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef lsp_h
+#define lsp_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "q_plsf.h"
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+
+        /* Past LSPs */
+        Word16 lsp_old[M];
+        Word16 lsp_old_q[M];
+
+        /* Quantization state */
+        Q_plsfState *qSt;
+
+    } lspState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    /*
+    **************************************************************************
+    *
+    *  Function    : lsp_init
+    *  Purpose     : Allocates memory and initializes state variables
+    *  Description : Stores pointer to filter status struct in *st. This
+    *                pointer has to be passed to lsp in each call.
+    *  Returns     : 0 on success
+    *
+    **************************************************************************
+    */
+    OSCL_IMPORT_REF Word16 lsp_init(lspState **st);
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : lsp_reset
+    *  Purpose     : Resets state memory
+    *  Returns     : 0 on success
+    *
+    **************************************************************************
+    */
+    OSCL_IMPORT_REF Word16 lsp_reset(lspState *st);
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : lsp_exit
+    *  Purpose     : The memory used for state memory is freed
+    *  Description : Stores NULL in *st
+    *
+    **************************************************************************
+    */
+    OSCL_IMPORT_REF void lsp_exit(lspState **st);
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : lsp
+    *  Purpose     : Conversion from LP coefficients to LSPs.
+    *                Quantization of LSPs.
+    *  Description : Generates 2 sets of LSPs from 2 sets of
+    *                LP coefficients for mode 12.2. For the other
+    *                modes 1 set of LSPs is generated from 1 set of
+    *                LP coefficients. These LSPs are quantized with
+    *                Matrix/Vector quantization (depending on the mode)
+    *                and interpolated for the subframes not yet having
+    *                their own LSPs.
+    *
+    **************************************************************************
+    */
+    OSCL_IMPORT_REF void lsp(lspState *st,  /* i/o : State struct                 */
+                             enum Mode req_mode, /* i   : requested coder mode                    */
+                             enum Mode used_mode,/* i   : used coder mode                         */
+                             Word16 az[],        /* i/o : interpolated LP parameters Q12          */
+                             Word16 azQ[],       /* o   : quantization interpol. LP parameters Q12*/
+                             Word16 lsp_new[],   /* o   : new lsp vector                          */
+                             Word16 **anap,      /* o   : analysis parameters                     */
+                             Flag   *pOverflow   /* o   : Flag set when overflow occurs           */
+                            );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LSP_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_az.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_az.h
new file mode 100644 (file)
index 0000000..fb3d248
--- /dev/null
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lsp_az.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsp_az function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef LSP_AZ_H
+#define LSP_AZ_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF void Lsp_Az(
+        Word16 lsp[],        /* (i)  : line spectral frequencies            */
+        Word16 a[],          /* (o)  : predictor coefficients (order = 10)  */
+        Flag  *pOverflow     /* (o)  : overflow flag                        */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LSP_AZ_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_lsf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_lsf.h
new file mode 100644 (file)
index 0000000..ac7fca0
--- /dev/null
@@ -0,0 +1,111 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: lsp_lsf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsp_lsf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef lsp_lsf_h
+#define lsp_lsf_h
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    OSCL_IMPORT_REF void Lsf_lsp(
+        Word16 lsf[],      /* (i)    : lsf[m] normalized (range: 0.0<=val<=0.5) */
+        Word16 lsp[],      /* (o)    : lsp[m] (range: -1<=val<1)                */
+        Word16 m,          /* (i)    : LPC order                                */
+        Flag  *pOverflow   /* (o)    : Flag set when overflow occurs            */
+    );
+    OSCL_IMPORT_REF void Lsp_lsf(
+        Word16 lsp[],      /* (i)    : lsp[m] (range: -1<=val<1)                */
+        Word16 lsf[],      /* (o)    : lsf[m] normalized (range: 0.0<=val<=0.5) */
+        Word16 m,          /* (i)    : LPC order                                */
+        Flag  *pOverflow   /* (o)    : Flag set when overflow occurs            */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LSP_LSF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_tab.h
new file mode 100644 (file)
index 0000000..db3cd52
--- /dev/null
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lsp_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a table lsp_init_data.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef LSP_TAB_H
+#define LSP_TAB_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 lsp_init_data[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mac_32.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mac_32.h
new file mode 100644 (file)
index 0000000..b79a84f
--- /dev/null
@@ -0,0 +1,136 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mac_32.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the Mac_32 and Mac_32_16 functions
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef MAC_32_H
+#define MAC_32_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    static inline Word32 Mac_32(Word32 L_var3,
+    Word16 L_var1_hi,
+    Word16 L_var1_lo,
+    Word16 L_var2_hi,
+    Word16 L_var2_lo,
+    Flag *pOverflow)
+    {
+        Word16  product;
+
+        L_var3 = L_mac(L_var3, L_var1_hi, L_var2_hi, pOverflow);
+
+        product = mult(L_var1_hi, L_var2_lo, pOverflow);
+        L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+        product = mult(L_var1_lo, L_var2_hi, pOverflow);
+        L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+        return (L_var3);
+    }
+
+    static inline Word32 Mac_32_16(Word32 L_var3,
+                                   Word16 L_var1_hi,
+                                   Word16 L_var1_lo,
+                                   Word16 var2,
+                                   Flag  *pOverflow)
+    {
+        Word16  product;
+
+        L_var3 = L_mac(L_var3, L_var1_hi, var2, pOverflow);
+
+        product = mult(L_var1_lo, var2, pOverflow);
+        L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+        return (L_var3);
+    }
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MAC_32_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mode.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mode.h
new file mode 100644 (file)
index 0000000..75f86cb
--- /dev/null
@@ -0,0 +1,82 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : mode.h
+*      Purpose          : Declaration of mode type
+*
+********************************************************************************
+*/
+#ifndef mode_h
+#define mode_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    ********************************************************************************
+    */
+    enum Mode { MR475 = 0,
+        MR515,
+        MR59,
+        MR67,
+        MR74,
+        MR795,
+        MR102,
+        MR122,
+
+        MRDTX,
+
+        N_MODES     /* number of (SPC) modes */
+
+    };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h
new file mode 100644 (file)
index 0000000..8df43c9
--- /dev/null
@@ -0,0 +1,224 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mpy_32.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the Mpy_32 function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef MPY_32_H
+#define MPY_32_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
+
+    static inline Word32 Mpy_32(Word16 L_var1_hi,
+    Word16 L_var1_lo,
+    Word16 L_var2_hi,
+    Word16 L_var2_lo,
+    Flag   *pOverflow)
+    {
+        register Word32 product32;
+        register Word32 L_sum;
+        register Word32 L_product, result;
+        register Word32 ra = L_var1_hi;
+        register Word32 rb = L_var1_lo;
+        register Word32 rc = L_var2_hi;
+        register Word32 rd = L_var2_lo;
+
+
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        asm volatile("smulbb %0, %1, %2"
+             : "=r"(L_product)
+                             : "r"(ra), "r"(rc)
+                            );
+        asm volatile("mov %0, #0"
+             : "=r"(result)
+                    );
+
+        asm volatile("qdadd %0, %1, %2"
+             : "=r"(L_sum)
+                             : "r"(result), "r"(L_product)
+                            );
+
+        asm volatile("smulbb %0, %1, %2"
+             : "=r"(product32)
+                             : "r"(ra), "r"(rd)
+                            );
+
+        asm volatile("mov %0, %1, ASR #15"
+             : "=r"(ra)
+                             : "r"(product32)
+                            );
+        asm volatile("qdadd %0, %1, %2"
+             : "=r"(L_product)
+                             : "r"(L_sum), "r"(ra)
+                            );
+
+        asm volatile("smulbb %0, %1, %2"
+             : "=r"(product32)
+                             : "r"(rb), "r"(rc)
+                            );
+
+        asm volatile("mov %0, %1, ASR #15"
+             : "=r"(rb)
+                             : "r"(product32)
+                            );
+
+        asm volatile("qdadd %0, %1, %2"
+             : "=r"(L_sum)
+                             : "r"(L_product), "r"(rb)
+                            );
+
+        return (L_sum);
+    }
+
+#else /* C_EQUIVALENT */
+
+    __inline Word32 Mpy_32(Word16 L_var1_hi,
+                           Word16 L_var1_lo,
+                           Word16 L_var2_hi,
+                           Word16 L_var2_lo,
+                           Flag   *pOverflow)
+    {
+        Word32 L_product;
+        Word32 L_sum;
+        Word32 product32;
+
+        OSCL_UNUSED_ARG(pOverflow);
+        L_product = (Word32) L_var1_hi * L_var2_hi;
+
+        if (L_product != (Word32) 0x40000000L)
+        {
+            L_product <<= 1;
+        }
+        else
+        {
+            L_product = MAX_32;
+        }
+
+        /* result = mult (L_var1_hi, L_var2_lo, pOverflow); */
+        product32 = ((Word32) L_var1_hi * L_var2_lo) >> 15;
+
+        /* L_product = L_mac (L_product, result, 1, pOverflow); */
+        L_sum = L_product + (product32 << 1);
+
+        if ((L_product ^ product32) > 0)
+        {
+            if ((L_sum ^ L_product) < 0)
+            {
+                L_sum = (L_product < 0) ? MIN_32 : MAX_32;
+            }
+        }
+
+        L_product = L_sum;
+
+        /* result = mult (L_var1_lo, L_var2_hi, pOverflow); */
+        product32 = ((Word32) L_var1_lo * L_var2_hi) >> 15;
+
+        /* L_product = L_mac (L_product, result, 1, pOverflow); */
+        L_sum = L_product + (product32 << 1);
+
+        if ((L_product ^ product32) > 0)
+        {
+            if ((L_sum ^ L_product) < 0)
+            {
+                L_sum = (L_product < 0) ? MIN_32 : MAX_32;
+            }
+        }
+
+        /*----------------------------------------------------------------------------
+        ; Return nothing or data or data pointer
+        ----------------------------------------------------------------------------*/
+        return (L_sum);
+    }
+
+#endif
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MPY_32_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h
new file mode 100644 (file)
index 0000000..3a68e69
--- /dev/null
@@ -0,0 +1,184 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mpy_32_16.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the Mpy_32_16 function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef MPY_32_16_H
+#define MPY_32_16_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
+
+    static inline Word32 Mpy_32_16(Word16 L_var1_hi,
+    Word16 L_var1_lo,
+    Word16 var2,
+    Flag *pOverflow)
+    {
+
+        register Word32 ra = L_var1_hi;
+        register Word32 rb = L_var1_lo;
+        register Word32 rc = var2;
+        Word32 result, L_product;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        __asm__ volatile("smulbb %0, %1, %2"
+             : "=r"(L_product)
+                             : "r"(ra), "r"(rc)
+                            );
+        __asm__ volatile("mov %0, #0"
+             : "=r"(result)
+                    );
+
+        __asm__ volatile("qdadd %0, %1, %2"
+             : "=r"(L_product)
+                             : "r"(result), "r"(L_product)
+                            );
+
+        __asm__ volatile("smulbb %0, %1, %2"
+             : "=r"(result)
+                             : "r"(rb), "r"(rc)
+                            );
+
+        __asm__ volatile("mov %0, %1, ASR #15"
+             : "=r"(ra)
+                             : "r"(result)
+                            );
+        __asm__ volatile("qdadd %0, %1, %2"
+             : "=r"(result)
+                             : "r"(L_product), "r"(ra)
+                            );
+
+        return (result);
+    }
+
+#else /* C_EQUIVALENT */
+    static inline Word32 Mpy_32_16(Word16 L_var1_hi,
+                                   Word16 L_var1_lo,
+                                   Word16 var2,
+                                   Flag *pOverflow)
+    {
+
+        Word32 L_product;
+        Word32 L_sum;
+        Word32 result;
+        L_product = (Word32) L_var1_hi * var2;
+
+        if (L_product != (Word32) 0x40000000L)
+        {
+            L_product <<= 1;
+        }
+        else
+        {
+            *pOverflow = 1;
+            L_product = MAX_32;
+        }
+
+        result = ((Word32)L_var1_lo * var2) >> 15;
+
+        L_sum  =  L_product + (result << 1);
+
+        if ((L_product ^ result) > 0)
+        {
+            if ((L_sum ^ L_product) < 0)
+            {
+                L_sum = (L_product < 0) ? MIN_32 : MAX_32;
+                *pOverflow = 1;
+            }
+        }
+        return (L_sum);
+
+    }
+
+#endif
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MPY_32_16_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h
new file mode 100644 (file)
index 0000000..c89a94e
--- /dev/null
@@ -0,0 +1,152 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mult.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the mult function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef MULT_H
+#define MULT_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))
+
+    __inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        register Word32 ra = var1;
+        register Word32 rb = var2;
+        Word32 product;
+        Word32 temp = 0x7FFF;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        asm volatile("smulbb %0, %1, %2"
+             : "=r"(product)
+                             : "r"(ra), "r"(rb)
+                            );
+        asm volatile("mov %0, %1, ASR #15"
+             : "=r"(product)
+                             : "r"(product)
+                            );
+        asm volatile("cmp %0, %1"
+             : "=r"(product)
+                             : "r"(temp)
+                            );
+        asm volatile("movge %0, %1"
+             : "=r"(product)
+                             : "r"(temp)
+                            );
+
+        return ((Word16) product);
+    }
+
+#else /* C EQUIVALENT */
+
+    static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
+    {
+        register Word32 product;
+
+        product = ((Word32) var1 * var2) >> 15;
+
+        /* Saturate result (if necessary). */
+        /* var1 * var2 >0x00007fff is the only case */
+        /* that saturation occurs. */
+
+        if (product > 0x00007fffL)
+        {
+            *pOverflow = 1;
+            product = (Word32) MAX_16;
+        }
+
+
+        /* Return the product as a 16 bit value by type casting Word32 to Word16 */
+
+        return ((Word16) product);
+    }
+
+#endif
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _MULT_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult_r.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult_r.h
new file mode 100644 (file)
index 0000000..90f7e83
--- /dev/null
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mult_r.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the mult_r function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef MULT_R__H
+#define MULT_R__H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* _MULT_R_H_ */
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/n_proc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/n_proc.h
new file mode 100644 (file)
index 0000000..e5738c1
--- /dev/null
@@ -0,0 +1,31 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/* $Id $ */
+
+void proc_head(char *mes);
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h
new file mode 100644 (file)
index 0000000..2b77f77
--- /dev/null
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/*****************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+**************************************************************************/
+/*
+ Filename: negate.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the negate function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef NEGATE_H
+#define NEGATE_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 negate(register Word16 var1);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h
new file mode 100644 (file)
index 0000000..288b6c7
--- /dev/null
@@ -0,0 +1,119 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: norm_l.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the norm_l function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef NORM_L_H
+#define NORM_L_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))
+    static inline Word16 norm_l(Word32 L_var1)
+    {
+        register Word32 var_out = 0;
+        register Word32 ra = L_var1;
+        if (L_var1)
+        {
+            ra ^= (ra << 1);
+            __asm__ volatile(
+                "clz %0, %1"
+    : "=r"(var_out)
+                        : "r"(ra)
+                    );
+        }
+        return (var_out);
+    }
+#else
+    /* C EQUIVALENT */
+    OSCL_IMPORT_REF Word16 norm_l(Word32 L_var1);
+
+#endif
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h
new file mode 100644 (file)
index 0000000..7847f34
--- /dev/null
@@ -0,0 +1,118 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: norm_s.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the norm_s function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef NORM_S_H
+#define NORM_S_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))
+    static inline Word16 norm_s(Word16 var1)
+    {
+        register Word32 var_out = 0;
+        register Word32 ra = var1 << 16;
+        if (ra)
+        {
+            ra ^= (ra << 1);
+            __asm__ volatile(
+                "clz %0, %1"
+    : "=r"(var_out)
+                        : "r"(ra)
+                    );
+        }
+        return (var_out);
+    }
+#else
+    /*C EQUIVALENT */
+    OSCL_IMPORT_REF Word16 norm_s(Word16 var1);
+#endif
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/oper_32b.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/oper_32b.h
new file mode 100644 (file)
index 0000000..c2ef975
--- /dev/null
@@ -0,0 +1,92 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: oper_32b.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file includes all the oper_32b.c functions' header files.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef OPER_32B_H
+#define OPER_32B_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include        "typedef.h"
+
+#include        "l_comp.h"
+#include        "l_extract.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; ENUMERATED TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; STRUCTURES TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; GLOBAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; END
+----------------------------------------------------------------------------*/
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/p_ol_wgh.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/p_ol_wgh.h
new file mode 100644 (file)
index 0000000..f07ea36
--- /dev/null
@@ -0,0 +1,134 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: p_ol_wgh.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+       File             : p_ol_wgh.h
+       Purpose          : Compute the open loop pitch lag with weighting.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef P_OL_WGH_H
+#define P_OL_WGH_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "vad.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+    extern const Word16 corrweight[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    /* state variable */
+
+    typedef struct
+    {
+        Word16 old_T0_med;
+        Word16 ada_w;
+        Word16 wght_flg;
+    } pitchOLWghtState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    Word16 p_ol_wgh_init(pitchOLWghtState **st);
+    /* initialize one instance of the pre processing state.
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to p_ol_wgh in each call.
+       returns 0 on success
+     */
+
+    Word16 p_ol_wgh_reset(pitchOLWghtState *st);
+    /* reset of pre processing state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+
+    void p_ol_wgh_exit(pitchOLWghtState **st);
+    /* de-initialize pre processing state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    Word16 Pitch_ol_wgh(      /* o   : open loop pitch lag                            */
+        pitchOLWghtState *st, /* i/o : State struct                                   */
+        vadState *vadSt,      /* i/o : VAD state struct                               */
+        Word16 signal[],      /* i   : signal used to compute the open loop pitch     */
+        /*       signal[-pit_max] to signal[-1] should be known */
+        Word16 pit_min,       /* i   : minimum pitch lag                              */
+        Word16 pit_max,       /* i   : maximum pitch lag                              */
+        Word16 L_frame,       /* i   : length of frame to compute pitch               */
+        Word16 old_lags[],    /* i   : history with old stored Cl lags                */
+        Word16 ol_gain_flg[], /* i   : OL gain flag                                   */
+        Word16 idx,           /* i   : index                                          */
+        Flag dtx,             /* i   : dtx flag; use dtx=1, do not use dtx=0          */
+        Flag   *pOverflow     /* o   : overflow flag                                  */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _P_OL_WGH_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pow2.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pow2.h
new file mode 100644 (file)
index 0000000..ba83477
--- /dev/null
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: pow2.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the prototype declaration for Pow2() function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef POW2_H
+#define POW2_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include  "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 pow2_tbl[];
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    OSCL_IMPORT_REF Word32 Pow2(
+        /* (o)  : result       (range: 0<=val<=0x7fffffff) */
+        Word16 exponent,    /* (i)  : Integer part.      (range: 0<=val<=30)   */
+        Word16 fraction,    /* (i)  : Fractional part.  (range: 0.0<=val<1.0)  */
+        Flag *pOverflow     /* (i/o) : overflow flag                           */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _POW2_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pred_lt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pred_lt.h
new file mode 100644 (file)
index 0000000..28a0dd8
--- /dev/null
@@ -0,0 +1,105 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: pred_lt.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the pred_lt function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef pred_lt_h
+#define pred_lt_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF void Pred_lt_3or6(
+        Word16 exc[],     /* in/out: excitation buffer                          */
+        Word16 T0,        /* input : integer pitch lag                          */
+        Word16 frac,      /* input : fraction of lag                            */
+        Word16 L_subfr,   /* input : subframe size                              */
+        Word16 flag3,     /* input : if set, upsampling rate = 3 (6 otherwise)  */
+        Flag  *pOverflow  /* output: if set, overflow occurred in this function */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PRED_LT_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pvgsmamr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pvgsmamr.h
new file mode 100644 (file)
index 0000000..b697524
--- /dev/null
@@ -0,0 +1,63 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+#ifndef __PVGSMAMR_H
+#define __PVGSMAMR_H
+
+
+// includes
+#include <e32std.h>
+#include <e32base.h>
+
+#include "sp_dec.h"
+#include "pvglobals.h"
+
+
+// PVGsmDecoder AO
+class CPVGsmDecoder : public CBase
+{
+    public:
+        IMPORT_C static CPVGsmDecoder* NewL(void);
+        IMPORT_C ~CPVGsmDecoder();
+        IMPORT_C TInt StartL(void);
+
+        // only port the API's used in PVPlayer 2.0
+        IMPORT_C TInt DecodeFrame(enum Mode mode, unsigned char* compressedBlock, unsigned char* audioBuffer);
+        IMPORT_C TInt InitDecoder(void);
+        IMPORT_C void ExitDecoder(void);
+
+    private:
+        CPVGsmDecoder();
+        void ConstructL(void);
+
+        Speech_Decode_FrameState* decState;
+        enum RXFrameType rx_type;
+        struct globalDataStruct *gds;
+};
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf.h
new file mode 100644 (file)
index 0000000..9298d09
--- /dev/null
@@ -0,0 +1,156 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: q_plsf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the q_plsf_3.c and q_plsf_5.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef q_plsf_h
+#define q_plsf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define MR795_1_SIZE  512
+#define PAST_RQ_INIT_SIZE 8
+
+#define DICO1_SIZE  256
+#define DICO2_SIZE  512
+#define DICO3_SIZE  512
+
+#define DICO1_5_SIZE  128
+#define DICO2_5_SIZE  256
+#define DICO3_5_SIZE  256
+#define DICO4_5_SIZE  256
+#define DICO5_5_SIZE  64
+
+#define MR515_3_SIZE  128
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 past_rq[M];    /* Past quantized prediction error, Q15 */
+
+    } Q_plsfState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    Word16 Q_plsf_init(Q_plsfState **st);
+    /* initialize one instance of the state.
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to Q_plsf_5 / Q_plsf_3 in each call.
+       returns 0 on success
+     */
+
+    Word16 Q_plsf_reset(Q_plsfState *st);
+    /* reset of state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+
+    void Q_plsf_exit(Q_plsfState **st);
+    /* de-initialize state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    OSCL_IMPORT_REF void Q_plsf_3(
+        Q_plsfState *st,    /* i/o: state struct                             */
+        enum Mode mode,     /* i  : coder mode                               */
+        Word16 *lsp1,       /* i  : 1st LSP vector                      Q15  */
+        Word16 *lsp1_q,     /* o  : quantized 1st LSP vector            Q15  */
+        Word16 *indice,     /* o  : quantization indices of 3 vectors   Q0   */
+        Word16 *pred_init_i,/* o  : init index for MA prediction in DTX mode */
+        Flag  *pOverflow    /* o : Flag set when overflow occurs             */
+    );
+
+    OSCL_IMPORT_REF void Q_plsf_5(
+        Q_plsfState *st,
+        Word16 *lsp1,      /* i  : 1st LSP vector,                     Q15 */
+        Word16 *lsp2,      /* i  : 2nd LSP vector,                     Q15 */
+        Word16 *lsp1_q,    /* o  : quantized 1st LSP vector,           Q15 */
+        Word16 *lsp2_q,    /* o  : quantized 2nd LSP vector,           Q15 */
+        Word16 *indice,    /* o  : quantization indices of 5 matrices, Q0  */
+        Flag  *pOverflow   /* o : Flag set when overflow occurs            */
+    );
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Q_PLSF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_3_tbl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_3_tbl.h
new file mode 100644 (file)
index 0000000..8bf7047
--- /dev/null
@@ -0,0 +1,123 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: q_plsf_3_tbl.h
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+#define MR795_1_SIZE  512
+#define PAST_RQ_INIT_SIZE 8
+
+#define DICO1_SIZE  256
+#define DICO2_SIZE  512
+#define DICO3_SIZE  512
+
+#define MR515_3_SIZE  128
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /* Codebooks of LSF prediction residual */
+    extern const Word16 mean_lsf_3[];
+
+    extern const Word16 pred_fac_3[];
+
+    extern const Word16 dico1_lsf_3[];
+    extern const Word16 dico2_lsf_3[];
+    extern const Word16 dico3_lsf_3[];
+
+    extern const Word16 mr515_3_lsf[];
+    extern const Word16 mr795_1_lsf[];
+
+    extern const Word16 past_rq_init[];
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_5_tbl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_5_tbl.h
new file mode 100644 (file)
index 0000000..e495c4a
--- /dev/null
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: q_plsf_5_tbl.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares tables defined in q_plsf_5_tbl.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef Q_PLSF_5_TBL_H
+#define Q_PLSF_5_TBL_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 mean_lsf_5[];
+    extern const Word16 dico1_lsf_5[];
+    extern const Word16 dico2_lsf_5[];
+    extern const Word16 dico3_lsf_5[];
+    extern const Word16 dico4_lsf_5[];
+    extern const Word16 dico5_lsf_5[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qgain475_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qgain475_tab.h
new file mode 100644 (file)
index 0000000..cfa5dee
--- /dev/null
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: qgain475_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares tables defined in qgain475_tab.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef QGAIN475_TAB_H
+#define QGAIN475_TAB_H
+
+#define MR475_VQ_SIZE 256
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 table_gain_MR475[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain.h
new file mode 100644 (file)
index 0000000..951a2c4
--- /dev/null
@@ -0,0 +1,126 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: qua_gain.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, qua_gain.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef qua_gain_h
+#define qua_gain_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "gc_pred.h"
+#include "mode.h"
+#include "get_const_tbls.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define VQ_SIZE_HIGHRATES 128
+#define VQ_SIZE_LOWRATES 64
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    Word16
+    Qua_gain(                   /* o  : index of quantization.                 */
+        enum Mode mode,         /* i  : AMR mode                               */
+        Word16 exp_gcode0,      /* i  : predicted CB gain (exponent),      Q0  */
+        Word16 frac_gcode0,     /* i  : predicted CB gain (fraction),      Q15 */
+        Word16 frac_coeff[],    /* i  : energy coeff. (5), fraction part,  Q15 */
+        Word16 exp_coeff[],     /* i  : energy coeff. (5), exponent part,  Q0  */
+        /*      (frac_coeff and exp_coeff computed in  */
+        /*       calc_filt_energies())                 */
+        Word16 gp_limit,        /* i  : pitch gain limit                       */
+        Word16 *gain_pit,       /* o  : Pitch gain,                        Q14 */
+        Word16 *gain_cod,       /* o  : Code gain,                         Q1  */
+        Word16 *qua_ener_MR122, /* o  : quantized energy error,            Q10 */
+        /*      (for MR122 MA predictor update)        */
+        Word16 *qua_ener,       /* o  : quantized energy error,            Q10 */
+        /*      (for other MA predictor update)        */
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs     */
+        Flag   *pOverflow       /* o  : overflow indicator                     */
+    );
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* qua_gain_h */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain_tbl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain_tbl.h
new file mode 100644 (file)
index 0000000..b3d2c01
--- /dev/null
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: qua_gain_tbl.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares tables defined in qua_gain_tbl.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef QUA_GAIN_TBL_H
+#define QUA_GAIN_TBL_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 table_gain_highrates[];
+    extern const Word16 table_gain_lowrates[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reorder.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reorder.h
new file mode 100644 (file)
index 0000000..231bc9a
--- /dev/null
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: reorder.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the Reorder_lsf() function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef REORDER_H
+#define REORDER_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF void Reorder_lsf(
+        Word16 *lsf,       /* (i/o)  : vector of LSFs   (range: 0<=val<=0.5)    */
+        Word16 min_dist,   /* (i)    : minimum required distance                */
+        Word16 n,          /* (i)    : LPC order                                */
+        Flag   *pOverflow  /* (i/o)  : overflow Flag                            */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REORDER_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/residu.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/residu.h
new file mode 100644 (file)
index 0000000..2c6d430
--- /dev/null
@@ -0,0 +1,83 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : residu.h
+*      Purpose          : Computes the LP residual.
+*      Description      : The LP residual is computed by filtering the input
+*                       : speech through the LP inverse filter A(z).
+*
+*
+********************************************************************************
+*/
+#ifndef residu_h
+#define residu_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    ********************************************************************************
+    */
+
+    /*
+    ********************************************************************************
+    *                         DECLARATION OF PROTOTYPES
+    ********************************************************************************
+    */
+    OSCL_IMPORT_REF void Residu(
+        Word16 a[],        /* (i)  : prediction coefficients                    */
+        Word16 x[],        /* (i)  : speech signal                              */
+        Word16 y[],        /* (o)  : residual signal                            */
+        Word16 lg          /* (i)  : size of filtering                          */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reverse_bits.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reverse_bits.h
new file mode 100644 (file)
index 0000000..5933e15
--- /dev/null
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: reverse_bits.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the reverse_bits function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef REVERSE_BITS_H
+#define REVERSE_BITS_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void reverse_bits(enum Mode mode, unsigned char *pCompressedBlock);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/round.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/round.h
new file mode 100644 (file)
index 0000000..f4f8072
--- /dev/null
@@ -0,0 +1,98 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: round.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the pv_round function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef ROUND_H
+#define ROUND_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF Word16 pv_round(Word32 L_var1, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROUND_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/set_zero.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/set_zero.h
new file mode 100644 (file)
index 0000000..debd223
--- /dev/null
@@ -0,0 +1,79 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : set_zero.h
+*      Description      : Set vector x[] to zero
+*
+*
+********************************************************************************
+*/
+#ifndef set_zero_h
+#define set_zero_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    ********************************************************************************
+    */
+
+    /*
+    ********************************************************************************
+    *                         DECLARATION OF PROTOTYPES
+    ********************************************************************************
+    */
+    void Set_zero(
+        Word16 x[],        /* (o)  : vector to clear                            */
+        Word16 L           /* (i)  : length of vector                           */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shl.h
new file mode 100644 (file)
index 0000000..ca09201
--- /dev/null
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: shl.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the shl function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef SHL_H
+#define SHL_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 shl(Word16 var1, Word16 var2, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _SHL_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr.h
new file mode 100644 (file)
index 0000000..b3149a0
--- /dev/null
@@ -0,0 +1,99 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: shr.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the shr function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef SHR_H
+#define SHR_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF Word16 shr(Word16 var1, Word16 var2, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _SHR_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr_r.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr_r.h
new file mode 100644 (file)
index 0000000..30ccf29
--- /dev/null
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: shr_r.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the shr_r function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef SHR_R_H
+#define SHR_R_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF Word16 shr_r(Word16 var1, Word16 var2, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sqrt_l.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sqrt_l.h
new file mode 100644 (file)
index 0000000..368e9f9
--- /dev/null
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: sqrt_l.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the sqrt_l() function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef SQRT_L_H
+#define SQRT_L_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 sqrt_l_tbl[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    OSCL_IMPORT_REF Word32 sqrt_l_exp(      /* o : output value,          Q31 */
+        Word32 L_x,         /* i : input value,                           Q31 */
+        Word16 *pExp,       /* o : right shift to be applied to result,   Q1  */
+        Flag   *pOverflow   /* i : pointer to overflow flag */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SQRT_L__H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sub.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sub.h
new file mode 100644 (file)
index 0000000..b28d686
--- /dev/null
@@ -0,0 +1,99 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: sub.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the sub function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef SUB_H
+#define SUB_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    OSCL_IMPORT_REF Word16 sub(Word16 var1, Word16 var2, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _SUB_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/syn_filt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/syn_filt.h
new file mode 100644 (file)
index 0000000..4d8cd13
--- /dev/null
@@ -0,0 +1,83 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : syn_filt.h
+*      Purpose          : Perform synthesis filtering through 1/A(z).
+*
+*
+********************************************************************************
+*/
+#ifndef syn_filt_h
+#define syn_filt_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    ********************************************************************************
+    */
+
+    /*
+    ********************************************************************************
+    *                         DECLARATION OF PROTOTYPES
+    ********************************************************************************
+    */
+    OSCL_IMPORT_REF void Syn_filt(
+        Word16 a[],        /* (i)  : a[m+1] prediction coefficients   (m=10)    */
+        Word16 x[],        /* (i)  : input signal                               */
+        Word16 y[],        /* (o)  : output signal                              */
+        Word16 lg,         /* (i)  : size of filtering                          */
+        Word16 mem[],      /* (i/o): memory associated with this filtering.     */
+        Word16 update      /* (i)  : 0=no update, 1=update of memory.           */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h
new file mode 100644 (file)
index 0000000..3cf16d5
--- /dev/null
@@ -0,0 +1,74 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : typedef.c
+*      Purpose          : Basic types.
+*
+********************************************************************************
+*/
+#include "oscl_base_macros.h"// has integer values of PV_COMPILER
+#ifndef typedef_h
+#define typedef_h "$Id $"
+
+#undef ORIGINAL_TYPEDEF_H /* CHANGE THIS TO #define to get the      */
+/*  "original" ETSI version of typedef.h  */
+/* CHANGE TO #undef for PV version        */
+
+#ifdef ORIGINAL_TYPEDEF_H
+/*
+ * this is the original code from the ETSI file typedef.h
+ */
+
+#if   defined(__unix__) || defined(__unix)
+typedef signed char Word8;
+typedef short Word16;
+typedef int Word32;
+typedef int Flag;
+
+#else
+#error No System recognized
+#endif
+#else /* not original typedef.h */
+
+/*
+ * use (improved) type definition file typdefs.h
+ */
+#include "gsm_amr_typedefs.h"
+
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad.h
new file mode 100644 (file)
index 0000000..b9ee89f
--- /dev/null
@@ -0,0 +1,76 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+**-------------------------------------------------------------------------**
+**                                                                         **
+**     GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001       **
+**                               R99   Version 3.2.0                       **
+**                               REL-4 Version 4.0.0                       **
+**                                                                         **
+**-------------------------------------------------------------------------**
+********************************************************************************
+*
+*      File             : vad.h
+*      Purpose          : Voice Activity Detection (VAD) for AMR
+*
+********************************************************************************
+*/
+#ifndef vad_h
+#define vad_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+
+#include "vad1.h"   /* for VAD option 1 */
+#include "vad2.h"   /* for VAD option 2 */
+
+/*
+********************************************************************************
+*                         LOCAL VARIABLES AND TABLES
+********************************************************************************
+*/
+
+/*
+********************************************************************************
+*                         DEFINITION OF DATA TYPES
+********************************************************************************
+*/
+
+#ifndef VAD2
+#define vadState vadState1
+#else
+#define vadState vadState2
+#endif
+
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/weight_a.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/weight_a.h
new file mode 100644 (file)
index 0000000..cede607
--- /dev/null
@@ -0,0 +1,81 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : weight_a.h
+*      Purpose          : Spectral expansion of LP coefficients.  (order==10)
+*      Description      : a_exp[i] = a[i] * fac[i-1]    ,i=1,10
+*
+*
+********************************************************************************
+*/
+#ifndef weight_a_h
+#define weight_a_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    ********************************************************************************
+    */
+
+    /*
+    ********************************************************************************
+    *                         DECLARATION OF PROTOTYPES
+    ********************************************************************************
+    */
+    OSCL_IMPORT_REF void Weight_Ai(
+        Word16 a[],        /* (i)  : a[m+1]  LPC coefficients   (m=10)          */
+        const Word16 fac[],/* (i)  : Spectral expansion factors.                */
+        Word16 a_exp[]     /* (o)  : Spectral expanded LPC coefficients         */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/window_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/window_tab.h
new file mode 100644 (file)
index 0000000..5928c54
--- /dev/null
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: window_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a tables in window_tab.c used in lpc.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef WINDOW_TAB_H
+#define WINDOW_TAB_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 window_200_40[];
+    extern const Word16 window_160_80[];
+    extern const Word16 window_232_8[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/wmf_to_ets.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/wmf_to_ets.h
new file mode 100644 (file)
index 0000000..c005f52
--- /dev/null
@@ -0,0 +1,108 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: wmf_to_ets.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the wmf_to_ets function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef WMF_TO_ETS_H
+#define WMF_TO_ETS_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "frame_type_3gpp.h"
+#include "typedef.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void wmf_to_ets(enum Frame_Type_3GPP frame_type_3gpp,
+    UWord8   *wmf_input_ptr,
+    Word16   *ets_output_ptr,
+    CommonAmrTbls* common_amr_tbls);
+
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/add.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/add.cpp
new file mode 100644 (file)
index 0000000..0a1182b
--- /dev/null
@@ -0,0 +1,171 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: add.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ Summation function with overflow control
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: add
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+    var2 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the add operation resulted in overflow
+
+ Returns:
+    sum = 16-bit limited sum of var1 and var2 (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the addition (var1+var2) with overflow control and
+ saturation; the 16 bit result is set at +32767 when overflow occurs or at
+ -32768 when underflow occurs.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] add.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ Word16 add (Word16 var1, Word16 var2)
+{
+    Word16 var_out;
+    Word32 sum;
+
+    sum = (Word32) var1 + var2;
+
+* The reference ETSI code uses a global flag for Overflow inside the function
+* saturate(). In the actual implementation a pointer to Overflow flag is passed in
+* as a parameter to the function
+
+    var_out = saturate (sum);
+#if (WMOPS)
+    multiCounter[currCounter].add++;
+#endif
+    return (var_out);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+OSCL_EXPORT_REF Word16 add_16(Word16 var1, Word16 var2, Flag *pOverflow)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+    Word32 sum;
+    sum = (Word32) var1 + var2;
+
+    /* Saturate result (if necessary). */
+    /* Replaced function call with in-line code             */
+    /* to conserve MIPS, i.e., var_out = saturate (sum)  */
+
+    if (sum > 0X00007fffL)
+    {
+        *pOverflow = 1;
+        sum = MAX_16;
+    }
+    else if (sum < (Word32) - 32768)
+    {
+        *pOverflow = 1;
+        sum = MIN_16;
+    }
+
+    /* Return the sum as a 16 bit value by type casting Word32 to Word16 */
+
+    return ((Word16) sum);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp
new file mode 100644 (file)
index 0000000..7711ac9
--- /dev/null
@@ -0,0 +1,665 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: az_lsp.cpp
+ Funtions: Chebps
+           Chebps_Wrapper
+           Az_lsp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ These modules compute the LSPs from the LP coefficients.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "az_lsp.h"
+#include "cnst.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NC   M/2                  /* M = LPC order, NC = M/2 */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Chebps
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    x = input value (Word16)
+    f = polynomial (Word16)
+    n = polynomial order (Word16)
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the operations in the function resulted in saturation.
+
+ Returns:
+    cheb = Chebyshev polynomial for the input value x.(Word16)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This module evaluates the Chebyshev polynomial series.
+    - The polynomial order is   n = m/2 = 5
+    - The polynomial F(z) (F1(z) or F2(z)) is given by
+        F(w) = 2 exp(-j5w) C(x)
+        where
+        C(x) = T_n(x) + f(1)T_n-1(x) + ... +f(n-1)T_1(x) + f(n)/2
+        and T_m(x) = cos(mw) is the mth order Chebyshev
+        polynomial ( x=cos(w) )
+    - C(x) for the input x is returned.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ az_lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static Word16 Chebps (Word16 x,
+                      Word16 f[], // (n)
+                      Word16 n)
+{
+    Word16 i, cheb;
+    Word16 b0_h, b0_l, b1_h, b1_l, b2_h, b2_l;
+    Word32 t0;
+
+// The reference ETSI code uses a global flag for Overflow. However, in the
+// actual implementation a pointer to Overflow flag is passed in as a
+// parameter to the function. This pointer is passed into all the basic math
+// functions invoked
+
+    b2_h = 256; // b2 = 1.0
+    b2_l = 0;
+
+    t0 = L_mult (x, 512);          // 2*x
+    t0 = L_mac (t0, f[1], 8192);   // + f[1]
+    L_Extract (t0, &b1_h, &b1_l);  // b1 = 2*x + f[1]
+
+    for (i = 2; i < n; i++)
+    {
+        t0 = Mpy_32_16 (b1_h, b1_l, x);         // t0 = 2.0*x*b1
+        t0 = L_shl (t0, 1);
+        t0 = L_mac (t0, b2_h, (Word16) 0x8000); // t0 = 2.0*x*b1 - b2
+        t0 = L_msu (t0, b2_l, 1);
+        t0 = L_mac (t0, f[i], 8192);            // t0 = 2.0*x*b1 - b2 + f[i]
+
+        L_Extract (t0, &b0_h, &b0_l);           // b0 = 2.0*x*b1 - b2 + f[i]
+
+        b2_l = b1_l; // b2 = b1;
+        b2_h = b1_h;
+        b1_l = b0_l; // b1 = b0;
+        b1_h = b0_h;
+    }
+
+    t0 = Mpy_32_16 (b1_h, b1_l, x);             // t0 = x*b1;
+    t0 = L_mac (t0, b2_h, (Word16) 0x8000);     // t0 = x*b1 - b2
+    t0 = L_msu (t0, b2_l, 1);
+    t0 = L_mac (t0, f[i], 4096);                // t0 = x*b1 - b2 + f[i]/2
+
+    t0 = L_shl (t0, 6);
+
+    cheb = extract_h (t0);
+
+    return (cheb);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 Chebps(Word16 x,
+                     Word16 f[], /* (n) */
+                     Word16 n,
+                     Flag *pOverflow)
+{
+    Word16 i;
+    Word16 cheb;
+    Word16 b1_h;
+    Word16 b1_l;
+    Word32 t0;
+    Word32 L_temp;
+    Word16 *p_f = &f[1];
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    /* L_temp = 1.0 */
+
+    L_temp = 0x01000000L;
+
+    t0 = ((Word32) x << 10) + ((Word32) * (p_f++) << 14);
+
+    /* b1 = t0 = 2*x + f[1]  */
+
+    b1_h = (Word16)(t0 >> 16);
+    b1_l = (Word16)((t0 >> 1) - (b1_h << 15));
+
+
+    for (i = 2; i < n; i++)
+    {
+        /* t0 = 2.0*x*b1    */
+        t0  = ((Word32) b1_h * x);
+        t0 += ((Word32) b1_l * x) >> 15;
+        t0 <<= 2;
+
+        /* t0 = 2.0*x*b1 - b2   */
+        t0 -= L_temp;
+
+        /* t0 = 2.0*x*b1 - b2 + f[i] */
+        t0 += (Word32) * (p_f++) << 14;
+
+        L_temp = ((Word32) b1_h << 16) + ((Word32) b1_l << 1);
+
+        /* b0 = 2.0*x*b1 - b2 + f[i]*/
+        b1_h = (Word16)(t0 >> 16);
+        b1_l = (Word16)((t0 >> 1) - (b1_h << 15));
+
+    }
+
+    /* t0 = x*b1; */
+    t0  = ((Word32) b1_h * x);
+    t0 += ((Word32) b1_l * x) >> 15;
+    t0 <<= 1;
+
+
+    /* t0 = x*b1 - b2   */
+    t0 -= L_temp;
+
+    /* t0 = x*b1 - b2 + f[i]/2 */
+    t0 += (Word32) * (p_f) << 13;
+
+
+    if ((UWord32)(t0 + 33554432) < 67108863)
+    {
+        cheb = (Word16)(t0 >> 10);
+    }
+    else
+    {
+        if (t0 > (Word32) 0x01ffffffL)
+        {
+            cheb = MAX_16;
+
+        }
+        else
+        {
+            cheb = MIN_16;
+        }
+    }
+
+    return (cheb);
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Az_lsp
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS FOR Az_lsp
+
+ Inputs:
+    a = predictor coefficients (Word16)
+    lsp = line spectral pairs (Word16)
+    old_lsp = old line spectral pairs (Word16)
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the operations in the function resulted in saturation.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes the LSPs from the LP coefficients.
+
+ The sum and difference filters are computed and divided by 1+z^{-1} and
+ 1-z^{-1}, respectively.
+
+     f1[i] = a[i] + a[11-i] - f1[i-1] ;   i=1,...,5
+     f2[i] = a[i] - a[11-i] + f2[i-1] ;   i=1,...,5
+
+ The roots of F1(z) and F2(z) are found using Chebyshev polynomial evaluation.
+ The polynomials are evaluated at 60 points regularly spaced in the
+ frequency domain. The sign change interval is subdivided 4 times to better
+ track the root. The LSPs are found in the cosine domain [1,-1].
+
+ If less than 10 roots are found, the LSPs from the past frame are used.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ az_lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Az_lsp (
+    Word16 a[],         // (i)  : predictor coefficients (MP1)
+    Word16 lsp[],       // (o)  : line spectral pairs (M)
+    Word16 old_lsp[]    // (i)  : old lsp[] (in case not found 10 roots) (M)
+)
+{
+    Word16 i, j, nf, ip;
+    Word16 xlow, ylow, xhigh, yhigh, xmid, ymid, xint;
+    Word16 x, y, sign, exp;
+    Word16 *coef;
+    Word16 f1[M / 2 + 1], f2[M / 2 + 1];
+    Word32 t0;
+
+     *-------------------------------------------------------------*
+     *  find the sum and diff. pol. F1(z) and F2(z)                *
+     *    F1(z) <--- F1(z)/(1+z**-1) & F2(z) <--- F2(z)/(1-z**-1)  *
+     *                                                             *
+     * f1[0] = 1.0;                                                *
+     * f2[0] = 1.0;                                                *
+     *                                                             *
+     * for (i = 0; i< NC; i++)                                     *
+     * {                                                           *
+     *   f1[i+1] = a[i+1] + a[M-i] - f1[i] ;                       *
+     *   f2[i+1] = a[i+1] - a[M-i] + f2[i] ;                       *
+     * }                                                           *
+     *-------------------------------------------------------------*
+
+    f1[0] = 1024; // f1[0] = 1.0
+    f2[0] = 1024; // f2[0] = 1.0
+
+// The reference ETSI code uses a global flag for Overflow. However, in the
+// actual implementation a pointer to Overflow flag is passed in as a
+// parameter to the function. This pointer is passed into all the basic math
+// functions invoked
+
+    for (i = 0; i < NC; i++)
+    {
+        t0 = L_mult (a[i + 1], 8192);   // x = (a[i+1] + a[M-i]) >> 2
+        t0 = L_mac (t0, a[M - i], 8192);
+        x = extract_h (t0);
+        // f1[i+1] = a[i+1] + a[M-i] - f1[i]
+        f1[i + 1] = sub (x, f1[i]);
+
+        t0 = L_mult (a[i + 1], 8192);   // x = (a[i+1] - a[M-i]) >> 2
+        t0 = L_msu (t0, a[M - i], 8192);
+        x = extract_h (t0);
+        // f2[i+1] = a[i+1] - a[M-i] + f2[i]
+        f2[i + 1] = add (x, f2[i]);
+    }
+
+     *-------------------------------------------------------------*
+     * find the LSPs using the Chebychev pol. evaluation           *
+     *-------------------------------------------------------------*
+
+    nf = 0; // number of found frequencies
+    ip = 0; // indicator for f1 or f2
+
+    coef = f1;
+
+    xlow = grid[0];
+    ylow = Chebps (xlow, coef, NC);
+
+    j = 0;
+    // while ( (nf < M) && (j < grid_points) )
+    while ((sub (nf, M) < 0) && (sub (j, grid_points) < 0))
+    {
+        j++;
+        xhigh = xlow;
+        yhigh = ylow;
+        xlow = grid[j];
+        ylow = Chebps (xlow, coef, NC);
+
+        if (L_mult (ylow, yhigh) <= (Word32) 0L)
+        {
+
+            // divide 4 times the interval
+
+            for (i = 0; i < 4; i++)
+            {
+                // xmid = (xlow + xhigh)/2
+                xmid = add (shr (xlow, 1), shr (xhigh, 1));
+                ymid = Chebps (xmid, coef, NC);
+
+                if (L_mult (ylow, ymid) <= (Word32) 0L)
+                {
+                    yhigh = ymid;
+                    xhigh = xmid;
+                }
+                else
+                {
+                    ylow = ymid;
+                    xlow = xmid;
+                }
+            }
+
+             *-------------------------------------------------------------*
+             * Linear interpolation                                        *
+             *    xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow);            *
+             *-------------------------------------------------------------*
+
+            x = sub (xhigh, xlow);
+            y = sub (yhigh, ylow);
+
+            if (y == 0)
+            {
+                xint = xlow;
+            }
+            else
+            {
+                sign = y;
+                y = abs_s (y);
+                exp = norm_s (y);
+                y = shl (y, exp);
+                y = div_s ((Word16) 16383, y);
+                t0 = L_mult (x, y);
+                t0 = L_shr (t0, sub (20, exp));
+                y = extract_l (t0);     // y= (xhigh-xlow)/(yhigh-ylow)
+
+                if (sign < 0)
+                    y = negate (y);
+
+                t0 = L_mult (ylow, y);
+                t0 = L_shr (t0, 11);
+                xint = sub (xlow, extract_l (t0)); // xint = xlow - ylow*y
+            }
+
+            lsp[nf] = xint;
+            xlow = xint;
+            nf++;
+
+            if (ip == 0)
+            {
+                ip = 1;
+                coef = f2;
+            }
+            else
+            {
+                ip = 0;
+                coef = f1;
+            }
+            ylow = Chebps (xlow, coef, NC);
+
+        }
+    }
+
+    // Check if M roots found
+
+    if (sub (nf, M) < 0)
+    {
+        for (i = 0; i < M; i++)
+        {
+            lsp[i] = old_lsp[i];
+        }
+
+    }
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Az_lsp(
+    Word16 a[],         /* (i)  : predictor coefficients (MP1)               */
+    Word16 lsp[],       /* (o)  : line spectral pairs (M)                    */
+    Word16 old_lsp[],   /* (i)  : old lsp[] (in case not found 10 roots) (M) */
+    Flag   *pOverflow   /* (i/o): overflow flag                              */
+)
+{
+    register Word16 i;
+    register Word16 j;
+    register Word16 nf;
+    register Word16 ip;
+    Word16 xlow;
+    Word16 ylow;
+    Word16 xhigh;
+    Word16 yhigh;
+    Word16 xmid;
+    Word16 ymid;
+    Word16 xint;
+    Word16 x;
+    Word16 y;
+    Word16 sign;
+    Word16 exp;
+    Word16 *coef;
+    Word16 f1[NC + 1];
+    Word16 f2[NC + 1];
+    Word32 L_temp1;
+    Word32 L_temp2;
+    Word16 *p_f1 = f1;
+    Word16 *p_f2 = f2;
+
+    /*-------------------------------------------------------------*
+     *  find the sum and diff. pol. F1(z) and F2(z)                *
+     *    F1(z) <--- F1(z)/(1+z**-1) & F2(z) <--- F2(z)/(1-z**-1)  *
+     *                                                             *
+     * f1[0] = 1.0;                                                *
+     * f2[0] = 1.0;                                                *
+     *                                                             *
+     * for (i = 0; i< NC; i++)                                     *
+     * {                                                           *
+     *   f1[i+1] = a[i+1] + a[M-i] - f1[i] ;                       *
+     *   f2[i+1] = a[i+1] - a[M-i] + f2[i] ;                       *
+     * }                                                           *
+     *-------------------------------------------------------------*/
+
+    *p_f1 = 1024;                       /* f1[0] = 1.0 */
+    *p_f2 = 1024;                       /* f2[0] = 1.0 */
+
+    for (i = 0; i < NC; i++)
+    {
+        L_temp1 = (Word32) * (a + i + 1);
+        L_temp2 = (Word32) * (a + M - i);
+        /* x = (a[i+1] + a[M-i]) >> 2  */
+        x = (Word16)((L_temp1 + L_temp2) >> 2);
+        /* y = (a[i+1] - a[M-i]) >> 2 */
+        y = (Word16)((L_temp1 - L_temp2) >> 2);
+        /* f1[i+1] = a[i+1] + a[M-i] - f1[i] */
+        x -= *(p_f1++);
+        *(p_f1) = x;
+        /* f2[i+1] = a[i+1] - a[M-i] + f2[i] */
+        y += *(p_f2++);
+        *(p_f2) = y;
+    }
+
+    /*-------------------------------------------------------------*
+     * find the LSPs using the Chebychev pol. evaluation           *
+     *-------------------------------------------------------------*/
+
+    nf = 0;                         /* number of found frequencies */
+    ip = 0;                         /* indicator for f1 or f2      */
+
+    coef = f1;
+
+    xlow = *(grid);
+    ylow = Chebps(xlow, coef, NC, pOverflow);
+
+    j = 0;
+
+    while ((nf < M) && (j < grid_points))
+    {
+        j++;
+        xhigh = xlow;
+        yhigh = ylow;
+        xlow = *(grid + j);
+        ylow = Chebps(xlow, coef, NC, pOverflow);
+
+        if (((Word32)ylow*yhigh) <= 0)
+        {
+            /* divide 4 times the interval */
+            for (i = 4; i != 0; i--)
+            {
+                /* xmid = (xlow + xhigh)/2 */
+                x = xlow >> 1;
+                y = xhigh >> 1;
+                xmid = x + y;
+
+                ymid = Chebps(xmid, coef, NC, pOverflow);
+
+                if (((Word32)ylow*ymid) <= 0)
+                {
+                    yhigh = ymid;
+                    xhigh = xmid;
+                }
+                else
+                {
+                    ylow = ymid;
+                    xlow = xmid;
+                }
+            }
+
+            /*-------------------------------------------------------------*
+             * Linear interpolation                                        *
+             *    xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow);            *
+             *-------------------------------------------------------------*/
+
+            x = xhigh - xlow;
+            y = yhigh - ylow;
+
+            if (y == 0)
+            {
+                xint = xlow;
+            }
+            else
+            {
+                sign = y;
+                y = abs_s(y);
+                exp = norm_s(y);
+                y <<= exp;
+                y = div_s((Word16) 16383, y);
+
+                y = ((Word32)x * y) >> (19 - exp);
+
+                if (sign < 0)
+                {
+                    y = -y;
+                }
+
+                /* xint = xlow - ylow*y */
+                xint = xlow - (((Word32) ylow * y) >> 10);
+            }
+
+            *(lsp + nf) = xint;
+            xlow = xint;
+            nf++;
+
+            if (ip == 0)
+            {
+                ip = 1;
+                coef = f2;
+            }
+            else
+            {
+                ip = 0;
+                coef = f1;
+            }
+
+            ylow = Chebps(xlow, coef, NC, pOverflow);
+
+        }
+    }
+
+    /* Check if M roots found */
+
+    if (nf < M)
+    {
+        for (i = NC; i != 0 ; i--)
+        {
+            *lsp++ = *old_lsp++;
+            *lsp++ = *old_lsp++;
+        }
+    }
+
+}
+
+Word16 Chebps_Wrapper(Word16 x,
+                      Word16 f[], /* (n) */
+                      Word16 n,
+                      Flag *pOverflow)
+{
+    return Chebps(x, f, n, pOverflow);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitno_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitno_tab.cpp
new file mode 100644 (file)
index 0000000..d0ecd39
--- /dev/null
@@ -0,0 +1,273 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: bitno_tab.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    None
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+      File             : bitno.tab
+      Purpose          : Tables for bit2prm and prm2bit
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"   /* parameter sizes: MAX_PRM_SIZE */
+#include "mode.h"   /* N_MODES */
+#include "bitno_tab.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+    /* number of parameters per modes (values must be <= MAX_PRM_SIZE!) */
+    const Word16 prmno[N_MODES] =
+    {
+        PRMNO_MR475,
+        PRMNO_MR515,
+        PRMNO_MR59,
+        PRMNO_MR67,
+        PRMNO_MR74,
+        PRMNO_MR795,
+        PRMNO_MR102,
+        PRMNO_MR122,
+        PRMNO_MRDTX
+    };
+
+    /* number of parameters to first subframe per modes */
+    const Word16 prmnofsf[N_MODES - 1] =
+    {
+        PRMNOFSF_MR475,
+        PRMNOFSF_MR515,
+        PRMNOFSF_MR59,
+        PRMNOFSF_MR67,
+        PRMNOFSF_MR74,
+        PRMNOFSF_MR795,
+        PRMNOFSF_MR102,
+        PRMNOFSF_MR122
+    };
+
+    /* parameter sizes (# of bits), one table per mode */
+    const Word16 bitno_MR475[PRMNO_MR475] =
+    {
+        8, 8, 7,                                 /* LSP VQ          */
+        8, 7, 2, 8,                              /* first subframe  */
+        4, 7, 2,                                 /* second subframe */
+        4, 7, 2, 8,                              /* third subframe  */
+        4, 7, 2,                                 /* fourth subframe */
+    };
+
+    const Word16 bitno_MR515[PRMNO_MR515] =
+    {
+        8, 8, 7,                                 /* LSP VQ          */
+        8, 7, 2, 6,                              /* first subframe  */
+        4, 7, 2, 6,                              /* second subframe */
+        4, 7, 2, 6,                              /* third subframe  */
+        4, 7, 2, 6,                              /* fourth subframe */
+    };
+
+    const Word16 bitno_MR59[PRMNO_MR59] =
+    {
+        8, 9, 9,                                 /* LSP VQ          */
+        8, 9, 2, 6,                              /* first subframe  */
+        4, 9, 2, 6,                              /* second subframe */
+        8, 9, 2, 6,                              /* third subframe  */
+        4, 9, 2, 6,                              /* fourth subframe */
+    };
+
+    const Word16 bitno_MR67[PRMNO_MR67] =
+    {
+        8, 9, 9,                                 /* LSP VQ          */
+        8, 11, 3, 7,                             /* first subframe  */
+        4, 11, 3, 7,                             /* second subframe */
+        8, 11, 3, 7,                             /* third subframe  */
+        4, 11, 3, 7,                             /* fourth subframe */
+    };
+
+    const Word16 bitno_MR74[PRMNO_MR74] =
+    {
+        8, 9, 9,                                 /* LSP VQ          */
+        8, 13, 4, 7,                             /* first subframe  */
+        5, 13, 4, 7,                             /* second subframe */
+        8, 13, 4, 7,                             /* third subframe  */
+        5, 13, 4, 7,                             /* fourth subframe */
+    };
+
+    const Word16 bitno_MR795[PRMNO_MR795] =
+    {
+        9, 9, 9,                                 /* LSP VQ          */
+        8, 13, 4, 4, 5,                          /* first subframe  */
+        6, 13, 4, 4, 5,                          /* second subframe */
+        8, 13, 4, 4, 5,                          /* third subframe  */
+        6, 13, 4, 4, 5,                          /* fourth subframe */
+    };
+
+    const Word16 bitno_MR102[PRMNO_MR102] =
+    {
+        8, 9, 9,                                 /* LSP VQ          */
+        8, 1, 1, 1, 1, 10, 10, 7, 7,             /* first subframe  */
+        5, 1, 1, 1, 1, 10, 10, 7, 7,             /* second subframe */
+        8, 1, 1, 1, 1, 10, 10, 7, 7,             /* third subframe  */
+        5, 1, 1, 1, 1, 10, 10, 7, 7,             /* fourth subframe */
+    };
+
+    const Word16 bitno_MR122[PRMNO_MR122] =
+    {
+        7, 8, 9, 8, 6,                           /* LSP VQ          */
+        9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5,   /* first subframe  */
+        6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5,   /* second subframe */
+        9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5,   /* third subframe  */
+        6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5    /* fourth subframe */
+    };
+
+    const Word16 bitno_MRDTX[PRMNO_MRDTX] =
+    {
+        3,
+        8, 9, 9,
+        6
+    };
+
+    /* overall table with all parameter sizes for all modes */
+    const Word16 * const bitno[N_MODES] =
+    {
+        bitno_MR475,
+        bitno_MR515,
+        bitno_MR59,
+        bitno_MR67,
+        bitno_MR74,
+        bitno_MR795,
+        bitno_MR102,
+        bitno_MR122,
+        bitno_MRDTX
+    };
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL FUNCTION REFERENCES
+    ; Declare functions defined elsewhere and referenced in this module
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; Define all local variables
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Function body here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Return nothing or data or data pointer
+----------------------------------------------------------------------------*/
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitreorder_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitreorder_tab.cpp
new file mode 100644 (file)
index 0000000..3245cdb
--- /dev/null
@@ -0,0 +1,381 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: bitreorder_tab.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    None
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function contains tables needed to reformat the encoded speech bits
+ into IF2, WMF, and ETS.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ AMR Speech Codec Frame Structure,
+ 3GPP TS 26.101 version 4.1.0 Release 4, June 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "bitreorder_tab.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+#define NUM_MODES           16
+#define NUMBIT_MR475        95
+#define NUMBIT_MR515       103
+#define NUMBIT_MR59        118
+#define NUMBIT_MR67        134
+#define NUMBIT_MR74        148
+#define NUMBIT_MR795       159
+#define NUMBIT_MR102       204
+#define NUMBIT_MR122       244
+#define NUMBIT_AMR_SID      39
+#define NUMBIT_GSMEFR_SID   43
+#define NUMBIT_TDMAEFR_SID  38
+#define NUMBIT_PDCEFR_SID   37
+#define NUMBIT_UNUSED1       0
+#define NUMBIT_UNUSED2       0
+#define NUMBIT_UNUSED3       0
+#define NUMBIT_NO_DATA       0
+
+#define MAX_NUM_BITS       244
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+    /* number of parameters per modes (values must be <= MAX_PRM_SIZE!) */
+    const Word16 numOfBits[NUM_MODES] =
+    {
+        NUMBIT_MR475,
+        NUMBIT_MR515,
+        NUMBIT_MR59,
+        NUMBIT_MR67,
+        NUMBIT_MR74,
+        NUMBIT_MR795,
+        NUMBIT_MR102,
+        NUMBIT_MR122,
+        NUMBIT_AMR_SID,
+        NUMBIT_GSMEFR_SID,
+        NUMBIT_TDMAEFR_SID,
+        NUMBIT_PDCEFR_SID,
+        NUMBIT_UNUSED1,
+        NUMBIT_UNUSED2,
+        NUMBIT_UNUSED3,
+        NUMBIT_NO_DATA
+    };
+
+    const Word16 reorderBits_MR475[NUMBIT_MR475] =
+    {
+        0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
+        10, 11, 12, 13, 14, 15, 23, 24, 25, 26,
+        27, 28, 48, 49, 61, 62, 82, 83, 47, 46,
+        45, 44, 81, 80, 79, 78, 17, 18, 20, 22,
+        77, 76, 75, 74, 29, 30, 43, 42, 41, 40,
+        38, 39, 16, 19, 21, 50, 51, 59, 60, 63,
+        64, 72, 73, 84, 85, 93, 94, 32, 33, 35,
+        36, 53, 54, 56, 57, 66, 67, 69, 70, 87,
+        88, 90, 91, 34, 55, 68, 89, 37, 58, 71,
+        92, 31, 52, 65, 86
+    };
+
+    const Word16 reorderBits_MR515[NUMBIT_MR515] =
+    {
+        7,  6,  5,  4,  3,  2,  1,  0, 15, 14,
+        13, 12, 11, 10,  9,  8, 23, 24, 25, 26,
+        27, 46, 65, 84, 45, 44, 43, 64, 63, 62,
+        83, 82, 81, 102, 101, 100, 42, 61, 80, 99,
+        28, 47, 66, 85, 18, 41, 60, 79, 98, 29,
+        48, 67, 17, 20, 22, 40, 59, 78, 97, 21,
+        30, 49, 68, 86, 19, 16, 87, 39, 38, 58,
+        57, 77, 35, 54, 73, 92, 76, 96, 95, 36,
+        55, 74, 93, 32, 51, 33, 52, 70, 71, 89,
+        90, 31, 50, 69, 88, 37, 56, 75, 94, 34,
+        53, 72, 91
+    };
+
+    const Word16 reorderBits_MR59[NUMBIT_MR59] =
+    {
+        0,  1,  4,  5,  3,  6,  7,  2, 13, 15,
+        8,  9, 11, 12, 14, 10, 16, 28, 74, 29,
+        75, 27, 73, 26, 72, 30, 76, 51, 97, 50,
+        71, 96, 117, 31, 77, 52, 98, 49, 70, 95,
+        116, 53, 99, 32, 78, 33, 79, 48, 69, 94,
+        115, 47, 68, 93, 114, 46, 67, 92, 113, 19,
+        21, 23, 22, 18, 17, 20, 24, 111, 43, 89,
+        110, 64, 65, 44, 90, 25, 45, 66, 91, 112,
+        54, 100, 40, 61, 86, 107, 39, 60, 85, 106,
+        36, 57, 82, 103, 35, 56, 81, 102, 34, 55,
+        80, 101, 42, 63, 88, 109, 41, 62, 87, 108,
+        38, 59, 84, 105, 37, 58, 83, 104
+    };
+
+    const Word16 reorderBits_MR67[NUMBIT_MR67] =
+    {
+        0,  1,  4,  3,  5,  6, 13,  7,  2,  8,
+        9, 11, 15, 12, 14, 10, 28, 82, 29, 83,
+        27, 81, 26, 80, 30, 84, 16, 55, 109, 56,
+        110, 31, 85, 57, 111, 48, 73, 102, 127, 32,
+        86, 51, 76, 105, 130, 52, 77, 106, 131, 58,
+        112, 33, 87, 19, 23, 53, 78, 107, 132, 21,
+        22, 18, 17, 20, 24, 25, 50, 75, 104, 129,
+        47, 72, 101, 126, 54, 79, 108, 133, 46, 71,
+        100, 125, 128, 103, 74, 49, 45, 70, 99, 124,
+        42, 67, 96, 121, 39, 64, 93, 118, 38, 63,
+        92, 117, 35, 60, 89, 114, 34, 59, 88, 113,
+        44, 69, 98, 123, 43, 68, 97, 122, 41, 66,
+        95, 120, 40, 65, 94, 119, 37, 62, 91, 116,
+        36, 61, 90, 115
+    };
+
+    const Word16 reorderBits_MR74[NUMBIT_MR74] =
+    {
+        0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
+        10, 11, 12, 13, 14, 15, 16, 26, 87, 27,
+        88, 28, 89, 29, 90, 30, 91, 51, 80, 112,
+        141, 52, 81, 113, 142, 54, 83, 115, 144, 55,
+        84, 116, 145, 58, 119, 59, 120, 21, 22, 23,
+        17, 18, 19, 31, 60, 92, 121, 56, 85, 117,
+        146, 20, 24, 25, 50, 79, 111, 140, 57, 86,
+        118, 147, 49, 78, 110, 139, 48, 77, 53, 82,
+        114, 143, 109, 138, 47, 76, 108, 137, 32, 33,
+        61, 62, 93, 94, 122, 123, 41, 42, 43, 44,
+        45, 46, 70, 71, 72, 73, 74, 75, 102, 103,
+        104, 105, 106, 107, 131, 132, 133, 134, 135, 136,
+        34, 63, 95, 124, 35, 64, 96, 125, 36, 65,
+        97, 126, 37, 66, 98, 127, 38, 67, 99, 128,
+        39, 68, 100, 129, 40, 69, 101, 130
+    };
+
+    const Word16 reorderBits_MR795[NUMBIT_MR795] =
+    {
+        8,  7,  6,  5,  4,  3,  2, 14, 16,  9,
+        10, 12, 13, 15, 11, 17, 20, 22, 24, 23,
+        19, 18, 21, 56, 88, 122, 154, 57, 89, 123,
+        155, 58, 90, 124, 156, 52, 84, 118, 150, 53,
+        85, 119, 151, 27, 93, 28, 94, 29, 95, 30,
+        96, 31, 97, 61, 127, 62, 128, 63, 129, 59,
+        91, 125, 157, 32, 98, 64, 130,  1,  0, 25,
+        26, 33, 99, 34, 100, 65, 131, 66, 132, 54,
+        86, 120, 152, 60, 92, 126, 158, 55, 87, 121,
+        153, 117, 116, 115, 46, 78, 112, 144, 43, 75,
+        109, 141, 40, 72, 106, 138, 36, 68, 102, 134,
+        114, 149, 148, 147, 146, 83, 82, 81, 80, 51,
+        50, 49, 48, 47, 45, 44, 42, 39, 35, 79,
+        77, 76, 74, 71, 67, 113, 111, 110, 108, 105,
+        101, 145, 143, 142, 140, 137, 133, 41, 73, 107,
+        139, 37, 69, 103, 135, 38, 70, 104, 136
+    };
+
+    const Word16 reorderBits_MR102[NUMBIT_MR102] =
+    {
+        7,  6,  5,  4,  3,  2,  1,  0, 16, 15,
+        14, 13, 12, 11, 10,  9,  8, 26, 27, 28,
+        29, 30, 31, 115, 116, 117, 118, 119, 120, 72,
+        73, 161, 162, 65, 68, 69, 108, 111, 112, 154,
+        157, 158, 197, 200, 201, 32, 33, 121, 122, 74,
+        75, 163, 164, 66, 109, 155, 198, 19, 23, 21,
+        22, 18, 17, 20, 24, 25, 37, 36, 35, 34,
+        80, 79, 78, 77, 126, 125, 124, 123, 169, 168,
+        167, 166, 70, 67, 71, 113, 110, 114, 159, 156,
+        160, 202, 199, 203, 76, 165, 81, 82, 92, 91,
+        93, 83, 95, 85, 84, 94, 101, 102, 96, 104,
+        86, 103, 87, 97, 127, 128, 138, 137, 139, 129,
+        141, 131, 130, 140, 147, 148, 142, 150, 132, 149,
+        133, 143, 170, 171, 181, 180, 182, 172, 184, 174,
+        173, 183, 190, 191, 185, 193, 175, 192, 176, 186,
+        38, 39, 49, 48, 50, 40, 52, 42, 41, 51,
+        58, 59, 53, 61, 43, 60, 44, 54, 194, 179,
+        189, 196, 177, 195, 178, 187, 188, 151, 136, 146,
+        153, 134, 152, 135, 144, 145, 105, 90, 100, 107,
+        88, 106, 89, 98, 99, 62, 47, 57, 64, 45,
+        63, 46, 55, 56
+    };
+
+    const Word16 reorderBits_MR122[NUMBIT_MR122] =
+    {
+        0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
+        10, 11, 12, 13, 14, 23, 15, 16, 17, 18,
+        19, 20, 21, 22, 24, 25, 26, 27, 28, 38,
+        141, 39, 142, 40, 143, 41, 144, 42, 145, 43,
+        146, 44, 147, 45, 148, 46, 149, 47, 97, 150,
+        200, 48, 98, 151, 201, 49, 99, 152, 202, 86,
+        136, 189, 239, 87, 137, 190, 240, 88, 138, 191,
+        241, 91, 194, 92, 195, 93, 196, 94, 197, 95,
+        198, 29, 30, 31, 32, 33, 34, 35, 50, 100,
+        153, 203, 89, 139, 192, 242, 51, 101, 154, 204,
+        55, 105, 158, 208, 90, 140, 193, 243, 59, 109,
+        162, 212, 63, 113, 166, 216, 67, 117, 170, 220,
+        36, 37, 54, 53, 52, 58, 57, 56, 62, 61,
+        60, 66, 65, 64, 70, 69, 68, 104, 103, 102,
+        108, 107, 106, 112, 111, 110, 116, 115, 114, 120,
+        119, 118, 157, 156, 155, 161, 160, 159, 165, 164,
+        163, 169, 168, 167, 173, 172, 171, 207, 206, 205,
+        211, 210, 209, 215, 214, 213, 219, 218, 217, 223,
+        222, 221, 73, 72, 71, 76, 75, 74, 79, 78,
+        77, 82, 81, 80, 85, 84, 83, 123, 122, 121,
+        126, 125, 124, 129, 128, 127, 132, 131, 130, 135,
+        134, 133, 176, 175, 174, 179, 178, 177, 182, 181,
+        180, 185, 184, 183, 188, 187, 186, 226, 225, 224,
+        229, 228, 227, 232, 231, 230, 235, 234, 233, 238,
+        237, 236, 96, 199
+    };
+
+    /* overall table with all parameter sizes for all modes */
+    const Word16 * const reorderBits[NUM_MODES-1] =
+    {
+        reorderBits_MR475,
+        reorderBits_MR515,
+        reorderBits_MR59,
+        reorderBits_MR67,
+        reorderBits_MR74,
+        reorderBits_MR795,
+        reorderBits_MR102,
+        reorderBits_MR122
+    };
+
+    /* Number of Frames (16-bit segments sent for each mode */
+    const Word16 numCompressedBytes[16] =
+    {
+        13, /*4.75*/
+        14, /*5.15*/
+        16, /*5.90*/
+        18, /*6.70*/
+        19, /*7.40*/
+        21, /*7.95*/
+        26, /*10.2*/
+        31, /*12.2*/
+        6, /*GsmAmr comfort noise*/
+        6, /*Gsm-Efr comfort noise*/
+        6, /*IS-641 comfort noise*/
+        6, /*Pdc-Efr comfort noise*/
+        0, /*future use*/
+        0, /*future use*/
+        0, /*future use*/
+        1  /*No transmission*/
+    };
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL FUNCTION REFERENCES
+    ; Declare functions defined elsewhere and referenced in this module
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; Define all local variables
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Function body here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Return nothing or data or data pointer
+----------------------------------------------------------------------------*/
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bits2prm.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bits2prm.cpp
new file mode 100644 (file)
index 0000000..3901545
--- /dev/null
@@ -0,0 +1,249 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: bits2prm.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "bits2prm.h"
+#include "typedef.h"
+#include "mode.h"
+#include "bitno_tab.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Bin2int
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    no_of_bits = number of bits associated with value
+    bitstream = pointer to buffer where bits are read
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function    : Bin2int
+  Purpose     : Read "no_of_bits" bits from the array bitstream[]
+                and convert to integer.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ bits2prm.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static Word16 Bin2int ( // Reconstructed parameter
+    Word16 no_of_bits,  // input : number of bits associated with value
+    Word16 *bitstream   // output: address where bits are written
+)
+{
+    Word16 value, i, bit;
+
+    value = 0;
+    for (i = 0; i < no_of_bits; i++)
+    {
+        value = shl (value, 1);
+        bit = *bitstream++;
+        if (sub (bit, BIT_1) == 0)
+            value = add (value, 1);
+    }
+    return (value);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+static Word16 Bin2int(  /* Reconstructed parameter                      */
+    Word16 no_of_bits,  /* input : number of bits associated with value */
+    Word16 *bitstream   /* input: address where bits are read from      */
+)
+{
+    Word16 value;
+    Word16 i;
+    Word16 single_bit;
+
+    value = 0;
+    for (i = 0; i < no_of_bits; i++)
+    {
+        value <<= 1;
+        single_bit = *(bitstream++);
+        value |= single_bit;
+    }
+    return (value);
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: bits2prm
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode = AMR mode of type enum Mode
+    bits[] = pointer to serial bits of type Word16
+    prm[] = pointer to analysis parameters of type Word16
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function    : Bits2prm
+  Purpose     : Retrieves the vector of encoder parameters from
+                the received serial bits in a frame.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ bits2prm.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Bits2prm (
+    enum Mode mode,     // i : AMR mode
+    Word16 bits[],      // i : serial bits       (size <= MAX_SERIAL_SIZE)
+    Word16 prm[]        // o : analysis parameters  (size <= MAX_PRM_SIZE)
+)
+{
+    Word16 i;
+
+    for (i = 0; i < prmno[mode]; i++)
+    {
+        prm[i] = Bin2int (bitno[mode][i], bits);
+        bits += bitno[mode][i];
+        add(0,0);       // account for above pointer update
+    }
+
+   return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+OSCL_EXPORT_REF void Bits2prm(
+    enum Mode mode,     /* i : AMR mode                                    */
+    Word16 bits[],      /* i : serial bits       (size <= MAX_SERIAL_SIZE) */
+    Word16 prm[]        /* o : analysis parameters  (size <= MAX_PRM_SIZE) */
+)
+{
+    Word16 i;
+
+    for (i = 0; i < prmno[mode]; i++)
+    {
+        prm[i] = Bin2int(bitno[mode][i], bits);
+        bits += bitno[mode][i];
+    }
+
+    return;
+}
+
+
+
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/c2_9pf_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/c2_9pf_tab.cpp
new file mode 100644 (file)
index 0000000..4db7e9b
--- /dev/null
@@ -0,0 +1,137 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: c2_9pf_tab.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the declaration for startPos[] used by the functions
+ c2_9pf.c and d2_9pf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+
+    extern const Word16 startPos[];
+    const Word16 startPos[2*4*2] =
+    {
+        0, 2, 0, 3,
+        0, 2, 0, 3,
+        1, 3, 2, 4,
+        1, 4, 1, 4
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] c2_9pf.c UMTS GSM AMR speech codec, R99 -  Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/copy.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/copy.cpp
new file mode 100644 (file)
index 0000000..1dec39d
--- /dev/null
@@ -0,0 +1,86 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*      File             : copy.h
+*
+********************************************************************************
+*/
+
+/*
+********************************************************************************
+*                         MODULE INCLUDE FILE AND VERSION ID
+********************************************************************************
+*/
+#include "copy.h"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+#include "basic_op.h"
+#include "oscl_mem.h"
+
+/*
+********************************************************************************
+*                         PUBLIC PROGRAM CODE
+********************************************************************************
+*/
+/*************************************************************************
+ *
+ *   FUNCTION:   Copy
+ *
+ *   PURPOSE:   Copy vector x[] to y[]
+ *
+ *
+ *************************************************************************/
+/*
+**************************************************************************
+*
+*  Function    : Copy
+*  Purpose     : Copy vector x[] to y[]
+*
+**************************************************************************
+*/
+void Copy(
+    const Word16 x[],   /* i : input vector (L)  */
+    Word16 y[],         /* o : output vector (L) */
+    Word16 L            /* i : vector length     */
+)
+{
+    oscl_memmove(y, x, L*sizeof(*x));
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_32.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_32.cpp
new file mode 100644 (file)
index 0000000..ea02926
--- /dev/null
@@ -0,0 +1,172 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: div_32.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: div_32
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_num = 32 bit signed integer (Word32) whose value falls in the
+                range : 0x0000 0000 < L_num < L_denom
+    L_denom_hi = 16 bit positive normalized integer whose value falls in
+               the range : 0x4000 < hi < 0x7fff
+    L_denom_lo = 16 bit positive integer whose value falls in the range :
+               0 < lo < 0x7fff
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the 32 bit divide operation resulted in overflow
+
+ Returns:
+    result = 32-bit quotient of of the division of two 32 bit integers
+                L_num / L_denom (Word32)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function is a fractional integer division of two 32 bit numbers, the
+ numerator L_num and the denominator L_denom. The denominator is formed by
+ combining denom_hi and denom_lo. Note that denom_hi is a normalized numbers.
+ The numerator and denominator must be positive and the numerator must be
+ less than the denominator.
+
+ The division is done as follows:
+ 1. Find 1/L_denom by first approximating: approx = 1 / denom_hi.
+ 2. 1/L_denom = approx * (2.0 - L_denom * approx ).
+ 3. result = L_num * (1/L_denom).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] div_32() function in oper_32b.c,  UMTS GSM AMR speech codec, R99 -
+ Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word32 Div_32(Word32 L_num,
+              Word16 L_denom_hi,
+              Word16 L_denom_lo,
+              Flag   *pOverflow)
+{
+
+    Word16 approx;
+    Word16 hi;
+    Word16 lo;
+    Word16 n_hi;
+    Word16 n_lo;
+    Word32 result;
+
+    /* First approximation: 1 / L_denom = 1/L_denom_hi */
+
+    approx = div_s((Word16) 0x3fff, L_denom_hi);
+
+    /* 1/L_denom = approx * (2.0 - L_denom * approx) */
+
+    result = Mpy_32_16(L_denom_hi, L_denom_lo, approx, pOverflow);
+    /* result is > 0 , and less than 1.0 */
+    result =  0x7fffffffL - result;
+
+    hi = (Word16)(result >> 16);
+    lo = (result >> 1) - (hi << 15);
+
+    result = Mpy_32_16(hi, lo, approx, pOverflow);
+
+    /* L_num * (1/L_denom) */
+
+    hi = (Word16)(result >> 16);
+    lo = (result >> 1) - (hi << 15);
+
+    n_hi = (Word16)(L_num >> 16);
+    n_lo = (L_num >> 1) - (n_hi << 15);
+
+    result = Mpy_32(n_hi, n_lo, hi, lo, pOverflow);
+    result = L_shl(result, 2, pOverflow);
+
+    return (result);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp
new file mode 100644 (file)
index 0000000..f60f18b
--- /dev/null
@@ -0,0 +1,235 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: div_s.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    var1 = 16 bit signed integer (Word16) whose value falls in
+           the range : 0x0000 <= var1 <= 0x7fff.
+    var2 = 16 bit signed integer (Word16) whose value falls in
+           the range : 0x0000 <= var1 <= 0x7fff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    var_out = quotient of var1 divided by var2 (Word16)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function produces a result which is the fractional integer division of
+ var1 by var2; var1 and var2 must be positive and var2 must be greater or equal
+ to var1; the result is positive (leading bit equal to 0) and truncated to 16
+ bits. If var1 = var2 then div(var1,var2) = 32767.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 div_s (Word16 var1, Word16 var2)
+{
+    Word16 var_out = 0;
+    Word16 iteration;
+    Word32 L_num;
+    Word32 L_denom;
+    Word16 abort_flag = 0;
+
+    if ((var1 > var2) || (var1 < 0))
+    {
+        printf ("Division Error var1=%d  var2=%d\n", var1, var2);
+        abort_flag = 1;
+        exit(0);
+    }
+    if ((var1 != 0) && (abort_flag == 0))
+    {
+        if (var1 == var2)
+        {
+            var_out = MAX_16;
+        }
+        else
+        {
+            L_num = (Word32) var1;
+            L_denom = (Word32) var2;
+
+            for (iteration = 15; iteration > 0; iteration--)
+            {
+                var_out <<= 1;
+                L_num <<= 1;
+
+                if (L_num >= L_denom)
+                {
+                    L_num -= L_denom;
+                    var_out += 1;
+                }
+            }
+        }
+    }
+
+#if (WMOPS)
+    multiCounter[currCounter].div_s++;
+#endif
+    return (var_out);
+}
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+OSCL_EXPORT_REF Word16 div_s(register Word16 var1, register Word16 var2)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+    Word16 var_out = 0;
+    register Word16 iteration;
+    Word32 L_num;
+    Word32 L_denom;
+    Word32 L_denom_by_2;
+    Word32 L_denom_by_4;
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+    if ((var1 > var2) || (var1 < 0))
+    {
+        return 0; // used to exit(0);
+    }
+    if (var1)
+    {
+        if (var1 != var2)
+        {
+
+            L_num = (Word32) var1;
+            L_denom = (Word32) var2;
+            L_denom_by_2 = (L_denom << 1);
+            L_denom_by_4 = (L_denom << 2);
+            for (iteration = 5; iteration > 0; iteration--)
+            {
+                var_out <<= 3;
+                L_num   <<= 3;
+
+                if (L_num >= L_denom_by_4)
+                {
+                    L_num -= L_denom_by_4;
+                    var_out |= 4;
+                }
+
+                if (L_num >= L_denom_by_2)
+                {
+                    L_num -= L_denom_by_2;
+                    var_out |=  2;
+                }
+
+                if (L_num >= (L_denom))
+                {
+                    L_num -= (L_denom);
+                    var_out |=  1;
+                }
+
+            }
+        }
+        else
+        {
+            var_out = MAX_16;
+        }
+    }
+
+#if (WMOPS)
+    multiCounter[currCounter].div_s++;
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+    return (var_out);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_h.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_h.cpp
new file mode 100644 (file)
index 0000000..54d0dee
--- /dev/null
@@ -0,0 +1,144 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: extract_h.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_var1 = 32 bit long signed integer (Word32 ) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    L_var1 = Most significant word of input (Word16)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function returns the 16 MSB of the input, L_var1.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 extract_h (Word32 L_var1)
+{
+    Word16 var_out;
+
+    var_out = (Word16) (L_var1 >> 16);
+#if (WMOPS)
+    multiCounter[currCounter].extract_h++;
+#endif
+    return (var_out);
+}
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word16 extract_h(Word32 L_var1)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+    return ((Word16)(L_var1 >> 16));
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_l.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_l.cpp
new file mode 100644 (file)
index 0000000..a96519b
--- /dev/null
@@ -0,0 +1,143 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: extract_l.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_var1 = 32 bit long signed integer (Word32 ) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    L_var1 = Most significant word of input (Word16)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function returns the 16 LSB of the input, L_var1.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 extract_l (Word32 L_var1)
+{
+    Word16 var_out;
+
+    var_out = (Word16) L_var1;
+#if (WMOPS)
+    multiCounter[currCounter].extract_l++;
+#endif
+    return (var_out);
+}
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word16 extract_l(Word32 L_var1)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+    return ((Word16) L_var1);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gains_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gains_tbl.cpp
new file mode 100644 (file)
index 0000000..925c1dc
--- /dev/null
@@ -0,0 +1,188 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: gains_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+#define NB_QUA_PITCH 16
+#define NB_QUA_CODE 32
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+
+
+    extern const Word16 qua_gain_pitch[];
+    const Word16 qua_gain_pitch[NB_QUA_PITCH] =
+    {
+        0, 3277, 6556, 8192, 9830, 11469, 12288, 13107,
+        13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661
+    };
+
+
+    extern const Word16 qua_gain_code[];
+    const Word16 qua_gain_code[(NB_QUA_CODE+1)*3] =
+    {
+        /* gain factor (g_fac) and quantized energy error (qua_ener_MR122, qua_ener)
+         * are stored:
+         *
+         * qua_ener_MR122 = log2(g_fac)      (not the rounded floating point value, but
+         *                                    the value the original EFR algorithm
+         *                                    calculates from g_fac [using Log2])
+         * qua_ener       = 20*log10(g_fac); (rounded floating point value)
+         *
+         *
+         * g_fac (Q11), qua_ener_MR122 (Q10), qua_ener (Q10)
+         */
+        159,                -3776,          -22731,
+        206,                -3394,          -20428,
+        268,                -3005,          -18088,
+        349,                -2615,          -15739,
+        419,                -2345,          -14113,
+        482,                -2138,          -12867,
+        554,                -1932,          -11629,
+        637,                -1726,          -10387,
+        733,                -1518,           -9139,
+        842,                -1314,           -7906,
+        969,                -1106,           -6656,
+        1114,                 -900,           -5416,
+        1281,                 -694,           -4173,
+        1473,                 -487,           -2931,
+        1694,                 -281,           -1688,
+        1948,                  -75,            -445,
+        2241,                  133,             801,
+        2577,                  339,            2044,
+        2963,                  545,            3285,
+        3408,                  752,            4530,
+        3919,                  958,            5772,
+        4507,                 1165,            7016,
+        5183,                 1371,            8259,
+        5960,                 1577,            9501,
+        6855,                 1784,           10745,
+        7883,                 1991,           11988,
+        9065,                 2197,           13231,
+        10425,                 2404,           14474,
+        12510,                 2673,           16096,
+        16263,                 3060,           18429,
+        21142,                 3448,           20763,
+        27485,                 3836,           23097,
+        27485,                 3836,           23097
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] gains.tab,  UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp
new file mode 100644 (file)
index 0000000..71519e9
--- /dev/null
@@ -0,0 +1,982 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: gc_pred.cpp
+ Functions:
+            gc_pred_reset
+            gc_pred
+            gc_pred_update
+            gc_pred_average_limited
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the functions that perform codebook gain MA prediction.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "gc_pred.h"
+#include "basicop_malloc.h"
+#include "basic_op.h"
+#include "cnst.h"
+#include "log2.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NPRED 4  /* number of prediction taps */
+
+/* average innovation energy.                               */
+/* MEAN_ENER  = 36.0/constant, constant = 20*Log10(2)       */
+#define MEAN_ENER_MR122  783741L  /* 36/(20*log10(2)) (Q17) */
+
+/* minimum quantized energy: -14 dB */
+#define MIN_ENERGY       -14336       /* 14                 Q10 */
+#define MIN_ENERGY_MR122  -2381       /* 14 / (20*log10(2)) Q10 */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/* MA prediction coefficients (Q13) */
+static const Word16 pred[NPRED] = {5571, 4751, 2785, 1556};
+
+/* MA prediction coefficients (Q6)  */
+static const Word16 pred_MR122[NPRED] = {44, 37, 22, 12};
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gc_pred_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a structure of type gc_predState
+
+ Outputs:
+    past_qua_en field in the structure pointed to by state is initialized
+      to MIN_ENERGY
+    past_qua_en_MR122 field in the structure pointed to by state is
+      initialized to MIN_ENERGY_MR122
+
+ Returns:
+    return_value = 0, if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function initializes the state memory used by gc_pred to zero.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ gc_pred.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int gc_pred_reset (gc_predState *state)
+{
+   Word16 i;
+
+   if (state == (gc_predState *) NULL){
+      fprintf(stderr, "gc_pred_reset: invalid parameter\n");
+      return -1;
+   }
+
+   for(i = 0; i < NPRED; i++)
+   {
+      state->past_qua_en[i] = MIN_ENERGY;
+      state->past_qua_en_MR122[i] = MIN_ENERGY_MR122;
+   }
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF Word16 gc_pred_reset(gc_predState *state)
+{
+    Word16 i;
+
+    if (state == (gc_predState *) NULL)
+    {
+        /* fprintf(stderr, "gc_pred_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    for (i = 0; i < NPRED; i++)
+    {
+        state->past_qua_en[i] = MIN_ENERGY;
+        state->past_qua_en_MR122[i] = MIN_ENERGY_MR122;
+    }
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gc_pred
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type gc_predState
+    mode = AMR mode (enum Mode)
+    code = pointer to the innovative codebook vector; Q12 in MR122 mode,
+           otherwise, Q13 (Word16)
+    exp_gcode0 = pointer to the exponent part of predicted gain factor
+             (Q0) (Word16)
+    frac_gcode0 = pointer to the fractional part of predicted gain factor
+              (Q15) (Word16)
+    exp_en = pointer to the exponent part of the innovation energy; this
+         is calculated for MR795 mode, Q0 (Word16)
+    frac_en = pointer to the fractional part of the innovation energy;
+          this is calculated for MR795 mode, Q15 (Word16)
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    store pointed to by exp_gcode0 contains the exponent part of the
+      recently calculated predicted gain factor
+    store pointed to by frac_gcode0 contains the fractional part of the
+      recently calculated predicted gain factor
+    store pointed to by exp_en contains the exponent part of the
+      recently calculated innovation energy
+    store pointed to by frac_en contains the fractional part of the
+      recently calculated innovation energy
+    pOverflow = 1 if the math functions called by gc_pred
+                results in overflow else zero.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    pred = table of MA prediction coefficients (Q13) (Word16)
+    pred_MR122 = table of MA prediction coefficients (Q6) (Word16)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the MA prediction of the innovation energy (in
+ dB/(20*log10(2))), with the mean removed.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ gc_pred.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+The original etsi reference code uses a global flag Overflow. However, in the
+actual implementation a pointer to a the overflow flag is passed in.
+
+void
+gc_pred(
+    gc_predState *st,   // i/o: State struct
+    enum Mode mode,     // i  : AMR mode
+    Word16 *code,       // i  : innovative codebook vector (L_SUBFR)
+                        //      MR122: Q12, other modes: Q13
+    Word16 *exp_gcode0, // o  : exponent of predicted gain factor, Q0
+    Word16 *frac_gcode0,// o  : fraction of predicted gain factor  Q15
+    Word16 *exp_en,     // o  : exponent of innovation energy,     Q0
+                        //      (only calculated for MR795)
+    Word16 *frac_en     // o  : fraction of innovation energy,     Q15
+                        //      (only calculated for MR795)
+)
+{
+    Word16 i;
+    Word32 ener_code;
+    Word16 exp, frac;
+
+     *-------------------------------------------------------------------*
+     *  energy of code:                                                  *
+     *  ~~~~~~~~~~~~~~~                                                  *
+     *  ener_code = sum(code[i]^2)                                       *
+     *-------------------------------------------------------------------*
+    ener_code = L_mac((Word32) 0, code[0], code[0]);
+                                                 // MR122:  Q12*Q12 -> Q25
+                                                 // others: Q13*Q13 -> Q27
+    for (i = 1; i < L_SUBFR; i++)
+        ener_code = L_mac(ener_code, code[i], code[i]);
+
+    if (sub (mode, MR122) == 0)
+    {
+        Word32 ener;
+
+        // ener_code = ener_code / lcode; lcode = 40; 1/40 = 26214 Q20
+        ener_code = L_mult (pv_round (ener_code), 26214);   // Q9  * Q20 -> Q30
+
+         *-------------------------------------------------------------------*
+         *  energy of code:                                                  *
+         *  ~~~~~~~~~~~~~~~                                                  *
+         *  ener_code(Q17) = 10 * Log10(energy) / constant                   *
+         *                 = 1/2 * Log2(energy)                              *
+         *                                           constant = 20*Log10(2)  *
+         *-------------------------------------------------------------------*
+        // ener_code = 1/2 * Log2(ener_code); Note: Log2=log2+30
+        Log2(ener_code, &exp, &frac);
+        ener_code = L_Comp (sub (exp, 30), frac);     // Q16 for log()
+                                                    // ->Q17 for 1/2 log()
+
+         *-------------------------------------------------------------------*
+         *  predicted energy:                                                *
+         *  ~~~~~~~~~~~~~~~~~                                                *
+         *  ener(Q24) = (Emean + sum{pred[i]*past_en[i]})/constant           *
+         *            = MEAN_ENER + sum(pred[i]*past_qua_en[i])              *
+         *                                           constant = 20*Log10(2)  *
+         *-------------------------------------------------------------------*
+
+        ener = MEAN_ENER_MR122;                      // Q24 (Q17)
+        for (i = 0; i < NPRED; i++)
+        {
+            ener = L_mac (ener, st->past_qua_en_MR122[i], pred_MR122[i]);
+                                                     // Q10 * Q13 -> Q24
+                                                     // Q10 * Q6  -> Q17
+        }
+
+         *-------------------------------------------------------------------*
+         *  predicted codebook gain                                          *
+         *  ~~~~~~~~~~~~~~~~~~~~~~~                                          *
+         *  gc0     = Pow10( (ener*constant - ener_code*constant) / 20 )     *
+         *          = Pow2(ener-ener_code)                                   *
+         *          = Pow2(int(d)+frac(d))                                   *
+         *                                                                   *
+         *  (store exp and frac for pow2())                                  *
+         *-------------------------------------------------------------------*
+
+        ener = L_shr (L_sub (ener, ener_code), 1);                // Q16
+        L_Extract(ener, exp_gcode0, frac_gcode0);
+    }
+    else // all modes except 12.2
+    {
+        Word32 L_tmp;
+        Word16 exp_code, gcode0;
+
+         *-----------------------------------------------------------------*
+         *  Compute: means_ener - 10log10(ener_code/ L_sufr)               *
+         *-----------------------------------------------------------------*
+
+        exp_code = norm_l (ener_code);
+        ener_code = L_shl (ener_code, exp_code);
+
+        // Log2 = log2 + 27
+        Log2_norm (ener_code, exp_code, &exp, &frac);
+
+        // fact = 10/log2(10) = 3.01 = 24660 Q13
+        L_tmp = Mpy_32_16(exp, frac, -24660); // Q0.Q15 * Q13 -> Q14
+
+         *   L_tmp = means_ener - 10log10(ener_code/L_SUBFR)
+         *         = means_ener - 10log10(ener_code) + 10log10(L_SUBFR)
+         *         = K - fact * Log2(ener_code)
+         *         = K - fact * log2(ener_code) - fact*27
+         *
+         *   ==> K = means_ener + fact*27 + 10log10(L_SUBFR)
+         *
+         *   means_ener =       33    =  540672    Q14  (MR475, MR515, MR59)
+         *   means_ener =       28.75 =  471040    Q14  (MR67)
+         *   means_ener =       30    =  491520    Q14  (MR74)
+         *   means_ener =       36    =  589824    Q14  (MR795)
+         *   means_ener =       33    =  540672    Q14  (MR102)
+         *   10log10(L_SUBFR) = 16.02 =  262481.51 Q14
+         *   fact * 27                = 1331640    Q14
+         *   -----------------------------------------
+         *   (MR475, MR515, MR59)   K = 2134793.51 Q14 ~= 16678 * 64 * 2
+         *   (MR67)                 K = 2065161.51 Q14 ~= 32268 * 32 * 2
+         *   (MR74)                 K = 2085641.51 Q14 ~= 32588 * 32 * 2
+         *   (MR795)                K = 2183945.51 Q14 ~= 17062 * 64 * 2
+         *   (MR102)                K = 2134793.51 Q14 ~= 16678 * 64 * 2
+
+
+        if (sub (mode, MR102) == 0)
+        {
+            // mean = 33 dB
+            L_tmp = L_mac(L_tmp, 16678, 64);     // Q14
+        }
+        else if (sub (mode, MR795) == 0)
+        {
+            // ener_code  = <xn xn> * 2^27*2^exp_code
+            // frac_en    = ener_code / 2^16
+            //            = <xn xn> * 2^11*2^exp_code
+            // <xn xn>    = <xn xn>*2^11*2^exp * 2^exp_en
+            //           := frac_en            * 2^exp_en
+
+            // ==> exp_en = -11-exp_code;
+
+            *frac_en = extract_h (ener_code);
+            *exp_en = sub (-11, exp_code);
+
+            // mean = 36 dB
+            L_tmp = L_mac(L_tmp, 17062, 64);     // Q14
+        }
+        else if (sub (mode, MR74) == 0)
+        {
+            // mean = 30 dB
+            L_tmp = L_mac(L_tmp, 32588, 32);     // Q14
+        }
+        else if (sub (mode, MR67) == 0)
+        {
+            // mean = 28.75 dB
+            L_tmp = L_mac(L_tmp, 32268, 32);     // Q14
+        }
+        else // MR59, MR515, MR475
+        {
+            // mean = 33 dB
+            L_tmp = L_mac(L_tmp, 16678, 64);     // Q14
+        }
+
+         *-----------------------------------------------------------------*
+         * Compute gcode0.                                                 *
+         *  = Sum(i=0,3) pred[i]*past_qua_en[i] - ener_code + mean_ener    *
+         *-----------------------------------------------------------------*
+
+        L_tmp = L_shl(L_tmp, 10);                // Q24
+        for (i = 0; i < 4; i++)
+            L_tmp = L_mac(L_tmp, pred[i], st->past_qua_en[i]);
+                                                 // Q13 * Q10 -> Q24
+
+        gcode0 = extract_h(L_tmp);               // Q8
+
+         *-----------------------------------------------------------------*
+         * gcode0 = pow(10.0, gcode0/20)                                   *
+         *        = pow(2, 3.3219*gcode0/20)                               *
+         *        = pow(2, 0.166*gcode0)                                   *
+         *-----------------------------------------------------------------*
+
+        // 5439 Q15 = 0.165985
+        // (correct: 1/(20*log10(2)) 0.166096 = 5443 Q15)
+        if (sub (mode, MR74) == 0) // For IS641 bitexactness
+            L_tmp = L_mult(gcode0, 5439);  // Q8 * Q15 -> Q24
+        else
+            L_tmp = L_mult(gcode0, 5443);  // Q8 * Q15 -> Q24
+
+        L_tmp = L_shr(L_tmp, 8);                   //          -> Q16
+        L_Extract(L_tmp, exp_gcode0, frac_gcode0); //       -> Q0.Q15
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void gc_pred(
+    gc_predState *st,   /* i/o: State struct                           */
+    enum Mode mode,     /* i  : AMR mode                               */
+    Word16 *code,       /* i  : innovative codebook vector (L_SUBFR)   */
+    /*      MR122: Q12, other modes: Q13           */
+    Word16 *exp_gcode0, /* o  : exponent of predicted gain factor, Q0  */
+    Word16 *frac_gcode0,/* o  : fraction of predicted gain factor  Q15 */
+    Word16 *exp_en,     /* o  : exponent of innovation energy,     Q0  */
+    /*      (only calculated for MR795)            */
+    Word16 *frac_en,    /* o  : fraction of innovation energy,     Q15 */
+    /*      (only calculated for MR795)            */
+    Flag   *pOverflow
+)
+{
+    register Word16 i;
+    register Word32 L_temp1, L_temp2;
+    register Word32 L_tmp;
+    Word32 ener_code;
+    Word32 ener;
+    Word16 exp, frac;
+    Word16 exp_code, gcode0;
+    Word16 tmp;
+    Word16 *p_code = &code[0];
+
+    /*-------------------------------------------------------------------*
+     *  energy of code:                                                  *
+     *  ~~~~~~~~~~~~~~~                                                  *
+     *  ener_code = sum(code[i]^2)                                       *
+     *-------------------------------------------------------------------*/
+    ener_code = 0;
+
+    /* MR122:  Q12*Q12 -> Q25 */
+    /* others: Q13*Q13 -> Q27 */
+
+    for (i = L_SUBFR >> 2; i != 0; i--)
+    {
+        tmp = *(p_code++);
+        ener_code += ((Word32) tmp * tmp) >> 3;
+        tmp = *(p_code++);
+        ener_code += ((Word32) tmp * tmp) >> 3;
+        tmp = *(p_code++);
+        ener_code += ((Word32) tmp * tmp) >> 3;
+        tmp = *(p_code++);
+        ener_code += ((Word32) tmp * tmp) >> 3;
+    }
+
+    ener_code <<= 4;
+
+    if ((ener_code >> 31))     /*  Check for saturation */
+    {
+        ener_code = MAX_32;
+    }
+
+    if (mode == MR122)
+    {
+        /* ener_code = ener_code / lcode; lcode = 40; 1/40 = 26214 Q20 */
+        /* Q9  * Q20 -> Q30 */
+
+        ener_code = ((Word32)(pv_round(ener_code, pOverflow) * 26214)) << 1;
+
+        /*-------------------------------------------------------------*
+         *  energy of code:                                            *
+         *  ~~~~~~~~~~~~~~~                                            *
+         *  ener_code(Q17) = 10 * Log10(energy) / constant             *
+         *                 = 1/2 * Log2(energy)                        *
+         *  constant = 20*Log10(2)                                     *
+         *-------------------------------------------------------------*/
+        /* ener_code = 1/2 * Log2(ener_code); Note: Log2=log2+30 */
+        Log2(ener_code, &exp, &frac, pOverflow);
+
+        /* Q16 for log()    */
+        /* ->Q17 for 1/2 log()*/
+
+        L_temp1 = (Word32)(exp - 30) << 16;
+        ener_code = L_temp1 + ((Word32)frac << 1);
+
+        /*-------------------------------------------------------------*
+         *  predicted energy:                                          *
+         *  ~~~~~~~~~~~~~~~~~                                          *
+         *  ener(Q24) = (Emean + sum{pred[i]*past_en[i]})/constant     *
+         *            = MEAN_ENER + sum(pred[i]*past_qua_en[i])        *
+         *  constant = 20*Log10(2)                                     *
+         *-------------------------------------------------------------*/
+
+        ener = MEAN_ENER_MR122;                   /* Q24 (Q17) */
+        for (i = 0; i < NPRED; i++)
+        {
+            L_temp1 = (((Word32) st->past_qua_en_MR122[i]) *
+                       pred_MR122[i]) << 1;
+            ener = L_add(ener, L_temp1, pOverflow);
+
+            /* Q10 * Q13 -> Q24 */
+            /* Q10 * Q6  -> Q17 */
+        }
+
+        /*---------------------------------------------------------------*
+         *  predicted codebook gain                                      *
+         *  ~~~~~~~~~~~~~~~~~~~~~~~                                      *
+         *  gc0     = Pow10( (ener*constant - ener_code*constant) / 20 ) *
+         *          = Pow2(ener-ener_code)                               *
+         *          = Pow2(int(d)+frac(d))                               *
+         *                                                               *
+         *  (store exp and frac for pow2())                              *
+         *---------------------------------------------------------------*/
+        /* Q16 */
+
+        L_temp1 = L_sub(ener, ener_code, pOverflow);
+
+
+        *exp_gcode0 = (Word16)(L_temp1 >> 17);
+
+        L_temp2 = (Word32) * exp_gcode0 << 15;
+        L_temp1 >>= 2;
+
+        *frac_gcode0 = (Word16)(L_temp1 - L_temp2);
+
+    }
+    else /* all modes except 12.2 */
+    {
+        /*-----------------------------------------------------------------*
+         *  Compute: means_ener - 10log10(ener_code/ L_sufr)               *
+         *-----------------------------------------------------------------*/
+
+        exp_code = norm_l(ener_code);
+        ener_code = L_shl(ener_code, exp_code, pOverflow);
+
+        /* Log2 = log2 + 27 */
+        Log2_norm(ener_code, exp_code, &exp, &frac);
+
+        /* fact = 10/log2(10) = 3.01 = 24660 Q13 */
+        /* Q0.Q15 * Q13 -> Q14 */
+
+        L_temp2 = (((Word32) exp) * -24660) << 1;
+        L_tmp = (((Word32) frac) * -24660) >> 15;
+
+        /* Sign-extend resulting product */
+        if (L_tmp & (Word32) 0x00010000L)
+        {
+            L_tmp = L_tmp | (Word32) 0xffff0000L;
+        }
+
+        L_tmp = L_tmp << 1;
+        L_tmp = L_add(L_tmp, L_temp2, pOverflow);
+
+
+        /*   L_tmp = means_ener - 10log10(ener_code/L_SUBFR)
+         *         = means_ener - 10log10(ener_code) + 10log10(L_SUBFR)
+         *         = K - fact * Log2(ener_code)
+         *         = K - fact * log2(ener_code) - fact*27
+         *
+         *   ==> K = means_ener + fact*27 + 10log10(L_SUBFR)
+         *
+         *   means_ener =       33    =  540672    Q14  (MR475, MR515, MR59)
+         *   means_ener =       28.75 =  471040    Q14  (MR67)
+         *   means_ener =       30    =  491520    Q14  (MR74)
+         *   means_ener =       36    =  589824    Q14  (MR795)
+         *   means_ener =       33    =  540672    Q14  (MR102)
+         *   10log10(L_SUBFR) = 16.02 =  262481.51 Q14
+         *   fact * 27                = 1331640    Q14
+         *   -----------------------------------------
+         *   (MR475, MR515, MR59)   K = 2134793.51 Q14 ~= 16678 * 64 * 2
+         *   (MR67)                 K = 2065161.51 Q14 ~= 32268 * 32 * 2
+         *   (MR74)                 K = 2085641.51 Q14 ~= 32588 * 32 * 2
+         *   (MR795)                K = 2183945.51 Q14 ~= 17062 * 64 * 2
+         *   (MR102)                K = 2134793.51 Q14 ~= 16678 * 64 * 2
+         */
+
+        if (mode == MR102)
+        {
+            /* mean = 33 dB */
+            L_temp2 = (Word32) 16678 << 7;
+            L_tmp = L_add(L_tmp, L_temp2, pOverflow);     /* Q14 */
+        }
+        else if (mode == MR795)
+        {
+            /* ener_code  = <xn xn> * 2^27*2^exp_code
+               frac_en    = ener_code / 2^16
+                          = <xn xn> * 2^11*2^exp_code
+               <xn xn>    = <xn xn>*2^11*2^exp * 2^exp_en
+            :                 = frac_en            * 2^exp_en
+                          ==> exp_en = -11-exp_code;      */
+            *frac_en = (Word16)(ener_code >> 16);
+            *exp_en = -11 - exp_code;
+
+            /* mean = 36 dB */
+            L_temp2 = (Word32) 17062 << 7;
+            L_tmp = L_add(L_tmp, L_temp2, pOverflow);     /* Q14 */
+        }
+        else if (mode == MR74)
+        {
+            /* mean = 30 dB */
+            L_temp2 = (Word32) 32588 << 6;
+            L_tmp = L_add(L_tmp, L_temp2, pOverflow);     /* Q14 */
+        }
+        else if (mode == MR67)
+        {
+            /* mean = 28.75 dB */
+            L_temp2 = (Word32) 32268 << 6;
+            L_tmp = L_add(L_tmp, L_temp2, pOverflow);     /* Q14 */
+        }
+        else /* MR59, MR515, MR475 */
+        {
+            /* mean = 33 dB */
+            L_temp2 = (Word32) 16678 << 7;
+            L_tmp = L_add(L_tmp, L_temp2, pOverflow);     /* Q14 */
+        }
+
+        /*-------------------------------------------------------------*
+         * Compute gcode0.                                              *
+         *  = Sum(i=0,3) pred[i]*past_qua_en[i] - ener_code + mean_ener *
+         *--------------------------------------------------------------*/
+        /* Q24 */
+        if (L_tmp > (Word32) 0X001fffffL)
+        {
+            *pOverflow = 1;
+            L_tmp = MAX_32;
+        }
+        else if (L_tmp < -2097152)
+        {
+            *pOverflow = 1;
+            L_tmp = MIN_32;
+        }
+        else
+        {
+            L_tmp = L_tmp << 10;
+        }
+
+        for (i = 0; i < 4; i++)
+        {
+            L_temp2 = ((((Word32) pred[i]) * st->past_qua_en[i]) << 1);
+            L_tmp = L_add(L_tmp, L_temp2, pOverflow);  /* Q13 * Q10 -> Q24 */
+        }
+
+        gcode0 = (Word16)(L_tmp >> 16);               /* Q8  */
+
+        /*-----------------------------------------------------------*
+         * gcode0 = pow(10.0, gcode0/20)                             *
+         *        = pow(2, 3.3219*gcode0/20)                         *
+         *        = pow(2, 0.166*gcode0)                             *
+         *-----------------------------------------------------------*/
+
+        /* 5439 Q15 = 0.165985                                       */
+        /* (correct: 1/(20*log10(2)) 0.166096 = 5443 Q15)            */
+
+        if (mode == MR74) /* For IS641 bitexactness */
+        {
+            L_tmp = (((Word32) gcode0) * 5439) << 1;  /* Q8 * Q15 -> Q24 */
+        }
+        else
+        {
+            L_tmp = (((Word32) gcode0) * 5443) << 1;  /* Q8 * Q15 -> Q24 */
+        }
+
+        if (L_tmp < 0)
+        {
+            L_tmp = ~((~L_tmp) >> 8);
+        }
+        else
+        {
+            L_tmp = L_tmp >> 8;     /* -> Q16 */
+        }
+
+        *exp_gcode0 = (Word16)(L_tmp >> 16);
+        if (L_tmp < 0)
+        {
+            L_temp1 = ~((~L_tmp) >> 1);
+        }
+        else
+        {
+            L_temp1 = L_tmp >> 1;
+        }
+        L_temp2 = (Word32) * exp_gcode0 << 15;
+        *frac_gcode0 = (Word16)(L_sub(L_temp1, L_temp2, pOverflow));
+        /* -> Q0.Q15 */
+    }
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gc_pred_update
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type gc_predState
+    qua_ener_MR122 = quantized energy for update (Q10); calculated as
+             (log2(qua_err)) (Word16)
+    qua_ener = quantized energy for update (Q10); calculated as
+           (20*log10(qua_err)) (Word16)
+
+ Outputs:
+    structure pointed to by st contains the calculated quantized energy
+      for update
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function updates the MA predictor with the last quantized energy.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ gc_pred.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void gc_pred_update(
+    gc_predState *st,      // i/o: State struct
+    Word16 qua_ener_MR122, // i  : quantized energy for update, Q10
+                           //      (log2(qua_err))
+    Word16 qua_ener        // i  : quantized energy for update, Q10
+                           //      (20*log10(qua_err))
+)
+{
+    Word16 i;
+
+    for (i = 3; i > 0; i--)
+    {
+        st->past_qua_en[i] = st->past_qua_en[i - 1];
+        st->past_qua_en_MR122[i] = st->past_qua_en_MR122[i - 1];
+    }
+
+    st->past_qua_en_MR122[0] = qua_ener_MR122;  //    log2 (qua_err), Q10
+
+    st->past_qua_en[0] = qua_ener;              // 20*log10(qua_err), Q10
+
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void gc_pred_update(
+    gc_predState *st,      /* i/o: State struct                     */
+    Word16 qua_ener_MR122, /* i  : quantized energy for update, Q10 */
+    /*      (log2(qua_err))                  */
+    Word16 qua_ener        /* i  : quantized energy for update, Q10 */
+    /*      (20*log10(qua_err))              */
+)
+{
+    st->past_qua_en[3] = st->past_qua_en[2];
+    st->past_qua_en_MR122[3] = st->past_qua_en_MR122[2];
+
+    st->past_qua_en[2] = st->past_qua_en[1];
+    st->past_qua_en_MR122[2] = st->past_qua_en_MR122[1];
+
+    st->past_qua_en[1] = st->past_qua_en[0];
+    st->past_qua_en_MR122[1] = st->past_qua_en_MR122[0];
+
+    st->past_qua_en_MR122[0] = qua_ener_MR122; /*    log2 (qua_err), Q10 */
+
+    st->past_qua_en[0] = qua_ener;            /* 20*log10(qua_err), Q10 */
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gc_pred_average_limited
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type gc_predState
+    ener_avg_MR122 = pointer to the averaged quantized energy (Q10);
+             calculated as (log2(qua_err)) (Word16)
+    ener_avg = pointer to the averaged quantized energy (Q10); calculated
+           as (20*log10(qua_err)) (Word16)
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    store pointed to by ener_avg_MR122 contains the new averaged quantized
+      energy
+    store pointed to by ener_avg contains the new averaged quantized
+      energy
+    pOverflow = 1 if the math functions called by gc_pred_average_limited
+            results in overflow else zero.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates the average of MA predictor state values (with a
+ lower limit) used in error concealment.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ gc_pred.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+The original etsi reference code uses a global flag Overflow. However, in the
+actual implementation a pointer to a the overflow flag is passed in.
+
+void gc_pred_average_limited(
+    gc_predState *st,       // i: State struct
+    Word16 *ener_avg_MR122, // o: everaged quantized energy,  Q10
+                            //    (log2(qua_err))
+    Word16 *ener_avg        // o: averaged quantized energy,  Q10
+                            //    (20*log10(qua_err))
+)
+{
+    Word16 av_pred_en;
+    Word16 i;
+
+    // do average in MR122 mode (log2() domain)
+    av_pred_en = 0;
+    for (i = 0; i < NPRED; i++)
+    {
+        av_pred_en = add (av_pred_en, st->past_qua_en_MR122[i]);
+    }
+
+    // av_pred_en = 0.25*av_pred_en
+    av_pred_en = mult (av_pred_en, 8192);
+
+    // if (av_pred_en < -14/(20Log10(2))) av_pred_en = ..
+
+    if (sub (av_pred_en, MIN_ENERGY_MR122) < 0)
+    {
+        av_pred_en = MIN_ENERGY_MR122;
+    }
+    *ener_avg_MR122 = av_pred_en;
+
+    // do average for other modes (20*log10() domain)
+    av_pred_en = 0;
+    for (i = 0; i < NPRED; i++)
+    {
+        av_pred_en = add (av_pred_en, st->past_qua_en[i]);
+    }
+
+    // av_pred_en = 0.25*av_pred_en
+    av_pred_en = mult (av_pred_en, 8192);
+
+    // if (av_pred_en < -14) av_pred_en = ..
+
+    if (sub (av_pred_en, MIN_ENERGY) < 0)
+    {
+        av_pred_en = MIN_ENERGY;
+    }
+    *ener_avg = av_pred_en;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void gc_pred_average_limited(
+    gc_predState *st,       /* i: State struct                    */
+    Word16 *ener_avg_MR122, /* o: everaged quantized energy,  Q10 */
+    /*    (log2(qua_err))                 */
+    Word16 *ener_avg,       /* o: averaged quantized energy,  Q10 */
+    /*    (20*log10(qua_err))             */
+    Flag *pOverflow
+)
+{
+    Word16 av_pred_en;
+    register Word16 i;
+
+    /* do average in MR122 mode (log2() domain) */
+    av_pred_en = 0;
+    for (i = 0; i < NPRED; i++)
+    {
+        av_pred_en =
+            add_16(av_pred_en, st->past_qua_en_MR122[i], pOverflow);
+    }
+
+    /* av_pred_en = 0.25*av_pred_en  (with sign-extension)*/
+    if (av_pred_en < 0)
+    {
+        av_pred_en = (av_pred_en >> 2) | 0xc000;
+    }
+    else
+    {
+        av_pred_en >>= 2;
+    }
+
+    /* if (av_pred_en < -14/(20Log10(2))) av_pred_en = .. */
+    if (av_pred_en < MIN_ENERGY_MR122)
+    {
+        av_pred_en = MIN_ENERGY_MR122;
+    }
+    *ener_avg_MR122 = av_pred_en;
+
+    /* do average for other modes (20*log10() domain) */
+    av_pred_en = 0;
+    for (i = 0; i < NPRED; i++)
+    {
+        av_pred_en = add_16(av_pred_en, st->past_qua_en[i], pOverflow);
+    }
+
+    /* av_pred_en = 0.25*av_pred_en  (with sign-extension)*/
+    if (av_pred_en < 0)
+    {
+        av_pred_en = (av_pred_en >> 2) | 0xc000;
+    }
+    else
+    {
+        av_pred_en >>= 2;
+    }
+
+    /* if (av_pred_en < -14) av_pred_en = .. */
+    if (av_pred_en < MIN_ENERGY)
+    {
+        av_pred_en = MIN_ENERGY;
+    }
+    *ener_avg = av_pred_en;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/get_const_tbls.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/get_const_tbls.cpp
new file mode 100644 (file)
index 0000000..87ecb86
--- /dev/null
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+#ifndef GET_CONST_TBLS_H
+#include "get_const_tbls.h"
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    extern const Word16 dgray[];
+    extern const Word16 dico1_lsf_3[];
+    extern const Word16 dico1_lsf_5[];
+    extern const Word16 dico2_lsf_3[];
+    extern const Word16 dico2_lsf_5[];
+    extern const Word16 dico3_lsf_3[];
+    extern const Word16 dico3_lsf_5[];
+    extern const Word16 dico4_lsf_5[];
+    extern const Word16 dico5_lsf_5[];
+    extern const Word16 gray[];
+    extern const Word16 lsp_init_data[];
+    extern const Word16 mean_lsf_3[];
+    extern const Word16 mean_lsf_5[];
+    extern const Word16 mr515_3_lsf[];
+    extern const Word16 mr795_1_lsf[];
+    extern const Word16 past_rq_init[];
+    extern const Word16 pred_fac_3[];
+    extern const Word16 qua_gain_code[];
+    extern const Word16 qua_gain_pitch[];
+    extern const Word16 startPos[];
+    extern const Word16 table_gain_lowrates[];
+    extern const Word16 table_gain_highrates[];
+    extern const Word16 prmno[];
+    extern const Word16* const bitno[];
+    extern const Word16 numOfBits[];
+    extern const Word16* const reorderBits[];
+    extern const Word16 numCompressedBytes[];
+    extern const Word16 window_200_40[];
+    extern const Word16 window_160_80[];
+    extern const Word16 window_232_8[];
+    extern const Word16 ph_imp_low_MR795[];
+    extern const Word16 ph_imp_mid_MR795[];
+    extern const Word16 ph_imp_low[];
+    extern const Word16 ph_imp_mid[];
+
+#ifdef __cplusplus
+}
+#endif
+
+OSCL_EXPORT_REF void get_const_tbls(CommonAmrTbls* tbl_struct_ptr)
+{
+    tbl_struct_ptr->dgray_ptr = dgray;
+    tbl_struct_ptr->dico1_lsf_3_ptr = dico1_lsf_3;
+    tbl_struct_ptr->dico1_lsf_5_ptr = dico1_lsf_5;
+    tbl_struct_ptr->dico2_lsf_3_ptr = dico2_lsf_3;
+    tbl_struct_ptr->dico2_lsf_5_ptr = dico2_lsf_5;
+    tbl_struct_ptr->dico3_lsf_3_ptr = dico3_lsf_3;
+    tbl_struct_ptr->dico3_lsf_5_ptr = dico3_lsf_5;
+    tbl_struct_ptr->dico4_lsf_5_ptr = dico4_lsf_5;
+    tbl_struct_ptr->dico5_lsf_5_ptr = dico5_lsf_5;
+    tbl_struct_ptr->gray_ptr = gray;
+    tbl_struct_ptr->lsp_init_data_ptr = lsp_init_data;
+    tbl_struct_ptr->mean_lsf_3_ptr = mean_lsf_3;
+    tbl_struct_ptr->mean_lsf_5_ptr = mean_lsf_5;
+    tbl_struct_ptr->mr515_3_lsf_ptr = mr515_3_lsf;
+    tbl_struct_ptr->mr795_1_lsf_ptr = mr795_1_lsf;
+    tbl_struct_ptr->past_rq_init_ptr = past_rq_init;
+    tbl_struct_ptr->pred_fac_3_ptr = pred_fac_3;
+    tbl_struct_ptr->qua_gain_code_ptr = qua_gain_code;
+    tbl_struct_ptr->qua_gain_pitch_ptr = qua_gain_pitch;
+    tbl_struct_ptr->startPos_ptr = startPos;
+    tbl_struct_ptr->table_gain_lowrates_ptr = table_gain_lowrates;
+    tbl_struct_ptr->table_gain_highrates_ptr = table_gain_highrates;
+    tbl_struct_ptr->prmno_ptr = prmno;
+    tbl_struct_ptr->bitno_ptr = bitno;
+    tbl_struct_ptr->numOfBits_ptr = numOfBits;
+    tbl_struct_ptr->reorderBits_ptr = reorderBits;
+    tbl_struct_ptr->numCompressedBytes_ptr = numCompressedBytes;
+    tbl_struct_ptr->window_200_40_ptr = window_200_40;
+    tbl_struct_ptr->window_160_80_ptr = window_160_80;
+    tbl_struct_ptr->window_232_8_ptr = window_232_8;
+    tbl_struct_ptr->ph_imp_low_MR795_ptr = ph_imp_low_MR795;
+    tbl_struct_ptr->ph_imp_mid_MR795_ptr = ph_imp_mid_MR795;
+    tbl_struct_ptr->ph_imp_low_ptr = ph_imp_low;
+    tbl_struct_ptr->ph_imp_mid_ptr = ph_imp_mid;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp
new file mode 100644 (file)
index 0000000..a723ce4
--- /dev/null
@@ -0,0 +1,184 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: gmed_n.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "gmed_n.h"
+#include    "typedef.h"
+#include    "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NMAX    9   /* largest N used in median calculation */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gmed_n
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    ind = input values (Word16)
+    n = number of inputs to find the median (Word16)
+
+ Returns:
+    median value.
+
+ Outputs:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates N-point median of a data set. This routine is only
+ valid for a odd number of gains (n <= NMAX).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ gmed_n.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 gmed_n (   // o : The median value (0...N-1)
+    Word16 ind[], // i : Past gain values
+    Word16 n      // i : The number of gains; this routine
+                  //     is only valid for a odd number of gains
+                  //     (n <= NMAX)
+)
+{
+    Word16 i, j, ix = 0;
+    Word16 max;
+    Word16 medianIndex;
+    Word16 tmp[NMAX];
+    Word16 tmp2[NMAX];
+
+    for (i = 0; i < n; i++)
+    {
+        tmp2[i] = ind[i];
+    }
+
+    for (i = 0; i < n; i++)
+    {
+        max = -32767;
+        for (j = 0; j < n; j++)
+        {
+            if (sub (tmp2[j], max) >= 0)
+            {
+                max = tmp2[j];
+                ix = j;
+            }
+        }
+        tmp2[ix] = -32768;
+        tmp[i] = ix;
+    }
+
+    medianIndex=tmp[ shr(n,1) ];  // account for complex addressing
+    return (ind[medianIndex]);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF Word16 gmed_n(            /* o : the median value    */
+    Word16 ind[],   /* i : input values        */
+    Word16 n        /* i : number of inputs    */
+)
+{
+    register Word16 i, j, ix = 0;
+    register Word16 max;
+    register Word16 medianIndex;
+    Word16  tmp[NMAX];
+    Word16  tmp2[NMAX];
+
+    oscl_memmove(tmp2, ind, n*sizeof(*ind));
+
+    for (i = 0; i < n; i++)
+    {
+        max = -32767;
+        for (j = 0; j < n; j++)
+        {
+            if (*(tmp2 + j) >= max)
+            {
+                max = *(tmp2 + j);
+                ix = j;
+            }
+        }
+        *(tmp2 + ix) = -32768;
+        *(tmp + i) = ix;
+    }
+
+    medianIndex = *(tmp + (n >> 1));  /* account for complex addressing */
+
+    return (*(ind + medianIndex));
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gray_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gray_tbl.cpp
new file mode 100644 (file)
index 0000000..8b192f2
--- /dev/null
@@ -0,0 +1,135 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: gray_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the declaration for the gray encoding and decoding tables,
+ gray_tbl[] and dgray_tbl[] used by the c1035pf and d1035pf module
+ respectively.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+
+    extern const Word16 gray[];
+    extern const Word16 dgray[];
+    const Word16 gray[8]  = {0, 1, 3, 2, 6, 4, 5, 7};
+    const Word16 dgray[8] = {0, 1, 3, 2, 5, 6, 4, 7};
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] gray.tab,  UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/grid_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/grid_tbl.cpp
new file mode 100644 (file)
index 0000000..48bab68
--- /dev/null
@@ -0,0 +1,153 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: grid_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the declaration for grid_tbl[] used by the az_lsp()
+ function.
+
+ //  Table for az_lsp()
+ //
+ // grid[0] = 1.0;
+ // grid[grid_points+1] = -1.0;
+ // for (i = 1; i < grid_points; i++)
+ //   grid[i] = cos((6.283185307*i)/(2.0*grid_points));
+ //
+ //
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "az_lsp.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+#define grid_points 60
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+    const Word16 grid[grid_points + 1] =
+    {
+        32760, 32723, 32588, 32364, 32051, 31651,
+        31164, 30591, 29935, 29196, 28377, 27481,
+        26509, 25465, 24351, 23170, 21926, 20621,
+        19260, 17846, 16384, 14876, 13327, 11743,
+        10125, 8480, 6812, 5126, 3425, 1714,
+        0, -1714, -3425, -5126, -6812, -8480,
+        -10125, -11743, -13327, -14876, -16384, -17846,
+        -19260, -20621, -21926, -23170, -24351, -25465,
+        -26509, -27481, -28377, -29196, -29935, -30591,
+        -31164, -31651, -32051, -32364, -32588, -32723,
+        -32760
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] grid.tab,  UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/int_lpc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/int_lpc.cpp
new file mode 100644 (file)
index 0000000..dc08c11
--- /dev/null
@@ -0,0 +1,515 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: int_lpc.cpp
+ Functions:
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "int_lpc.h"
+#include "typedef.h"
+#include "cnst.h"
+#include "lsp_az.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Int_lpc_1and3
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsp_old -- array of type Word16 -- LSP vector at the
+                                       4th subfr. of past frame (M)
+    lsp_mid -- array of type Word16 -- LSP vector at the 2nd subfr. of
+                                       present frame (M)
+    lsp_new -- array of type Word16 -- LSP vector at the 4th subfr. of
+                                       present frame (M)
+
+ Outputs:
+    Az -- array of type Word16 -- interpolated LP parameters in all subfr.
+                                  (AZ_SIZE)
+    pOverflow -- pointer to type Flag -- Overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose     : Interpolates the LSPs and converts to LPC parameters
+               to get a different LP filter in each subframe.
+ Description : The 20 ms speech frame is divided into 4 subframes.
+               The LSPs are quantized and transmitted at the 2nd and
+               4th subframes (twice per frame) and interpolated at the
+               1st and 3rd subframe.
+
+                     |------|------|------|------|
+                        sf1    sf2    sf3    sf4
+                  F0            Fm            F1
+
+                sf1:   1/2 Fm + 1/2 F0         sf3:   1/2 F1 + 1/2 Fm
+                sf2:       Fm                  sf4:       F1
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ int_lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Int_lpc_1and3(
+    Word16 lsp_old[],  /* i : LSP vector at the 4th subfr. of past frame (M) */
+    Word16 lsp_mid[],  /* i : LSP vector at the 2nd subfr. of
+                              present frame (M)                              */
+    Word16 lsp_new[],  /* i : LSP vector at the 4th subfr. of
+                              present frame (M)                              */
+    Word16 Az[],       /* o : interpolated LP parameters in all subfr.
+                              (AZ_SIZE)                                      */
+    Flag  *pOverflow
+)
+{
+    Word16 i;
+    Word16 lsp[M];
+    Word16 *p_lsp_old = &lsp_old[0];
+    Word16 *p_lsp_mid = &lsp_mid[0];
+    Word16 *p_lsp_new = &lsp_new[0];
+    Word16 *p_lsp     = &lsp[0];
+
+    /*  lsp[i] = lsp_mid[i] * 0.5 + lsp_old[i] * 0.5 */
+
+    for (i = M >> 1; i != 0; i--)
+    {
+        *(p_lsp++) = (*(p_lsp_old++) >> 1) + (*(p_lsp_mid++) >> 1);
+        *(p_lsp++) = (*(p_lsp_old++) >> 1) + (*(p_lsp_mid++) >> 1);
+    }
+
+    Lsp_Az(
+        lsp,
+        Az,
+        pOverflow);       /* Subframe 1 */
+
+    Az += MP1;
+
+    Lsp_Az(
+        lsp_mid,
+        Az,
+        pOverflow);       /* Subframe 2 */
+
+    Az += MP1;
+
+    p_lsp_mid = &lsp_mid[0];
+    p_lsp     = &lsp[0];
+
+    for (i = M >> 1; i != 0; i--)
+    {
+        *(p_lsp++) = (*(p_lsp_mid++) >> 1) + (*(p_lsp_new++) >> 1);
+        *(p_lsp++) = (*(p_lsp_mid++) >> 1) + (*(p_lsp_new++) >> 1);
+    }
+
+    Lsp_Az(
+        lsp,
+        Az,
+        pOverflow);           /* Subframe 3 */
+
+    Az += MP1;
+
+    Lsp_Az(
+        lsp_new,
+        Az,
+        pOverflow);       /* Subframe 4 */
+
+    return;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Int_lpc_1and3_2
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsp_old -- array of type Word16 -- LSP vector at the
+                                       4th subfr. of past frame (M)
+    lsp_mid -- array of type Word16 -- LSP vector at the 2nd subfr. of
+                                       present frame (M)
+    lsp_new -- array of type Word16 -- LSP vector at the 4th subfr. of
+                                       present frame (M)
+
+ Outputs:
+    Az -- array of type Word16 -- interpolated LP parameters in.
+                                  subfr 1 and 2.
+    pOverflow -- pointer to type Flag -- Overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose : Interpolation of the LPC parameters. Same as the Int_lpc
+           function but we do not recompute Az() for subframe 2 and
+           4 because it is already available.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ int_lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Int_lpc_1and3_2(
+    Word16 lsp_old[],  /* i : LSP vector at the 4th subfr. of past frame (M) */
+    Word16 lsp_mid[],  /* i : LSP vector at the 2nd subframe of
+                             present frame (M)                               */
+    Word16 lsp_new[],  /* i : LSP vector at the 4th subframe of
+                             present frame (M)                               */
+    Word16 Az[],       /* o :interpolated LP parameters
+                             in subframes 1 and 3 (AZ_SIZE)                  */
+    Flag  *pOverflow
+)
+{
+    Word16 i;
+    Word16 lsp[M];
+    Word16 *p_lsp_old = &lsp_old[0];
+    Word16 *p_lsp_mid = &lsp_mid[0];
+    Word16 *p_lsp_new = &lsp_new[0];
+    Word16 *p_lsp     = &lsp[0];
+
+    /*  lsp[i] = lsp_mid[i] * 0.5 + lsp_old[i] * 0.5 */
+
+    for (i = M >> 1; i != 0; i--)
+    {
+        *(p_lsp++) = (*(p_lsp_old++) >> 1) + (*(p_lsp_mid++) >> 1);
+        *(p_lsp++) = (*(p_lsp_old++) >> 1) + (*(p_lsp_mid++) >> 1);
+    }
+    Lsp_Az(lsp, Az, pOverflow);            /* Subframe 1 */
+    Az += MP1 * 2;
+
+    p_lsp_mid = &lsp_mid[0];
+    p_lsp     = &lsp[0];
+
+    for (i = M >> 1; i != 0; i--)
+    {
+        *(p_lsp++) = (*(p_lsp_mid++) >> 1) + (*(p_lsp_new++) >> 1);
+        *(p_lsp++) = (*(p_lsp_mid++) >> 1) + (*(p_lsp_new++) >> 1);
+    }
+
+    Lsp_Az(lsp, Az, pOverflow);            /* Subframe 3 */
+
+    return;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lsp
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsp_old -- array of type Word16 -- LSP vector at the
+                                       4th subfr. of past frame (M)
+    lsp_new -- array of type Word16 -- LSP vector at the 4th subfr. of
+                                       present frame (M)
+
+ Outputs:
+    Az -- array of type Word16 -- interpolated LP parameters in.
+                                  all subframes.
+    pOverflow -- pointer to type Flag -- Overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE:  Interpolates the LSPs and convert to LP parameters to get
+           a different LP filter in each subframe.
+
+ DESCRIPTION:
+    The 20 ms speech frame is divided into 4 subframes.
+    The LSPs are quantized and transmitted at the 4th subframe
+    (once per frame) and interpolated at the 1st, 2nd and 3rd subframe.
+
+         |------|------|------|------|
+            sf1    sf2    sf3    sf4
+      F0                          F1
+
+    sf1:   3/4 F0 + 1/4 F1         sf3:   1/4 F0 + 3/4 F1
+    sf2:   1/2 F0 + 1/2 F1         sf4:       F1
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ int_lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Int_lpc_1to3(
+    Word16 lsp_old[], /* input : LSP vector at the 4th SF of past frame    */
+    Word16 lsp_new[], /* input : LSP vector at the 4th SF of present frame */
+    Word16 Az[],      /* output: interpolated LP parameters in all SFs     */
+    Flag   *pOverflow
+)
+{
+    Word16 i;
+    Word16 temp;
+
+    Word16 lsp[M];
+
+    for (i = 0; i < M; i++)
+    {
+        temp = lsp_old[i] - (lsp_old[i] >> 2);
+        lsp[i] = temp + (lsp_new[i] >> 2);
+    }
+
+    Lsp_Az(
+        lsp,
+        Az,
+        pOverflow);        /* Subframe 1 */
+
+    Az += MP1;
+
+
+    for (i = 0; i < M; i++)
+    {
+        lsp[i] = (lsp_new[i] >> 1) + (lsp_old[i] >> 1);
+
+    }
+
+    Lsp_Az(lsp, Az, pOverflow);        /* Subframe 2 */
+
+    Az += MP1;
+
+    for (i = 0; i < M; i++)
+    {
+
+        temp = lsp_new[i] - (lsp_new[i] >> 2);
+        lsp[i] = temp + (lsp_old[i] >> 2);
+
+    }
+
+    Lsp_Az(lsp, Az, pOverflow);        /* Subframe 3 */
+
+    Az += MP1;
+
+    Lsp_Az(lsp_new, Az, pOverflow);    /* Subframe 4 */
+
+    return;
+}
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Int_lpc_1to3_2
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsp_old -- array of type Word16 -- LSP vector at the
+                                       4th subfr. of past frame (M)
+    lsp_new -- array of type Word16 -- LSP vector at the 4th subfr. of
+                                       present frame (M)
+
+ Outputs:
+    Az -- array of type Word16 -- interpolated LP parameters in.
+                                  subfr 1, 2, and 3.
+    pOverflow -- pointer to type Flag -- Overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Interpolation of the LPC parameters.
+ Same as the previous function but we do not recompute Az() for
+ subframe 4 because it is already available.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ int_lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Int_lpc_1to3_2(
+    Word16 lsp_old[],  /* input : LSP vector at the 4th SF of past frame    */
+    Word16 lsp_new[],  /* input : LSP vector at the 4th SF of present frame */
+    Word16 Az[],       /* output: interpolated LP parameters in SFs 1,2,3   */
+    Flag   *pOverflow
+)
+{
+    Word16 i;
+    Word16 temp;
+    Word16 lsp[M];
+
+    for (i = 0; i < M; i++)
+    {
+        temp = lsp_old[i] - (lsp_old[i] >> 2);
+        lsp[i] = temp + (lsp_new[i] >> 2);
+
+    }
+
+    Lsp_Az(lsp, Az, pOverflow);         /* Subframe 1 */
+
+    Az += MP1;
+
+    for (i = 0; i < M; i++)
+    {
+        lsp[i] = (lsp_new[i] >> 1) + (lsp_old[i] >> 1);
+
+    }
+
+    Lsp_Az(lsp, Az, pOverflow);         /* Subframe 2 */
+
+    Az += MP1;
+
+    for (i = 0; i < M; i++)
+    {
+        temp = lsp_new[i] - (lsp_new[i] >> 2);
+        lsp[i] = temp + (lsp_old[i] >> 2);
+
+    }
+
+    Lsp_Az(lsp, Az, pOverflow);         /* Subframe 3 */
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt.cpp
new file mode 100644 (file)
index 0000000..0125dd4
--- /dev/null
@@ -0,0 +1,220 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: inv_sqrt.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "inv_sqrt.h"
+#include    "typedef.h"
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Inv_sqrt
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_x = input value (Word32)
+    pOverflow = pointer to overflow flag
+
+ Outputs:
+    pOverflow -> if the Inv_sqrt operation resulted in an overflow.
+
+ Returns:
+    L_y = inverse squareroot of L_x (Word32)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes 1/sqrt(L_x), where L_x is positive.
+ If L_x is negative or zero, the result is 1 (3fff ffff).
+
+ The function 1/sqrt(L_x) is approximated by a table and linear
+ interpolation. The inverse square root is computed using the
+ following steps:
+    1- Normalization of L_x.
+    2- If (30-exponent) is even then shift right once.
+    3- exponent = (30-exponent)/2  +1
+    4- i = bit25-b31 of L_x;  16<=i<=63  because of normalization.
+    5- a = bit10-b24
+    6- i -=16
+    7- L_y = table[i]<<16 - (table[i] - table[i+1]) * a * 2
+    8- L_y >>= exponent
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ inv_sqrt.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word32 Inv_sqrt (       // (o) : output value
+    Word32 L_x          // (i) : input value
+)
+{
+    Word16 exp, i, a, tmp;
+    Word32 L_y;
+
+* The reference ETSI code uses a global Overflow flag. In the actual
+* implementation a pointer to the overflow flag is passed into the function.
+* This pointer is in turn passed into the basic math functions such as add(),
+* L_shl(), L_shr(), sub() called by this module.
+
+    if (L_x <= (Word32) 0)
+        return ((Word32) 0x3fffffffL);
+
+    exp = norm_l (L_x);
+    L_x = L_shl (L_x, exp);     // L_x is normalize
+
+    exp = sub (30, exp);
+
+    if ((exp & 1) == 0)         // If exponent even -> shift right
+    {
+        L_x = L_shr (L_x, 1);
+    }
+    exp = shr (exp, 1);
+    exp = add (exp, 1);
+
+    L_x = L_shr (L_x, 9);
+    i = extract_h (L_x);        // Extract b25-b31
+    L_x = L_shr (L_x, 1);
+    a = extract_l (L_x);        // Extract b10-b24
+    a = a & (Word16) 0x7fff;
+
+    i = sub (i, 16);
+
+    L_y = L_deposit_h (table[i]);       // table[i] << 16
+    tmp = sub (table[i], table[i + 1]); // table[i] - table[i+1])
+    L_y = L_msu (L_y, tmp, a);  // L_y -=  tmp*a*2
+
+    L_y = L_shr (L_y, exp);     // denormalization
+
+    return (L_y);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF Word32 Inv_sqrt(        /* (o) : output value   */
+    Word32 L_x,         /* (i) : input value    */
+    Flag   * pOverflow  /* (i) : pointer to overflow flag */
+)
+{
+    Word16 exp;
+    Word16 i;
+    Word16 a;
+    Word16 tmp;
+    Word32 L_y;
+    OSCL_UNUSED_ARG(pOverflow);
+
+    if (L_x <= (Word32) 0)
+    {
+        return ((Word32) 0x3fffffffL);
+    }
+
+    exp = norm_l(L_x);
+    L_x <<= exp;         /* L_x is normalize */
+
+    exp = 30 - exp;
+
+    if ((exp & 1) == 0)             /* If exponent even -> shift right */
+    {
+        L_x >>= 1;
+    }
+    exp >>= 1;
+    exp += 1;
+
+    L_x >>= 9;
+    i = (Word16)(L_x >> 16);        /* Extract b25-b31 */
+    a = (Word16)(L_x >> 1);         /* Extract b10-b24 */
+    a &= (Word16) 0x7fff;
+
+    i -= 16;
+
+    L_y = (Word32)inv_sqrt_tbl[i] << 16;    /* inv_sqrt_tbl[i] << 16    */
+
+    /* inv_sqrt_tbl[i] - inv_sqrt_tbl[i+1])  */
+    tmp =  inv_sqrt_tbl[i] - inv_sqrt_tbl[i + 1];
+    /* always a positive number less than 200 */
+
+    L_y -= ((Word32)tmp * a) << 1;        /* L_y -=  tmp*a*2         */
+    /* always a positive minus a small negative number */
+
+    L_y >>= exp;                /* denormalization, exp always 0< exp < 31 */
+
+    return (L_y);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt_tbl.cpp
new file mode 100644 (file)
index 0000000..3ae066a
--- /dev/null
@@ -0,0 +1,138 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: inv_sqrt_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the declaration for table[] used by the inv_sqrt function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "inv_sqrt.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+    const Word16 inv_sqrt_tbl[49] =
+    {
+
+        32767, 31790, 30894, 30070, 29309, 28602, 27945, 27330, 26755, 26214,
+        25705, 25225, 24770, 24339, 23930, 23541, 23170, 22817, 22479, 22155,
+        21845, 21548, 21263, 20988, 20724, 20470, 20225, 19988, 19760, 19539,
+        19326, 19119, 18919, 18725, 18536, 18354, 18176, 18004, 17837, 17674,
+        17515, 17361, 17211, 17064, 16921, 16782, 16646, 16514, 16384
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] inv_sqrt.tab file,  UMTS GSM AMR speech codec, R99 - Version 3.2.0,
+ March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp
new file mode 100644 (file)
index 0000000..e436006
--- /dev/null
@@ -0,0 +1,160 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_abs.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_var1 = 32 bit long signed integer (Word32 ) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    L_var1 = absolute value of input (Word32)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates the absolute value of L_var1; saturate in case
+ where the input is -214783648.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word32 L_abs (Word32 L_var1)
+{
+    Word32 L_var_out;
+
+    if (L_var1 == MIN_32)
+    {
+        L_var_out = MAX_32;
+    }
+    else
+    {
+        if (L_var1 < 0)
+        {
+            L_var_out = -L_var1;
+        }
+        else
+        {
+            L_var_out = L_var1;
+        }
+    }
+
+#if (WMOPS)
+    multiCounter[currCounter].L_abs++;
+#endif
+    return (L_var_out);
+}
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word32 L_abs(register Word32 L_var1)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+
+    Word32 y = L_var1 - (L_var1 < 0);
+    y = y ^(y >> 31);
+    return (y);
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_h.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_h.cpp
new file mode 100644 (file)
index 0000000..2a8ad2f
--- /dev/null
@@ -0,0 +1,144 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_deposit_h.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    var1 = deposit of var1 into MSWord of 32 bit value (Word32)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function deposits the 16 bit var1 into the 16 MS bits of the 32 bit
+ output. The 16 LS bits of the output are zeroed.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word32 L_deposit_h (Word16 var1)
+{
+    Word32 L_var_out;
+
+    L_var_out = (Word32) var1 << 16;
+#if (WMOPS)
+    multiCounter[currCounter].L_deposit_h++;
+#endif
+    return (L_var_out);
+}
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word32 L_deposit_h(Word16 var1)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+    return ((Word32) var1 << 16);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_l.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_l.cpp
new file mode 100644 (file)
index 0000000..1f5f1fb
--- /dev/null
@@ -0,0 +1,144 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_deposit_l.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    var1 = deposit of var1 into LSWord of 32 bit value (Word32)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function deposits the 16 bit var1 into the 16 LS bits of the 32 bit
+ output. The 16 MS bits of the output are sign extended.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word32 L_deposit_l (Word16 var1)
+{
+    Word32 L_var_out;
+
+    L_var_out = (Word32) var1;
+#if (WMOPS)
+    multiCounter[currCounter].L_deposit_l++;
+#endif
+    return (L_var_out);
+}
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word32 L_deposit_l(Word16 var1)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+    return ((Word32) var1);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp
new file mode 100644 (file)
index 0000000..0a07135
--- /dev/null
@@ -0,0 +1,183 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_shr_r.cpp
+
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: L_shr_r
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_var1 = 32 bit long signed integer (Word32 ) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+    var2 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the 32 bit shift operation resulted in overflow
+
+ Returns:
+    result = Shifted result w/ rounding (Word32)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function arithmetically shifts the 32 bit input L_var1 right var2
+ positions with rounding. If var2 is negative, the function
+ arithmetically shifts L_var1 left by -var2 and zero fills the -var2 LSB of
+ the result. The result is saturated in case of underflows or overflows, i.e.,
+
+ - If var2 is greater than zero :
+    if (L_sub(L_shl(L_shr(L_var1,var2),1),L_shr(L_var1,sub(var2,1))))
+    is equal to zero
+    then
+        L_shr_r(L_var1,var2) = L_shr(L_var1,var2)
+    else
+        L_shr_r(L_var1,var2) = L_add(L_shr(L_var1,var2),1)
+ - If var2 is less than or equal to zero :
+    L_shr_r(L_var1,var2) = L_shr(L_var1,var2).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] L_shr_r() function in basic_op2.c,  UMTS GSM AMR speech codec, R99 -
+ Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word32 L_shr_r (Word32 L_var1, Word16 var2)
+{
+    Word32 L_var_out;
+
+* The reference ETSI code uses a global flag for Overflow. In the actual
+* implementation a pointer to Overflow flag is passed in as a parameter to the
+* function L_shr()
+
+    if (var2 > 31)
+    {
+        L_var_out = 0;
+    }
+    else
+    {
+        L_var_out = L_shr (L_var1, var2);
+#if (WMOPS)
+        multiCounter[currCounter].L_shr--;
+#endif
+        if (var2 > 0)
+        {
+            if ((L_var1 & ((Word32) 1 << (var2 - 1))) != 0)
+            {
+                L_var_out++;
+            }
+        }
+    }
+#if (WMOPS)
+    multiCounter[currCounter].L_shr_r++;
+#endif
+    return (L_var_out);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+OSCL_EXPORT_REF Word32 L_shr_r(register Word32 L_var1, register Word16 var2, Flag *pOverflow)
+{
+    Word32 result;
+
+    if (var2 > 31)
+    {
+        result = 0;
+    }
+    else
+    {
+        result = L_shr(L_var1, var2, pOverflow);
+
+        if (var2 > 0)
+        {
+            if ((L_var1 & ((Word32) 1 << (var2 - 1))) != 0)
+            {
+                result++;
+            }
+        }
+    }
+    return (result);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2.cpp
new file mode 100644 (file)
index 0000000..d08543f
--- /dev/null
@@ -0,0 +1,142 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: log2.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "log2.h"
+#include "basic_op.h"
+#include "log2_norm.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: log2()
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_x = input value of type Word32
+    pExponent = pointer to the integer part of Log2 of type Word16 whose
+           valid range is: 0 <= value <= 30
+    pFraction = pointer to the fractional part of Log2 of type Word16
+           whose valid range is: 0 <= value < 1
+    pOverflow = pointer to overflow flag
+
+
+ Outputs:
+    pExponent -> integer part of the newly calculated Log2
+    pFraction -> fractional part of the newly calculated Log2
+    pOverflow -> 1 if the log2() operation resulted in saturation
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes logarithm (base2) of the input L_x, where L_x is
+ positive. If L_x is negative or zero, the result is 0.
+
+ This function first normalizes the input L_x and calls the function Log2_norm
+ to calculate the logarithm.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] log2.c,  UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+OSCL_EXPORT_REF void Log2(
+    Word32 L_x,         /* (i) : input value                                */
+    Word16 *pExponent,  /* (o) : Integer part of Log2.   (range: 0<=val<=30)*/
+    Word16 *pFraction,  /* (o) : Fractional part of Log2. (range: 0<=val<1) */
+    Flag   *pOverflow   /* (i/o) : overflow flag                            */
+)
+{
+    Word16 exp;
+    Word32 result;
+    OSCL_UNUSED_ARG(pOverflow);
+
+    exp = norm_l(L_x);
+    result = L_x << exp;
+    Log2_norm(result, exp, pExponent, pFraction);
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_norm.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_norm.cpp
new file mode 100644 (file)
index 0000000..174d57f
--- /dev/null
@@ -0,0 +1,202 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: log2_norm.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "log2_norm.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Log2_norm
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_x = normalized input value of type Word32
+    exp = number of shifts required to normalize L_x; it is of type Word16
+    exponent = pointer to the integer part of Log2 (of type Word16)
+           whose valid range is: 0 <= value <= 30
+    fraction = pointer to the fractional part of Log2 (of type Word16)
+           whose valid range is: 0 <= value < 1
+
+ Outputs:
+    exponent points to the newly calculated integer part of Log2
+    fraction points to the newly calculated fractional part of Log2
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    table = Log2 table of constants of type Word16
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ The function Log2(L_x) calculates the logarithm of the normalized input
+ buffer L_x. The logarithm is approximated by a table and linear
+ interpolation. The following steps are used to compute Log2(L_x):
+
+ 1. exponent = 30 - norm_exponent
+ 2. i = bit25-b31 of L_x;  32<=i<=63  (because of normalization).
+ 3. a = bit10-b24
+ 4. i = i - 32
+ 5. fraction = table[i]<<16 - (table[i] - table[i+1]) * a * 2
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ log2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Log2_norm (
+    Word32 L_x,         // (i) : input value (normalized)
+    Word16 exp,         // (i) : norm_l (L_x)
+    Word16 *exponent,   // (o) : Integer part of Log2.   (range: 0<=val<=30)
+    Word16 *fraction    // (o) : Fractional part of Log2. (range: 0<=val<1)
+)
+{
+    Word16 i, a, tmp;
+    Word32 L_y;
+
+    if (L_x <= (Word32) 0)
+    {
+        *exponent = 0;
+        *fraction = 0;
+        return;
+    }
+
+    *exponent = sub (30, exp);
+
+    L_x = L_shr (L_x, 9);
+    i = extract_h (L_x);                // Extract b25-b31
+    L_x = L_shr (L_x, 1);
+    a = extract_l (L_x);                // Extract b10-b24 of fraction
+    a = a & (Word16) 0x7fff;
+
+    i = sub (i, 32);
+
+    L_y = L_deposit_h (table[i]);       // table[i] << 16
+    tmp = sub (table[i], table[i + 1]); // table[i] - table[i+1]
+    L_y = L_msu (L_y, tmp, a);          // L_y -= tmp*a*2
+
+    *fraction = extract_h (L_y);
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Log2_norm(
+    Word32 L_x,         /* (i) : input value (normalized)                   */
+    Word16 exp,         /* (i) : norm_l (L_x)                               */
+    Word16 *exponent,   /* (o) : Integer part of Log2.   (range: 0<=val<=30)*/
+    Word16 *fraction    /* (o) : Fractional part of Log2. (range: 0<=val<1) */
+)
+{
+    Word16 i, a, tmp;
+    Word32 L_y;
+
+    if (L_x <= (Word32) 0)
+    {
+        *exponent = 0;
+        *fraction = 0;
+    }
+    else
+    {
+        /* Calculate exponent portion of Log2 */
+        *exponent = 30 - exp;
+
+        /* At this point, L_x > 0       */
+        /* Shift L_x to the right by 10 to extract bits 10-31,  */
+        /* which is needed to calculate fractional part of Log2 */
+        L_x >>= 10;
+        i = (Word16)(L_x >> 15);    /* Extract b25-b31 */
+        a = L_x & 0x7fff;           /* Extract b10-b24 of fraction */
+
+        /* Calculate table index -> subtract by 32 is done for           */
+        /* proper table indexing, since 32<=i<=63 (due to normalization) */
+        i -= 32;
+
+        /* Fraction part of Log2 is approximated by using table[]    */
+        /* and linear interpolation, i.e.,                           */
+        /* fraction = table[i]<<16 - (table[i] - table[i+1]) * a * 2 */
+        L_y = (Word32) log2_tbl[i] << 16;  /* table[i] << 16        */
+        tmp = log2_tbl[i] - log2_tbl[i + 1];  /* table[i] - table[i+1] */
+        L_y -= (((Word32) tmp) * a) << 1; /* L_y -= tmp*a*2        */
+
+        *fraction = (Word16)(L_y >> 16);
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_tbl.cpp
new file mode 100644 (file)
index 0000000..76f66b0
--- /dev/null
@@ -0,0 +1,137 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: log2_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the declaration for log2_tbl[] used by the log2() and
+ log2_norm() function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "log2_norm.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+
+    const Word16 log2_tbl[33] =
+    {
+        0, 1455, 2866, 4236, 5568, 6863, 8124, 9352, 10549, 11716,
+        12855, 13967, 15054, 16117, 17156, 18172, 19167, 20142, 21097, 22033,
+        22951, 23852, 24735, 25603, 26455, 27291, 28113, 28922, 29716, 30497,
+        31266, 32023, 32767
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] log2.tab,  UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsfwt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsfwt.cpp
new file mode 100644 (file)
index 0000000..310ba3c
--- /dev/null
@@ -0,0 +1,202 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: lsfwt.cpp
+ Functions: Lsf_wt
+
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsf -- Pointer to Word16 -- LSF vector
+
+ Outputs:
+    wf -- Pointer to Word16 -- square of weighting factors
+    pOverflow -- Pointer to type Flag -- Flag set when overflow occurs
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+Compute LSF weighting factors
+
+ d[i] = lsf[i+1] - lsf[i-1]
+
+ The weighting factors are approximated by two line segment
+
+ First segment passes by the following 2 points:
+
+    d[i] = 0Hz     wf[i] = 3.347
+    d[i] = 450Hz   wf[i] = 1.8
+
+ Second segment passes by the following 2 points:
+
+    d[i] = 450Hz   wf[i] = 1.8
+    d[i] = 1500Hz  wf[i] = 1.0
+
+ if( d[i] < 450Hz )
+   wf[i] = 3.347 - ( (3.347-1.8) / (450-0)) *  d[i]
+ else
+   wf[i] = 1.8 - ( (1.8-1.0) / (1500-450)) *  (d[i] - 450)
+
+
+ if( d[i] < 1843)
+   wf[i] = 3427 - (28160*d[i])>>15
+ else
+   wf[i] = 1843 - (6242*(d[i]-1843))>>15
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lsfwt.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "lsfwt.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void Lsf_wt(
+    Word16 *lsf,         /* input : LSF vector                  */
+    Word16 *wf,          /* output: square of weighting factors */
+    Flag   *pOverflow
+)
+{
+    Word16 temp;
+    Word16 wgt_fct;
+    Word16 i;
+    Word16 *p_wf = wf;
+    Word16 *p_lsf   = &lsf[0];
+    Word16 *p_lsf_2 = &lsf[1];
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    /* wf[0] = lsf[1] - 0  */
+    *(p_wf++) = *(p_lsf_2++);
+
+    for (i = 4; i != 0 ; i--)
+    {
+        *(p_wf++) = *(p_lsf_2++) - *(p_lsf++);
+        *(p_wf++) = *(p_lsf_2++) - *(p_lsf++);
+    }
+    /*
+     *  wf[9] = 4000 - lsf[8]
+     */
+    *(p_wf) = 16384 - *(p_lsf);
+
+    p_wf = wf;
+
+    for (i = 10; i != 0; i--)
+    {
+        /*
+         *  (wf[i] - 450);
+         *  1843 == 450 Hz (Q15 considering 7FFF = 8000 Hz)
+         */
+        wgt_fct = *p_wf;
+        temp =  wgt_fct - 1843;
+
+        if (temp > 0)
+        {
+            temp = (Word16)(((Word32)temp * 6242) >> 15);
+            wgt_fct = 1843 - temp;
+        }
+        else
+        {
+            temp = (Word16)(((Word32)wgt_fct * 28160) >> 15);
+            wgt_fct = 3427 - temp;
+        }
+
+        *(p_wf++) = wgt_fct << 3;
+
+    } /* for (i = 10; i != 0; i--) */
+
+    return;
+
+} /* Lsf_wt() */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp.cpp
new file mode 100644 (file)
index 0000000..d5c1d27
--- /dev/null
@@ -0,0 +1,440 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: lsp.cpp
+ Functions:
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "lsp.h"
+#include "typedef.h"
+#include "q_plsf.h"
+#include "az_lsp.h"
+#include "int_lpc.h"
+#include "lsp_tab.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lsp_init (lspState **st)
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = Pointer to type lspState
+
+ Outputs:
+    st = Pointer to type lspState -- values are initialized.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    lsp_init_data = Word16 array.
+
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Initializes lsp state data.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF Word16 lsp_init(lspState **st)
+{
+    lspState* s;
+
+    if (st == (lspState **) NULL)
+    {
+        /* fprintf(stderr, "lsp_init: invalid parameter\n"); */
+        return -1;
+    }
+
+    *st = NULL;
+
+    /* allocate memory */
+    if ((s = (lspState *) oscl_malloc(sizeof(lspState))) == NULL)
+    {
+        /* fprintf(stderr, "lsp_init: can not malloc state structure\n"); */
+        return -1;
+    }
+
+    /* Initialize quantization state */
+    if (0 != Q_plsf_init(&s->qSt))
+    {
+        return -1;
+    }
+
+    if (0 != lsp_reset(s))
+    {
+        return -1;
+    }
+
+    *st = s;
+
+    return 0;
+}
+
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lsp_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = Pointer to type lspState
+
+ Outputs:
+    st = Pointer to type lspState -- values are reset.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    resets lsp_state data
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF Word16 lsp_reset(lspState *st)
+{
+
+    if (st == (lspState *) NULL)
+    {
+        /* fprintf(stderr, "lsp_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    /* Init lsp_old[] */
+    oscl_memcpy(st->lsp_old,   lsp_init_data,   M*sizeof(Word16));
+
+    /* Initialize lsp_old_q[] */
+    oscl_memcpy(st->lsp_old_q,   st->lsp_old,  M*sizeof(Word16));
+
+    /* Reset quantization state */
+    Q_plsf_reset(st->qSt);
+
+    return 0;
+}
+
+
+
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lsp_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = Pointer to type lspState
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Frees memory used by lspState.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF void lsp_exit(lspState **st)
+{
+    if (st == NULL || *st == NULL)
+        return;
+
+    /* Deallocate members */
+    Q_plsf_exit(&(*st)->qSt);
+
+    /* deallocate memory */
+    oscl_free(*st);
+    *st = NULL;
+
+    return;
+}
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lsp
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+
+
+ Inputs:
+    st = Pointer to type lspState -- State struct
+    req_mode = enum Mode -- requested coder mode
+    used_mode = enum Mode -- used coder mode
+    az = array of type Word16 -- interpolated LP parameters Q12
+
+ Outputs:
+    azQ = array of type Word16 -- quantization interpol. LP parameters Q12
+    lsp_new = array of type Word16 -- new lsp vector
+    anap = Double pointer of type Word16 -- analysis parameters
+    pOverflow = Pointer to type Flag -- Flag set when overflow occurs
+    st = Pointer to type lspState -- State struct
+    az = array of type Word16 -- interpolated LP parameters Q12
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF void lsp(lspState *st,       /* i/o : State struct            */
+                         enum Mode req_mode, /* i   : requested coder mode                    */
+                         enum Mode used_mode,/* i   : used coder mode                         */
+                         Word16 az[],        /* i/o : interpolated LP parameters Q12          */
+                         Word16 azQ[],       /* o   : quantization interpol. LP parameters Q12*/
+                         Word16 lsp_new[],   /* o   : new lsp vector                          */
+                         Word16 **anap,      /* o   : analysis parameters                     */
+                         Flag   *pOverflow)  /* o   : Flag set when overflow occurs           */
+
+{
+    Word16 lsp_new_q[M];    /* LSPs at 4th subframe           */
+    Word16 lsp_mid[M], lsp_mid_q[M];    /* LSPs at 2nd subframe           */
+
+    Word16 pred_init_i; /* init index for MA prediction in DTX mode */
+
+    if (req_mode == MR122)
+    {
+        Az_lsp(&az[MP1], lsp_mid, st->lsp_old, pOverflow);
+        Az_lsp(&az[MP1 * 3], lsp_new, lsp_mid, pOverflow);
+
+        /*--------------------------------------------------------------------*
+         * Find interpolated LPC parameters in all subframes (both quantized  *
+         * and unquantized).                                                  *
+         * The interpolated parameters are in array A_t[] of size (M+1)*4     *
+         * and the quantized interpolated parameters are in array Aq_t[]      *
+         *--------------------------------------------------------------------*/
+        Int_lpc_1and3_2(st->lsp_old, lsp_mid, lsp_new, az, pOverflow);
+
+        if (used_mode != MRDTX)
+        {
+            /* LSP quantization (lsp_mid[] and lsp_new[] jointly quantized) */
+            Q_plsf_5(
+                st->qSt,
+                lsp_mid,
+                lsp_new,
+                lsp_mid_q,
+                lsp_new_q,
+                *anap,
+                pOverflow);
+
+            Int_lpc_1and3(st->lsp_old_q, lsp_mid_q, lsp_new_q, azQ, pOverflow);
+
+            /* Advance analysis parameters pointer */
+            (*anap) += 5;
+        }
+    }
+    else
+    {
+        Az_lsp(&az[MP1 * 3], lsp_new, st->lsp_old, pOverflow);  /* From A(z) to lsp  */
+
+        /*--------------------------------------------------------------------*
+         * Find interpolated LPC parameters in all subframes (both quantized  *
+         * and unquantized).                                                  *
+         * The interpolated parameters are in array A_t[] of size (M+1)*4     *
+         * and the quantized interpolated parameters are in array Aq_t[]      *
+         *--------------------------------------------------------------------*/
+
+        Int_lpc_1to3_2(st->lsp_old, lsp_new, az, pOverflow);
+
+        if (used_mode != MRDTX)
+        {
+            /* LSP quantization */
+            Q_plsf_3(
+                st->qSt,
+                req_mode,
+                lsp_new,
+                lsp_new_q,
+                *anap,
+                &pred_init_i,
+                pOverflow);
+
+            Int_lpc_1to3(
+                st->lsp_old_q,
+                lsp_new_q,
+                azQ,
+                pOverflow);
+
+            /* Advance analysis parameters pointer */
+            (*anap) += 3;
+        }
+    }
+
+    /* update the LSPs for the next frame */
+    oscl_memcpy(st->lsp_old,   lsp_new,   M*sizeof(Word16));
+
+    if (used_mode != MRDTX)
+    {
+        oscl_memcpy(st->lsp_old_q, lsp_new_q, M*sizeof(Word16));
+    }
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp
new file mode 100644 (file)
index 0000000..c41f614
--- /dev/null
@@ -0,0 +1,376 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lsp_az.cpp
+ Functions: Get_lsp_pol
+           Lsp_Az
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains functions that convert line spectral pairs (LSP) to
+ linear predictive (LP) coefficients (filter order = 10). The functions
+ included in this file include Get_lsp_pol, which finds the coefficients of
+ F1(z) and F2(z), and Lsp_Az, which converts LSP to LPC by multiplying
+ F1(z) by 1+z^(-1) and F2(z) by 1-z^(-1), then calculating A(z) = (F1(z) +
+ F2(z))/2.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "lsp_az.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Get_lsp_pol
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsp = pointer to the buffer containing the line spectral pairs (LSP)
+          of type Word16
+    f = pointer to the polynomial of type Word32 to be generated
+
+    pOverflow  = pointer set in case where one of the operations overflows.
+                 [data type Pointer to Flag]
+
+ Outputs:
+    buffer pointed to by f contains the polynomial generated
+
+    pOverflow  = pointer set in case where one of the operations overflows.
+                 [data type Pointer to Flag]
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function finds the polynomial F1(z) or F2(z) from the LSPs. If the LSP
+ vector is passed at address 0, F1(z) is computed and if it is passed at
+ address 1, F2(z) is computed.
+
+ This is performed by expanding the product polynomials:
+
+    F1(z) =   product   ( 1 - 2 lsp[i] z^-1 + z^-2 )
+        i=0,2,4,6,8
+    F2(z) =   product   ( 1 - 2 lsp[i] z^-1 + z^-2 )
+        i=1,3,5,7,9
+
+ where lsp[] is the LSP vector in the cosine domain.
+
+ The expansion is performed using the following recursion:
+
+    f[0] = 1
+    b = -2.0 * lsp[0]
+    f[1] = b
+    for i=2 to 5 do
+        b = -2.0 * lsp[2*i-2];
+        for j=i-1 down to 2 do
+            f[j] = f[j] + b*f[j-1] + f[j-2];
+        f[1] = f[1] + b;
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lsp_az.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static void Get_lsp_pol (Word16 *lsp, Word32 *f)
+{
+    Word16 i, j, hi, lo;
+    Word32 t0;
+
+    // f[0] = 1.0;
+    *f = L_mult (4096, 2048);
+    f++;
+    *f = L_msu ((Word32) 0, *lsp, 512);    // f[1] =  -2.0 * lsp[0];
+    f++;
+    lsp += 2;                              // Advance lsp pointer
+
+    for (i = 2; i <= 5; i++)
+    {
+        *f = f[-2];
+
+        for (j = 1; j < i; j++, f--)
+        {
+            L_Extract (f[-1], &hi, &lo);
+            t0 = Mpy_32_16 (hi, lo, *lsp); // t0 = f[-1] * lsp
+            t0 = L_shl (t0, 1);
+            *f = L_add (*f, f[-2]); // *f += f[-2]
+            *f = L_sub (*f, t0); // *f -= t0
+        }
+        *f = L_msu (*f, *lsp, 512); // *f -= lsp<<9
+        f += i;                            // Advance f pointer
+        lsp += 2;                          // Advance lsp pointer
+    }
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void Get_lsp_pol(
+    Word16 *lsp,
+    Word32 *f,
+    Flag   *pOverflow)
+{
+    register Word16 i;
+    register Word16 j;
+
+    Word16 hi;
+    Word16 lo;
+    Word32 t0;
+    OSCL_UNUSED_ARG(pOverflow);
+
+    /* f[0] = 1.0;             */
+    *f++ = (Word32) 0x01000000;
+    *f++ = (Word32) - *(lsp++) << 10;       /* f[1] =  -2.0 * lsp[0];  */
+    lsp++;                                  /* Advance lsp pointer     */
+
+    for (i = 2; i <= 5; i++)
+    {
+        *f = *(f - 2);
+
+        for (j = 1; j < i; j++)
+        {
+            hi = (Word16)(*(f - 1) >> 16);
+
+            lo = (Word16)((*(f - 1) >> 1) - ((Word32) hi << 15));
+
+            t0  = ((Word32)hi * *lsp);
+            t0 += ((Word32)lo * *lsp) >> 15;
+
+            *(f) +=  *(f - 2);          /*      *f += f[-2]      */
+            *(f--) -=  t0 << 2;         /*      *f -= t0         */
+
+        }
+
+        *f -= (Word32)(*lsp++) << 10;
+
+        f  += i;
+        lsp++;
+    }
+
+    return;
+}
+
+/****************************************************************************/
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Lsp_Az
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsp = pointer to the buffer containing the line spectral pairs (LSP)
+          of type Word16
+
+      a = pointer to the buffer containing Linear Predictive (LP)
+          coefficients of type Word16 to be generated
+
+    pOverflow  = pointer set in case where one of the operations overflows.
+                 [data type Pointer to Flag]
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    pOverflow  = pointer set in case where one of the operations overflows.
+                 [data type Pointer to Flag]
+
+ Pointers and Buffers Modified:
+    a buffer contains the generated Linear Predictive (LP) coefficients
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+        None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function converts from the line spectral pairs (LSP) to LP coefficients
+ for a 10th order filter.
+
+ This is done by:
+    (1) Find the coefficients of F1(z) and F2(z) (see Get_lsp_pol)
+    (2) Multiply F1(z) by 1+z^{-1} and F2(z) by 1-z^{-1}
+    (3) A(z) = ( F1(z) + F2(z) ) / 2
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lsp_az.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Lsp_Az (
+    Word16 lsp[],        // (i)  : line spectral frequencies
+    Word16 a[]           // (o)  : predictor coefficients (order = 10)
+)
+{
+    Word16 i, j;
+    Word32 f1[6], f2[6];
+    Word32 t0;
+
+    Get_lsp_pol (&lsp[0], f1);
+    Get_lsp_pol (&lsp[1], f2);
+
+    for (i = 5; i > 0; i--)
+    {
+        f1[i] = L_add (f1[i], f1[i - 1]); // f1[i] += f1[i-1];
+        f2[i] = L_sub (f2[i], f2[i - 1]); // f2[i] -= f2[i-1];
+    }
+
+    a[0] = 4096;
+    for (i = 1, j = 10; i <= 5; i++, j--)
+    {
+        t0 = L_add (f1[i], f2[i]);           // f1[i] + f2[i]
+        a[i] = extract_l (L_shr_r (t0, 13));
+        t0 = L_sub (f1[i], f2[i]);           // f1[i] - f2[i]
+        a[j] = extract_l (L_shr_r (t0, 13));
+    }
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Lsp_Az(
+    Word16 lsp[],        /* (i)  : line spectral frequencies            */
+    Word16 a[],          /* (o)  : predictor coefficients (order = 10)  */
+    Flag  *pOverflow     /* (o)  : overflow flag                        */
+)
+{
+    register Word16 i;
+    register Word16 j;
+
+    Word32 f1[6];
+    Word32 f2[6];
+    Word32 t0;
+    Word32 t1;
+    Word16 *p_a = &a[0];
+    Word32 *p_f1;
+    Word32 *p_f2;
+
+    Get_lsp_pol(&lsp[0], f1, pOverflow);
+
+    Get_lsp_pol(&lsp[1], f2, pOverflow);
+
+    p_f1 = &f1[5];
+    p_f2 = &f2[5];
+
+    for (i = 5; i > 0; i--)
+    {
+        *(p_f1--) += f1[i-1];
+        *(p_f2--) -= f2[i-1];
+    }
+
+    *(p_a++) = 4096;
+    p_f1 = &f1[1];
+    p_f2 = &f2[1];
+
+    for (i = 1, j = 10; i <= 5; i++, j--)
+    {
+        t0 = *(p_f1) + *(p_f2);               /* f1[i] + f2[i] */
+        t1 = *(p_f1++) - *(p_f2++);           /* f1[i] - f2[i] */
+
+        t0 = t0 + ((Word32) 1 << 12);
+        t1 = t1 + ((Word32) 1 << 12);
+
+        *(p_a++) = (Word16)(t0 >> 13);
+        a[j]     = (Word16)(t1 >> 13);
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf.cpp
new file mode 100644 (file)
index 0000000..f315f5f
--- /dev/null
@@ -0,0 +1,318 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: lsp_lsf.cpp
+ Functions: Lsp_lsf
+            Lsf_lsp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the functions that convert line spectral pairs (LSP) to
+ line spectral frequencies (LSF) and vice-versa.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "lsp_lsf.h"
+#include "basicop_malloc.h"
+#include "basic_op.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    extern const Word16 table[];
+    extern const Word16 slope[];
+
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Lsf_lsp
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsf = buffer containing normalized line spectral frequencies; valid
+          range is between 0 and 0.5 (Word16)
+    lsp = buffer containing line spectral pairs; valid range is between
+          -1 and 1 (Word16)
+    m = LPC order (Word16)
+
+ Outputs:
+    lsp contains the newly calculated line spectral pairs
+
+ Returns:
+    None
+
+ Global Variables Used:
+    table = cosine table
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the LSF to LSP transformation using the equation:
+
+    lsf[i] = arccos(lsp[i])/(2*pi)
+
+ The transformation from lsp[i] to lsf[i] is approximated by a look-up table
+ and interpolation.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lsp_lsf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Lsf_lsp (
+    Word16 lsf[],       // (i) : lsf[m] normalized (range: 0.0<=val<=0.5)
+    Word16 lsp[],       // (o) : lsp[m] (range: -1<=val<1)
+    Word16 m            // (i) : LPC order
+)
+{
+    Word16 i, ind, offset;
+    Word32 L_tmp;
+
+    for (i = 0; i < m; i++)
+    {
+        ind = shr (lsf[i], 8);      // ind    = b8-b15 of lsf[i]
+        offset = lsf[i] & 0x00ff;    // offset = b0-b7  of lsf[i]
+
+        // lsp[i] = table[ind]+ ((table[ind+1]-table[ind])*offset) / 256
+
+        L_tmp = L_mult (sub (table[ind + 1], table[ind]), offset);
+        lsp[i] = add (table[ind], extract_l (L_shr (L_tmp, 9)));
+
+    }
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Lsf_lsp(
+    Word16 lsf[],       /* (i) : lsf[m] normalized (range: 0.0<=val<=0.5) */
+    Word16 lsp[],       /* (o) : lsp[m] (range: -1<=val<1)                */
+    Word16 m,           /* (i) : LPC order                                */
+    Flag   *pOverflow   /* (o) : Flag set when overflow occurs            */
+)
+{
+    Word16 i, ind, offset;
+    Word32 L_tmp;
+
+    for (i = 0; i < m; i++)
+    {
+        ind = lsf[i] >> 8;           /* ind    = b8-b15 of lsf[i] */
+        offset = lsf[i] & 0x00ff;    /* offset = b0-b7  of lsf[i] */
+
+        /* lsp[i] = table[ind]+ ((table[ind+1]-table[ind])*offset) / 256 */
+
+        L_tmp = ((Word32)(table[ind + 1] - table[ind]) * offset) >> 8;
+        lsp[i] = table[ind] + (Word16) L_tmp;
+
+    }
+
+    return;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Lsp_lsf
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsp = buffer containing line spectral pairs; valid range is between
+          -1 and 1 (Word16)
+    lsf = buffer containing normalized line spectral frequencies; valid
+          range is between 0 and 0.5 (Word16)
+    m = LPC order (Word16)
+
+ Outputs:
+    lsf contains the newly calculated normalized line spectral frequencies
+
+ Returns:
+    None
+
+ Global Variables Used:
+    table = cosine table
+    slope = table to used to calculate inverse cosine
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the LSP to LSF transformation using the equation:
+
+    lsp[i] = cos(2*pi*lsf[i])
+
+ The transformation from lsf[i] to lsp[i] is approximated by a look-up table
+ and interpolation.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lsp_lsf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Lsp_lsf (
+    Word16 lsp[],       // (i)  : lsp[m] (range: -1<=val<1)
+    Word16 lsf[],       // (o)  : lsf[m] normalized (range: 0.0<=val<=0.5)
+    Word16 m            // (i)  : LPC order
+)
+{
+    Word16 i, ind;
+    Word32 L_tmp;
+
+    ind = 63;                        // begin at end of table -1
+
+    for (i = m - 1; i >= 0; i--)
+    {
+        // find value in table that is just greater than lsp[i]
+
+        while (sub (table[ind], lsp[i]) < 0)
+        {
+            ind--;
+
+        }
+
+        // acos(lsp[i])= ind*256 + ( ( lsp[i]-table[ind] ) *
+           slope[ind] )/4096
+
+        L_tmp = L_mult (sub (lsp[i], table[ind]), slope[ind]);
+        //(lsp[i]-table[ind])*slope[ind])>>12
+        lsf[i] = pv_round (L_shl (L_tmp, 3));
+        lsf[i] = add (lsf[i], shl (ind, 8));
+    }
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Lsp_lsf(
+    Word16 lsp[],       /* (i)  : lsp[m] (range: -1<=val<1)                */
+    Word16 lsf[],       /* (o)  : lsf[m] normalized (range: 0.0<=val<=0.5) */
+    Word16 m,           /* (i)  : LPC order                                */
+    Flag  *pOverflow    /* (o)  : Flag set when overflow occurs            */
+)
+{
+    Word16 i;
+    Word16 ind;
+    Word16 temp;
+    Word32 L_tmp;
+    Word16 *p_lsp = &lsp[m-1];
+    Word16 *p_lsf = &lsf[m-1];
+    OSCL_UNUSED_ARG(pOverflow);
+
+    ind = 63;                        /* begin at end of table -1 */
+
+    for (i = m - 1; i >= 0; i--)
+    {
+        /* find value in table that is just greater than lsp[i] */
+        temp = *(p_lsp--);
+        while (table[ind] < temp)
+        {
+            ind--;
+        }
+
+        /* acos(lsp[i])= ind*256 + ( ( lsp[i]-table[ind] ) *
+           slope[ind] )/4096 */
+
+        L_tmp = (Word32)(temp - table[ind]) * slope[ind];
+
+        /*(lsp[i]-table[ind])*slope[ind])>>12*/
+        L_tmp  = (L_tmp + 0x00000800) >> 12;
+
+        *(p_lsf--) = (Word16)(L_tmp) + (ind << 8);
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf_tbl.cpp
new file mode 100644 (file)
index 0000000..f44aabf
--- /dev/null
@@ -0,0 +1,105 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: lsp_lsf_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+
+    extern const Word16 table[];
+    const Word16 table[65] =
+    {
+        32767, 32729, 32610, 32413, 32138, 31786, 31357, 30853,
+        30274, 29622, 28899, 28106, 27246, 26320, 25330, 24279,
+        23170, 22006, 20788, 19520, 18205, 16846, 15447, 14010,
+        12540, 11039, 9512, 7962, 6393, 4808, 3212, 1608,
+        0, -1608, -3212, -4808, -6393, -7962, -9512, -11039,
+        -12540, -14010, -15447, -16846, -18205, -19520, -20788, -22006,
+        -23170, -24279, -25330, -26320, -27246, -28106, -28899, -29622,
+        -30274, -30853, -31357, -31786, -32138, -32413, -32610, -32729,
+        (Word16) 0x8000
+    };
+
+    /* 0x8000 = -32768 (used to silence the compiler) */
+
+    /* slope used to compute y = acos(x) */
+
+    extern const Word16 slope[];
+    const Word16 slope[64] =
+    {
+        -26887, -8812, -5323, -3813, -2979, -2444, -2081, -1811,
+        -1608, -1450, -1322, -1219, -1132, -1059, -998, -946,
+        -901, -861, -827, -797, -772, -750, -730, -713,
+        -699, -687, -677, -668, -662, -657, -654, -652,
+        -652, -654, -657, -662, -668, -677, -687, -699,
+        -713, -730, -750, -772, -797, -827, -861, -901,
+        -946, -998, -1059, -1132, -1219, -1322, -1450, -1608,
+        -1811, -2081, -2444, -2979, -3813, -5323, -8812, -26887
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_tab.cpp
new file mode 100644 (file)
index 0000000..d236137
--- /dev/null
@@ -0,0 +1,154 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lsp_tab.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    None
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   File             : lsp.tab
+   Purpose          : Table for lsp init
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "lsp_tab.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+    const Word16 lsp_init_data[M] =
+    {
+        30000, 26000, 21000, 15000, 8000,
+        0, -8000, -15000, -21000, -26000
+    };
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL FUNCTION REFERENCES
+    ; Declare functions defined elsewhere and referenced in this module
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; Define all local variables
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Function body here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Return nothing or data or data pointer
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp
new file mode 100644 (file)
index 0000000..003afc7
--- /dev/null
@@ -0,0 +1,183 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mult_r.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ Multiplication function with rounding and overflow control
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: mult_r
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+    var2 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the add operation resulted in overflow
+
+ Returns:
+    L_product_arr = 16-bit limited product of var1 and var2 (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the multiplication of var1 by var2 with rounding, and
+ gives a 16 bit result which is scaled, i.e.:
+    mult_r(var1,var2) = extract_l(L_shr(((var1 * var2) + 16384),15)) and  |
+    mult_r(-32768,-32768) = 32767
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] mult_r() function in basicop2.c, UMTS GSM AMR speech codec, R99 -
+ Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 mult_r (Word16 var1, Word16 var2)
+{
+    Word16 var_out;
+    Word32 L_product_arr;
+
+    L_product_arr = (Word32) var1 *(Word32) var2;
+    L_product_arr += (Word32) 0x00004000L;
+    L_product_arr &= (Word32) 0xffff8000L;
+    L_product_arr >>= 15;
+
+    if (L_product_arr & (Word32) 0x00010000L)
+    {
+        L_product_arr |= (Word32) 0xffff0000L;
+    }
+* The reference ETSI code uses a global flag for Overflow inside the function
+* saturate(). In the actual implementation a pointer to Overflow flag is passed in
+* as a parameter to the function
+
+    var_out = saturate (L_product_arr);
+
+#if (WMOPS)
+    multiCounter[currCounter].mult_r++;
+#endif
+
+    return (var_out);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+OSCL_EXPORT_REF Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow)
+{
+
+    register Word32 L_product_arr;
+
+    L_product_arr = ((Word32) var1) * var2;              /* product */
+    L_product_arr += (Word32) 0x00004000L;               /* round */
+    L_product_arr >>= 15;                                /* shift */
+
+    /* sign extend when necessary */
+    L_product_arr |= (Word32) - (L_product_arr & (Word32) 0x00010000L);
+
+    /* Saturate result (if necessary). */
+    /* Replaced function call with in-line code to conserve MIPS, */
+    /* i.e., var_out = saturate (L_product_arr)  */
+
+    if (L_product_arr > 0X00007fffL)
+    {
+        *pOverflow = 1;
+        L_product_arr = MAX_16;
+    }
+    else if (L_product_arr < (Word32) - 32768)
+    {
+        *pOverflow = 1;
+        L_product_arr = MIN_16;
+    }
+
+    return ((Word16) L_product_arr);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp
new file mode 100644 (file)
index 0000000..3db2458
--- /dev/null
@@ -0,0 +1,146 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: negate.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    var1 = negated value of input (Word16)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function negates var1 with saturation; saturate in the case where input
+ is -32768: negate(var1) = sub(0,var1).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 negate (Word16 var1)
+{
+    Word16 var_out;
+
+    var_out = (var1 == MIN_16) ? MAX_16 : -var1;
+#if (WMOPS)
+    multiCounter[currCounter].negate++;
+#endif
+    return (var_out);
+}
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "negate.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word16 negate(register Word16 var1)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+    var1 = (var1 == MIN_16) ? MAX_16 : -var1;
+
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+    return (var1);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp
new file mode 100644 (file)
index 0000000..dc4ca72
--- /dev/null
@@ -0,0 +1,203 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: norm_l.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_var1 = 32 bit long signed integer (Word32) whose value falls
+             in the range : 0x8000 0000 <= var1 <= 0x7fff ffff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    var_out = number of left shifts need to normalize input (Word16)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function produces the number of left shifts needed to normalize the 32
+ bit variable L_var1 for positive values on the interval with minimum of
+ 0x40000000 and maximum of 0x7fffffff, and for negative values on the interval
+ with minimum of 0x80000000 and maximum of 0xc0000000. Note that when L_var1
+ is equal to zero, the output var_out is set to zero.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 norm_l (Word32 L_var1)
+{
+    Word16 var_out;
+
+    if (L_var1 == 0)
+    {
+        var_out = 0;
+    }
+    else
+    {
+        if (L_var1 == (Word32) 0xffffffffL)
+        {
+            var_out = 31;
+        }
+        else
+        {
+            if (L_var1 < 0)
+            {
+                L_var1 = ~L_var1;
+            }
+            for (var_out = 0; L_var1 < (Word32) 0x40000000L; var_out++)
+            {
+                L_var1 <<= 1;
+            }
+        }
+    }
+
+#if (WMOPS)
+    multiCounter[currCounter].norm_l++;
+#endif
+    return (var_out);
+}
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+#if !((PV_CPU_ARCH_VERSION >=5) && ((PV_COMPILER == EPV_ARM_GNUC) || (PV_COMPILER == EPV_ARM_RVCT)))
+OSCL_EXPORT_REF Word16 norm_l(register Word32 L_var1)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+    register Word16 var_out = 0;
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+
+    if (L_var1)
+    {
+
+        Word32 y = L_var1 - (L_var1 < 0);
+        L_var1 = y ^(y >> 31);
+
+
+        while (!(0x40000000L & L_var1))
+        {
+            var_out++;
+            if ((0x20000000L & L_var1))
+            {
+                break;
+            }
+            var_out++;
+            if ((0x10000000L & L_var1))
+            {
+                break;
+            }
+            var_out++;
+            if ((0x08000000L & L_var1))
+            {
+                break;
+            }
+            var_out++;
+            L_var1 <<= 4;
+        }
+    }
+
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+
+
+    return (var_out);
+}
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp
new file mode 100644 (file)
index 0000000..4fdc6d2
--- /dev/null
@@ -0,0 +1,203 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: norm_s.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    var1 = 16 bit signed integer of type Word16, whose value falls
+           in the range: 0x8000 <= var1 <= 0x7fff
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    var_out = number of left shifts need to normalize var1 (Word16)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function produces the number of left shifts needed to normalize the 16
+ bit variable var1 for positive values on the interval with minimum of 0x4000
+ and maximum of 0x7fff, and for negative values on the interval with minimum
+ of 0x8000 and maximum of 0xc000. Note that when var1 is zero, the resulting
+ output var_out is set to zero.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 norm_s (Word16 var1)
+{
+    Word16 var_out;
+
+    if (var1 == 0)
+    {
+        var_out = 0;
+    }
+    else
+    {
+        if (var1 == (Word16) 0xffff)
+        {
+            var_out = 15;
+        }
+        else
+        {
+            if (var1 < 0)
+            {
+                var1 = ~var1;
+            }
+            for (var_out = 0; var1 < 0x4000; var_out++)
+            {
+                var1 <<= 1;
+            }
+        }
+    }
+
+#if (WMOPS)
+    multiCounter[currCounter].norm_s++;
+#endif
+    return (var_out);
+}
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+#if !((PV_CPU_ARCH_VERSION >=5) && ((PV_COMPILER == EPV_ARM_GNUC) || (PV_COMPILER == EPV_ARM_RVCT)))
+
+OSCL_EXPORT_REF Word16 norm_s(register Word16 var1)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+
+    register Word16 var_out = 0;
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+
+    if (var1)
+    {
+        Word16 y = var1 - (var1 < 0);
+        var1 = y ^(y >> 15);
+
+        while (!(0x4000 & var1))
+        {
+            var_out++;
+            if ((0x2000 & var1))
+            {
+                break;
+            }
+            var_out++;
+            if ((0x1000 & var1))
+            {
+                break;
+            }
+            var_out++;
+            if ((0x0800 & var1))
+            {
+                break;
+            }
+            var_out++;
+            var1 <<= 4;
+        }
+    }
+
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+    return (var_out);
+}
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/overflow_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/overflow_tbl.cpp
new file mode 100644 (file)
index 0000000..d78d627
--- /dev/null
@@ -0,0 +1,147 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: overflow_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the declaration for overflow_tbl[] used by the l_shl()
+ and l_shr() functions.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+    const Word32 overflow_tbl [32]   = {0x7fffffffL, 0x3fffffffL,
+        0x1fffffffL, 0x0fffffffL,
+        0x07ffffffL, 0x03ffffffL,
+        0x01ffffffL, 0x00ffffffL,
+        0x007fffffL, 0x003fffffL,
+        0x001fffffL, 0x000fffffL,
+        0x0007ffffL, 0x0003ffffL,
+        0x0001ffffL, 0x0000ffffL,
+        0x00007fffL, 0x00003fffL,
+        0x00001fffL, 0x00000fffL,
+        0x000007ffL, 0x000003ffL,
+        0x000001ffL, 0x000000ffL,
+        0x0000007fL, 0x0000003fL,
+        0x0000001fL, 0x0000000fL,
+        0x00000007L, 0x00000003L,
+        0x00000001L, 0x00000000L
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] l_shl() function in basic_op2.c,  UMTS GSM AMR speech codec, R99 -
+ Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/ph_disp_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/ph_disp_tab.cpp
new file mode 100644 (file)
index 0000000..f9e7faa
--- /dev/null
@@ -0,0 +1,165 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: ph_disp_tab.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the table of impulse responses of the phase dispersion
+ filters. All impulse responses are in Q15
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+    extern const Word16 ph_imp_low_MR795[];
+    const Word16 ph_imp_low_MR795[40] =
+    {
+        26777,    801,   2505,   -683,  -1382,    582,    604,  -1274,   3511,  -5894,
+        4534,   -499,  -1940,   3011,  -5058,   5614,  -1990,  -1061,  -1459,   4442,
+        -700,  -5335,   4609,    452,   -589,  -3352,   2953,   1267,  -1212,  -2590,
+        1731,   3670,  -4475,   -975,   4391,  -2537,    949,  -1363,   -979,   5734
+    };
+    extern const Word16 ph_imp_mid_MR795[];
+    const Word16 ph_imp_mid_MR795[40] =
+    {
+        30274,   3831,  -4036,   2972,  -1048,  -1002,   2477,  -3043,   2815,  -2231,
+        1753,  -1611,   1714,  -1775,   1543,  -1008,    429,   -169,    472,  -1264,
+        2176,  -2706,   2523,  -1621,    344,    826,  -1529,   1724,  -1657,   1701,
+        -2063,   2644,  -3060,   2897,  -1978,    557,    780,  -1369,    842,    655
+    };
+
+    extern const Word16 ph_imp_low[];
+    const Word16 ph_imp_low[40] =
+    {
+        14690,  11518,   1268,  -2761,  -5671,   7514,    -35,  -2807,  -3040,   4823,
+        2952,  -8424,   3785,   1455,   2179,  -8637,   8051,  -2103,  -1454,    777,
+        1108,  -2385,   2254,   -363,   -674,  -2103,   6046,  -5681,   1072,   3123,
+        -5058,   5312,  -2329,  -3728,   6924,  -3889,    675,  -1775,     29,  10145
+    };
+    extern const Word16 ph_imp_mid[];
+    const Word16 ph_imp_mid[40] =
+    {
+        30274,   3831,  -4036,   2972,  -1048,  -1002,   2477,  -3043,   2815,  -2231,
+        1753,  -1611,   1714,  -1775,   1543,  -1008,    429,   -169,    472,  -1264,
+        2176,  -2706,   2523,  -1621,    344,    826,  -1529,   1724,  -1657,   1701,
+        -2063,   2644,  -3060,   2897,  -1978,    557,    780,  -1369,    842,    655
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] ph_disp.tab, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2.cpp
new file mode 100644 (file)
index 0000000..637f92d
--- /dev/null
@@ -0,0 +1,176 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: pow2.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "pow2.h"
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pow2
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    exponent = Integer part whose valid range is: 0 <= value <= 30 (Word16)
+    fraction = Fractional part whose valid range is 0 <= value < 1
+
+    pOverflow = pointer to overflow flag
+
+ Outputs:
+    L_x = Result of the Pow2() computation (Word32)
+    pOverflow -> 1 if the Pow2() function results in saturation
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes  L_x = pow(2.0, exponent.fraction)
+
+ The function Pow2(L_x) is approximated by a table and linear interpolation.
+
+ 1- i = bit10-b15 of fraction,   0 <= i <= 31
+ 2- a = bit0-b9   of fraction
+ 3- L_x = table[i]<<16 - (table[i] - table[i+1]) * a * 2
+ 4- L_x = L_x >> (30-exponent)     (with rounding)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pow2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word32 Pow2 (           // (o)  : result       (range: 0<=val<=0x7fffffff)
+    Word16 exponent,    // (i)  : Integer part.      (range: 0<=val<=30)
+    Word16 fraction     // (i)  : Fractional part.  (range: 0.0<=val<1.0)
+)
+{
+    Word16 exp, i, a, tmp;
+    Word32 L_x;
+
+    L_x = L_mult (fraction, 32);        // L_x = fraction<<6
+    i = extract_h (L_x);                // Extract b10-b16 of fraction
+    L_x = L_shr (L_x, 1);
+    a = extract_l (L_x);                // Extract b0-b9   of fraction
+    a = a & (Word16) 0x7fff;
+
+    L_x = L_deposit_h (table[i]);       // table[i] << 16
+    tmp = sub (table[i], table[i + 1]); // table[i] - table[i+1]
+    L_x = L_msu (L_x, tmp, a);          // L_x -= tmp*a*2
+
+    exp = sub (30, exponent);
+    L_x = L_shr_r (L_x, exp);
+
+    return (L_x);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+OSCL_EXPORT_REF Word32 Pow2(            /* (o)  : result       (range: 0<=val<=0x7fffffff) */
+    Word16 exponent,    /* (i)  : Integer part.      (range: 0<=val<=30)   */
+    Word16 fraction,    /* (i)  : Fractional part.  (range: 0.0<=val<1.0)  */
+    Flag *pOverflow
+)
+{
+    Word16 exp, i, a, tmp;
+    Word32 L_x;
+
+    L_x = L_mult(fraction, 32, pOverflow);      /* L_x = fraction<<6    */
+
+    /* Extract b0-b16 of fraction */
+
+    i = ((Word16)(L_x >> 16)) & 31;             /* ensure index i is bounded */
+    a = (Word16)((L_x >> 1) & 0x7fff);
+
+    L_x = ((Word32) pow2_tbl[i] << 16);             /* pow2_tbl[i] << 16       */
+
+    /* pow2_tbl[i] - pow2_tbl[i+1] */
+    tmp = pow2_tbl[i] - pow2_tbl[i + 1];
+    L_x = L_msu(L_x, tmp, a, pOverflow);        /* L_x -= tmp*a*2        */
+
+    exp = 30 - exponent;
+    L_x = L_shr_r(L_x, exp, pOverflow);
+
+    return (L_x);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2_tbl.cpp
new file mode 100644 (file)
index 0000000..e49a89d
--- /dev/null
@@ -0,0 +1,136 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: pow2_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the declaration for log2_tbl[] used by the Pow2() function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "pow2.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+
+    const Word16 pow2_tbl[33] =
+    {
+        16384, 16743, 17109, 17484, 17867, 18258, 18658, 19066, 19484, 19911,
+        20347, 20792, 21247, 21713, 22188, 22674, 23170, 23678, 24196, 24726,
+        25268, 25821, 26386, 26964, 27554, 28158, 28774, 29405, 30048, 30706,
+        31379, 32066, 32767
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] pow2.tab,  UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp
new file mode 100644 (file)
index 0000000..fd51242
--- /dev/null
@@ -0,0 +1,291 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: pred_lt.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "pred_lt.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define UP_SAMP_MAX  6
+#define L_INTER10    (L_INTERPOL-1)
+#define FIR_SIZE     (UP_SAMP_MAX*L_INTER10+1)
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/* 1/6 resolution interpolation filter  (-3 dB at 3600 Hz) */
+/* Note: the 1/3 resolution filter is simply a subsampled
+ *       version of the 1/6 resolution filter, i.e. it uses
+ *       every second coefficient:
+ *
+ *          inter_3l[k] = inter_6[2*k], 0 <= k <= 3*L_INTER10
+ */
+
+const Word16 inter_6_pred_lt[FIR_SIZE] =
+{
+    29443,
+    28346, 25207, 20449, 14701,  8693,  3143,
+    -1352, -4402, -5865, -5850, -4673, -2783,
+    -672,  1211,  2536,  3130,  2991,  2259,
+    1170,     0, -1001, -1652, -1868, -1666,
+    -1147,  -464,   218,   756,  1060,  1099,
+    904,   550,   135,  -245,  -514,  -634,
+    -602,  -451,  -231,     0,   191,   308,
+    340,   296,   198,    78,   -36,  -120,
+    -163,  -165,  -132,   -79,   -19,    34,
+    73,    91,    89,    70,    38,     0
+};
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pred_lt_3or6
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    exc = buffer containing the excitation (Word16)
+    T0 = integer pitch lag (Word16)
+    frac = fraction of lag (Word16)
+    L_subfr = number of samples per subframe (Word16)
+    flag3 = flag to indicate the upsampling rate; if set, upsampling
+            rate is 3, otherwise, upsampling rate is 6 (Word16)
+
+    pOverflow = pointer to overflow (Flag)
+
+ Returns:
+    None
+
+ Outputs:
+    exc buffer contains the newly formed adaptive codebook excitation
+    pOverflow -> 1 if the add operation resulted in overflow
+
+ Global Variables Used:
+    inter_6_pred_lt = (1/6) resolution interpolation filter table (Word16)
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes the result of long term prediction with fractional
+ interpolation of resolution 1/3 or 1/6. (Interpolated past excitation).
+
+ The past excitation signal at the given delay is interpolated at
+ the given fraction to build the adaptive codebook excitation.
+ On return exc[0..L_subfr-1] contains the interpolated signal
+ (adaptive codebook excitation).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pred_lt.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Pred_lt_3or6 (
+    Word16 exc[],     // in/out: excitation buffer
+    Word16 T0,        // input : integer pitch lag
+    Word16 frac,      // input : fraction of lag
+    Word16 L_subfr,   // input : subframe size
+    Word16 flag3      // input : if set, upsampling rate = 3 (6 otherwise)
+)
+{
+    Word16 i, j, k;
+    Word16 *pX0, *pX1, *pX2;
+    const Word16 *pC1, *pC2;
+    Word32 s;
+
+    pX0 = &exc[-T0];
+
+    frac = negate (frac);
+    if (flag3 != 0)
+    {
+      frac = shl (frac, 1);   // inter_3l[k] = inter_6[2*k] -> k' = 2*k
+    }
+
+    if (frac < 0)
+    {
+        frac = add (frac, UP_SAMP_MAX);
+        pX0--;
+    }
+
+    for (j = 0; j < L_subfr; j++)
+    {
+        pX1 = pX0++;
+        pX2 = pX0;
+        pC1 = &inter_6[frac];
+        pC2 = &inter_6[sub (UP_SAMP_MAX, frac)];
+
+        s = 0;
+        for (i = 0, k = 0; i < L_INTER10; i++, k += UP_SAMP_MAX)
+        {
+            s = L_mac (s, pX1[-i], pC1[k]);
+            s = L_mac (s, pX2[i], pC2[k]);
+        }
+
+        exc[j] = pv_round (s);
+    }
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Pred_lt_3or6(
+    Word16 exc[],     /* in/out: excitation buffer                          */
+    Word16 T0,        /* input : integer pitch lag                          */
+    Word16 frac,      /* input : fraction of lag                            */
+    Word16 L_subfr,   /* input : subframe size                              */
+    Word16 flag3,     /* input : if set, upsampling rate = 3 (6 otherwise)  */
+    Flag  *pOverflow  /* output: if set, overflow occurred in this function */
+)
+{
+    register Word16 i;
+    register Word16 j;
+    register Word16 k;
+
+    Word16 *pX0;
+    Word16 *pX2;
+    Word16 *pX3;
+    Word16 *p_exc;
+    Word16 *pC1;
+    const Word16 *pC1_ref;
+    const Word16 *pC2_ref;
+
+    Word16 Coeff_1[(L_INTER10<<1)];
+
+    Word32 s1;
+    Word32 s2;
+    OSCL_UNUSED_ARG(pOverflow);
+
+    pX0 = &(exc[-T0]);
+
+    /* frac goes between -3 and 3 */
+
+    frac = -frac;
+
+    if (flag3 != 0)
+    {
+        frac <<= 1;   /* inter_3l[k] = inter_6[2*k] -> k' = 2*k */
+    }
+
+    if (frac < 0)
+    {
+        frac += UP_SAMP_MAX;
+        pX0--;
+    }
+
+    pC1_ref = &inter_6_pred_lt[frac];
+    pC2_ref = &inter_6_pred_lt[UP_SAMP_MAX-frac];
+
+
+    pC1 = Coeff_1;
+
+    k = 0;
+
+    for (i = L_INTER10 >> 1; i > 0; i--)
+    {
+        *(pC1++) = pC1_ref[k];
+        *(pC1++) = pC2_ref[k];
+        k += UP_SAMP_MAX;
+        *(pC1++) = pC1_ref[k];
+        *(pC1++) = pC2_ref[k];
+        k += UP_SAMP_MAX;
+
+    }
+
+    p_exc = exc;
+
+    for (j = (L_subfr >> 1); j != 0 ; j--)
+    {
+        pX0++;
+        pX2 = pX0;
+        pX3 = pX0++;
+
+        pC1 = Coeff_1;
+
+        s1  = 0x00004000L;
+        s2  = 0x00004000L;
+
+        for (i = L_INTER10 >> 1; i > 0; i--)
+        {
+            s2 += ((Word32) * (pX3--)) * *(pC1);
+            s1 += ((Word32) * (pX3)) * *(pC1++);
+            s1 += ((Word32) * (pX2++)) * *(pC1);
+            s2 += ((Word32) * (pX2)) * *(pC1++);
+            s2 += ((Word32) * (pX3--)) * *(pC1);
+            s1 += ((Word32) * (pX3)) * *(pC1++);
+            s1 += ((Word32) * (pX2++)) * *(pC1);
+            s2 += ((Word32) * (pX2)) * *(pC1++);
+
+        } /* for (i = L_INTER10>>1; i > 0; i--) */
+
+        *(p_exc++) = (Word16)(s1 >> 15);
+        *(p_exc++) = (Word16)(s2 >> 15);
+
+    } /* for (j = (L_subfr>>1); j != 0 ; j--) */
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf.cpp
new file mode 100644 (file)
index 0000000..75392e9
--- /dev/null
@@ -0,0 +1,142 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : q_plsf.c
+*      Purpose          : common part (init, exit, reset) of LSF quantization
+*                         module (rest in q_plsf_3.c and q_plsf_5.c)
+*
+********************************************************************************
+*/
+
+/*
+********************************************************************************
+*                         MODULE INCLUDE FILE AND VERSION ID
+********************************************************************************
+*/
+#include "q_plsf.h"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+#include "basic_op.h"
+#include "oscl_mem.h"
+
+
+/*
+********************************************************************************
+*                         PUBLIC PROGRAM CODE
+********************************************************************************
+*/
+
+/*
+**************************************************************************
+*
+*  Function    : Q_plsf_init
+*  Purpose     : Allocates memory and initializes state variables
+*
+**************************************************************************
+*/
+Word16 Q_plsf_init(Q_plsfState **state)
+{
+    Q_plsfState* s;
+
+    if (state == (Q_plsfState **) NULL)
+    {
+        /* fprintf(stderr, "Q_plsf_init: invalid parameter\n"); */
+        return -1;
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (Q_plsfState *) oscl_malloc(sizeof(Q_plsfState))) == NULL)
+    {
+        /* fprintf(stderr, "Q_plsf_init: can not malloc state structure\n"); */
+        return -1;
+    }
+
+    Q_plsf_reset(s);
+    *state = s;
+
+    return 0;
+}
+
+/*
+**************************************************************************
+*
+*  Function    : Q_plsf_reset
+*  Purpose     : Resets state memory
+*
+**************************************************************************
+*/
+Word16 Q_plsf_reset(Q_plsfState *state)
+{
+    Word16 i;
+
+    if (state == (Q_plsfState *) NULL)
+    {
+        /* fprintf(stderr, "Q_plsf_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    for (i = 0; i < M; i++)
+        state->past_rq[i] = 0;
+
+    return 0;
+}
+
+/*
+**************************************************************************
+*
+*  Function    : Q_plsf_exit
+*  Purpose     : The memory used for state memory is freed
+*
+**************************************************************************
+*/
+void Q_plsf_exit(Q_plsfState **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp
new file mode 100644 (file)
index 0000000..2c5446b
--- /dev/null
@@ -0,0 +1,1097 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: q_plsf_3.cpp
+ Funtions: Vq_subvec4
+           Test_Vq_subvec4
+           Vq_subvec3
+           Test_Vq_subvec3
+           Q_plsf_3
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the functions that perform the quantization of LSF
+ parameters with first order MA prediction and split by 3 vector
+ quantization (split-VQ).
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "q_plsf.h"
+#include "typedef.h"
+#include "lsp_lsf.h"
+#include "reorder.h"
+#include "lsfwt.h"
+#include "oscl_mem.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+#define PAST_RQ_INIT_SIZE 8
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    /* Codebooks of LSF prediction residual */
+    extern const Word16 mean_lsf_3[];
+
+    extern const Word16 pred_fac_3[];
+
+    extern const Word16 dico1_lsf_3[];
+    extern const Word16 dico2_lsf_3[];
+    extern const Word16 dico3_lsf_3[];
+
+    extern const Word16 mr515_3_lsf[];
+    extern const Word16 mr795_1_lsf[];
+
+    extern const Word16 past_rq_init[];
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Vq_subvec4
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsf_r1 = pointer to the first LSF residual vector (Q15) (Word16)
+    dico = pointer to the quantization codebook (Q15) (const Word16)
+    wf1 = pointer to the first LSF weighting factor (Q13) (Word16)
+    dico_size = size of quantization codebook (Q0) (Word16)
+
+ Outputs:
+    buffer pointed to by lsf_r1 contains the selected vector
+    pOverflow -- pointer to Flag -- Flag set when overflow occurs
+
+ Returns:
+    index = quantization index (Q0) (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the quantization of a 4-dimensional subvector.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ q_plsf_3.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static Word16
+Vq_subvec4(             // o: quantization index,            Q0
+    Word16 * lsf_r1,    // i: 1st LSF residual vector,       Q15
+    Word16 * dico,      // i: quantization codebook,         Q15
+    Word16 * wf1,       // i: 1st LSF weighting factors,     Q13
+    Word16 dico_size)   // i: size of quantization codebook, Q0
+{
+    Word16 i, index = 0;
+    Word16 *p_dico, temp;
+    Word32 dist_min, dist;
+
+    dist_min = MAX_32;
+    p_dico = dico;
+
+    for (i = 0; i < dico_size; i++)
+    {
+        temp = sub (lsf_r1[0], *p_dico++);
+        temp = mult (wf1[0], temp);
+        dist = L_mult (temp, temp);
+
+        temp = sub (lsf_r1[1], *p_dico++);
+        temp = mult (wf1[1], temp);
+        dist = L_mac (dist, temp, temp);
+
+        temp = sub (lsf_r1[2], *p_dico++);
+        temp = mult (wf1[2], temp);
+        dist = L_mac (dist, temp, temp);
+
+        temp = sub (lsf_r1[3], *p_dico++);
+        temp = mult (wf1[3], temp);
+        dist = L_mac (dist, temp, temp);
+
+
+        if (L_sub (dist, dist_min) < (Word32) 0)
+        {
+            dist_min = dist;
+            index = i;
+        }
+    }
+
+    // Reading the selected vector
+
+    p_dico = &dico[shl (index, 2)];
+    lsf_r1[0] = *p_dico++;
+    lsf_r1[1] = *p_dico++;
+    lsf_r1[2] = *p_dico++;
+    lsf_r1[3] = *p_dico;
+
+    return index;
+
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 Vq_subvec4( /* o: quantization index,            Q0  */
+    Word16 * lsf_r1,      /* i: 1st LSF residual vector,       Q15 */
+    const Word16 * dico,  /* i: quantization codebook,         Q15 */
+    Word16 * wf1,         /* i: 1st LSF weighting factors,     Q13 */
+    Word16 dico_size,     /* i: size of quantization codebook, Q0  */
+    Flag  *pOverflow      /* o : Flag set when overflow occurs     */
+)
+{
+    register Word16 i;
+    Word16 temp;
+    const Word16 *p_dico;
+    Word16 index = 0;
+    Word32 dist_min;
+    Word32 dist;
+
+    Word16 lsf_r1_0;
+    Word16 lsf_r1_1;
+    Word16 lsf_r1_2;
+    Word16 lsf_r1_3;
+
+    Word16 wf1_0;
+    Word16 wf1_1;
+    Word16 wf1_2;
+    Word16 wf1_3;
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    dist_min = MAX_32;
+    p_dico = dico;
+
+    lsf_r1_0 = lsf_r1[0];
+    lsf_r1_1 = lsf_r1[1];
+    lsf_r1_2 = lsf_r1[2];
+    lsf_r1_3 = lsf_r1[3];
+
+    wf1_0 = wf1[0];
+    wf1_1 = wf1[1];
+    wf1_2 = wf1[2];
+    wf1_3 = wf1[3];
+
+    for (i = 0; i < dico_size; i++)
+    {
+        temp = lsf_r1_0 - (*p_dico++);
+        temp = (Word16)((((Word32) wf1_0) * temp) >> 15);
+        dist = ((Word32) temp) * temp;
+
+        temp = lsf_r1_1 - (*p_dico++);
+        temp = (Word16)((((Word32) wf1_1) * temp) >> 15);
+        dist += ((Word32) temp) * temp;
+
+        temp = lsf_r1_2 - (*p_dico++);
+        temp = (Word16)((((Word32) wf1_2) * temp) >> 15);
+        dist += ((Word32) temp) * temp;
+
+        temp = lsf_r1_3 - (*p_dico++);
+        temp = (Word16)((((Word32) wf1_3) * temp) >> 15);
+        dist += ((Word32) temp) * temp;
+
+        if (dist < dist_min)
+        {
+            dist_min = dist;
+            index = i;
+        }
+    }
+
+    /* Reading the selected vector */
+
+    p_dico = dico + (index << 2);
+    *lsf_r1++ = *p_dico++;
+    *lsf_r1++ = *p_dico++;
+    *lsf_r1++ = *p_dico++;
+    *lsf_r1 = *p_dico;
+
+    return(index);
+
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Test_Vq_subvec4
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsf_r1 = pointer to the first LSF residual vector (Q15) (Word16)
+    dico = pointer to the quantization codebook (Q15) (const Word16)
+    wf1 = pointer to the first LSF weighting factor (Q13) (Word16)
+    dico_size = size of quantization codebook (Q0) (Word16)
+
+ Outputs:
+    buffer pointed to by lsf_r1 contains the selected vector
+    pOverflow -- pointer to Flag -- Flag set when overflow occurs
+
+ Returns:
+    index = quantization index (Q0) (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calls the static function Vq_subvec4. It is used for testing
+ purposes only
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+ CALL Vq_subvec4(lsf_r1 = lsf_r1
+                 dico = dico
+                 wf1 = wf1
+                 dico_size = dico_size)
+   MODIFYING(nothing)
+   RETURNING(index = tst_index4)
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Test_Vq_subvec4(
+    Word16 * lsf_r1,
+    const Word16 * dico,
+    Word16 * wf1,
+    Word16 dico_size,
+    Flag   *pOverflow)
+{
+    Word16  tst_index4 = 0;
+
+    /*------------------------------------------------------------------------
+     CALL Vq_subvec4(lsf_r1 = lsf_r1
+                     dico = dico
+                     wf1 = wf1
+                     dico_size = dico_size)
+       MODIFYING(nothing)
+       RETURNING(index = index)
+    ------------------------------------------------------------------------*/
+    tst_index4 =
+        Vq_subvec4(
+            lsf_r1,
+            dico,
+            wf1,
+            dico_size,
+            pOverflow);
+
+    return(tst_index4);
+
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Vq_subvec3
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsf_r1 = pointer to the first LSF residual vector (Q15) (Word16)
+    dico = pointer to the quantization codebook (Q15) (const Word16)
+    wf1 = pointer to the first LSF weighting factor (Q13) (Word16)
+    dico_size = size of quantization codebook (Q0) (Word16)
+    use_half = flag to indicate use of every second entry in the
+               codebook (Flag)
+
+ Outputs:
+    buffer pointed to by lsf_r1 contains the selected vector
+    pOverflow -- pointer to Flag -- Flag set when overflow occurs
+
+ Returns:
+    index = quantization index (Q0) (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the quantization of a 3 dimensional subvector.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ q_plsf_3.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static Word16
+Vq_subvec3(             // o: quantization index,            Q0
+    Word16 * lsf_r1,    // i: 1st LSF residual vector,       Q15
+    Word16 * dico,      // i: quantization codebook,         Q15
+    Word16 * wf1,       // i: 1st LSF weighting factors,     Q13
+    Word16 dico_size,   // i: size of quantization codebook, Q0
+    Flag use_half)      // i: use every second entry in codebook
+{
+    Word16 i, index = 0;
+    Word16 *p_dico, temp;
+    Word32 dist_min, dist;
+
+    dist_min = MAX_32;
+    p_dico = dico;
+
+    if (use_half == 0) {
+       for (i = 0; i < dico_size; i++)
+       {
+          temp = sub(lsf_r1[0], *p_dico++);
+          temp = mult(wf1[0], temp);
+          dist = L_mult(temp, temp);
+
+          temp = sub(lsf_r1[1], *p_dico++);
+          temp = mult(wf1[1], temp);
+          dist = L_mac(dist, temp, temp);
+
+          temp = sub(lsf_r1[2], *p_dico++);
+          temp = mult(wf1[2], temp);
+          dist = L_mac(dist, temp, temp);
+
+          if (L_sub(dist, dist_min) < (Word32) 0) {
+             dist_min = dist;
+             index = i;
+          }
+       }
+       p_dico = &dico[add(index, add(index, index))];
+    }
+    else
+    {
+       for (i = 0; i < dico_size; i++)
+       {
+          temp = sub(lsf_r1[0], *p_dico++);
+          temp = mult(wf1[0], temp);
+          dist = L_mult(temp, temp);
+
+          temp = sub(lsf_r1[1], *p_dico++);
+          temp = mult(wf1[1], temp);
+          dist = L_mac(dist, temp, temp);
+
+          temp = sub(lsf_r1[2], *p_dico++);
+          temp = mult(wf1[2], temp);
+          dist = L_mac(dist, temp, temp);
+
+          if (L_sub(dist, dist_min) < (Word32) 0)
+          {
+             dist_min = dist;
+             index = i;
+          }
+          p_dico = p_dico + 3; add(0,0);
+       }
+       p_dico = &dico[shl(add(index, add(index, index)),1)];
+    }
+
+
+    // Reading the selected vector
+    lsf_r1[0] = *p_dico++;
+    lsf_r1[1] = *p_dico++;
+    lsf_r1[2] = *p_dico++;
+
+    return index;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 Vq_subvec3( /* o: quantization index,            Q0  */
+    Word16 * lsf_r1,      /* i: 1st LSF residual vector,       Q15 */
+    const Word16 * dico,  /* i: quantization codebook,         Q15 */
+    Word16 * wf1,         /* i: 1st LSF weighting factors,     Q13 */
+    Word16 dico_size,     /* i: size of quantization codebook, Q0  */
+    Flag use_half,        /* i: use every second entry in codebook */
+    Flag  *pOverflow)     /* o : Flag set when overflow occurs     */
+{
+    register Word16 i;
+    Word16 temp;
+
+    const Word16 *p_dico;
+
+    Word16 p_dico_index = 0;
+    Word16 index = 0;
+
+    Word32 dist_min;
+    Word32 dist;
+
+    Word16 lsf_r1_0;
+    Word16 lsf_r1_1;
+    Word16 lsf_r1_2;
+
+    Word16 wf1_0;
+    Word16 wf1_1;
+    Word16 wf1_2;
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    dist_min = MAX_32;
+    p_dico = dico;
+
+    lsf_r1_0 = lsf_r1[0];
+    lsf_r1_1 = lsf_r1[1];
+    lsf_r1_2 = lsf_r1[2];
+
+    wf1_0 = wf1[0];
+    wf1_1 = wf1[1];
+    wf1_2 = wf1[2];
+
+    if (use_half != 0)
+    {
+        p_dico_index = 3;
+    }
+
+    for (i = 0; i < dico_size; i++)
+    {
+        temp = lsf_r1_0 - (*p_dico++);
+        temp = (Word16)((((Word32) wf1_0) * temp) >> 15);
+        dist = ((Word32) temp) * temp;
+
+        temp = lsf_r1_1 - (*p_dico++);
+        temp = (Word16)((((Word32) wf1_1) * temp) >> 15);
+        dist += ((Word32) temp) * temp;
+
+        temp = lsf_r1_2 - (*p_dico++);
+        temp = (Word16)((((Word32) wf1_2) * temp) >> 15);
+        dist += ((Word32) temp) * temp;
+
+        if (dist < dist_min)
+        {
+            dist_min = dist;
+            index = i;
+        }
+
+        p_dico = p_dico + p_dico_index;
+    }
+
+    p_dico = dico + (3 * index);
+
+    if (use_half != 0)
+    {
+        p_dico += (3 * index);
+    }
+
+    /* Reading the selected vector */
+    *lsf_r1++ = *p_dico++;
+    *lsf_r1++ = *p_dico++;
+    *lsf_r1 = *p_dico;
+
+    return(index);
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Test_Vq_subvec3
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsf_r1 = pointer to the first LSF residual vector (Q15) (Word16)
+    dico = pointer to the quantization codebook (Q15) (const Word16)
+    wf1 = pointer to the first LSF weighting factor (Q13) (Word16)
+    dico_size = size of quantization codebook (Q0) (Word16)
+    use_half = flag to indicate use of every second entry in the
+               codebook (Flag)
+
+ Outputs:
+    buffer pointed to by lsf_r1 contains the selected vector
+    pOverflow -- pointer to Flag -- Flag set when overflow occurs
+
+ Returns:
+    index = quantization index (Q0) (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calls the static function Vq_subvec3. It is used for testing
+ purposes only
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ CALL Vq_subvec3(lsf_r1 = lsf_r1
+                 dico = dico
+                 wf1 = wf1
+                 dico_size = dico_size
+                 use_half = use_half)
+   MODIFYING(nothing)
+   RETURNING(index = tst_index3)
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Test_Vq_subvec3(
+    Word16 * lsf_r1,
+    const Word16 * dico,
+    Word16 * wf1,
+    Word16 dico_size,
+    Flag use_half,
+    Flag *pOverflow)
+{
+    Word16  tst_index3 = 0;
+
+    /*------------------------------------------------------------------------
+     CALL Vq_subvec3(lsf_r1 = lsf_r1
+                     dico = dico
+                     wf1 = wf1
+                     dico_size = dico_size
+                     use_half = use_half)
+       MODIFYING(nothing)
+       RETURNING(index = index)
+    ------------------------------------------------------------------------*/
+    tst_index3 =
+        Vq_subvec3(
+            lsf_r1,
+            dico,
+            wf1,
+            dico_size,
+            use_half,
+            pOverflow);
+
+    return(tst_index3);
+
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Q_plsf_3
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to structures of type Q_plsfState (Q_plsfState)
+    mode = coder mode (enum)
+    lsp1 = pointer to the first LSP vector (Word16)
+    lsp1_q = pointer to the quantized first LSP vector (Word16)
+    indice = pointer to the quantization indices of 3 vectors (Word16)
+    pred_init_i = pointer to the index of the initial value for
+                  MA prediction in DTX mode (Word16)
+
+ Outputs:
+    lsp1_q points to a vector containing the new quantized LSPs
+    indice points to the new quantization indices of 3 vectors
+    pred_init_i points to the new initial index for MA prediction
+      in DTX mode
+    past_rq field of structure pointed to by st contains the current
+      quantized LSF parameters
+    pOverflow -- pointer to Flag -- Flag set when overflow occurs
+
+ Returns:
+    None
+
+ Global Variables Used:
+    pred_fac = table containing prediction factors (const Word16)
+    dico1_lsf = quantization table for split_MQ of 2 sets of LSFs
+                in a 20 ms frame (const Word16)
+    dico2_lsf = quantization table for split_MQ of 2 sets of LSFs
+                in a 20 ms frame (const Word16)
+    dico3_lsf = quantization table for split_MQ of 2 sets of LSFs
+                in a 20 ms frame (const Word16)
+    mr515_3_lsf = third codebook for MR475 and MR515 modes (const Word16)
+    mr795_1_lsf = first codebook for MR795 mode (const Word16)
+    mean_lsf = table of mean LSFs (const Word16)
+    past_rq_init = initalization table for MA predictor in DTX mode
+                   (const Word16)
+
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs quantization of LSF parameters with 1st order MA
+ prediction and split by 3 vector quantization (split-VQ)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ q_plsf_3.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Q_plsf_3(
+    Q_plsfState *st,    // i/o: state struct
+    enum Mode mode,     // i  : coder mode
+    Word16 *lsp1,       // i  : 1st LSP vector                      Q15
+    Word16 *lsp1_q,     // o  : quantized 1st LSP vector            Q15
+    Word16 *indice,     // o  : quantization indices of 3 vectors   Q0
+    Word16 *pred_init_i // o  : init index for MA prediction in DTX mode
+)
+{
+    Word16 i, j;
+    Word16 lsf1[M], wf1[M], lsf_p[M], lsf_r1[M];
+    Word16 lsf1_q[M];
+
+    Word32 L_pred_init_err;
+    Word32 L_min_pred_init_err;
+    Word16 temp_r1[M];
+    Word16 temp_p[M];
+
+    // convert LSFs to normalize frequency domain 0..16384
+
+    Lsp_lsf(lsp1, lsf1, M);
+
+    // compute LSF weighting factors (Q13)
+
+    Lsf_wt(lsf1, wf1);
+
+    // Compute predicted LSF and prediction error
+    if (test(), sub(mode, MRDTX) != 0)
+    {
+       for (i = 0; i < M; i++)
+       {
+          lsf_p[i] = add(mean_lsf[i],
+                         mult(st->past_rq[i],
+                              pred_fac[i]));
+          lsf_r1[i] = sub(lsf1[i], lsf_p[i]);
+      }
+    }
+    else
+    {
+       // DTX mode, search the init vector that yields
+       // lowest prediction resuidual energy
+       *pred_init_i = 0;
+       L_min_pred_init_err = 0x7fffffff; // 2^31 - 1
+       for (j = 0; j < PAST_RQ_INIT_SIZE; j++)
+       {
+          L_pred_init_err = 0;
+          for (i = 0; i < M; i++)
+          {
+             temp_p[i] = add(mean_lsf[i], past_rq_init[j*M+i]);
+             temp_r1[i] = sub(lsf1[i],temp_p[i]);
+             L_pred_init_err = L_mac(L_pred_init_err, temp_r1[i], temp_r1[i]);
+          }  // next i
+
+
+          if (L_sub(L_pred_init_err, L_min_pred_init_err) < (Word32) 0)
+          {
+             L_min_pred_init_err = L_pred_init_err;
+             Copy(temp_r1, lsf_r1, M);
+             Copy(temp_p, lsf_p, M);
+             // Set zerom
+             Copy(&past_rq_init[j*M], st->past_rq, M);
+             *pred_init_i = j;
+          } // endif
+       } // next j
+    } // endif MRDTX
+
+    //---- Split-VQ of prediction error ----
+    if (sub (mode, MR475) == 0 || sub (mode, MR515) == 0)
+    {   // MR475, MR515
+
+
+      indice[0] = Vq_subvec3(&lsf_r1[0], dico1_lsf, &wf1[0], DICO1_SIZE, 0);
+
+      indice[1] = Vq_subvec3(&lsf_r1[3], dico2_lsf, &wf1[3], DICO2_SIZE/2, 1);
+
+      indice[2] = Vq_subvec4(&lsf_r1[6], mr515_3_lsf, &wf1[6], MR515_3_SIZE);
+
+    }
+    else if (sub (mode, MR795) == 0)
+    {   // MR795
+
+
+      indice[0] = Vq_subvec3(&lsf_r1[0], mr795_1_lsf, &wf1[0], MR795_1_SIZE, 0);
+
+      indice[1] = Vq_subvec3(&lsf_r1[3], dico2_lsf, &wf1[3], DICO2_SIZE, 0);
+
+      indice[2] = Vq_subvec4(&lsf_r1[6], dico3_lsf, &wf1[6], DICO3_SIZE);
+
+    }
+    else
+    {   // MR59, MR67, MR74, MR102 , MRDTX
+
+
+      indice[0] = Vq_subvec3(&lsf_r1[0], dico1_lsf, &wf1[0], DICO1_SIZE, 0);
+
+      indice[1] = Vq_subvec3(&lsf_r1[3], dico2_lsf, &wf1[3], DICO2_SIZE, 0);
+
+      indice[2] = Vq_subvec4(&lsf_r1[6], dico3_lsf, &wf1[6], DICO3_SIZE);
+
+    }
+
+
+    // Compute quantized LSFs and update the past quantized residual
+
+    for (i = 0; i < M; i++)
+    {
+        lsf1_q[i] = add(lsf_r1[i], lsf_p[i]);
+        st->past_rq[i] = lsf_r1[i];
+    }
+
+    // verification that LSFs has mimimum distance of LSF_GAP Hz
+
+    Reorder_lsf(lsf1_q, LSF_GAP, M);
+
+    //  convert LSFs to the cosine domain
+
+    Lsf_lsp(lsf1_q, lsp1_q, M);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Q_plsf_3(
+    Q_plsfState *st,    /* i/o: state struct                             */
+    enum Mode mode,     /* i  : coder mode                               */
+    Word16 *lsp1,       /* i  : 1st LSP vector                      Q15  */
+    Word16 *lsp1_q,     /* o  : quantized 1st LSP vector            Q15  */
+    Word16 *indice,     /* o  : quantization indices of 3 vectors   Q0   */
+    Word16 *pred_init_i,/* o  : init index for MA prediction in DTX mode */
+    Flag  *pOverflow    /* o : Flag set when overflow occurs             */
+)
+{
+    register Word16 i, j;
+    Word16 lsf1[M];
+    Word16 wf1[M];
+    Word16 lsf_p[M];
+    Word16 lsf_r1[M];
+    Word16 lsf1_q[M];
+
+    Word32 L_pred_init_err;
+    Word32 L_min_pred_init_err;
+    Word32 L_temp;
+    Word16 temp_r1[M];
+    Word16 temp_p[M];
+    Word16 temp;
+
+    /* convert LSFs to normalize frequency domain 0..16384 */
+
+    Lsp_lsf(
+        lsp1,
+        lsf1,
+        M,
+        pOverflow);
+
+    /* compute LSF weighting factors (Q13) */
+
+    Lsf_wt(
+        lsf1,
+        wf1,
+        pOverflow);
+
+    /* Compute predicted LSF and prediction error */
+    if (mode != MRDTX)
+    {
+        for (i = 0; i < M; i++)
+        {
+            temp = (Word16)((((Word32) st->past_rq[i]) *
+                             (*(pred_fac_3 + i))) >> 15);
+
+            *(lsf_p + i) = *(mean_lsf_3 + i) + temp;
+
+            *(lsf_r1 + i) = *(lsf1 + i) - *(lsf_p + i);
+        }
+    }
+    else
+    {
+        /* DTX mode, search the init vector that yields */
+        /* lowest prediction resuidual energy           */
+        *pred_init_i = 0;
+        L_min_pred_init_err = 0x7fffffff; /* 2^31 - 1 */
+
+        for (j = 0; j < PAST_RQ_INIT_SIZE; j++)
+        {
+            L_pred_init_err = 0;
+            for (i = 0; i < M; i++)
+            {
+                *(temp_p + i) = *(mean_lsf_3 + i) + *(past_rq_init + j * M + i);
+
+                *(temp_r1 + i) = *(lsf1 + i) - *(temp_p + i);
+
+                L_temp = ((Word32) * (temp_r1 + i)) * *(temp_r1 + i);
+
+                L_pred_init_err = L_pred_init_err + (L_temp << 1);
+
+            }  /* next i */
+
+
+            if (L_pred_init_err < L_min_pred_init_err)
+            {
+                L_min_pred_init_err = L_pred_init_err;
+
+                oscl_memcpy(
+                    lsf_r1,
+                    temp_r1,
+                    M*sizeof(Word16));
+
+                oscl_memcpy(
+                    lsf_p,
+                    temp_p,
+                    M*sizeof(Word16));
+
+                /* Set zerom */
+                oscl_memcpy(
+                    st->past_rq,
+                    &past_rq_init[j*M],
+                    M*sizeof(Word16));
+
+                *pred_init_i = j;
+
+            } /* endif */
+        } /* next j */
+    } /* endif MRDTX */
+
+    /*---- Split-VQ of prediction error ----*/
+    if ((mode == MR475) || (mode == MR515))
+    {   /* MR475, MR515 */
+
+        *indice =
+            Vq_subvec3(
+                lsf_r1,
+                dico1_lsf_3,
+                wf1,
+                DICO1_SIZE,
+                0,
+                pOverflow);
+
+        *(indice + 1) =
+            Vq_subvec3(
+                lsf_r1 + 3,
+                dico2_lsf_3,
+                wf1 + 3,
+                DICO2_SIZE / 2,
+                1,
+                pOverflow);
+
+        *(indice + 2) =
+            Vq_subvec4(
+                lsf_r1 + 6,
+                mr515_3_lsf,
+                wf1 + 6,
+                MR515_3_SIZE,
+                pOverflow);
+
+    }
+    else if (mode == MR795)
+    {   /* MR795 */
+
+        *indice =
+            Vq_subvec3(
+                lsf_r1,
+                mr795_1_lsf,
+                wf1,
+                MR795_1_SIZE,
+                0,
+                pOverflow);
+
+        *(indice + 1) =
+            Vq_subvec3(
+                lsf_r1 + 3,
+                dico2_lsf_3,
+                wf1 + 3,
+                DICO2_SIZE,
+                0,
+                pOverflow);
+
+        *(indice + 2) =
+            Vq_subvec4(
+                lsf_r1 + 6,
+                dico3_lsf_3,
+                wf1 + 6,
+                DICO3_SIZE,
+                pOverflow);
+
+    }
+    else
+    {   /* MR59, MR67, MR74, MR102 , MRDTX */
+
+        *indice =
+            Vq_subvec3(
+                lsf_r1,
+                dico1_lsf_3,
+                wf1,
+                DICO1_SIZE,
+                0,
+                pOverflow);
+
+        *(indice + 1) =
+            Vq_subvec3(
+                lsf_r1 + 3,
+                dico2_lsf_3,
+                wf1 + 3,
+                DICO2_SIZE,
+                0,
+                pOverflow);
+
+        *(indice + 2) =
+            Vq_subvec4(
+                lsf_r1 + 6,
+                dico3_lsf_3,
+                wf1 + 6,
+                DICO3_SIZE,
+                pOverflow);
+
+    }
+
+
+    /* Compute quantized LSFs and update the past quantized residual */
+
+    for (i = 0; i < M; i++)
+    {
+        *(lsf1_q + i) = *(lsf_r1 + i) + *(lsf_p + i);
+        st->past_rq[i] = *(lsf_r1 + i);
+    }
+
+    /* verification that LSFs has mimimum distance of LSF_GAP Hz */
+
+    Reorder_lsf(
+        lsf1_q,
+        LSF_GAP,
+        M,
+        pOverflow);
+
+    /*  convert LSFs to the cosine domain */
+
+    Lsf_lsp(
+        lsf1_q,
+        lsp1_q,
+        M,
+        pOverflow);
+
+    return;
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3_tbl.cpp
new file mode 100644 (file)
index 0000000..8714fcd
--- /dev/null
@@ -0,0 +1,2083 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: q_plsf_3_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "q_plsf_3_tbl.h"
+
+/*--------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : q_plsf_3.tab
+*      Purpose          : Table for routine LSF VQ.
+*      $Id $
+*
+********************************************************************************
+*/
+
+
+/* initalization table for MA predictor in dtx mode */
+const Word16 past_rq_init[80] =
+{
+    -258, -318, -439, -634, -656, -773, -711, -502, -268, -193,
+    -2,  125,  122,  -39,   -9,  105,  129,  283,  372,  575,
+    -277, -324, -197, -487, -445, -362, -292,  -27,  177,  543,
+    342,  517,  516,  130,   27, -104, -120, -140,  -74,  -56,
+    -564, -943, -1520, -965, -814, -526, -322,   -2,  159,  657,
+    -312, -284, -386, -597, -493, -526, -418, -229,  105,  449,
+    -557, -870, -1075, -919, -950, -752, -709, -316,   62,  486,
+    -314, -191, -203, -330, -160, -103,  -51,  131,  338,  515
+};
+
+
+const Word16 mean_lsf_3[10] =
+{
+    1546,
+    2272,
+    3778,
+    5488,
+    6972,
+    8382,
+    10047,
+    11229,
+    12766,
+    13714
+};
+
+
+const Word16 pred_fac_3[10] =
+{
+    9556,
+    10769,
+    12571,
+    13292,
+    14381,
+    11651,
+    10588,
+    9767,
+    8593,
+    6484
+};
+
+
+
+/* first codebook from IS641 */
+
+const Word16 dico1_lsf_3[DICO1_SIZE*3] =
+{
+    6, 82, -131,
+    154, -56, -735,
+    183, -65, -265,
+    9, -210, -361,
+    113, 718, 1817,
+    1010, 1214, 1573,
+    857, 1333, 2276,
+    827, 1568, 1933,
+    717, 1989, 2206,
+    838, 1172, 1823,
+    721, 1000, 2154,
+    286, 476, 1509,
+    -247, -531, 230,
+    147, -82, 569,
+    26, -177, -944,
+    -27, -273, 692,
+    -164, -264, -183,
+    224, 790, 1039,
+    899, 946, 601,
+    485, 771, 1150,
+    524, 677, 903,
+    -140, 375, 778,
+    410, 676, 429,
+    301, 530, 1009,
+    719, 646, 38,
+    226, 367, 40,
+    145, -45, -505,
+    290, 121, -121,
+    302, 127, 166,
+    -124, -383, -956,
+    -358, -455, -977,
+    715, 878, 894,
+    978, 923, 211,
+    477, 272, 64,
+    188, -78, 17,
+    -143, -65, 38,
+    643, 586, 621,
+    -134, -426, -651,
+    347, 545, 2820,
+    1188, 2726, 2442,
+    142, -80, 1735,
+    283, 130, 461,
+    -262, -399, -1145,
+    -411, 155, 430,
+    329, 375, 779,
+    53, -226, -139,
+    -129, -236, 1682,
+    285, 744, 1327,
+    738, 697, 1664,
+    312, 409, 266,
+    325, 720, 135,
+    1, 221, 453,
+    8, 203, 145,
+    299, 640, 760,
+    29, 468, 638,
+    103, 429, 379,
+    420, 954, 932,
+    1326, 1210, 1258,
+    704, 1012, 1152,
+    -166, -444, -266,
+    -316, -130, -376,
+    191, 1151, 1904,
+    -240, -543, -1260,
+    -112, 268, 1207,
+    70, 1062, 1583,
+    278, 1360, 1574,
+    -258, -272, -768,
+    19, 563, 2240,
+    -3, -265, 135,
+    -295, -591, -388,
+    140, 354, -206,
+    -260, -504, -795,
+    -433, -718, -1319,
+    109, 331, 962,
+    -429, -87, 652,
+    -296, 426, 1019,
+    -239, 775, 851,
+    489, 1334, 1073,
+    -334, -332, 25,
+    543, 1206, 1807,
+    326, 61, 727,
+    578, 849, 1405,
+    -208, -277, 329,
+    -152, 64, 669,
+    -434, -678, -727,
+    -454, -71, 251,
+    605, 480, 254,
+    -482, 11, 996,
+    -289, 395, 486,
+    722, 1049, 1440,
+    -30, -316, -786,
+    -106, -115, -619,
+    861, 1474, 1412,
+    1055, 1366, 1184,
+    812, 1237, 925,
+    42, -251, -576,
+    342, 141, -454,
+    -168, -80, 1359,
+    -342, -656, -1763,
+    100, 821, 725,
+    990, 747, 800,
+    332, 440, 568,
+    663, 379, 852,
+    112, 165, -369,
+    597, 910, 282,
+    -8, 834, 1281,
+    -352, 572, 695,
+    462, 2246, 1806,
+    345, 190, 1374,
+    416, 915, 2166,
+    168, -82, 280,
+    -516, -446, 840,
+    47, 533, 44,
+    -362, -711, -1143,
+    22, 193, 1472,
+    -85, 233, 1813,
+    -62, 579, 1504,
+    550, 944, 1749,
+    723, 650, 1148,
+    972, 884, 1395,
+    -425, 643, 0,
+    1000, 952, 1098,
+    249, 1446, 672,
+    -334, -87, 2172,
+    -554, 1882, 2672,
+    140, 1826, 1853,
+    920, 1749, 2590,
+    1076, 1933, 2038,
+    -137, -443, -1555,
+    1269, 1174, 468,
+    -493, -122, 1521,
+    -451, 1033, 1214,
+    482, 1695, 1118,
+    815, 649, 384,
+    -446, -692, 107,
+    -319, -605, -118,
+    -207, -505, 525,
+    -468, -12, 2736,
+    75, 1934, 1305,
+    880, 2358, 2267,
+    1285, 1575, 2004,
+    -48, -304, -1186,
+    -435, -461, -251,
+    -366, -404, -547,
+    -289, -605, -597,
+    -538, -810, -165,
+    -120, 3, 356,
+    639, 1241, 1502,
+    96, 177, 750,
+    -435, -585, -1174,
+    -356, 109, -79,
+    -485, 288, 2005,
+    9, 1116, 731,
+    880, 2134, 946,
+    -265, 1585, 1065,
+    1157, 1210, 843,
+    -498, -668, 431,
+    374, 321, -229,
+    1440, 2101, 1381,
+    449, 461, 1155,
+    -105, 39, -384,
+    -263, 367, 182,
+    -371, -660, 773,
+    -188, 1151, 971,
+    1333, 1632, 1435,
+    774, 1267, 1221,
+    -482, -832, -1489,
+    -237, -210, 860,
+    890, 1615, 1064,
+    472, 1062, 1192,
+    185, 1077, 989,
+    -568, -992, -1704,
+    -449, -902, -2043,
+    -142, -377, -458,
+    -210, -554, -1029,
+    -11, 1133, 2265,
+    -329, -675, -893,
+    -250, 657, 1187,
+    519, 1510, 1779,
+    520, 539, 1403,
+    527, 1421, 1302,
+    -563, -871, -1248,
+    -147, -463, 879,
+    -76, 2334, 2840,
+    563, 2573, 2385,
+    632, 1926, 2920,
+    719, 2023, 1840,
+    -545, -723, 1108,
+    129, -125, 884,
+    1417, 1632, 925,
+    -94, 1566, 1751,
+    -341, 1533, 1551,
+    591, 395, -274,
+    -76, 981, 2831,
+    153, 2985, 1844,
+    1032, 2565, 2749,
+    1508, 2832, 1879,
+    791, 1199, 538,
+    -190, -453, 1489,
+    -278, -548, 1158,
+    -245, 1941, 2044,
+    1024, 1560, 1650,
+    512, 253, 466,
+    -62, -323, 1151,
+    -473, -376, 507,
+    -433, 1380, 2162,
+    899, 1943, 1445,
+    134, 704, 440,
+    460, 525, -28,
+    -450, 279, 1338,
+    0, 971, 252,
+    -445, -627, -991,
+    -348, -602, -1424,
+    398, 712, 1656,
+    -107, 314, -178,
+    93, 2226, 2238,
+    518, 849, 656,
+    -462, -711, -447,
+    174, -34, 1191,
+    -119, 42, 1005,
+    -372, 274, 758,
+    1036, 2352, 1838,
+    675, 1724, 1498,
+    430, 1286, 2133,
+    -129, -439, 0,
+    -373, 800, 2144,
+    6, 1587, 2478,
+    478, 596, 2128,
+    -428, -736, 1505,
+    385, 178, 980,
+    139, 449, 1225,
+    -526, -842, -982,
+    145, 1554, 1242,
+    623, 1448, 656,
+    349, 1016, 1482,
+    31, -280, 415,
+    -316, 724, 1641,
+    360, 1058, 556,
+    -436, -358, 1201,
+    -355, 1123, 1939,
+    401, 1584, 2248,
+    -527, -1012, 355,
+    233, 238, 2233,
+    -550, -897, -639,
+    -365, -501, 1957,
+    389, 1860, 1621,
+    162, 1132, 1264,
+    -237, 1174, 1390,
+    -640, -411, 116,
+    -228, 1694, 2298,
+    1639, 2186, 2267,
+    562, 1273, 2658,
+    323, 338, 1774,
+    578, 1107, 852,
+    22, 594, 934,
+    -143, 718, 446
+};
+
+
+/* second codebook from IS641 */
+
+const Word16 dico2_lsf_3[DICO2_SIZE*3] =
+{
+    50, 71, -9,
+    -338, -698, -1407,
+    102, -138, -820,
+    -310, -469, -1147,
+    414, 67, -267,
+    1060, 814, 1441,
+    1548, 1360, 1272,
+    1754, 1895, 1661,
+    2019, 2133, 1820,
+    1808, 2318, 1845,
+    644, -93, 454,
+    858, 329, -136,
+    489, -258, -128,
+    -198, -745, -41,
+    -52, -265, -985,
+    346, 137, 479,
+    -1741, -748, -684,
+    -1163, -1725, -367,
+    -895, -1145, -784,
+    -488, -946, -968,
+    -85, -390, -725,
+    215, -340, -171,
+    1020, 916, 1969,
+    564, 179, 746,
+    662, 977, 1734,
+    887, 622, 914,
+    939, 856, 1165,
+    309, 688, 803,
+    917, 161, 570,
+    118, -20, -283,
+    -816, -42, 204,
+    -1228, -325, -462,
+    -963, -202, -143,
+    -988, -484, -361,
+    -702, -978, -477,
+    -302, -790, -1188,
+    -100, -786, -1088,
+    -1054, -947, -1684,
+    -202, -843, -782,
+    -1039, -1378, -901,
+    -624, -110, -85,
+    356, 213, -10,
+    -493, 364, 774,
+    425, 822, 479,
+    -83, 557, 520,
+    -992, -1560, -572,
+    -603, -741, -26,
+    -502, -638, -903,
+    209, 306, 147,
+    -316, -593, -596,
+    -85, -211, -225,
+    -918, -529, 117,
+    233, -439, -738,
+    1101, 751, 633,
+    1457, 1716, 1511,
+    1765, 1457, 910,
+    1122, 1156, 849,
+    1354, 868, 470,
+    -871, -1150, -1796,
+    -871, -861, -992,
+    -118, 155, 212,
+    -1051, -849, -606,
+    -1117, -1849, -2750,
+    -1019, -1427, -1869,
+    370, -184, -414,
+    959, 493, 104,
+    958, 1039, 543,
+    154, 653, 201,
+    1249, 507, 150,
+    663, 503, 230,
+    623, 777, 675,
+    659, 88, -110,
+    843, 244, 224,
+    382, 541, 302,
+    724, 433, 666,
+    1166, 734, 341,
+    -138, 20, -397,
+    -1183, -424, -46,
+    -321, -352, -124,
+    1333, 1021, 1080,
+    262, 366, 723,
+    922, 283, -551,
+    31, -636, -611,
+    -689, -697, -415,
+    -952, -779, -201,
+    -1329, -598, -359,
+    -953, -1285, 166,
+    493, 305, 221,
+    846, 703, 610,
+    840, 936, 774,
+    -723, -1324, -1261,
+    -357, -1025, -1388,
+    -1096, -1376, -365,
+    -1416, -1881, -608,
+    -1798, -1727, -674,
+    -545, -1173, -703,
+    678, 786, 148,
+    -123, 696, 1288,
+    644, 350, -10,
+    414, 614, 15,
+    137, 344, -211,
+    -814, -1512, -819,
+    -391, -930, -588,
+    47, -591, -898,
+    -909, -1097, -163,
+    -1272, -1167, -157,
+    -1464, -1525, -389,
+    -1274, -1188, -624,
+    671, 213, 454,
+    124, -274, -525,
+    -729, -496, -152,
+    -1344, 122, 135,
+    -2905, -589, -394,
+    -1728, 441, -50,
+    1476, 904, 787,
+    316, 236, -440,
+    -347, 217, 413,
+    -911, -917, 121,
+    -455, -932, 202,
+    -92, -465, -375,
+    488, 390, 474,
+    876, 729, 316,
+    -1815, -1312, -669,
+    87, 962, 432,
+    563, -249, -1058,
+    250, 285, 1105,
+    1141, 427, 696,
+    -1038, -1664, -1582,
+    -948, 346, 160,
+    -309, -272, -858,
+    670, 624, 1250,
+    -944, -408, -666,
+    -606, -320, -384,
+    -492, 230, 65,
+    334, -50, -16,
+    -16, -690, -1397,
+    1791, 1716, 1399,
+    2478, 2063, 1404,
+    1245, 1471, 1426,
+    -382, -1037, -2,
+    173, -398, 1145,
+    1491, 2024, 1801,
+    772, 1274, 1506,
+    1429, 1735, 2001,
+    1079, 1218, 1273,
+    -1154, -1851, -1329,
+    -808, -1133, -1096,
+    -451, -1033, -1722,
+    65, 578, -84,
+    -1476, -2434, -1778,
+    -765, -1366, -494,
+    -218, -594, -931,
+    337, -236, 562,
+    2357, 2662, 1938,
+    1489, 1276, 874,
+    189, 358, 374,
+    -1519, -2281, -2346,
+    -967, -1271, -2095,
+    -628, -1188, -1542,
+    1661, 1043, 546,
+    565, 1061, 732,
+    -64, -836, -434,
+    -436, -96, 203,
+    1078, 1216, 1636,
+    907, 1534, 986,
+    326, 965, 845,
+    142, -84, 197,
+    470, 2379, 1570,
+    1133, 470, 1214,
+    395, 1376, 1200,
+    1125, 1042, 348,
+    -543, -1234, -376,
+    -215, -181, 481,
+    -1947, -1621, -210,
+    -750, -1185, 390,
+    29, -399, 27,
+    820, 1236, 755,
+    695, 979, 409,
+    -174, 1197, 1035,
+    912, 1356, 1846,
+    -992, -1437, 484,
+    -1485, -1700, 208,
+    -412, 1204, 1432,
+    -271, 896, 1144,
+    -416, 1777, 1434,
+    -1696, -2644, -204,
+    -1789, -1551, 1033,
+    -1656, -1559, 1303,
+    -1253, -1589, 1081,
+    -669, -1095, -66,
+    -682, 320, -345,
+    659, 305, 1069,
+    -1292, -804, -19,
+    -1635, -1291, 29,
+    -1683, -497, 71,
+    -287, -7, -100,
+    -494, -962, -237,
+    852, 1881, 1740,
+    -1217, -1387, 227,
+    -660, 302, 373,
+    96, 1087, 1257,
+    -1074, -1669, 160,
+    485, 2076, 1798,
+    -934, -220, 552,
+    -596, -612, 237,
+    336, 1720, 879,
+    643, 629, 434,
+    1267, 522, 1633,
+    15, 244, -441,
+    1475, 717, 184,
+    1819, 1590, 1709,
+    988, 261, 937,
+    2093, 2345, 1520,
+    2139, 1858, 1606,
+    -577, -579, -1203,
+    -956, 135, -488,
+    -464, 51, -338,
+    -629, -348, -723,
+    1146, 2073, 1442,
+    2192, 1466, 911,
+    -1444, -1572, -2278,
+    1400, 710, 1297,
+    1335, 633, 928,
+    1434, 2194, 2594,
+    2422, 2204, 1881,
+    982, 2242, 1854,
+    380, 792, 1145,
+    -63, -539, 414,
+    -252, -964, -314,
+    -1261, -683, -780,
+    -831, -526, -1005,
+    -1666, -1135, -424,
+    -1611, -452, -299,
+    1268, 1048, 642,
+    1147, 853, 856,
+    -675, -336, 139,
+    2268, 1343, 1418,
+    29, 768, 797,
+    -1224, 423, 564,
+    -1318, -1082, 245,
+    -1302, -812, 573,
+    -1298, -1617, 646,
+    -968, 834, 723,
+    993, 1652, 2027,
+    -191, -817, 432,
+    662, 60, 198,
+    626, 997, 1330,
+    1648, 1963, 1289,
+    -1597, -93, -45,
+    -1088, 37, -84,
+    1653, 2607, 2337,
+    1065, 2040, 2377,
+    1139, 2326, 2118,
+    859, 357, 1510,
+    664, 1227, 1099,
+    479, 1360, 912,
+    1897, 1754, 2019,
+    1168, 1909, 1784,
+    399, 34, 256,
+    -593, -304, -1053,
+    547, 1694, 1407,
+    647, -99, -341,
+    1492, 1647, 1190,
+    38, -644, -212,
+    395, 846, 222,
+    -704, -765, -716,
+    -724, -1964, -2804,
+    -150, 291, -82,
+    1233, 1459, 1007,
+    -140, -155, 153,
+    439, 297, 1568,
+    -1529, -410, -636,
+    1536, 455, -237,
+    -1328, -139, -260,
+    531, 554, 868,
+    269, 1264, 606,
+    -233, 883, 463,
+    742, 600, -120,
+    -73, 421, 212,
+    -439, -58, 804,
+    -1286, -1241, 728,
+    294, -490, 50,
+    -591, -905, -1254,
+    42, -687, 147,
+    -25, 273, 596,
+    -311, 1213, 601,
+    -754, 849, 584,
+    429, 607, 587,
+    -602, -166, 461,
+    -796, -823, 777,
+    1380, 910, 1755,
+    119, 1417, 972,
+    -219, -880, -1596,
+    -1049, -1010, 438,
+    -713, -1379, 78,
+    0, -447, -1179,
+    -1136, -1319, -1573,
+    2248, 1767, 1309,
+    946, 1583, 1432,
+    1150, 482, 436,
+    -469, -1108, 618,
+    -447, -966, 1088,
+    -1252, -1515, -114,
+    -1104, -2008, -579,
+    210, 613, 497,
+    -1975, -1437, 642,
+    -1269, -856, 1011,
+    -1646, -1185, 1063,
+    -1555, -672, 1204,
+    -1692, -1114, 623,
+    -979, -1326, -1277,
+    539, -147, 894,
+    -1354, -897, -434,
+    888, 475, 428,
+    153, -384, 338,
+    -1492, -511, 359,
+    -974, -1115, -470,
+    105, -550, 677,
+    -937, -1145, 877,
+    380, -260, 210,
+    1685, 924, 1256,
+    1775, 1190, 1095,
+    1419, 631, 533,
+    627, 299, -347,
+    -411, -534, 647,
+    -650, 29, -595,
+    -378, -1367, 1563,
+    1402, 1121, 1465,
+    1089, 1410, 648,
+    -2096, -1090, -6,
+    311, -194, -869,
+    -639, -831, 416,
+    -1162, -1224, 1349,
+    -1247, -941, 1813,
+    -2193, -1987, 453,
+    -619, -1367, -956,
+    -1606, -1972, -1507,
+    -1175, -1057, -1104,
+    -377, 601, 201,
+    1876, 825, 374,
+    -430, -1323, 29,
+    -1397, -1249, -1331,
+    -1007, -1504, 960,
+    -1401, -2009, 197,
+    -1379, -1949, -236,
+    -1077, 123, 422,
+    615, 1269, 546,
+    -306, 1526, 904,
+    1194, 1788, 1177,
+    -626, -884, -1526,
+    199, 766, 1504,
+    -1065, 862, 197,
+    -1034, -1773, -887,
+    -800, 145, 599,
+    -1134, -519, 626,
+    -1205, -1926, 500,
+    -910, -1041, -1395,
+    -1476, -1567, -969,
+    -523, 842, 34,
+    1794, 646, 862,
+    -1207, -1888, -1002,
+    -78, -9, -672,
+    1044, 759, 80,
+    -600, 1139, 1019,
+    57, 2000, 1422,
+    -833, 1414, 1121,
+    -1202, 1630, 1260,
+    -461, 1420, 1244,
+    1537, 975, 253,
+    -283, 324, -359,
+    599, -195, 106,
+    588, 62, -587,
+    -757, 645, 205,
+    51, 1201, 758,
+    -1209, 673, -390,
+    -624, 1581, 941,
+    -151, 1023, 735,
+    2820, 1301, 690,
+    -302, 524, -99,
+    -900, -1588, -1189,
+    1084, 251, 238,
+    2014, 1792, 1010,
+    1245, 1633, 1741,
+    -1227, -1540, -1208,
+    -621, 456, -109,
+    40, -65, 788,
+    -805, -699, -1350,
+    -583, 904, 832,
+    -801, 532, 594,
+    1972, 1408, 1351,
+    -1177, -1880, -2114,
+    -773, 568, 948,
+    -1015, 1079, 1260,
+    -1111, 482, -130,
+    1778, 1044, 780,
+    -1491, 245, 912,
+    -316, -1141, -917,
+    -536, -1442, -2346,
+    -785, -1546, -1988,
+    -2003, 257, 909,
+    -1849, -633, -1209,
+    -1538, -1918, -1054,
+    1606, 2239, 1576,
+    -567, -1500, -1544,
+    -1279, 195, 1369,
+    -817, 293, 1219,
+    -525, 630, 1197,
+    -1698, -2425, -1840,
+    -303, 731, 747,
+    -1169, -251, 269,
+    -950, -75, 1684,
+    -1182, -453, 1005,
+    -1599, 585, 378,
+    -2075, -571, -427,
+    -529, -1159, -1171,
+    -283, -205, -564,
+    -796, 1246, 717,
+    2277, 927, 539,
+    -454, 559, 440,
+    -717, 1460, 1615,
+    -1030, 1052, 1610,
+    -1169, -138, 847,
+    226, 39, -612,
+    -1251, -106, -729,
+    -651, 968, 1302,
+    -714, -636, 1727,
+    353, 1069, 410,
+    -798, -156, 1099,
+    -574, 918, 446,
+    -1310, 1012, 466,
+    1408, 1591, 765,
+    1429, 1380, 1757,
+    1949, 1956, 2378,
+    1578, 2047, 2148,
+    916, 98, -7,
+    1893, 1418, 2141,
+    348, 1405, 1579,
+    152, 1134, 1801,
+    -267, 154, 1395,
+    -1166, 469, 1054,
+    -1142, -405, -1073,
+    -1341, -2264, -1581,
+    -364, 869, 1706,
+    -1162, 549, 1550,
+    -1225, -1932, -1666,
+    -1485, -1977, -2055,
+    -1727, -906, -98,
+    -1897, 233, 1492,
+    892, 108, -331,
+    -1728, -1170, -1700,
+    -1060, 1980, 1790,
+    -1070, -1741, -1909,
+    -11, 1539, 1317,
+    -1600, 94, 497,
+    421, 443, -197,
+    -1578, -349, -994,
+    -599, -539, 1140,
+    -965, -1419, -129,
+    -1341, 175, -447,
+    -375, 1311, 2055,
+    -371, -650, -307,
+    -1073, 605, 365,
+    -2057, -113, 430,
+    652, 914, 967,
+    -1012, -1586, -2323,
+    1505, 1248, 559,
+    262, -486, -401,
+    -1727, 1342, 1546,
+    50, 56, 432,
+    -330, 119, -604,
+    -1517, -1080, -810,
+    946, 1127, 1055,
+    -1400, -1703, -1712,
+    -1270, -704, -1317,
+    807, 1821, 1143,
+    2760, 1606, 2171,
+    1120, 409, -150,
+    -147, 404, 959,
+    2439, 1911, 2189,
+    -906, -141, -866,
+    -904, -142, -458,
+    -557, -708, -1679,
+    -830, -1431, -1583,
+    -1842, -1346, -1086,
+    -1604, -272, 915,
+    -1196, 772, 1056,
+    -638, -1234, -1897,
+    -500, -81, -822,
+    -1289, -1613, -735,
+    -117, 785, 168,
+    -1090, 1133, 922,
+    -1096, -746, 1384,
+    287, -547, -1063,
+    -1376, -2201, -1204,
+    -2176, -1570, -1757,
+    -1511, -2241, -771,
+    -1737, 1099, 830,
+    -1588, 724, 1243,
+    -1542, 693, 805,
+    -1690, -240, 1665,
+    -1700, -4, -668,
+    2149, 816, 1042,
+    -818, -1841, 22,
+    -764, -507, 449,
+    -1151, -617, 289,
+    -843, -1596, -240,
+    498, -234, -657,
+    -752, 480, 1678,
+    -319, -481, 193,
+    -811, 171, -119,
+    -2128, -202, -848,
+    1717, 1140, 1700
+};
+
+
+/* third codebook from IS641 */
+
+const Word16 dico3_lsf_3[DICO3_SIZE*4] =
+{
+    67, -17, 66, -12,
+    -1690, -581, -104, -272,
+    -1076, -1186, -1845, -376,
+    -1140, -926, -420, -58,
+    -259, -656, -1134, -553,
+    1788, 1227, 455, 129,
+    462, 441, -240, -528,
+    840, 514, 130, -75,
+    1114, 623, 153, 216,
+    1068, 564, -6, -276,
+    1119, 727, 190, -68,
+    704, 306, 119, -264,
+    329, 61, -100, 156,
+    364, 123, 183, -208,
+    -171, -123, 220, -65,
+    -306, -62, 402, 17,
+    -660, -938, -266, 0,
+    385, 235, 276, 285,
+    320, 268, -336, -200,
+    -724, 17, -84, 381,
+    -544, 429, 494, 519,
+    -117, 288, 304, 329,
+    643, 157, 701, 508,
+    1200, 625, 796, 608,
+    998, 421, 492, 632,
+    1204, 780, 446, 132,
+    1257, 844, 547, 449,
+    829, 658, 541, 470,
+    1132, 1258, 918, 639,
+    547, 51, 423, 279,
+    9, 392, 83, 94,
+    542, 543, 229, -147,
+    -198, 129, 194, -185,
+    -863, -1321, -302, 30,
+    -597, -629, -19, 114,
+    -900, -1081, 466, 353,
+    -1483, -1573, 15, -143,
+    -1708, -2059, -751, 196,
+    -1876, -2067, -642, -258,
+    -2335, -1470, -450, -564,
+    -584, -186, -872, -414,
+    -1805, -988, -1125, -1310,
+    -726, -1129, 28, 169,
+    -1039, -864, -718, -246,
+    484, 36, -233, -49,
+    265, 67, 289, 467,
+    178, 543, 810, 540,
+    84, 282, 672, 703,
+    -975, -777, 129, 287,
+    -938, -227, 955, 595,
+    -1617, -289, 836, 649,
+    -1847, -215, 1106, 718,
+    -2034, -1085, 650, 440,
+    -2101, -529, 907, 575,
+    -2011, -336, 670, 204,
+    -2389, -692, 360, 137,
+    -2156, -2204, -9, 280,
+    -266, 119, 39, 193,
+    78, -59, -120, 226,
+    -975, -858, -781, -1095,
+    -619, -413, -451, -842,
+    -1216, -1321, -813, -883,
+    -1376, -1615, -394, -428,
+    -737, -1113, -549, -790,
+    -880, -975, -967, -642,
+    -985, -886, -1273, -1361,
+    -473, -804, -1401, -1407,
+    160, -265, -919, -275,
+    -248, -250, -718, -380,
+    97, -103, -375, -229,
+    -415, -193, -135, -555,
+    628, 361, 119, 216,
+    579, 364, 391, 209,
+    634, 522, -154, -148,
+    526, 389, 170, 33,
+    105, 267, 64, 380,
+    -1503, -1000, -30, -369,
+    -1070, 58, 647, 223,
+    -1520, -291, 621, 307,
+    -1531, 156, 762, 404,
+    -2029, 141, 734, 499,
+    -1849, -650, 306, 512,
+    -187, -104, -59, 438,
+    134, -230, 156, -186,
+    -61, -260, -16, 10,
+    -569, -3, -421, -297,
+    -1725, -521, -346, 178,
+    -1362, -59, -44, 157,
+    -2146, -461, -470, -349,
+    -2170, -1, -369, -121,
+    -1579, -373, -900, -1015,
+    -1117, -591, -613, -784,
+    -561, 122, -75, -449,
+    -4, -171, -123, -372,
+    192, 168, -76, -132,
+    252, -107, 340, 210,
+    392, 509, 272, 181,
+    -109, 145, 218, 119,
+    -416, -263, 485, 265,
+    -181, -8, -286, 226,
+    -244, -218, 69, -290,
+    -158, 191, -1, -64,
+    -592, -90, 213, -96,
+    255, 435, 178, -80,
+    -369, -18, -33, -80,
+    -42, 415, 140, -222,
+    1143, 651, 649, 329,
+    767, 556, 249, 235,
+    948, 413, 442, 279,
+    141, 339, 356, 557,
+    -470, -170, 99, 237,
+    -569, -800, 352, 565,
+    282, 473, 470, 332,
+    -199, -690, -1284, -917,
+    -193, -426, -800, -1122,
+    -26, -371, -490, -193,
+    637, 595, 519, 330,
+    408, -115, 79, 12,
+    477, 87, -103, -376,
+    -666, -347, -277, -291,
+    -510, -481, 169, 297,
+    -829, -738, -205, -171,
+    -320, -540, 328, 283,
+    -859, -958, 442, -2,
+    556, 686, 130, 56,
+    1383, 1012, 755, 427,
+    612, 741, 628, 553,
+    -339, -796, 134, 277,
+    -633, -1085, -2, -246,
+    -880, -1035, -1607, -1064,
+    -994, -474, -1138, -488,
+    -414, -795, 73, -206,
+    -8, -139, 439, 204,
+    -176, -578, 23, 131,
+    -269, -757, -191, 245,
+    -109, -338, 112, 316,
+    120, -406, -118, 611,
+    -180, -186, -645, 115,
+    -173, 34, -518, -489,
+    -151, 61, -583, -844,
+    220, -138, -681, -1020,
+    391, -17, -598, -321,
+    157, -295, 129, 155,
+    -926, -875, -987, 285,
+    241, -83, -125, -125,
+    620, 597, 432, 92,
+    393, 78, 409, 61,
+    -393, -739, -413, -748,
+    83, 54, 361, 27,
+    -1084, 130, -337, -694,
+    -1565, 297, 318, -19,
+    -1873, 36, 51, -317,
+    -2323, -246, 231, -84,
+    -2306, -783, 40, -179,
+    -2233, -930, -474, -462,
+    -754, -86, -288, -626,
+    -2411, -455, -63, 171,
+    -1099, -1094, -26, -143,
+    -1193, -455, -406, -381,
+    -605, -210, -96, -51,
+    -580, -476, -276, -15,
+    -1195, -634, -1203, -881,
+    -378, -221, -669, -952,
+    594, 178, -403, -676,
+    763, 327, 601, 290,
+    172, 300, 203, 157,
+    -56, -336, 356, 24,
+    -228, -296, -259, -29,
+    -186, 263, 416, 14,
+    -353, 373, -12, -216,
+    257, 96, 174, 57,
+    -1526, -616, -954, -499,
+    -497, -152, -333, 125,
+    105, 200, 179, -97,
+    -331, -224, 765, 697,
+    760, 256, 301, 59,
+    455, -85, 204, 288,
+    -514, 240, 251, -109,
+    256, 417, -34, -413,
+    101, 430, 384, 156,
+    -31, -10, 206, 426,
+    589, 145, 143, 71,
+    808, 906, 333, 349,
+    986, 938, 589, 331,
+    1300, 824, 187, 509,
+    1062, 653, 379, 466,
+    1462, 937, 401, 274,
+    787, 861, 265, 2,
+    609, 553, 28, 305,
+    926, 340, 106, 386,
+    241, -267, -147, 225,
+    -178, -534, 347, 502,
+    -643, -381, 397, 30,
+    -651, -733, -435, 398,
+    -407, -726, -484, -248,
+    -789, -914, -438, -476,
+    -498, -390, 75, -295,
+    -964, -590, -606, 150,
+    -121, -49, -155, -78,
+    935, 550, 389, 38,
+    -321, 127, 424, 315,
+    -285, -113, 283, 259,
+    658, 203, 322, 486,
+    903, 505, 748, 417,
+    611, 423, 555, 512,
+    239, -83, -578, -19,
+    -339, -731, 349, 13,
+    -934, -1399, -114, -360,
+    107, 692, 182, 90,
+    -1243, -1538, -1551, -725,
+    -568, -903, -1363, -525,
+    -517, -853, -861, -1004,
+    -168, -690, -835, 63,
+    -137, -556, -547, 144,
+    -286, -817, 485, 319,
+    -147, -408, 526, 246,
+    -347, -434, 297, -28,
+    -290, -471, -1110, -1285,
+    -460, -359, -988, -794,
+    1347, 1299, 690, 523,
+    1216, 1068, 1094, 757,
+    825, 1140, 752, 494,
+    1252, 1365, 1195, 898,
+    521, 1053, 532, 432,
+    -334, -216, -313, -263,
+    -160, 52, -472, -155,
+    127, 136, -380, 44,
+    851, 410, -162, -489,
+    123, -255, -796, -667,
+    1090, 917, 789, 493,
+    1397, 1197, 558, 202,
+    -51, -118, -342, -701,
+    83, 108, -42, -441,
+    61, 95, 287, 256,
+    -27, 89, 524, 531,
+    351, 227, 592, 545,
+    697, 155, -164, 307,
+    638, 274, -489, -50,
+    754, 240, -166, -124,
+    -116, -579, -1212, -63,
+    190, -295, -1040, -1296,
+    147, -376, -177, -113,
+    841, 1241, 1051, 668,
+    2, 293, 551, 304,
+    -1096, -953, -248, 376,
+    -750, -965, 87, 516,
+    -275, -516, 689, 391,
+    -379, -643, 876, 594,
+    -390, -1013, -645, 573,
+    -107, -568, -689, -826,
+    -1025, -27, -328, -203,
+    861, 749, 548, 233,
+    -1660, -1043, 451, 108,
+    -660, -620, 430, 236,
+    21, -396, -1158, -631,
+    1372, 1298, 967, 577,
+    1125, 1125, 589, 454,
+    -323, -865, -467, 153,
+    -468, -699, -804, -509,
+    -392, -718, -204, -35,
+    -603, -1093, -567, -162,
+    -505, -1004, -102, 350,
+    219, 224, 423, 252,
+    395, 591, 608, 363,
+    -746, -96, 373, 172,
+    171, 295, 714, 339,
+    233, 77, 107, 277,
+    157, 153, -499, -356,
+    1547, 1073, 576, 494,
+    -292, -339, -504, -592,
+    -903, -72, -619, -481,
+    -1594, -1117, -567, -254,
+    -793, -507, -564, -291,
+    -492, -532, 502, 560,
+    -382, 427, 600, 230,
+    -227, 477, 251, 75,
+    285, 842, 813, 476,
+    -1310, -1333, 186, 377,
+    -587, -917, 643, 381,
+    -1186, -553, 411, 82,
+    -1127, -820, -174, -540,
+    -604, 119, 543, 205,
+    -380, 657, 909, 567,
+    112, -298, -374, 114,
+    -857, -251, 56, 159,
+    401, 345, -34, -140,
+    -111, -607, 41, 614,
+    355, -114, -77, 474,
+    578, 56, 1450, 924,
+    1098, 1420, 741, 400,
+    246, 22, 588, 313,
+    -121, 327, 831, 472,
+    -1138, -608, 856, 552,
+    -1241, -1072, 638, 600,
+    -358, 254, -333, -303,
+    -646, 739, 358, 74,
+    1226, 1671, 1221, 849,
+    2241, 1624, 983, 636,
+    1841, 1477, 749, 384,
+    350, 263, 87, 128,
+    -1902, -941, -144, -64,
+    -1734, -255, 288, -31,
+    -2644, -1238, 366, 235,
+    -1643, -1092, -1344, -304,
+    -541, -1075, -1116, 123,
+    -1178, -252, -816, -180,
+    -1016, 533, 565, 233,
+    -487, -430, -188, 334,
+    867, 1236, 534, 171,
+    -1590, -1607, 635, 630,
+    -2196, 310, 924, 412,
+    -2358, -328, 956, 529,
+    -2639, -377, 630, 278,
+    -2602, 317, 799, 299,
+    -2406, 133, 340, 31,
+    -2156, -1468, 131, 125,
+    -1184, -490, -139, 46,
+    -744, 447, 891, 564,
+    67, -451, 646, 604,
+    -553, -429, -876, 396,
+    162, -66, 1305, 915,
+    479, 579, 1088, 794,
+    450, 278, 566, 324,
+    -1057, -154, 148, -177,
+    -2545, 168, 1070, 592,
+    -2351, -42, 819, 345,
+    -2344, -707, 721, 250,
+    -2175, -1497, -309, 122,
+    -78, -73, 120, 173,
+    -4, 262, -263, -261,
+    -431, -64, -405, -732,
+    -2609, 116, -83, -193,
+    -1525, -944, -477, -725,
+    -508, 307, 170, 172,
+    832, 417, 832, 686,
+    -225, 177, 894, 818,
+    -482, -389, 1279, 1039,
+    -383, 201, -350, 40,
+    730, 635, 226, 526,
+    503, 462, 338, 398,
+    535, 714, 40, -282,
+    1482, 1471, 1085, 731,
+    1561, 1072, 909, 693,
+    1419, 1282, 889, 879,
+    1153, 728, 1186, 840,
+    -226, 1130, 949, 689,
+    -494, -986, -1556, -128,
+    -568, -721, -713, -26,
+    317, 524, 70, 135,
+    -405, -865, -1766, -652,
+    -174, -801, 885, 773,
+    -153, -91, 1099, 751,
+    -506, -1149, 853, 646,
+    241, 782, 519, 539,
+    1853, 1700, 1101, 684,
+    -1249, -1486, -464, 188,
+    -893, -1409, -1312, -341,
+    -135, 438, -175, 18,
+    1111, 976, 319, 208,
+    -1430, -1768, 83, 458,
+    -530, -1000, 307, 129,
+    -840, -15, -29, -356,
+    -911, -924, -1147, -242,
+    -119, -528, 127, -133,
+    -761, -765, 190, -83,
+    -315, 895, 522, 231,
+    -222, 102, -63, -428,
+    316, 699, 379, 70,
+    25, 716, 314, -108,
+    507, 874, 566, 238,
+    108, 941, 519, 195,
+    425, -60, -427, 257,
+    139, -103, -630, 446,
+    334, 370, 412, 48,
+    -172, -690, -283, 557,
+    187, -286, 158, 483,
+    140, 270, -344, -631,
+    924, 579, -116, 132,
+    142, 466, -68, -64,
+    230, -145, -302, -542,
+    -803, -912, 1018, 737,
+    -773, 1015, 630, 297,
+    -2596, 95, 445, 336,
+    -2122, 491, 510, 191,
+    -1253, 161, -2, -324,
+    -1450, -633, -712, -105,
+    -842, -254, -411, 100,
+    -640, -290, 1010, 763,
+    -650, 313, 1169, 730,
+    140, 505, 1030, 766,
+    772, 287, 1067, 823,
+    495, 749, 305, 323,
+    -164, 462, 78, 399,
+    -342, -874, 69, 597,
+    -16, 620, 621, 337,
+    -138, -444, -265, 218,
+    84, -450, 953, 666,
+    -222, -803, 541, 604,
+    -921, -1376, 244, 116,
+    -841, -723, 630, 588,
+    140, 663, 294, 368,
+    935, 1046, 881, 759,
+    1746, 1464, 916, 628,
+    436, 963, 281, 1,
+    -119, 74, 542, 213,
+    1, -567, 301, 241,
+    260, 435, 222, 396,
+    936, 957, 1108, 703,
+    510, 506, 808, 478,
+    601, 694, 960, 620,
+    972, 741, 980, 600,
+    834, 717, 767, 684,
+    643, 972, 935, 638,
+    501, 661, 720, 851,
+    -105, -632, -303, -117,
+    -429, 130, 789, 442,
+    -522, -188, 704, 373,
+    -759, 42, 814, 523,
+    -531, -1137, 373, 578,
+    -682, -1203, -455, 285,
+    -1163, -1577, -1098, 44,
+    81, -82, 712, 363,
+    477, 246, 954, 622,
+    1604, 1622, 1277, 891,
+    1409, 859, 924, 892,
+    774, 1041, 947, 1142,
+    40, -546, -75, 288,
+    -616, -106, -697, -26,
+    -169, -160, -891, -739,
+    -279, -384, -1029, -350,
+    1781, 1308, 1046, 816,
+    1580, 1533, 1472, 1178,
+    1505, 1076, 1216, 899,
+    890, 904, 564, 654,
+    920, 692, 1021, 856,
+    -493, 132, 177, 505,
+    71, 195, -28, 97,
+    456, 351, -164, 88,
+    439, 278, -40, 350,
+    1395, 949, 234, -95,
+    -805, -472, 38, -163,
+    367, -98, 489, 523,
+    1025, 1178, 1212, 906,
+    319, 1314, 814, 461,
+    -123, -543, -804, 447,
+    -748, -324, -897, -1127,
+    -737, -501, -789, -713,
+    715, 777, 1239, 922,
+    1949, 1939, 1368, 865,
+    730, 880, 758, 388,
+    -871, 454, 17, -251,
+    -381, -810, -1583, 239,
+    -521, -966, -792, 259,
+    -890, -1358, -770, -73,
+    166, 349, -212, 323,
+    -840, -301, 473, 435,
+    -679, -464, 728, 351,
+    -156, -199, 667, 432,
+    29, -252, 415, 480,
+    -731, -379, 145, 559,
+    -528, -631, -1158, -159,
+    445, 273, 123, 639,
+    373, -126, 800, 568,
+    84, -162, 720, 712,
+    -830, -536, -185, 222,
+    408, 452, 501, 771,
+    -897, -1355, -67, 442,
+    -792, -1406, 566, 602,
+    167, -326, 509, 330,
+    -95, -626, -730, -344,
+    1668, 1217, 779, 455,
+    1316, 828, 584, 719,
+    404, -31, 1013, 789,
+    89, 107, 891, 549,
+    871, 1581, 917, 671,
+    866, 1479, 1289, 854,
+    391, 1068, 1122, 812,
+    78, -562, 345, 563,
+    429, -103, 417, 787,
+    -122, -437, 411, 788,
+    -913, -417, 602, 754,
+    -226, -16, 151, 760,
+    -700, 118, -104, -14,
+    -1128, 48, 284, 393,
+    -390, -419, -639, -116,
+    -910, 306, 316, -13,
+    1207, 984, 821, 669,
+    -1195, -693, 140, -213,
+    -884, -416, -199, -558,
+    -616, 245, -404, -664,
+    262, 56, -617, -724,
+    -85, -491, -320, -656,
+    -570, -831, -129, -528,
+    -1506, -63, -367, -385,
+    -358, -321, 4, 51,
+    -366, -214, 319, 511,
+    146, 671, -17, -291,
+    -110, 464, -139, -496,
+    -202, 220, -312, -631,
+    -660, -73, -655, -820,
+    -662, -653, -1288, -857,
+    -430, -953, -959, -264,
+    -49, -468, -72, -381,
+    -350, -563, -193, -407,
+    55, -408, -803, 11,
+    -309, 649, 188, -198,
+    -512, 461, -79, -458,
+    -1318, -263, -134, -523,
+    -1657, -435, -495, -765,
+    57, -347, -414, 434,
+    -1141, -242, -664, -857,
+    34, -68, -707, -338
+};
+
+
+
+/* third codebook for MR475, MR515 */
+
+const Word16 mr515_3_lsf[MR515_3_SIZE*4] =
+{
+    419,   163,   -30,  -262,
+    -455,  -789, -1430,  -721,
+    1006,   664,   269,    25,
+    619,   260,   183,    96,
+    -968, -1358,  -388,   135,
+    -693,   835,   456,   154,
+    1105,   703,   569,   363,
+    1625,  1326,   985,   748,
+    -220,   219,    76,  -208,
+    -1455, -1662,    49,   149,
+    -964,  -172,  -752,  -336,
+    625,   209,  -250,   -66,
+    -1017,  -838,    -2,   317,
+    -2168, -1485,  -138,   123,
+    -1876, -2099,  -521,    85,
+    -967,  -366,  -695,  -881,
+    -921, -1011,  -763,  -949,
+    -124,  -256,  -352,  -660,
+    178,   463,   354,   304,
+    -1744,  -591,  -282,    79,
+    -2249,   175,   867,   499,
+    -138,  -180,  -181,   -21,
+    -2291, -1241,  -460,  -520,
+    -771,   451,   -10,  -308,
+    271,   -65,     4,   214,
+    -279,  -435,   -43,  -348,
+    -670,    35,   -65,  -211,
+    806,   535,    85,   297,
+    57,   239,   722,   493,
+    225,   661,   840,   547,
+    -540,  -376,    14,   349,
+    469,   721,   331,   162,
+    -544,  -752,   -62,   -10,
+    398,   -88,   724,   701,
+    -19,  -533,   -94,   601,
+    136,   -71,  -681,  -747,
+    -166,  -344,   261,   -50,
+    161,   -52,   485,   337,
+    -1675,    50,   190,   -93,
+    -2282,  -231,  -194,   -82,
+    -95,  -595,  -154,   128,
+    894,   501,   588,   457,
+    -345,   206,   122,   110,
+    -631,  -227,  -569,     3,
+    408,   239,   397,   226,
+    -197,    -2,   128,   491,
+    1281,   904,   292,   215,
+    538,   306,   259,   509,
+    -677, -1047,    13,   321,
+    -679,  -588,  -358,  -212,
+    -558,   243,   646,   479,
+    486,   342,   634,   532,
+    107,   802,   331,   136,
+    -112,  -398, -1031,  -286,
+    -326,  -705,   288,   272,
+    1299,  1144,  1178,   860,
+    -423,   121,  -385,  -148,
+    -295,  -302,  -834,  -819,
+    16,   -24,  -201,  -476,
+    555,    91,  -245,   294,
+    -38,  -379,  -962, -1221,
+    -1191, -1518,  -273,  -395,
+    -390, -1013,  -645,   573,
+    -1843, -1030,   505,   468,
+    744,   947,   609,   493,
+    -689, -1172,  -628,  -135,
+    -1026,   195,   411,   196,
+    1582,  1147,   575,   337,
+    -1239,  -777,  -648,  -142,
+    595,   825,   967,   735,
+    -1206,  -970,   -81,  -342,
+    -745,    13,   -72,   375,
+    454,    19,  1407,   921,
+    -1647,  -172,   861,   562,
+    928,  1537,  1063,   740,
+    -2472,  -952,   264,    82,
+    -502,  -965, -1334,   123,
+    867,  1236,   534,   171,
+    -2320,  -460,   780,   363,
+    -1190,  -617,   252,   -61,
+    -174,    34,  1011,   788,
+    -2333,   247,   423,   153,
+    -16,  -355,   262,   449,
+    -1576, -1073,  -544,  -371,
+    -615,  -305,  1051,   805,
+    687,   528,     6,  -182,
+    935,   875,  1002,   809,
+    199,   257,   126,    76,
+    -584, -1138,   599,   556,
+    -1105, -1391, -1591,  -519,
+    -977, -1325,   108,   347,
+    -722,  -975,   365,   101,
+    -145,   681,   249,  -153,
+    0,  -334,  -570,   159,
+    412,   285,  -336,  -617,
+    -953,  -966,   887,   689,
+    -1251,    84,  -185,  -398,
+    -592,   433,  1044,   653,
+    85,   329,   -40,   361,
+    -433,  -705,   466,   574,
+    -154,   654,   592,   290,
+    -167,    72,   349,   175,
+    674,   297,   977,   720,
+    1235,  1204,   757,   488,
+    -400,  -269,   538,   372,
+    -1350, -1387, -1194,   -91,
+    1262,   876,   775,   700,
+    -599,   -38,  -430,  -722,
+    1976,  1630,   991,   608,
+    111,   276,  -226,   -96,
+    -947,  -388,   -11,    -7,
+    -303,  -531,  -839,   338,
+    1734,  1710,  1405,  1013,
+    -516,  -855,  -645,   210,
+    -688,  -416,   513,   230,
+    -822,  -637, -1146,  -320,
+    -952,  -658,  -694,   183,
+    -114,  -623,   818,   674,
+    -191,  -204,   731,   635,
+    51,  1221,   883,   576,
+    -954,  -431,   826,   598,
+    -342,  -755,  -900,  -407,
+    -1126,  -354,  -206,  -512,
+    -547,  -810,  -357,  -620,
+    66,   515,   -73,  -410,
+    -872,  -945, -1444, -1227,
+    191,   -17,  -544,  -231,
+    -1540,  -544,  -901,  -886
+};
+
+/* first codebook for MR795 */
+
+const Word16 mr795_1_lsf[MR795_1_SIZE*3] =
+{
+    -890, -1550, -2541,
+    -819,  -970,   175,
+    -826, -1234,  -762,
+    -599,   -22,   634,
+    -811,  -987,  -902,
+    -323,   203,    26,
+    -383,  -235,  -781,
+    -399,  1262,   906,
+    -932, -1399, -1380,
+    -624,    93,    87,
+    -414,  -539,  -691,
+    37,   633,   510,
+    -387,  -476, -1330,
+    399,    66,   263,
+    -407,   -49,  -335,
+    -417,  1041,  1865,
+    -779, -1089, -1440,
+    -746,  -858,   832,
+    -581,  -759,  -371,
+    -673,  -506,  2088,
+    -560,  -634, -1179,
+    271,   241,    14,
+    -438,  -244,  -397,
+    463,  1202,  1047,
+    -606,  -797, -1438,
+    -51,  -323,   481,
+    -224,  -584,  -527,
+    494,   881,   682,
+    -433,  -306, -1002,
+    554,   659,   222,
+    171,  -160,  -353,
+    681,  1798,  1565,
+    -852, -1181, -1695,
+    -336,  -666,   114,
+    -581,  -756,  -744,
+    -195,   375,   497,
+    -465,  -804, -1098,
+    154,   282,  -131,
+    -50,  -191,  -719,
+    323,   732,  1542,
+    -722,  -819, -1404,
+    105,  -250,   185,
+    -178,  -502,  -742,
+    321,   510,  1111,
+    -323,  -567,  -966,
+    127,   484,   338,
+    -160,    52,  -338,
+    732,  1367,  1554,
+    -626,  -802, -1696,
+    -286,  -586,   676,
+    -695,  -343,  -370,
+    -490,   295,  1893,
+    -630,  -574, -1014,
+    -80,   645,   -69,
+    -6,  -318,  -364,
+    782,  1450,  1038,
+    -313,  -733, -1395,
+    120,    60,   477,
+    -264,  -585,  -123,
+    711,  1245,   633,
+    -91,  -355, -1016,
+    771,   758,   261,
+    253,    81,  -474,
+    930,  2215,  1720,
+    -808, -1099, -1925,
+    -560,  -782,   169,
+    -804, -1074,  -188,
+    -626,   -55,  1405,
+    -694,  -716, -1194,
+    -660,   354,   329,
+    -514,   -55,  -543,
+    366,  1033,  1182,
+    -658,  -959, -1357,
+    -55,  -184,    93,
+    -605,  -286,  -662,
+    404,   449,   827,
+    -286,  -350, -1263,
+    628,   306,   227,
+    -16,   147,  -623,
+    186,   923,  2146,
+    -674,  -890, -1606,
+    -443,  -228,   339,
+    -369,  -790,  -409,
+    231,    86,  1469,
+    -448,  -581, -1061,
+    594,   450,  -177,
+    -124,  -170,  -447,
+    671,  1159,  1404,
+    -476,  -667, -1511,
+    -77,  -138,   716,
+    -177,  -372,  -381,
+    451,   934,   915,
+    -250,  -432,  -822,
+    272,   828,   446,
+    26,    19,   -31,
+    698,  1692,  2168,
+    -646,  -977, -1924,
+    -179,  -473,   268,
+    -379,  -745,  -691,
+    11,   127,  1033,
+    -488,  -917,  -825,
+    61,   323,   135,
+    147,  -145,  -686,
+    685,   786,  1682,
+    -506,  -848, -1297,
+    35,    90,   222,
+    -23,  -346,  -670,
+    455,   591,  1287,
+    -203,  -593, -1086,
+    652,   352,   437,
+    39,    63,  -457,
+    841,  1265,  2105,
+    -520,  -882, -1584,
+    -328,  -711,  1421,
+    -596,  -342,   -70,
+    209,   173,  1928,
+    -423,  -598,  -921,
+    421,   605,   -38,
+    -2,  -245,  -127,
+    896,  1969,  1135,
+    -379,  -518, -1579,
+    173,   118,   753,
+    -55,  -381,   -52,
+    985,  1021,   753,
+    -2,  -291,  -891,
+    753,   992,   423,
+    264,   131,  -196,
+    895,  2274,  2543,
+    -635, -1088, -2499,
+    -529,  -982,   526,
+    -764,  -830,  -548,
+    -436,   316,   599,
+    -675,  -940,  -746,
+    -57,   236,   -11,
+    -201,   -81,  -798,
+    16,   845,  1558,
+    -737,  -985, -1212,
+    -468,    17,   290,
+    -279,  -584,  -700,
+    183,   822,   705,
+    -265,  -492, -1187,
+    421,   152,   468,
+    -390,   166,  -268,
+    39,  1550,  1868,
+    -635,  -966, -1571,
+    -453,  -492,   910,
+    -284, -1027,   -75,
+    -181,  -133,  1852,
+    -445,  -624, -1174,
+    420,   367,   -49,
+    -389,  -212,  -169,
+    707,  1073,  1208,
+    -539,  -710, -1449,
+    83,  -163,   484,
+    -236,  -543,  -355,
+    338,  1175,   814,
+    -246,  -309,  -958,
+    606,   760,    60,
+    166,    -8,  -163,
+    -306,  1849,  2563,
+    -747, -1025, -1783,
+    -419,  -446,   209,
+    -718,  -566,  -534,
+    -506,   693,   857,
+    -463,  -697, -1082,
+    325,   431,  -206,
+    -15,    -8,  -763,
+    545,   919,  1518,
+    -611,  -783, -1313,
+    256,   -55,   208,
+    -165,  -348,  -662,
+    321,   680,   930,
+    -326,  -429,  -951,
+    484,   446,   570,
+    -197,    72,   -73,
+    909,  1455,  1741,
+    -563,  -737, -1974,
+    -124,  -416,   718,
+    -478,  -404,  -314,
+    -16,   446,  1636,
+    -551,  -537,  -750,
+    -58,   638,   214,
+    55,  -185,  -271,
+    1148,  1301,  1212,
+    -483,  -671, -1264,
+    117,   285,   543,
+    -204,  -391,  -111,
+    513,  1538,   854,
+    -114,  -190,  -978,
+    877,   595,   464,
+    260,   260,  -311,
+    748,  2283,  2216,
+    -517,  -945, -2171,
+    -326,  -708,   378,
+    -812,  -691,  -232,
+    -560,   687,  1409,
+    -732,  -690,  -836,
+    -359,   645,   386,
+    -265,    62,  -678,
+    145,  1644,  1208,
+    -555,  -988, -1233,
+    -78,    14,   114,
+    -327,  -358,  -489,
+    392,   677,   697,
+    -201,  -236, -1140,
+    693,   449,   178,
+    -243,   256,  -433,
+    611,  1385,  2456,
+    -612,  -901, -1464,
+    -307,   -17,   499,
+    -315,  -667,  -254,
+    256,   428,  1463,
+    -486,  -422, -1056,
+    655,   370,    18,
+    -102,  -185,  -276,
+    755,  1578,  1335,
+    -488,  -603, -1418,
+    182,   -93,   870,
+    -73,  -458,  -348,
+    835,   862,   957,
+    -282,  -333,  -746,
+    547,   839,   428,
+    273,   -89,    13,
+    940,  1708,  2576,
+    -418, -1084, -1758,
+    -44,  -358,   259,
+    -497,  -643,  -560,
+    99,   557,   961,
+    -421,  -766,  -917,
+    295,   326,   184,
+    175,    15,  -626,
+    532,   878,  1981,
+    -443,  -768, -1275,
+    221,   156,   268,
+    39,  -363,  -505,
+    695,   772,  1140,
+    -162,  -459,  -912,
+    709,   444,   658,
+    25,   303,  -312,
+    1268,  1410,  1715,
+    -297,  -766, -1836,
+    -263,  -108,  1070,
+    -406,   -13,  -129,
+    57,   438,  2734,
+    -374,  -487,  -835,
+    304,   696,   164,
+    104,  -235,     5,
+    1611,  1900,  1399,
+    -229,  -582, -1325,
+    405,   192,   817,
+    -87,  -438,   111,
+    1028,  1199,   993,
+    68,  -175,  -934,
+    1033,  1117,   451,
+    478,   200,  -248,
+    2127,  2696,  2042,
+    -835, -1323, -2131,
+    -799,  -692,   466,
+    -812, -1032,  -469,
+    -622,   288,   920,
+    -701,  -841, -1070,
+    -411,   512,     8,
+    -390,   -91,  -744,
+    -30,  1043,  1161,
+    -822, -1148, -1156,
+    -294,   -46,   110,
+    -411,  -374,  -678,
+    214,   531,   668,
+    -406,  -420, -1194,
+    487,   232,   303,
+    -318,    91,  -472,
+    123,  1232,  2445,
+    -722,  -952, -1495,
+    -738,  -675,  1332,
+    -543,  -606,  -211,
+    -95,   -98,  1508,
+    -549,  -514, -1193,
+    473,   211,    73,
+    -288,  -112,  -389,
+    537,  1332,  1258,
+    -567,  -755, -1545,
+    71,  -283,   632,
+    -170,  -481,  -493,
+    681,  1002,   817,
+    -356,  -331,  -877,
+    419,   706,   346,
+    241,   -34,  -326,
+    377,  1950,  1883,
+    -727, -1075, -1625,
+    -233,  -543,   116,
+    -524,  -806,  -585,
+    -73,   478,   729,
+    -288,  -925, -1143,
+    173,   447,   -52,
+    68,  -229,  -606,
+    449,   529,  1797,
+    -591,  -875, -1363,
+    183,  -144,   324,
+    -103,  -452,  -666,
+    623,   488,  1176,
+    -238,  -511, -1004,
+    326,   552,   458,
+    136,   108,  -319,
+    626,  1343,  1883,
+    -490,  -646, -1730,
+    -186,  -449,   984,
+    -738,   -76,  -170,
+    -550,   755,  2560,
+    -496,  -510,  -947,
+    210,   694,   -52,
+    84,  -322,  -199,
+    1090,  1625,  1224,
+    -376,  -603, -1396,
+    343,    74,   632,
+    -175,  -502,   -32,
+    972,  1332,   734,
+    52,  -295, -1113,
+    1065,   918,   160,
+    393,   107,  -397,
+    1214,  2649,  1741,
+    -632, -1201, -1891,
+    -719,  -277,   353,
+    -651,  -880,  -122,
+    -211,   209,  1338,
+    -562,  -714, -1059,
+    -208,   388,   159,
+    -320,   -61,  -551,
+    293,  1092,  1443,
+    -648,  -865, -1253,
+    -49,  -143,   305,
+    -401,  -227,  -585,
+    561,   532,   927,
+    -117,  -443, -1188,
+    507,   436,   292,
+    -79,   233,  -458,
+    671,  1025,  2396,
+    -633,  -842, -1525,
+    -308,  -286,   640,
+    -373,  -621,  -407,
+    418,   253,  1305,
+    -315,  -581, -1137,
+    572,   685,  -281,
+    61,   -68,  -371,
+    991,  1101,  1498,
+    -493,  -683, -1362,
+    -47,   164,   704,
+    -256,  -314,  -268,
+    631,   949,  1052,
+    -118,  -348,  -833,
+    68,  1180,   568,
+    152,   117,    34,
+    1113,  1902,  2239,
+    -601,  -959, -1706,
+    -143,  -489,   480,
+    -332,  -655,  -574,
+    54,   353,  1192,
+    -462,  -652,  -796,
+    150,   549,   112,
+    195,  -111,  -515,
+    679,  1108,  1647,
+    -558,  -749, -1217,
+    -9,   272,   341,
+    -53,  -265,  -535,
+    489,   843,  1298,
+    -120,  -482, -1032,
+    632,   543,   408,
+    179,   306,  -526,
+    1124,  1464,  2244,
+    -417,  -786, -1562,
+    -224,  -384,  1364,
+    -377,  -459,   -25,
+    385,   489,  2174,
+    -332,  -651,  -829,
+    544,   553,    61,
+    22,  -113,   -89,
+    1128,  1725,  1524,
+    -216,  -373, -1653,
+    161,   316,   908,
+    -165,  -222,   -67,
+    1362,  1175,   789,
+    73,  -252,  -767,
+    738,   932,   616,
+    362,   246,  -126,
+    787,  2654,  3027,
+    -691, -1106, -2190,
+    -565,  -588,   524,
+    -590,  -979,  -490,
+    -263,   397,   982,
+    -577,  -837,  -945,
+    -22,   435,   -49,
+    -190,  -118,  -629,
+    -88,  1240,  1513,
+    -636, -1051, -1019,
+    -291,   189,   259,
+    -257,  -470,  -629,
+    145,   945,   894,
+    -326,  -364, -1094,
+    543,   260,   630,
+    -202,   189,  -209,
+    357,  1379,  2091,
+    -569, -1075, -1449,
+    -714,  -239,   919,
+    -420,  -705,   -84,
+    -109,  -114,  2407,
+    -413,  -529, -1177,
+    482,   368,   131,
+    -186,   -72,  -131,
+    861,  1255,  1220,
+    -611,  -658, -1341,
+    227,  -121,   631,
+    -176,  -489,  -218,
+    745,  1175,   957,
+    -321,  -148,  -936,
+    671,   966,   216,
+    340,    -3,  -143,
+    469,  1848,  2437,
+    -729,  -961, -1683,
+    -213,  -254,   321,
+    -511,  -438,  -521,
+    -126,   725,   903,
+    -340,  -685, -1032,
+    316,   480,    20,
+    23,   -89,  -551,
+    353,  1051,  1789,
+    -544,  -757, -1364,
+    298,   -25,   436,
+    -100,  -392,  -519,
+    467,   754,  1078,
+    -210,  -398, -1078,
+    620,   658,   630,
+    33,   147,  -178,
+    921,  1687,  1921,
+    -325,  -528, -1978,
+    2,  -285,   910,
+    -371,  -490,  -230,
+    0,   597,  2010,
+    -496,  -395,  -834,
+    37,   945,   245,
+    181,  -160,  -144,
+    1481,  1373,  1357,
+    -355,  -601, -1270,
+    298,   322,   672,
+    -193,  -336,    77,
+    1089,  1533,   922,
+    177,   -39, -1125,
+    996,   781,   536,
+    456,   366,  -432,
+    1415,  2440,  2279,
+    -466,  -758, -2325,
+    -303,  -509,   387,
+    -727,  -557,    66,
+    -145,   643,  1248,
+    -544,  -676,  -916,
+    -225,   862,   588,
+    -152,    40,  -533,
+    423,  1423,  1558,
+    -572,  -843, -1145,
+    -128,    85,   461,
+    -238,  -257,  -584,
+    605,   748,   861,
+    24,  -202, -1409,
+    797,   487,   303,
+    -181,   364,  -182,
+    616,  1378,  2942,
+    -494,  -852, -1441,
+    -292,    61,   812,
+    -84,  -723,  -182,
+    555,   532,  1506,
+    -365,  -493, -1057,
+    822,   588,    11,
+    -14,   -18,  -230,
+    1001,  1401,  1451,
+    -474,  -569, -1292,
+    302,    62,  1062,
+    -70,  -376,  -222,
+    982,   974,  1149,
+    -196,  -234,  -795,
+    479,  1098,   499,
+    362,    58,    70,
+    1147,  2069,  2857,
+    -487,  -878, -1824,
+    73,  -288,   348,
+    -358,  -500,  -508,
+    199,   721,  1242,
+    -78,  -697,  -795,
+    361,   536,   196,
+    374,   110,  -735,
+    847,  1051,  1896,
+    -366,  -713, -1182,
+    315,   320,   429,
+    72,  -215,  -450,
+    759,   886,  1363,
+    -30,  -428,  -834,
+    861,   627,   796,
+    118,   468,  -279,
+    1355,  1883,  1893,
+    -188,  -642, -1612,
+    63,  -175,  1198,
+    -418,  -211,    51,
+    414,   587,  2601,
+    -234,  -557,  -858,
+    424,   889,   222,
+    136,  -101,    83,
+    1413,  2278,  1383,
+    -84,  -445, -1389,
+    414,   313,  1045,
+    29,  -343,    65,
+    1552,  1647,   980,
+    183,   -91,  -829,
+    1273,  1413,   360,
+    553,   272,  -107,
+    1587,  3149,  2603
+};
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5.cpp
new file mode 100644 (file)
index 0000000..10d514d
--- /dev/null
@@ -0,0 +1,600 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: q_plsf_5.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "q_plsf.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "lsp_lsf.h"
+#include "reorder.h"
+#include "lsfwt.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    /* Codebooks of LSF prediction residual */
+    extern const Word16 mean_lsf_5[];
+
+    extern const Word16 dico1_lsf_5[];
+    extern const Word16 dico2_lsf_5[];
+    extern const Word16 dico3_lsf_5[];
+    extern const Word16 dico4_lsf_5[];
+    extern const Word16 dico5_lsf_5[];
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Vq_subvec
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsf_r1 -- array of type Word16 -- 1st LSF residual vector,  Q15
+    lsf_r2 -- array of type Word16 -- 2nd LSF residual vector,  Q15
+    dico -- pointer to const Word16 -- quantization codebook,   Q15
+    wf1 -- array of type Word16 -- 1st LSF weighting factors,   Q13
+    wf2 -- array of type Word16 -- 2nd LSF weighting factors,   Q13
+    dico_size -- Word16 -- size of quantization codebook,       Q0
+ Outputs:
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    Word16 -- quantization index, Q0
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the quantization of a 4-dimensional subvector.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ q_plsf_5.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+/* Quantization of a 4 dimensional subvector */
+
+static Word16 Vq_subvec( /* o : quantization index,            Q0  */
+    Word16 *lsf_r1,      /* i : 1st LSF residual vector,       Q15 */
+    Word16 *lsf_r2,      /* i : 2nd LSF residual vector,       Q15 */
+    const Word16 *dico,  /* i : quantization codebook,         Q15 */
+    Word16 *wf1,         /* i : 1st LSF weighting factors      Q13 */
+    Word16 *wf2,         /* i : 2nd LSF weighting factors      Q13 */
+    Word16 dico_size,    /* i : size of quantization codebook, Q0  */
+    Flag   *pOverflow    /* o : overflow indicator                 */
+)
+{
+    Word16 index = 0; /* initialization only needed to keep gcc silent */
+    Word16 i;
+    Word16 temp;
+    const Word16 *p_dico;
+    Word32 dist_min;
+    Word32 dist;
+    Word16 wf1_0;
+    Word16 wf1_1;
+    Word16 wf2_0;
+    Word16 wf2_1;
+    Word32 aux1;
+    Word32 aux2;
+    Word32 aux3;
+    Word32 aux4;
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    dist_min = MAX_32;
+    p_dico = dico;
+
+    wf1_0 = wf1[0];
+    wf1_1 = wf1[1];
+    wf2_0 = wf2[0];
+    wf2_1 = wf2[1];
+
+    aux1 = ((Word32) lsf_r1[0] * wf1_0);
+    aux2 = ((Word32) lsf_r1[1] * wf1_1);
+    aux3 = ((Word32) lsf_r2[0] * wf2_0);
+    aux4 = ((Word32) lsf_r2[1] * wf2_1);
+
+    for (i = 0; i < dico_size; i++)
+    {
+        temp  = (aux1 - ((Word32)wf1_0 * *(p_dico++))) >> 15;
+        dist  = ((Word32)temp * temp);
+
+        if (dist >= dist_min)
+        {
+            p_dico += 3;
+            continue;
+        }
+
+        temp  = (aux2 - ((Word32)wf1_1 * *(p_dico++))) >> 15;
+        dist += ((Word32)temp * temp);
+
+        if (dist >= dist_min)
+        {
+            p_dico += 2;
+            continue;
+        }
+
+        temp  = (aux3 - ((Word32)wf2_0 * *(p_dico++))) >> 15;
+        dist += ((Word32)temp * temp);
+
+        if (dist >= dist_min)
+        {
+            p_dico += 1;
+            continue;
+        }
+
+        temp  = (aux4 - ((Word32)wf2_1 * *(p_dico++))) >> 15;
+        dist += ((Word32)temp * temp);
+
+
+        if (dist < dist_min)
+        {
+            dist_min = dist;
+            index = i;
+        }
+    }
+
+
+
+    /* Reading the selected vector */
+
+    p_dico = &dico[ index<<2];
+    lsf_r1[0] = *p_dico++;
+    lsf_r1[1] = *p_dico++;
+    lsf_r2[0] = *p_dico++;
+    lsf_r2[1] = *p_dico;
+
+    return index;
+
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Vq_subvec_s
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsf_r1 -- array of type Word16 -- 1st LSF residual vector,  Q15
+    lsf_r2 -- array of type Word16 -- 2nd LSF residual vector,  Q15
+    dico -- pointer to const Word16 -- quantization codebook,   Q15
+    wf1 -- array of type Word16 -- 1st LSF weighting factors,   Q13
+    wf2 -- array of type Word16 -- 2nd LSF weighting factors,   Q13
+    dico_size -- Word16 -- size of quantization codebook,       Q0
+
+ Outputs:
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    Word16 -- quantization index, Q0
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the quantization of a 4-dimensional subvector.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ q_plsf_5.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+
+/* Quantization of a 4 dimensional subvector with a signed codebook */
+
+static Word16 Vq_subvec_s(  /* o : quantization index            Q0  */
+    Word16 *lsf_r1,         /* i : 1st LSF residual vector       Q15 */
+    Word16 *lsf_r2,         /* i : and LSF residual vector       Q15 */
+    const Word16 *dico,     /* i : quantization codebook         Q15 */
+    Word16 *wf1,            /* i : 1st LSF weighting factors     Q13 */
+    Word16 *wf2,            /* i : 2nd LSF weighting factors     Q13 */
+    Word16 dico_size,       /* i : size of quantization codebook Q0  */
+    Flag   *pOverflow)      /* o : overflow indicator                */
+{
+    Word16 index = 0;  /* initialization only needed to keep gcc silent */
+    Word16 sign = 0;   /* initialization only needed to keep gcc silent */
+    Word16 i;
+    Word16 temp;
+    Word16 temp1;
+    Word16 temp2;
+    const Word16 *p_dico;
+    Word32 dist_min;
+    Word32 dist1;
+    Word32 dist2;
+
+    Word16 lsf_r1_0;
+    Word16 lsf_r1_1;
+    Word16 lsf_r2_0;
+    Word16 lsf_r2_1;
+
+    Word16 wf1_0;
+    Word16 wf1_1;
+    Word16 wf2_0;
+    Word16 wf2_1;
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    dist_min = MAX_32;
+    p_dico = dico;
+
+
+    lsf_r1_0 = lsf_r1[0];
+    lsf_r1_1 = lsf_r1[1];
+    lsf_r2_0 = lsf_r2[0];
+    lsf_r2_1 = lsf_r2[1];
+
+    wf1_0 = wf1[0];
+    wf1_1 = wf1[1];
+    wf2_0 = wf2[0];
+    wf2_1 = wf2[1];
+
+    for (i = 0; i < dico_size; i++)
+    {
+        /* test positive */
+        temp = *p_dico++;
+        temp1 = lsf_r1_0 - temp;
+        temp2 = lsf_r1_0 + temp;
+        temp1 = ((Word32)wf1_0 * temp1) >> 15;
+        temp2 = ((Word32)wf1_0 * temp2) >> 15;
+        dist1 = ((Word32)temp1 * temp1);
+        dist2 = ((Word32)temp2 * temp2);
+
+        temp = *p_dico++;
+        temp1 = lsf_r1_1 - temp;
+        temp2 = lsf_r1_1 + temp;
+        temp1 = ((Word32)wf1_1 * temp1) >> 15;
+        temp2 = ((Word32)wf1_1 * temp2) >> 15;
+        dist1 += ((Word32)temp1 * temp1);
+        dist2 += ((Word32)temp2 * temp2);
+
+        if ((dist1 >= dist_min) && (dist2 >= dist_min))
+        {
+            p_dico += 2;
+            continue;
+        }
+
+        temp = *p_dico++;
+        temp1 = lsf_r2_0 - temp;
+        temp2 = lsf_r2_0 + temp;
+        temp1 = ((Word32)wf2_0 * temp1) >> 15;
+        temp2 = ((Word32)wf2_0 * temp2) >> 15;
+        dist1 += ((Word32)temp1 * temp1);
+        dist2 += ((Word32)temp2 * temp2);
+
+        temp = *p_dico++;
+        temp1 = lsf_r2_1 - temp;
+        temp2 = lsf_r2_1 + temp;
+        temp1 = ((Word32)wf2_1 * temp1) >> 15;
+        temp2 = ((Word32)wf2_1 * temp2) >> 15;
+        dist1 += ((Word32)temp1 * temp1);
+        dist2 += ((Word32)temp2 * temp2);
+
+        if (dist1 < dist_min)
+        {
+            dist_min = dist1;
+            index = i;
+            sign = 0;
+        }
+
+        /* test negative */
+
+        if (dist2 < dist_min)
+        {
+            dist_min = dist2;
+            index = i;
+            sign = 1;
+        }
+    }
+
+    /* Reading the selected vector */
+
+    p_dico = &dico[index<<2];
+    index <<= 1;
+    if (sign)
+    {
+        lsf_r1[0] = - (*p_dico++);
+        lsf_r1[1] = - (*p_dico++);
+        lsf_r2[0] = - (*p_dico++);
+        lsf_r2[1] = - (*p_dico);
+        index +=  1;
+    }
+    else
+    {
+        lsf_r1[0] = *p_dico++;
+        lsf_r1[1] = *p_dico++;
+        lsf_r2[0] = *p_dico++;
+        lsf_r2[1] = *p_dico;
+    }
+
+    return index;
+
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Q_plsf_5
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+
+ Inputs:
+    st   -- pointer to Q_plsfState -- state information
+    lsp1 -- array of type Word16 -- 1st LSP vector,  Q15
+    lsp2 -- array of type Word16 -- 2nd LSP vector,  Q15
+
+ Outputs:
+    lps1_q -- array of type Word16 -- quantized 1st LSP vector,   Q15
+    lps2_q -- array of type Word16 -- quantized 2nd LSP vector,   Q15
+    indices -- array of type Word16 -- quantization indices of 5 matrics, Q0
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    mean_lsf_5[];
+
+    dico1_lsf_5[];
+    dico2_lsf_5[];
+    dico3_lsf_5[];
+    dico4_lsf_5[];
+    dico5_lsf_5[];
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE:  Quantization of 2 sets of LSF parameters using 1st order MA
+           prediction and split by 5 matrix quantization (split-MQ)
+
+ DESCRIPTION:
+
+      p[i] = pred_factor*past_rq[i];   i=0,...,m-1
+      r1[i]= lsf1[i] - p[i];           i=0,...,m-1
+      r2[i]= lsf2[i] - p[i];           i=0,...,m-1
+ where:
+      lsf1[i]           1st mean-removed LSF vector.
+      lsf2[i]           2nd mean-removed LSF vector.
+      r1[i]             1st residual prediction vector.
+      r2[i]             2nd residual prediction vector.
+      past_r2q[i]       Past quantized residual (2nd vector).
+
+ The residual vectors r1[i] and r2[i] are jointly quantized using
+ split-MQ with 5 codebooks. Each 4th dimension submatrix contains 2
+ elements from each residual vector. The 5 submatrices are as follows:
+   {r1[0], r1[1], r2[0], r2[1]};  {r1[2], r1[3], r2[2], r2[3]};
+   {r1[4], r1[5], r2[4], r2[5]};  {r1[6], r1[7], r2[6], r2[7]};
+                  {r1[8], r1[9], r2[8], r2[9]}
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ q_plsf_5.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Q_plsf_5(
+    Q_plsfState *st,
+    Word16 *lsp1,      /* i : 1st LSP vector,                     Q15 */
+    Word16 *lsp2,      /* i : 2nd LSP vector,                     Q15 */
+    Word16 *lsp1_q,    /* o : quantized 1st LSP vector,           Q15 */
+    Word16 *lsp2_q,    /* o : quantized 2nd LSP vector,           Q15 */
+    Word16 *indice,    /* o : quantization indices of 5 matrices, Q0  */
+    Flag   *pOverflow  /* o : overflow indicator                      */
+)
+{
+    Word16 i;
+    Word16 lsf1[M];
+    Word16 lsf2[M];
+    Word16 wf1[M];
+    Word16 wf2[M];
+    Word16 lsf_p[M];
+    Word16 lsf_r1[M];
+    Word16 lsf_r2[M];
+    Word16 lsf1_q[M];
+    Word16 lsf2_q[M];
+
+    Word16 *p_lsf_p;
+    Word16 *p_lsf1;
+    Word16 *p_lsf2;
+    Word16 *p_lsf_r1;
+    Word16 *p_lsf_r2;
+
+    /* convert LSFs to normalize frequency domain 0..16384  */
+
+    Lsp_lsf(lsp1, lsf1, M, pOverflow);
+    Lsp_lsf(lsp2, lsf2, M, pOverflow);
+
+    /* Compute LSF weighting factors (Q13) */
+
+    Lsf_wt(lsf1, wf1, pOverflow);
+    Lsf_wt(lsf2, wf2, pOverflow);
+
+    /* Compute predicted LSF and prediction error */
+
+    p_lsf_p  = &lsf_p[0];
+    p_lsf1   = &lsf1[0];
+    p_lsf2   = &lsf2[0];
+    p_lsf_r1 = &lsf_r1[0];
+    p_lsf_r2 = &lsf_r2[0];
+
+    for (i = 0; i < M; i++)
+    {
+        *(p_lsf_p) = mean_lsf_5[i] +
+                     (((Word32)st->past_rq[i] * LSP_PRED_FAC_MR122) >> 15);
+
+        *(p_lsf_r1++) = *(p_lsf1++) - *(p_lsf_p);
+        *(p_lsf_r2++) = *(p_lsf2++) - *(p_lsf_p++);
+    }
+
+    /*---- Split-MQ of prediction error ----*/
+
+    indice[0] = Vq_subvec(&lsf_r1[0], &lsf_r2[0], dico1_lsf_5,
+                          &wf1[0], &wf2[0], DICO1_5_SIZE, pOverflow);
+
+    indice[1] = Vq_subvec(&lsf_r1[2], &lsf_r2[2], dico2_lsf_5,
+                          &wf1[2], &wf2[2], DICO2_5_SIZE, pOverflow);
+
+    indice[2] = Vq_subvec_s(&lsf_r1[4], &lsf_r2[4], dico3_lsf_5,
+                            &wf1[4], &wf2[4], DICO3_5_SIZE, pOverflow);
+
+    indice[3] = Vq_subvec(&lsf_r1[6], &lsf_r2[6], dico4_lsf_5,
+                          &wf1[6], &wf2[6], DICO4_5_SIZE, pOverflow);
+
+    indice[4] = Vq_subvec(&lsf_r1[8], &lsf_r2[8], dico5_lsf_5,
+                          &wf1[8], &wf2[8], DICO5_5_SIZE, pOverflow);
+
+    /* Compute quantized LSFs and update the past quantized residual */
+
+    p_lsf_r1 = &lsf_r1[0];
+    p_lsf_r2 = &lsf_r2[0];
+    p_lsf_p  = &lsf_p[0];
+    p_lsf1   = &lsf1_q[0];
+    p_lsf2   = &lsf2_q[0];
+
+
+    for (i = 0; i < M; i++)
+    {
+        *(p_lsf1++) = *(p_lsf_r1++) + *(p_lsf_p);
+        *(p_lsf2++) = *(p_lsf_r2) + *(p_lsf_p++);
+        st->past_rq[i] = *(p_lsf_r2++);
+    }
+
+    /* verification that LSFs has minimum distance of LSF_GAP */
+
+    Reorder_lsf(lsf1_q, LSF_GAP, M, pOverflow);
+    Reorder_lsf(lsf2_q, LSF_GAP, M, pOverflow);
+
+    /*  convert LSFs to the cosine domain */
+
+    Lsf_lsp(lsf1_q, lsp1_q, M, pOverflow);
+    Lsf_lsp(lsf2_q, lsp2_q, M, pOverflow);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5_tbl.cpp
new file mode 100644 (file)
index 0000000..42f37a1
--- /dev/null
@@ -0,0 +1,1131 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: q_plsf_5_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "q_plsf_5_tbl.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+#define NB_QUA_PITCH 16
+#define NB_QUA_CODE 32
+
+
+#define DICO1_5_SIZE  128
+#define DICO2_5_SIZE  256
+#define DICO3_5_SIZE  256
+#define DICO4_5_SIZE  256
+#define DICO5_5_SIZE  64
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+    /* LSF means ->normalize frequency domain */
+
+    const Word16 mean_lsf_5[10] =
+    {
+        1384,
+        2077,
+        3420,
+        5108,
+        6742,
+        8122,
+        9863,
+        11092,
+        12714,
+        13701
+    };
+
+    const Word16 dico1_lsf_5[DICO1_5_SIZE * 4] =
+    {
+        -451, -1065, -529, -1305,
+        -450, -756, -497, -863,
+        -384, -619, -413, -669,
+        -317, -538, -331, -556,
+        -414, -508, -424, -378,
+        -274, -324, -434, -614,
+        -226, -500, -232, -514,
+        -263, -377, -298, -410,
+        -151, -710, -174, -818,
+        -149, -412, -156, -429,
+        -288, -462, -186, -203,
+        -170, -302, -191, -321,
+        -131, -147, -297, -395,
+        -228, -214, -245, -192,
+        -67, -316, -71, -327,
+        -104, -205, -94, -183,
+        -143, -38, -193, -95,
+        16, -76, -124, -248,
+        23, -237, 24, -244,
+        18, -136, 44, -111,
+        -33, -24, -25, 0,
+        149, 19, 23, -143,
+        158, -169, 174, -181,
+        133, -55, 165, -26,
+        111, 84, 98, 75,
+        87, 183, -115, -11,
+        -8, 130, 11, 170,
+        254, 77, 205, 17,
+        183, 112, 262, 194,
+        202, 287, 95, 189,
+        -42, -105, 234, 179,
+        39, 186, 163, 345,
+        332, 199, 299, 161,
+        -54, 285, -78, 281,
+        -133, 141, -182, 111,
+        249, 341, 271, 364,
+        93, 403, 75, 391,
+        92, 510, -138, 220,
+        -185, -29, -34, 361,
+        -115, 320, 3, 554,
+        99, 286, 218, 591,
+        -245, 406, -268, 453,
+        0, 580, 25, 606,
+        275, 532, 148, 450,
+        -73, 739, -285, 518,
+        -288, 94, -203, 674,
+        -140, -74, 205, 714,
+        -114, 299, 176, 923,
+        182, 557, 240, 705,
+        -16, 513, 485, 593,
+        293, 384, 451, 617,
+        -38, 50, 563, 529,
+        303, 209, 459, 363,
+        433, 452, 450, 454,
+        367, 606, 477, 741,
+        432, 353, 368, 267,
+        361, 716, 273, 583,
+        453, 166, 510, 172,
+        201, 629, 274, 191,
+        568, 639, 302, 298,
+        634, 387, 643, 350,
+        587, 560, 612, 565,
+        600, 788, 487, 672,
+        512, 1015, 321, 333,
+        357, 854, -125, 413,
+        474, 712, 17, -151,
+        564, 285, 270, -241,
+        971, 889, 489, 220,
+        510, 896, 549, 924,
+        327, 825, 290, 911,
+        540, 1108, 158, 805,
+        199, 957, 511, 730,
+        100, 874, 13, 791,
+        435, 632, 676, 972,
+        249, 900, 467, 1218,
+        781, 1074, 585, 785,
+        -23, 669, 267, 1043,
+        619, 1084, 615, 1145,
+        622, 905, 916, 1049,
+        80, 331, 584, 1075,
+        89, 639, 988, 961,
+        770, 720, 798, 699,
+        492, 447, 899, 627,
+        271, 1188, 725, 1333,
+        87, 603, 832, 1603,
+        616, 1127, 890, 1505,
+        1000, 1156, 866, 1009,
+        995, 827, 1149, 858,
+        817, 1450, 773, 1320,
+        500, 1389, 312, 1153,
+        -20, 1084, 64, 1283,
+        2, 1172, 399, 1869,
+        514, 1706, 502, 1636,
+        886, 1522, 416, 600,
+        1131, 1350, 1275, 1390,
+        889, 1795, 914, 1766,
+        227, 1183, 1250, 1826,
+        505, 1854, 919, 2353,
+        -199, 431, 152, 1735,
+        -213, -28, 392, 1334,
+        -153, -52, 978, 1151,
+        -323, -400, 813, 1703,
+        -136, 84, 1449, 2015,
+        -331, -143, -137, 1192,
+        -256, 534, -157, 1031,
+        -307, -439, 542, 731,
+        -329, -420, -97, 616,
+        -362, -168, -322, 366,
+        -247, -110, -211, 89,
+        -196, -309, 20, 59,
+        -364, -463, -286, 89,
+        -336, 175, -432, 141,
+        -379, -190, -434, -196,
+        -79, 150, -278, -227,
+        -280, 166, -555, -422,
+        -155, 541, -366, 54,
+        -29, -83, -301, -774,
+        186, 628, -397, -264,
+        242, 293, -197, -585,
+        124, 410, 53, -133,
+        10, 340, -570, -1065,
+        65, -446, 68, -493,
+        383, 937, -357, -711,
+        -359, -250, -677, -1068,
+        292, -26, 363, 6,
+        607, 1313, -127, -10,
+        1513, 1886, 713, 972,
+        1469, 2181, 1443, 2016
+    };
+
+    const Word16 dico2_lsf_5[DICO2_5_SIZE * 4] =
+    {
+        -1631, -1600, -1796, -2290,
+        -1027, -1770, -1100, -2025,
+        -1277, -1388, -1367, -1534,
+        -947, -1461, -972, -1524,
+        -999, -1222, -1020, -1172,
+        -815, -987, -992, -1371,
+        -1216, -1006, -1289, -1094,
+        -744, -1268, -755, -1293,
+        -862, -923, -905, -984,
+        -678, -1051, -685, -1050,
+        -1087, -985, -1062, -679,
+        -989, -641, -1127, -976,
+        -762, -654, -890, -806,
+        -833, -1091, -706, -629,
+        -621, -806, -640, -812,
+        -775, -634, -779, -543,
+        -996, -565, -1075, -580,
+        -546, -611, -572, -619,
+        -760, -290, -879, -526,
+        -823, -462, -795, -253,
+        -553, -415, -589, -439,
+        -533, -340, -692, -935,
+        -505, -772, -702, -1131,
+        -263, -306, -971, -483,
+        -445, -74, -555, -548,
+        -614, -129, -693, -234,
+        -396, -246, -475, -250,
+        -265, -404, -376, -514,
+        -417, -510, -300, -313,
+        -334, -664, -463, -814,
+        -386, -704, -337, -615,
+        -234, -201, -233, -239,
+        -167, -567, -203, -619,
+        -147, -415, -115, -352,
+        -166, -750, -171, -761,
+        -270, -879, -264, -903,
+        -367, -744, 43, -475,
+        14, -653, 43, -670,
+        11, -448, -59, -521,
+        -126, -119, -155, -613,
+        -42, -863, -27, -931,
+        136, -483, 183, -468,
+        55, -298, 55, -304,
+        313, -609, 313, -720,
+        322, -167, 100, -541,
+        -3, -119, -111, -187,
+        233, -236, 260, -234,
+        26, -165, 134, -45,
+        -40, -549, 360, -203,
+        378, -388, 450, -383,
+        275, 20, 182, -103,
+        246, -111, 431, 37,
+        462, -146, 487, -157,
+        -284, -59, 503, -184,
+        24, 53, -3, 54,
+        122, 259, 333, 66,
+        484, 104, 436, 68,
+        195, 116, 190, 206,
+        269, -9, 482, 352,
+        382, 285, 399, 277,
+        452, 256, 69, 186,
+        13, 297, -13, 259,
+        -95, 30, 56, 394,
+        196, 425, 205, 456,
+        281, 577, 15, 191,
+        375, 290, 407, 576,
+        -56, 227, 544, 405,
+        0, 549, -92, 528,
+        -229, 351, -245, 338,
+        -362, 435, 167, 527,
+        -75, 302, 91, 824,
+        129, 599, 496, 679,
+        186, 749, 153, 737,
+        -281, 600, -348, 615,
+        -236, 769, 41, 881,
+        38, 890, -220, 841,
+        -357, 883, -393, 903,
+        -634, 474, -444, 850,
+        -175, 678, -493, 242,
+        -519, 785, -714, 582,
+        -541, 366, -543, 434,
+        -597, 500, -765, 222,
+        -702, 917, -743, 962,
+        -869, 501, -899, 548,
+        -379, 200, -435, 157,
+        -819, 214, -861, 157,
+        -614, 40, -632, 94,
+        -883, -54, -741, 516,
+        -501, 298, -614, -171,
+        -870, -161, -865, -23,
+        -818, 93, -1015, -267,
+        -662, -359, -549, 2,
+        -442, -121, -377, 0,
+        -227, 33, -414, -126,
+        -129, 212, -934, 34,
+        -1082, -282, -1119, -268,
+        -710, -825, -420, -191,
+        -1076, -928, -917, -93,
+        -628, -358, 97, 7,
+        -206, -393, -101, 24,
+        -203, 38, -168, 83,
+        -599, -423, -279, 426,
+        -700, 118, -75, 206,
+        -981, -673, -680, 417,
+        -367, 37, -279, 474,
+        -129, -318, 319, 296,
+        -626, -39, 343, 602,
+        -696, -39, -303, 940,
+        104, 233, -380, 137,
+        -36, 269, -75, -214,
+        120, 43, -529, -477,
+        459, 164, -202, -229,
+        -49, -167, 609, 792,
+        98, -220, 915, 148,
+        293, 283, 869, 91,
+        575, 394, 326, -78,
+        717, 67, 365, -323,
+        616, -36, 731, 27,
+        619, 238, 632, 273,
+        448, 99, 801, 476,
+        869, 273, 685, 64,
+        789, 72, 1021, 217,
+        793, 459, 734, 360,
+        646, 480, 360, 322,
+        429, 464, 638, 430,
+        756, 363, 1000, 404,
+        683, 528, 602, 615,
+        655, 413, 946, 687,
+        937, 602, 904, 604,
+        555, 737, 786, 662,
+        467, 654, 362, 589,
+        929, 710, 498, 478,
+        415, 420, 693, 883,
+        813, 683, 781, 925,
+        913, 939, 726, 732,
+        491, 853, 531, 948,
+        734, 963, 315, 808,
+        761, 755, 1144, 760,
+        655, 1076, 826, 1057,
+        1091, 838, 1003, 808,
+        1047, 1133, 659, 1101,
+        992, 1050, 1074, 1075,
+        971, 694, 1226, 1054,
+        571, 841, 884, 1404,
+        1379, 1096, 1080, 861,
+        1231, 735, 1284, 760,
+        1272, 991, 1367, 1053,
+        1257, 700, 1050, 534,
+        988, 453, 1264, 599,
+        1140, 679, 1621, 815,
+        1384, 521, 1317, 393,
+        1564, 805, 1448, 686,
+        1068, 648, 875, 307,
+        1083, 361, 1047, 317,
+        1417, 964, 675, 571,
+        1152, 79, 1114, -47,
+        1530, 311, 1721, 314,
+        1166, 689, 514, -94,
+        349, 282, 1412, 328,
+        1025, 487, -65, 57,
+        805, 970, 36, 62,
+        769, -263, 791, -346,
+        637, 699, -137, 620,
+        534, 541, -735, 194,
+        711, 300, -268, -863,
+        926, 769, -708, -428,
+        506, 174, -892, -630,
+        435, 547, -1435, -258,
+        621, 471, -1018, -1368,
+        -393, 521, -920, -686,
+        -25, 20, -982, -1156,
+        340, 9, -1558, -1135,
+        -352, 48, -1579, -402,
+        -887, 6, -1156, -888,
+        -548, -352, -1643, -1168,
+        -159, 610, -2024, -963,
+        -225, 193, -1656, -1960,
+        -245, -493, -964, -1680,
+        -936, -635, -1299, -1744,
+        -1388, -604, -1540, -835,
+        -1397, -135, -1588, -290,
+        -1670, -712, -2011, -1632,
+        -1663, -27, -2258, -811,
+        -1157, 184, -1265, 189,
+        -1367, 586, -2011, 201,
+        -790, 712, -1210, 3,
+        -1033, 808, -1251, 830,
+        -111, 635, -1636, 447,
+        -463, -949, -445, -928,
+        -504, -1162, -501, -1211,
+        144, -351, -372, -1052,
+        -283, -1059, -279, -1123,
+        -575, -1438, -587, -1614,
+        -935, -984, 229, 690,
+        -921, -719, -403, 1362,
+        -685, -465, 874, 397,
+        -509, -46, 317, 1334,
+        -485, 456, 813, 439,
+        -411, 339, 898, 1067,
+        -425, 46, 1441, 497,
+        -909, -800, 1465, 1046,
+        -254, -321, 1430, 1165,
+        68, 350, 1034, 666,
+        370, 11, 1311, 790,
+        143, 232, 1041, 1562,
+        -114, 663, 1616, 1078,
+        454, 579, 1275, 1040,
+        -76, 909, 752, 1067,
+        153, 512, 348, 1214,
+        614, 385, 1843, 808,
+        269, 1034, 203, 1086,
+        652, 1017, 1783, 1130,
+        429, 1327, 387, 1384,
+        -49, 1183, -72, 1215,
+        -416, 1001, 544, 1749,
+        -352, 1223, -502, 1199,
+        -589, 569, -227, 1630,
+        -142, 1578, -230, 1715,
+        -714, 1288, -838, 1398,
+        1131, 1357, -208, 1232,
+        437, 965, -929, 818,
+        811, 1410, 859, 1507,
+        164, 1212, 1387, 1793,
+        484, 1874, 456, 2063,
+        996, 1170, 1326, 1402,
+        1316, 1360, 1135, 1262,
+        1234, 1618, 1361, 1768,
+        1421, 1227, 1584, 1347,
+        854, 672, 1685, 1566,
+        1139, 1270, 2016, 1825,
+        1773, 1581, 1532, 1460,
+        1487, 946, 1659, 1021,
+        1744, 1212, 1392, 977,
+        1772, 1161, 1826, 1164,
+        1718, 1429, 1973, 1591,
+        1185, 864, 2132, 1061,
+        1799, 814, 1838, 757,
+        2104, 1315, 2054, 1258,
+        2113, 915, 2331, 930,
+        1467, 1147, 2590, 1439,
+        2245, 1744, 2090, 1620,
+        2358, 1454, 2666, 1506,
+        1876, 1837, 2070, 1975,
+        1739, 1577, 682, 1289,
+        1584, 2045, 1454, 2098,
+        2498, 2004, 2711, 2066,
+        726, 1588, 2756, 2336,
+        228, 847, 2456, 1659,
+        36, 301, 1942, 1957,
+        -446, -96, 2154, 1396,
+        1533, 1101, 14, 608,
+        -923, -732, 1383, 1982,
+        1345, 952, -680, 321,
+        1281, 1268, -1594, 365,
+        941, 946, -1737, -822,
+        2374, 2787, 1821, 2788
+    };
+
+    const Word16 dico3_lsf_5[DICO3_5_SIZE * 4] =
+    {
+        -1812, -2275, -1879, -2537,
+        -1640, -1848, -1695, -2004,
+        -1220, -1912, -1221, -2106,
+        -1559, -1588, -1573, -1556,
+        -1195, -1615, -1224, -1727,
+        -1359, -1151, -1616, -1948,
+        -1274, -1391, -1305, -1403,
+        -1607, -1179, -1676, -1311,
+        -1443, -1478, -1367, -898,
+        -1256, -1059, -1331, -1134,
+        -982, -1133, -1149, -1504,
+        -1080, -1308, -1020, -1183,
+        -980, -1486, -967, -1495,
+        -988, -922, -1047, -1077,
+        -838, -1179, -858, -1222,
+        -1131, -1041, -1064, -767,
+        -872, -1157, -701, -880,
+        -706, -906, -774, -1016,
+        -578, -1080, -801, -1478,
+        -591, -1111, -592, -1146,
+        -713, -1388, -640, -1376,
+        -597, -1059, -416, -903,
+        -686, -832, -661, -708,
+        -444, -868, -490, -921,
+        -374, -776, -619, -1170,
+        -585, -549, -769, -795,
+        -435, -659, -530, -741,
+        -498, -837, -357, -597,
+        -279, -871, -243, -887,
+        -282, -665, -280, -667,
+        -165, -560, -394, -903,
+        -362, -410, -448, -583,
+        -409, -574, -313, -357,
+        -637, -548, -570, -436,
+        -896, -504, -382, -757,
+        -58, -481, -165, -618,
+        -191, -374, -234, -382,
+        -222, -683, -25, -480,
+        -418, -359, -730, -353,
+        -324, -157, -432, -322,
+        -394, -303, -284, -104,
+        -601, -289, -556, -196,
+        -588, -150, -659, -608,
+        -473, -24, -68, -448,
+        -474, -8, -506, -45,
+        -748, -184, -844, -252,
+        -901, -91, -584, -97,
+        -652, 138, -764, -131,
+        -678, -12, -670, 165,
+        -259, -3, -840, -107,
+        -909, 37, -992, 44,
+        -854, -415, -839, 13,
+        -1001, -271, -1026, -309,
+        -798, -478, -832, -488,
+        -943, 168, -1112, -387,
+        -1185, -101, -1183, -40,
+        -941, -316, -1030, -770,
+        -1044, -625, -1081, -538,
+        -1224, -299, -1312, -436,
+        -1197, -663, -1167, -161,
+        -1216, -690, -1237, -831,
+        -1432, -720, -1403, -493,
+        -898, -740, -922, -801,
+        -1102, -402, -1579, -964,
+        -1061, -638, -1269, -1438,
+        -1499, -934, -1502, -895,
+        -1598, -564, -1723, -717,
+        -606, -597, -1166, -1085,
+        -1369, -468, -1946, -1493,
+        -1838, -953, -1932, -931,
+        -1499, -188, -1635, -421,
+        -1457, -338, -1448, -22,
+        -1942, -422, -2006, -249,
+        -496, -114, -1910, -755,
+        -1289, 174, -1451, -109,
+        -482, -257, -1221, -508,
+        -1617, 151, -1694, 208,
+        -654, 107, -1651, 29,
+        -1141, 279, -1215, 306,
+        -1228, -506, -730, -175,
+        -1236, -101, -969, 551,
+        -870, 278, -823, 315,
+        -563, 376, -1051, 228,
+        -507, 280, -599, 281,
+        -758, 253, -305, 379,
+        -755, -134, -611, 660,
+        -824, 536, -817, 646,
+        -413, 49, -341, 177,
+        -453, 526, -482, 589,
+        -71, 339, -657, 264,
+        -244, 295, -237, 315,
+        -387, 569, -506, -9,
+        -377, 14, -160, 661,
+        -216, 40, -308, -46,
+        95, 214, -242, 167,
+        -86, 192, -56, 27,
+        -76, 31, 36, 309,
+        -106, -182, -113, 74,
+        -441, -22, 23, 139,
+        81, -11, 44, 15,
+        -87, -137, -118, -207,
+        -158, -58, 272, -92,
+        -156, -441, 8, -136,
+        128, -221, 101, -218,
+        40, -197, -76, -456,
+        9, -445, 33, -423,
+        226, 60, 73, -222,
+        156, -399, 280, -318,
+        245, -341, 166, -499,
+        339, -190, 327, -219,
+        325, -137, -89, -596,
+        100, -627, 144, -677,
+        487, 28, 252, -391,
+        214, -41, 282, -28,
+        99, -286, 331, 49,
+        459, -388, 565, -369,
+        436, 28, 336, -9,
+        397, -167, 618, 34,
+        596, -17, 561, -140,
+        299, 79, 522, 125,
+        203, 2, 244, 288,
+        255, 211, 175, 82,
+        596, 187, 517, 108,
+        381, 255, 365, 297,
+        497, 352, 327, -82,
+        25, 210, 371, 245,
+        261, 3, 545, 449,
+        140, 294, 44, 295,
+        212, 347, 244, 494,
+        331, 528, 201, 307,
+        349, 411, 613, 284,
+        614, 413, 464, 322,
+        624, 397, 97, 200,
+        -160, 384, 149, 362,
+        495, 525, 269, 585,
+        33, 491, -121, 433,
+        427, 611, 498, 516,
+        171, 443, 497, 666,
+        440, 275, 566, 575,
+        146, 639, 155, 670,
+        -33, 173, 212, 696,
+        -166, 601, -191, 695,
+        -489, 503, 175, 742,
+        214, 476, 372, 1083,
+        578, 530, 586, 777,
+        425, 874, 315, 841,
+        374, 848, -165, 565,
+        35, 991, -39, 1062,
+        329, 712, 786, 840,
+        645, 795, 661, 676,
+        571, 918, 632, 1079,
+        673, 817, 318, 388,
+        874, 1012, 564, 848,
+        880, 620, 557, 479,
+        671, 453, 692, 468,
+        840, 642, 844, 645,
+        506, 428, 897, 567,
+        837, 387, 962, 499,
+        691, 561, 939, 926,
+        783, 296, 790, 268,
+        1028, 530, 874, 329,
+        548, 143, 675, 291,
+        503, 66, 1041, 359,
+        786, 97, 805, 33,
+        837, 470, 511, 49,
+        1092, 327, 1174, 323,
+        3, 242, 872, 474,
+        689, 429, 1329, 678,
+        1042, 620, 1109, 664,
+        321, 193, 889, 950,
+        1153, 874, 893, 635,
+        877, 862, 948, 913,
+        1293, 665, 1320, 639,
+        997, 793, 1402, 1030,
+        1176, 1012, 1110, 959,
+        1410, 925, 1403, 915,
+        543, 862, 1116, 1222,
+        835, 1190, 835, 1190,
+        959, 1148, 1147, 1376,
+        1300, 1193, 1415, 1231,
+        1335, 1341, 746, 1092,
+        1711, 1283, 1389, 1073,
+        1334, 1566, 1153, 1475,
+        1645, 1137, 1825, 1220,
+        1056, 1382, 1521, 1730,
+        1632, 1545, 1620, 1542,
+        855, 1596, 865, 1667,
+        693, 885, 1716, 1519,
+        1167, 1296, 2209, 1760,
+        1952, 1493, 2020, 1482,
+        1534, 1866, 1694, 2008,
+        1566, 748, 1761, 825,
+        294, 1392, 1084, 2058,
+        621, 1315, 365, 1287,
+        198, 1028, 488, 1408,
+        249, 403, 1014, 1561,
+        324, 363, 1645, 1044,
+        193, 367, 2034, 1859,
+        -251, 579, 750, 994,
+        -243, 30, 1325, 879,
+        -28, -169, 624, 917,
+        -453, 159, 186, 1370,
+        -614, 6, 537, 392,
+        -94, -291, 781, 229,
+        -128, -298, 245, 491,
+        -701, -648, 972, 789,
+        -501, -640, 178, 255,
+        -365, -390, -255, 317,
+        -958, -294, -191, 228,
+        -775, -447, 157, -237,
+        -657, -720, -407, 92,
+        -117, -611, 334, -230,
+        -679, -1084, -144, -317,
+        -901, -861, -738, -360,
+        -85, -727, -90, -787,
+        100, -22, -391, -263,
+        -56, -73, -337, -754,
+        5, -189, -706, -624,
+        89, -344, -135, -1113,
+        -353, -237, -684, -1135,
+        -275, -1102, -269, -1203,
+        152, 145, -722, -1232,
+        49, 80, -1248, -776,
+        -248, 391, -732, -547,
+        469, 218, -255, -864,
+        69, 366, -166, -485,
+        -688, 191, -1212, -1196,
+        -170, -169, -1308, -1631,
+        321, 470, -1419, -1243,
+        -64, 272, -1361, -248,
+        492, 565, -721, -609,
+        195, 485, -573, -133,
+        427, 202, -171, -118,
+        199, 575, 2, -31,
+        694, 755, -1366, -39,
+        552, 557, -489, 271,
+        680, 537, 13, -453,
+        855, 954, -133, -52,
+        -81, 738, -1169, 637,
+        1055, 1059, -95, 676,
+        1259, 1081, 489, 305,
+        -449, 954, -534, 996,
+        -969, 866, -1058, 1059,
+        -1294, 618, -1416, 617,
+        -458, 1366, -159, 1821,
+        -774, -528, -14, 1110,
+        -1202, -901, -772, 433,
+        -1256, -1255, -1011, -302,
+        -602, -585, -759, -1618,
+        -760, -1549, -840, -1921,
+        -816, -539, -1769, -2235,
+        -227, -36, -2034, -1831,
+        -2107, -1126, -2471, -1816,
+        -1470, 252, -2701, -415,
+        -571, -467, 1509, 1554,
+        2180, 1975, 2326, 2020
+    };
+
+    const Word16 dico4_lsf_5[DICO4_5_SIZE * 4] =
+    {
+        -1857, -1681, -1857, -1755,
+        -2056, -1150, -2134, -1654,
+        -1619, -1099, -1704, -1131,
+        -1345, -1608, -1359, -1638,
+        -1338, -1293, -1325, -1265,
+        -1664, -1649, -1487, -851,
+        -1346, -1832, -1413, -2188,
+        -1282, -681, -1785, -1649,
+        -966, -1082, -1183, -1676,
+        -1054, -1073, -1142, -1158,
+        -1207, -744, -1274, -997,
+        -934, -1383, -927, -1416,
+        -1010, -1305, -783, -955,
+        -1049, -900, -993, -817,
+        -737, -823, -972, -1189,
+        -738, -1094, -738, -1154,
+        -784, -801, -810, -786,
+        -892, -520, -1000, -818,
+        -644, -965, -577, -882,
+        -541, -694, -671, -917,
+        -595, -642, -646, -615,
+        -956, -621, -925, -515,
+        -727, -483, -815, -485,
+        -840, -578, -440, -713,
+        -578, -325, -657, -670,
+        -386, -570, -441, -666,
+        -514, -787, -392, -529,
+        -522, -453, -487, -423,
+        -616, -585, -617, -157,
+        -662, -268, -680, -348,
+        -322, -323, -632, -444,
+        -304, -430, -332, -458,
+        -277, -468, -659, -793,
+        -319, -636, -227, -554,
+        -373, -347, -334, -210,
+        -456, -192, -530, -242,
+        -216, -198, -366, -370,
+        -338, -161, -409, -748,
+        -107, -380, -294, -643,
+        -223, -665, -234, -741,
+        -141, -496, -130, -510,
+        -139, -327, -172, -305,
+        -306, -580, -164, -263,
+        -262, -172, -67, -402,
+        31, -366, -10, -436,
+        -86, -527, 71, -377,
+        -22, -609, -12, -678,
+        -67, -319, 63, -191,
+        35, -181, -39, -242,
+        126, -167, -140, -544,
+        155, -297, 174, -297,
+        38, -8, 117, -380,
+        197, -452, 240, -522,
+        223, -103, 110, -187,
+        87, -155, 169, -47,
+        157, 26, -83, -100,
+        128, 80, 209, -62,
+        6, 7, 22, 5,
+        318, -20, 248, -45,
+        -200, -63, 156, -69,
+        250, -183, 369, -126,
+        -113, -76, -142, -122,
+        -64, -254, -31, 35,
+        -177, -71, -7, 171,
+        93, 27, 108, 212,
+        -330, -209, -123, -70,
+        -279, 95, -96, 20,
+        -188, -61, -314, 87,
+        -300, -78, -354, -134,
+        11, 122, -140, 122,
+        -275, 152, -293, 140,
+        -82, 138, -321, -111,
+        -480, -156, -359, 76,
+        -254, -40, -635, -96,
+        -522, 79, -507, 8,
+        -268, 303, -539, 68,
+        -446, 61, -522, 306,
+        111, 189, -435, 122,
+        -379, 166, -571, -398,
+        -632, -74, -747, -95,
+        -455, 194, -952, 83,
+        -798, 192, -755, 192,
+        -781, -162, -619, 234,
+        -663, -297, -488, -109,
+        -964, -132, -838, -68,
+        -843, 58, -1112, -86,
+        -805, -299, -944, -253,
+        -778, -50, -965, -549,
+        -352, -98, -992, -343,
+        -1117, -315, -1117, -307,
+        -1155, -374, -637, -230,
+        -1166, -43, -1299, -100,
+        -925, -393, -1274, -600,
+        -689, -130, -1479, -312,
+        -1321, -254, -1464, -442,
+        -1292, -613, -1261, -503,
+        -1501, -368, -1322, 26,
+        -1432, -66, -1743, -161,
+        -1644, -467, -1760, -548,
+        -1393, -568, -1556, -871,
+        -1495, -1034, -1387, -571,
+        -1917, -528, -1783, -123,
+        -1897, -231, -2054, -323,
+        -2052, -906, -1976, -567,
+        -1917, -620, -2047, -989,
+        -1077, -370, -2031, -704,
+        -2355, -749, -2740, -1089,
+        -1909, 159, -2012, 248,
+        -626, -123, -2339, -962,
+        -669, -408, -1379, -1174,
+        -452, -364, -1044, -735,
+        -132, 183, -1620, -752,
+        -547, -307, -777, -1261,
+        -98, 41, -880, -1091,
+        -257, 97, -1602, -1833,
+        31, -26, -644, -561,
+        -180, -546, -385, -1095,
+        -410, -802, -414, -827,
+        -457, -970, -490, -1109,
+        -215, -916, -144, -937,
+        -493, -1269, -517, -1507,
+        181, 101, -332, -889,
+        -836, -937, -559, -429,
+        -629, -547, -183, -337,
+        -545, -82, -250, -286,
+        5, -132, -348, -252,
+        -293, -472, -158, 100,
+        -29, 197, -236, -424,
+        -861, -213, -140, -7,
+        -427, -443, 187, -97,
+        -684, -736, -293, 258,
+        -368, -152, -150, 392,
+        -609, 175, -142, 299,
+        -138, 152, -119, 329,
+        -486, -52, 293, 198,
+        -183, 117, 175, 331,
+        -58, -274, 231, 300,
+        -288, 330, -305, 372,
+        -111, 409, -9, 423,
+        83, 256, 67, 367,
+        -19, 248, 91, 113,
+        -35, 406, -191, 154,
+        238, 296, 5, 197,
+        141, 221, 313, 198,
+        211, 421, 244, 334,
+        88, 426, -243, 454,
+        202, 552, -5, 403,
+        291, 185, 219, 301,
+        251, 138, 128, 69,
+        197, 288, -140, -61,
+        188, 361, 197, 598,
+        442, 273, 290, 143,
+        472, 482, 157, 370,
+        415, 321, 372, 385,
+        402, 552, 155, 24,
+        550, 263, -11, 21,
+        360, 227, 147, -254,
+        424, 97, 366, -13,
+        375, 141, 449, 232,
+        396, 507, 474, 272,
+        701, 324, 362, -47,
+        587, 148, 543, 69,
+        400, -51, 561, 59,
+        220, -10, 352, 147,
+        206, 211, 653, 185,
+        563, 297, 565, 284,
+        594, 121, 766, 192,
+        398, 118, 642, 434,
+        233, 264, 481, 467,
+        129, -165, 699, 239,
+        90, 26, 342, 474,
+        -55, 27, 388, 94,
+        -172, 0, 725, 379,
+        -60, 337, 370, 465,
+        95, 319, 806, 595,
+        78, 260, 497, 851,
+        210, 560, 458, 574,
+        -464, 202, 497, 625,
+        -202, 152, 48, 712,
+        -20, 566, 100, 715,
+        455, 468, 411, 605,
+        319, 646, 195, 615,
+        401, 538, 680, 739,
+        201, 667, 434, 954,
+        454, 425, 646, 491,
+        606, 681, 416, 508,
+        497, 822, 426, 815,
+        660, 647, 628, 716,
+        697, 466, 618, 457,
+        685, 460, 365, 309,
+        721, 567, 836, 601,
+        609, 300, 825, 459,
+        943, 687, 681, 533,
+        915, 598, 591, 243,
+        876, 451, 874, 420,
+        786, 317, 732, 220,
+        922, 317, 1108, 367,
+        531, 466, 1028, 649,
+        1053, 615, 1034, 553,
+        829, 602, 1021, 799,
+        927, 803, 878, 763,
+        799, 496, 1373, 773,
+        585, 770, 803, 930,
+        1099, 793, 1222, 862,
+        1209, 895, 1025, 727,
+        772, 845, 1172, 1115,
+        867, 1021, 830, 1013,
+        841, 910, 506, 703,
+        1239, 1077, 620, 819,
+        1196, 1083, 1155, 1081,
+        1142, 907, 1547, 1121,
+        1309, 648, 1343, 612,
+        1484, 988, 1479, 937,
+        985, 1328, 955, 1341,
+        429, 910, 841, 1338,
+        564, 1179, 412, 1156,
+        1427, 1320, 1434, 1330,
+        640, 760, 1726, 1410,
+        190, 555, 1073, 1005,
+        426, 257, 839, 980,
+        235, 231, 1520, 1167,
+        109, 293, 1014, 1569,
+        305, 142, 1148, 539,
+        -291, -108, 1213, 972,
+        22, -216, 667, 828,
+        -482, 438, 453, 1431,
+        -581, -422, 789, 387,
+        -358, -454, 174, 780,
+        -36, -372, 390, -134,
+        -629, 160, -306, 751,
+        -1258, -331, 177, 522,
+        -248, 574, -251, 639,
+        -531, 407, -596, 394,
+        -419, 789, -617, 801,
+        -986, 399, -857, 727,
+        -7, 518, -703, 310,
+        -1143, -24, -1002, 287,
+        -960, 363, -1299, 312,
+        -1534, 245, -1557, 305,
+        28, 153, -859, -175,
+        -33, 332, -1398, -154,
+        212, 410, -593, -197,
+        -1092, -704, -904, -65,
+        282, 367, -918, -686,
+        345, 93, -258, -357,
+        696, 644, -693, -28,
+        448, 493, -273, 193,
+        527, 546, -243, -513,
+        384, -136, 273, -353,
+        512, -142, 537, -198,
+        941, 750, 83, 248,
+        578, 861, -56, 592,
+        842, 44, 892, 24,
+        33, 890, -16, 982,
+        831, 1398, 1535, 1898,
+        1716, 1376, 1948, 1465
+    };
+
+    const Word16 dico5_lsf_5[DICO5_5_SIZE * 4] =
+    {
+        -1002, -929, -1096, -1203,
+        -641, -931, -604, -961,
+        -779, -673, -835, -788,
+        -416, -664, -458, -766,
+        -652, -521, -662, -495,
+        -1023, -509, -1023, -428,
+        -444, -552, -368, -449,
+        -479, -211, -1054, -903,
+        -316, -249, -569, -591,
+        -569, -275, -541, -191,
+        -716, -188, -842, -264,
+        -333, -248, -318, -228,
+        -275, 1, -567, -228,
+        -115, -221, -238, -374,
+        -197, -507, -222, -579,
+        -258, -432, -61, -244,
+        -345, 2, -338, 39,
+        -215, -169, -58, 0,
+        -56, -6, -203, -131,
+        1, -186, -5, -211,
+        6, -380, 11, -418,
+        -116, 131, -134, 113,
+        89, -4, 71, -2,
+        -19, -192, 262, 24,
+        189, 151, -133, -109,
+        186, -153, 166, -219,
+        37, 139, 193, 171,
+        337, 124, 158, -61,
+        141, 226, -13, 190,
+        231, 34, 354, 109,
+        316, 201, 244, 164,
+        330, -85, 390, -84,
+        254, 327, 257, 335,
+        491, 147, 476, 105,
+        54, 77, 437, 370,
+        421, 314, 449, 342,
+        329, 126, 673, 292,
+        571, 388, 243, 193,
+        653, 320, 621, 280,
+        194, 380, 517, 581,
+        45, 323, 111, 422,
+        489, 395, 734, 534,
+        622, 546, 486, 502,
+        318, 572, 189, 550,
+        385, 422, -157, 153,
+        -125, 382, -197, 386,
+        -263, 334, 228, 697,
+        -188, 1, 51, 297,
+        -507, 213, -376, 397,
+        -24, 255, -547, 89,
+        -502, -94, 387, 179,
+        -620, 68, -684, 112,
+        -642, -350, -260, 172,
+        -438, -324, 264, 648,
+        -964, -4, -1121, 7,
+        -134, 134, -1133, -306,
+        143, 96, -420, -497,
+        -1221, -350, -1527, -685,
+        -161, 72, 873, 691,
+        732, 283, 921, 353,
+        334, 475, 1095, 821,
+        864, 524, 843, 497,
+        714, 711, 788, 750,
+        1076, 714, 1204, 753
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] q_plsf_5.tab,  UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/qua_gain_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/qua_gain_tbl.cpp
new file mode 100644 (file)
index 0000000..116a1b4
--- /dev/null
@@ -0,0 +1,363 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: qua_gain_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "qua_gain_tbl.h"
+#include "qua_gain.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+
+    /* The tables contains the following data:
+     *
+     *    g_pitch        (Q14),
+     *    g_fac          (Q12), (g_code = g_code0*g_fac),
+     *    qua_ener_MR122 (Q10), (log2(g_fac))
+     *    qua_ener       (Q10)  (20*log10(g_fac))
+     *
+     *    The log2() and log10() values are calculated on the fixed point value
+     *    (g_fac Q12) and not on the original floating point value of g_fac
+     *    to make the quantizer/MA predictdor use corresponding values.
+     */
+
+    /* table used in 'high' rates: MR67 MR74 */
+
+    extern const Word16 table_gain_highrates[];
+    const Word16 table_gain_highrates[VQ_SIZE_HIGHRATES*4] =
+    {
+
+        /*
+         * Note: column 4 (qua_ener) contains the original values from IS641
+         *       to ensure bit-exactness; however, they are not exactly the
+         *       rounded value of (20*log10(g_fac))
+         *
+         */
+
+        /*g_pit,    g_fac,  qua_ener_MR122, qua_ener */
+        577,      662,           -2692,   -16214,
+        806,     1836,           -1185,    -7135,
+        3109,     1052,           -2008,   -12086,
+        4181,     1387,           -1600,    -9629,
+        2373,     1425,           -1560,    -9394,
+        3248,     1985,           -1070,    -6442,
+        1827,     2320,            -840,    -5056,
+        941,     3314,            -313,    -1885,
+        2351,     2977,            -471,    -2838,
+        3616,     2420,            -777,    -4681,
+        3451,     3096,            -414,    -2490,
+        2955,     4301,              72,      434,
+        1848,     4500,             139,      836,
+        3884,     5416,             413,     2484,
+        1187,     7210,             835,     5030,
+        3083,     9000,            1163,     7002,
+        7384,      883,           -2267,   -13647,
+        5962,     1506,           -1478,    -8900,
+        5155,     2134,            -963,    -5800,
+        7944,     2009,           -1052,    -6335,
+        6507,     2250,            -885,    -5327,
+        7670,     2752,            -588,    -3537,
+        5952,     3016,            -452,    -2724,
+        4898,     3764,            -125,     -751,
+        6989,     3588,            -196,    -1177,
+        8174,     3978,             -43,     -260,
+        6064,     4404,             107,      645,
+        7709,     5087,             320,     1928,
+        5523,     6021,             569,     3426,
+        7769,     7126,             818,     4926,
+        6060,     7938,             977,     5885,
+        5594,    11487,            1523,     9172,
+        10581,     1356,           -1633,    -9831,
+        9049,     1597,           -1391,    -8380,
+        9794,     2035,           -1033,    -6220,
+        8946,     2415,            -780,    -4700,
+        10296,     2584,            -681,    -4099,
+        9407,     2734,            -597,    -3595,
+        8700,     3218,            -356,    -2144,
+        9757,     3395,            -277,    -1669,
+        10177,     3892,             -75,     -454,
+        9170,     4528,             148,      891,
+        10152,     5004,             296,     1781,
+        9114,     5735,             497,     2993,
+        10500,     6266,             628,     3782,
+        10110,     7631,             919,     5534,
+        8844,     8727,            1117,     6728,
+        8956,    12496,            1648,     9921,
+        12924,      976,           -2119,   -12753,
+        11435,     1755,           -1252,    -7539,
+        12138,     2328,            -835,    -5024,
+        11388,     2368,            -810,    -4872,
+        10700,     3064,            -429,    -2580,
+        12332,     2861,            -530,    -3192,
+        11722,     3327,            -307,    -1848,
+        11270,     3700,            -150,     -904,
+        10861,     4413,             110,      663,
+        12082,     4533,             150,      902,
+        11283,     5205,             354,     2132,
+        11960,     6305,             637,     3837,
+        11167,     7534,             900,     5420,
+        12128,     8329,            1049,     6312,
+        10969,    10777,            1429,     8604,
+        10300,    17376,            2135,    12853,
+        13899,     1681,           -1316,    -7921,
+        12580,     2045,           -1026,    -6179,
+        13265,     2439,            -766,    -4610,
+        14033,     2989,            -465,    -2802,
+        13452,     3098,            -413,    -2482,
+        12396,     3658,            -167,    -1006,
+        13510,     3780,            -119,     -713,
+        12880,     4272,              62,      374,
+        13533,     4861,             253,     1523,
+        12667,     5457,             424,     2552,
+        13854,     6106,             590,     3551,
+        13031,     6483,             678,     4084,
+        13557,     7721,             937,     5639,
+        12957,     9311,            1213,     7304,
+        13714,    11551,            1532,     9221,
+        12591,    15206,            1938,    11667,
+        15113,     1540,           -1445,    -8700,
+        15072,     2333,            -832,    -5007,
+        14527,     2511,            -723,    -4352,
+        14692,     3199,            -365,    -2197,
+        15382,     3560,            -207,    -1247,
+        14133,     3960,             -50,     -300,
+        15102,     4236,              50,      298,
+        14332,     4824,             242,     1454,
+        14846,     5451,             422,     2542,
+        15306,     6083,             584,     3518,
+        14329,     6888,             768,     4623,
+        15060,     7689,             930,     5602,
+        14406,     9426,            1231,     7413,
+        15387,     9741,            1280,     7706,
+        14824,    14271,            1844,    11102,
+        13600,    24939,            2669,    16067,
+        16396,     1969,           -1082,    -6517,
+        16817,     2832,            -545,    -3283,
+        15713,     2843,            -539,    -3248,
+        16104,     3336,            -303,    -1825,
+        16384,     3963,             -49,     -294,
+        16940,     4579,             165,      992,
+        15711,     4599,             171,     1030,
+        16222,     5448,             421,     2537,
+        16832,     6382,             655,     3945,
+        15745,     7141,             821,     4944,
+        16326,     7469,             888,     5343,
+        16611,     8624,            1100,     6622,
+        17028,    10418,            1379,     8303,
+        15905,    11817,            1565,     9423,
+        16878,    14690,            1887,    11360,
+        16515,    20870,            2406,    14483,
+        18142,     2083,            -999,    -6013,
+        19401,     3178,            -375,    -2257,
+        17508,     3426,            -264,    -1589,
+        20054,     4027,             -25,     -151,
+        18069,     4249,              54,      326,
+        18952,     5066,             314,     1890,
+        17711,     5402,             409,     2461,
+        19835,     6192,             610,     3676,
+        17950,     7014,             795,     4784,
+        21318,     7877,             966,     5816,
+        17910,     9289,            1210,     7283,
+        19144,     9290,            1210,     7284,
+        20517,    11381,            1510,     9089,
+        18075,    14485,            1866,    11234,
+        19999,    17882,            2177,    13108,
+        18842,    32764,            3072,    18494
+    };
+
+
+    /* table used in 'low' rates: MR475, MR515, MR59 */
+
+    extern const Word16 table_gain_lowrates[];
+    const Word16 table_gain_lowrates[VQ_SIZE_LOWRATES*4] =
+    {
+        /*g_pit,    g_fac,  qua_ener_MR122, qua_ener */
+        10813,    28753,            2879,    17333,
+        20480,     2785,            -570,    -3431,
+        18841,     6594,             703,     4235,
+        6225,     7413,             876,     5276,
+        17203,    10444,            1383,     8325,
+        21626,     1269,           -1731,   -10422,
+        21135,     4423,             113,      683,
+        11304,     1556,           -1430,    -8609,
+        19005,    12820,            1686,    10148,
+        17367,     2498,            -731,    -4398,
+        17858,     4833,             244,     1472,
+        9994,     2498,            -731,    -4398,
+        17530,     7864,             964,     5802,
+        14254,     1884,           -1147,    -6907,
+        15892,     3153,            -387,    -2327,
+        6717,     1802,           -1213,    -7303,
+        18186,    20193,            2357,    14189,
+        18022,     3031,            -445,    -2678,
+        16711,     5857,             528,     3181,
+        8847,     4014,             -30,     -180,
+        15892,     8970,            1158,     6972,
+        18022,     1392,           -1594,    -9599,
+        16711,     4096,               0,        0,
+        8192,      655,           -2708,   -16305,
+        15237,    13926,            1808,    10884,
+        14254,     3112,            -406,    -2444,
+        14090,     4669,             193,     1165,
+        5406,     2703,            -614,    -3697,
+        13434,     6553,             694,     4180,
+        12451,      901,           -2237,   -13468,
+        12451,     2662,            -637,    -3833,
+        3768,      655,           -2708,   -16305,
+        14745,    23511,            2582,    15543,
+        19169,     2457,            -755,    -4546,
+        20152,     5079,             318,     1913,
+        6881,     4096,               0,        0,
+        20480,     8560,            1089,     6556,
+        19660,      737,           -2534,   -15255,
+        19005,     4259,              58,      347,
+        7864,     2088,            -995,    -5993,
+        11468,    12288,            1623,     9771,
+        15892,     1474,           -1510,    -9090,
+        15728,     4628,             180,     1086,
+        9175,     1433,           -1552,    -9341,
+        16056,     7004,             793,     4772,
+        14827,      737,           -2534,   -15255,
+        15073,     2252,            -884,    -5321,
+        5079,     1228,           -1780,   -10714,
+        13271,    17326,            2131,    12827,
+        16547,     2334,            -831,    -5002,
+        15073,     5816,             518,     3118,
+        3932,     3686,            -156,     -938,
+        14254,     8601,            1096,     6598,
+        16875,      778,           -2454,   -14774,
+        15073,     3809,            -107,     -646,
+        6062,      614,           -2804,   -16879,
+        9338,     9256,            1204,     7251,
+        13271,     1761,           -1247,    -7508,
+        13271,     3522,            -223,    -1343,
+        2457,     1966,           -1084,    -6529,
+        11468,     5529,             443,     2668,
+        10485,      737,           -2534,   -15255,
+        11632,     3194,            -367,    -2212,
+        1474,      778,           -2454,   -14774
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] qua_gain.tab,  UMTS GSM AMR speech codec,
+                    R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/r_fft.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/r_fft.cpp
new file mode 100644 (file)
index 0000000..a528838
--- /dev/null
@@ -0,0 +1,570 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: r_fft.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "oper_32b.h"
+#include "vad2.h"
+#include "sub.h"
+#include "add.h"
+#include "shr.h"
+#include "shl.h"
+#include "l_mult.h"
+#include "l_mac.h"
+#include "l_msu.h"
+#include "round.h"
+#include "l_negate.h"
+#include "l_deposit_h.h"
+#include "l_shr.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define         SIZE            128
+#define         SIZE_BY_TWO     64
+#define         NUM_STAGE       6
+#define         TRUE            1
+#define         FALSE           0
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+const Word16 phs_tbl[] =
+{
+
+    32767,       0,  32729,  -1608,  32610,  -3212,  32413,  -4808,
+    32138,   -6393,  31786,  -7962,  31357,  -9512,  30853, -11039,
+    30274,  -12540,  29622, -14010,  28899, -15447,  28106, -16846,
+    27246,  -18205,  26320, -19520,  25330, -20788,  24279, -22006,
+    23170,  -23170,  22006, -24279,  20788, -25330,  19520, -26320,
+    18205,  -27246,  16846, -28106,  15447, -28899,  14010, -29622,
+    12540,  -30274,  11039, -30853,   9512, -31357,   7962, -31786,
+    6393,  -32138,   4808, -32413,   3212, -32610,   1608, -32729,
+    0,  -32768,  -1608, -32729,  -3212, -32610,  -4808, -32413,
+    -6393, -32138,  -7962, -31786,  -9512, -31357, -11039, -30853,
+    -12540, -30274, -14010, -29622, -15447, -28899, -16846, -28106,
+    -18205, -27246, -19520, -26320, -20788, -25330, -22006, -24279,
+    -23170, -23170, -24279, -22006, -25330, -20788, -26320, -19520,
+    -27246, -18205, -28106, -16846, -28899, -15447, -29622, -14010,
+    -30274, -12540, -30853, -11039, -31357,  -9512, -31786,  -7962,
+    -32138,  -6393, -32413,  -4808, -32610,  -3212, -32729,  -1608
+
+};
+
+const Word16 ii_table[] =
+    {SIZE / 2, SIZE / 4, SIZE / 8, SIZE / 16, SIZE / 32, SIZE / 64};
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: c_fft
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    farray_ptr = pointer to complex array that the FFT operates on of type
+                 Word16.
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow = 1 if the math functions called by cor_h_x2 result in overflow
+    else zero.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This is an implementation of decimation-in-time FFT algorithm for
+ real sequences.  The techniques used here can be found in several
+ books, e.g., i) Proakis and Manolakis, "Digital Signal Processing",
+ 2nd Edition, Chapter 9, and ii) W.H. Press et. al., "Numerical
+ Recipes in C", 2nd Ediiton, Chapter 12.
+
+ Input -  There is one input to this function:
+
+   1) An integer pointer to the input data array
+
+ Output - There is no return value.
+   The input data are replaced with transformed data.  If the
+   input is a real time domain sequence, it is replaced with
+   the complex FFT for positive frequencies.  The FFT value
+   for DC and the foldover frequency are combined to form the
+   first complex number in the array.  The remaining complex
+   numbers correspond to increasing frequencies.  If the input
+   is a complex frequency domain sequence arranged as above,
+   it is replaced with the corresponding time domain sequence.
+
+ Notes:
+
+   1) This function is designed to be a part of a VAD
+      algorithm that requires 128-point FFT of real
+      sequences.  This is achieved here through a 64-point
+      complex FFT.  Consequently, the FFT size information is
+      not transmitted explicitly.  However, some flexibility
+      is provided in the function to change the size of the
+      FFT by specifying the size information through "define"
+      statements.
+
+   2) The values of the complex sinusoids used in the FFT
+      algorithm are stored in a ROM table.
+
+   3) In the c_fft function, the FFT values are divided by
+      2 after each stage of computation thus dividing the
+      final FFT values by 64.  This is somewhat different
+          from the usual definition of FFT where the factor 1/N,
+          i.e., 1/64, used for the IFFT and not the FFT.  No factor
+          is used in the r_fft function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ r_fft.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+The original etsi reference code uses a global flag Overflow. However, in the
+actual implementation a pointer to a the overflow flag is passed in.
+
+void c_fft(Word16 * farray_ptr)
+{
+    Word16 i, j, k, ii, jj, kk, ji, kj, ii2;
+    Word32 ftmp, ftmp_real, ftmp_imag;
+    Word16 tmp, tmp1, tmp2;
+
+    // Rearrange the input array in bit reversed order
+    for (i = 0, j = 0; i < SIZE - 2; i = i + 2)
+    {
+        if (sub(j, i) > 0)
+        {
+            ftmp = *(farray_ptr + i);
+            *(farray_ptr + i) = *(farray_ptr + j);
+            *(farray_ptr + j) = ftmp;
+
+            ftmp = *(farray_ptr + i + 1);
+            *(farray_ptr + i + 1) = *(farray_ptr + j + 1);
+            *(farray_ptr + j + 1) = ftmp;
+        }
+
+        k = SIZE_BY_TWO;
+        while (sub(j, k) >= 0)
+        {
+            j = sub(j, k);
+            k = shr(k, 1);
+        }
+        j = add(j, k);
+    }
+
+    // The FFT part
+    for (i = 0; i < NUM_STAGE; i++)
+    {               // i is stage counter
+        jj = shl(2, i);     // FFT size
+        kk = shl(jj, 1);    // 2 * FFT size
+        ii = ii_table[i];   // 2 * number of FFT's
+        ii2 = shl(ii, 1);
+        ji = 0;         // ji is phase table index
+
+        for (j = 0; j < jj; j = j + 2)
+        {                   // j is sample counter
+
+            for (k = j; k < SIZE; k = k + kk)
+            {               // k is butterfly top
+                kj = add(k, jj);    // kj is butterfly bottom
+
+                // Butterfly computations
+                ftmp_real = L_mult(*(farray_ptr + kj), phs_tbl[ji]);
+                ftmp_real = L_msu(ftmp_real, *(farray_ptr + kj + 1), phs_tbl[ji + 1]);
+
+                ftmp_imag = L_mult(*(farray_ptr + kj + 1), phs_tbl[ji]);
+                ftmp_imag = L_mac(ftmp_imag, *(farray_ptr + kj), phs_tbl[ji + 1]);
+
+                tmp1 = pv_round(ftmp_real);
+                tmp2 = pv_round(ftmp_imag);
+
+                tmp = sub(*(farray_ptr + k), tmp1);
+                *(farray_ptr + kj) = shr(tmp, 1);
+
+                tmp = sub(*(farray_ptr + k + 1), tmp2);
+                *(farray_ptr + kj + 1) = shr(tmp, 1);
+
+                tmp = add(*(farray_ptr + k), tmp1);
+                *(farray_ptr + k) = shr(tmp, 1);
+
+                tmp = add(*(farray_ptr + k + 1), tmp2);
+                *(farray_ptr + k + 1) = shr(tmp, 1);
+            }
+
+            ji =  add(ji, ii2);
+        }
+    }
+}                               // end of c_fft ()
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/* FFT function for complex sequences */
+/*
+ * The decimation-in-time complex FFT is implemented below.
+ * The input complex numbers are presented as real part followed by
+ * imaginary part for each sample.  The counters are therefore
+ * incremented by two to access the complex valued samples.
+ */
+
+void c_fft(Word16 * farray_ptr, Flag *pOverflow)
+{
+
+    Word16 i;
+    Word16 j;
+    Word16 k;
+    Word16 ii;
+    Word16 jj;
+    Word16 kk;
+    Word16 ji;
+    Word16 kj;
+    Word16 ii2;
+    Word32 ftmp;
+    Word32 ftmp_real;
+    Word32 ftmp_imag;
+    Word16 tmp;
+    Word16 tmp1;
+    Word16 tmp2;
+
+    /* Rearrange the input array in bit reversed order */
+    for (i = 0, j = 0; i < SIZE - 2; i = i + 2)
+    {
+        if (j > i)
+        {
+            ftmp = *(farray_ptr + i);
+            *(farray_ptr + i) = *(farray_ptr + j);
+            *(farray_ptr + j) = (Word16)ftmp;
+
+            ftmp = *(farray_ptr + i + 1);
+            *(farray_ptr + i + 1) = *(farray_ptr + j + 1);
+            *(farray_ptr + j + 1) = (Word16)ftmp;
+        }
+
+        k = SIZE_BY_TWO;
+        while (j >= k)
+        {
+            j = sub(j, k, pOverflow);
+            k = shr(k, 1, pOverflow);
+        }
+        j = add(j, k, pOverflow);
+    }
+
+    /* The FFT part */
+    for (i = 0; i < NUM_STAGE; i++)
+    {               /* i is stage counter */
+        jj = shl(2, i, pOverflow);     /* FFT size */
+        kk = shl(jj, 1, pOverflow);    /* 2 * FFT size */
+        ii = ii_table[i];   /* 2 * number of FFT's */
+        ii2 = shl(ii, 1, pOverflow);
+        ji = 0;         /* ji is phase table index */
+
+        for (j = 0; j < jj; j = j + 2)
+        {                   /* j is sample counter */
+
+            for (k = j; k < SIZE; k = k + kk)
+            {               /* k is butterfly top */
+                kj = add(k, jj, pOverflow);    /* kj is butterfly bottom */
+
+                /* Butterfly computations */
+                ftmp_real = L_mult(*(farray_ptr + kj), phs_tbl[ji], pOverflow);
+                ftmp_real = L_msu(ftmp_real, *(farray_ptr + kj + 1),
+                                  phs_tbl[ji + 1], pOverflow);
+
+                ftmp_imag = L_mult(*(farray_ptr + kj + 1),
+                                   phs_tbl[ji], pOverflow);
+                ftmp_imag = L_mac(ftmp_imag, *(farray_ptr + kj),
+                                  phs_tbl[ji + 1], pOverflow);
+
+                tmp1 = pv_round(ftmp_real, pOverflow);
+                tmp2 = pv_round(ftmp_imag, pOverflow);
+
+                tmp = sub(*(farray_ptr + k), tmp1, pOverflow);
+                *(farray_ptr + kj) = shr(tmp, 1, pOverflow);
+
+                tmp = sub(*(farray_ptr + k + 1), tmp2, pOverflow);
+                *(farray_ptr + kj + 1) = shr(tmp, 1, pOverflow);
+
+                tmp = add(*(farray_ptr + k), tmp1, pOverflow);
+                *(farray_ptr + k) = shr(tmp, 1, pOverflow);
+
+                tmp = add(*(farray_ptr + k + 1), tmp2, pOverflow);
+                *(farray_ptr + k + 1) = shr(tmp, 1, pOverflow);
+            }
+
+            ji =  add(ji, ii2, pOverflow);
+        }
+    }
+}                               /* end of c_fft () */
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: r_fft
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    farray_ptr = pointer to complex array that the FFT operates on of type
+                 Word16.
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow = 1 if the math functions called by cor_h_x2 result in overflow
+    else zero.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This is an implementation of decimation-in-time FFT algorithm for
+ real sequences.  The techniques used here can be found in several
+ books, e.g., i) Proakis and Manolakis, "Digital Signal Processing",
+ 2nd Edition, Chapter 9, and ii) W.H. Press et. al., "Numerical
+ Recipes in C", 2nd Ediiton, Chapter 12.
+
+ Input -  There is one input to this function:
+
+   1) An integer pointer to the input data array
+
+ Output - There is no return value.
+   The input data are replaced with transformed data.  If the
+   input is a real time domain sequence, it is replaced with
+   the complex FFT for positive frequencies.  The FFT value
+   for DC and the foldover frequency are combined to form the
+   first complex number in the array.  The remaining complex
+   numbers correspond to increasing frequencies.  If the input
+   is a complex frequency domain sequence arranged as above,
+   it is replaced with the corresponding time domain sequence.
+
+ Notes:
+
+   1) This function is designed to be a part of a VAD
+      algorithm that requires 128-point FFT of real
+      sequences.  This is achieved here through a 64-point
+      complex FFT.  Consequently, the FFT size information is
+      not transmitted explicitly.  However, some flexibility
+      is provided in the function to change the size of the
+      FFT by specifying the size information through "define"
+      statements.
+
+   2) The values of the complex sinusoids used in the FFT
+      algorithm are stored in a ROM table.
+
+   3) In the c_fft function, the FFT values are divided by
+      2 after each stage of computation thus dividing the
+      final FFT values by 64.  This is somewhat different
+          from the usual definition of FFT where the factor 1/N,
+          i.e., 1/64, used for the IFFT and not the FFT.  No factor
+          is used in the r_fft function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ r_fft.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+The original etsi reference code uses a global flag Overflow. However, in the
+actual implementation a pointer to a the overflow flag is passed in.
+
+void r_fft(Word16 * farray_ptr)
+{
+
+    Word16 ftmp1_real, ftmp1_imag, ftmp2_real, ftmp2_imag;
+    Word32 Lftmp1_real, Lftmp1_imag;
+    Word16 i, j;
+    Word32 Ltmp1;
+
+    // Perform the complex FFT
+    c_fft(farray_ptr);
+
+    // First, handle the DC and foldover frequencies
+    ftmp1_real = *farray_ptr;
+    ftmp2_real = *(farray_ptr + 1);
+    *farray_ptr = add(ftmp1_real, ftmp2_real);
+    *(farray_ptr + 1) = sub(ftmp1_real, ftmp2_real);
+
+    // Now, handle the remaining positive frequencies
+    for (i = 2, j = SIZE - i; i <= SIZE_BY_TWO; i = i + 2, j = SIZE - i)
+    {
+        ftmp1_real = add(*(farray_ptr + i), *(farray_ptr + j));
+        ftmp1_imag = sub(*(farray_ptr + i + 1), *(farray_ptr + j + 1));
+        ftmp2_real = add(*(farray_ptr + i + 1), *(farray_ptr + j + 1));
+        ftmp2_imag = sub(*(farray_ptr + j), *(farray_ptr + i));
+
+        Lftmp1_real = L_deposit_h(ftmp1_real);
+        Lftmp1_imag = L_deposit_h(ftmp1_imag);
+
+        Ltmp1 = L_mac(Lftmp1_real, ftmp2_real, phs_tbl[i]);
+        Ltmp1 = L_msu(Ltmp1, ftmp2_imag, phs_tbl[i + 1]);
+        *(farray_ptr + i) = pv_round(L_shr(Ltmp1, 1));
+
+        Ltmp1 = L_mac(Lftmp1_imag, ftmp2_imag, phs_tbl[i]);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_real, phs_tbl[i + 1]);
+        *(farray_ptr + i + 1) = pv_round(L_shr(Ltmp1, 1));
+
+        Ltmp1 = L_mac(Lftmp1_real, ftmp2_real, phs_tbl[j]);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_imag, phs_tbl[j + 1]);
+        *(farray_ptr + j) = pv_round(L_shr(Ltmp1, 1));
+
+        Ltmp1 = L_negate(Lftmp1_imag);
+        Ltmp1 = L_msu(Ltmp1, ftmp2_imag, phs_tbl[j]);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_real, phs_tbl[j + 1]);
+        *(farray_ptr + j + 1) = pv_round(L_shr(Ltmp1, 1));
+
+    }
+}                               // end r_fft ()
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/* FFT function for complex sequences */
+/*
+ * The decimation-in-time complex FFT is implemented below.
+ * The input complex numbers are presented as real part followed by
+ * imaginary part for each sample.  The counters are therefore
+ * incremented by two to access the complex valued samples.
+ */
+void r_fft(Word16 * farray_ptr, Flag *pOverflow)
+{
+
+    Word16 ftmp1_real;
+    Word16 ftmp1_imag;
+    Word16 ftmp2_real;
+    Word16 ftmp2_imag;
+    Word32 Lftmp1_real;
+    Word32 Lftmp1_imag;
+    Word16 i;
+    Word16 j;
+    Word32 Ltmp1;
+
+    /* Perform the complex FFT */
+    c_fft(farray_ptr, pOverflow);
+
+    /* First, handle the DC and foldover frequencies */
+    ftmp1_real = *farray_ptr;
+    ftmp2_real = *(farray_ptr + 1);
+    *farray_ptr = add(ftmp1_real, ftmp2_real, pOverflow);
+    *(farray_ptr + 1) = sub(ftmp1_real, ftmp2_real, pOverflow);
+
+    /* Now, handle the remaining positive frequencies */
+    for (i = 2, j = SIZE - i; i <= SIZE_BY_TWO; i = i + 2, j = SIZE - i)
+    {
+        ftmp1_real = add(*(farray_ptr + i), *(farray_ptr + j), pOverflow);
+        ftmp1_imag = sub(*(farray_ptr + i + 1),
+                         *(farray_ptr + j + 1), pOverflow);
+        ftmp2_real = add(*(farray_ptr + i + 1),
+                         *(farray_ptr + j + 1), pOverflow);
+        ftmp2_imag = sub(*(farray_ptr + j),
+                         *(farray_ptr + i), pOverflow);
+
+        Lftmp1_real = L_deposit_h(ftmp1_real);
+        Lftmp1_imag = L_deposit_h(ftmp1_imag);
+
+        Ltmp1 = L_mac(Lftmp1_real, ftmp2_real, phs_tbl[i], pOverflow);
+        Ltmp1 = L_msu(Ltmp1, ftmp2_imag, phs_tbl[i + 1], pOverflow);
+        *(farray_ptr + i) = pv_round(L_shr(Ltmp1, 1, pOverflow), pOverflow);
+
+        Ltmp1 = L_mac(Lftmp1_imag, ftmp2_imag, phs_tbl[i], pOverflow);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_real, phs_tbl[i + 1], pOverflow);
+        *(farray_ptr + i + 1) = pv_round(L_shr(Ltmp1, 1, pOverflow), pOverflow);
+
+        Ltmp1 = L_mac(Lftmp1_real, ftmp2_real, phs_tbl[j], pOverflow);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_imag, phs_tbl[j + 1], pOverflow);
+        *(farray_ptr + j) = pv_round(L_shr(Ltmp1, 1, pOverflow), pOverflow);
+
+        Ltmp1 = L_negate(Lftmp1_imag);
+        Ltmp1 = L_msu(Ltmp1, ftmp2_imag, phs_tbl[j], pOverflow);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_real, phs_tbl[j + 1], pOverflow);
+        *(farray_ptr + j + 1) = pv_round(L_shr(Ltmp1, 1, pOverflow), pOverflow);
+
+    }
+}                               /* end r_fft () */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/reorder.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/reorder.cpp
new file mode 100644 (file)
index 0000000..0f932e5
--- /dev/null
@@ -0,0 +1,168 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: reorder.cpp
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "reorder.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Reorder_lsf
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsf = vector of LSFs   (range: 0<=val<=0.5)(Word16)
+    min_dist = minimum required distance (Word16)
+    n = LPC order (Word16)
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the add operation called by Reorder_lsf() results in
+     overflow
+    lsf -> reordered vector of LSFs (Word16)
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function makes sure that the LSFs are properly ordered keeps a certain
+ minimum distance between adjacent LSFs.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] reorder.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Reorder_lsf (
+    Word16 *lsf,        // (i/o)     : vector of LSFs   (range: 0<=val<=0.5)
+    Word16 min_dist,    // (i)       : minimum required distance
+    Word16 n            // (i)       : LPC order
+)
+{
+    Word16 i;
+    Word16 lsf_min;
+
+// The reference ETSI code uses a global flag for Overflow. In the actual
+// implementation a pointer to Overflow flag is passed into the function
+// for use by the math functions add() and sub()
+
+    lsf_min = min_dist;
+    for (i = 0; i < n; i++)
+    {
+        if (sub (lsf[i], lsf_min) < 0)
+        {
+            lsf[i] = lsf_min;
+        }
+        lsf_min = add (lsf[i], min_dist);
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+OSCL_EXPORT_REF void Reorder_lsf(
+    Word16 *lsf,        /* (i/o)    : vector of LSFs   (range: 0<=val<=0.5) */
+    Word16 min_dist,    /* (i)      : minimum required distance             */
+    Word16 n,           /* (i)      : LPC order                             */
+    Flag   *pOverflow   /* (i/o)    : Overflow flag                         */
+)
+{
+    Word16 i;
+    Word16 lsf_min;
+    Word16 *p_lsf = &lsf[0];
+    OSCL_UNUSED_ARG(pOverflow);
+
+    lsf_min = min_dist;
+    for (i = 0; i < n; i++)
+    {
+        if (*(p_lsf) < lsf_min)
+        {
+            *(p_lsf++) = lsf_min;
+            lsf_min +=  min_dist;
+        }
+        else
+        {
+            lsf_min = *(p_lsf++) + min_dist;
+        }
+    }
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp
new file mode 100644 (file)
index 0000000..787e043
--- /dev/null
@@ -0,0 +1,205 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: residu.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "residu.h"
+#include "typedef.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Residu
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    coef_ptr = pointer to buffer containing the prediction coefficients
+    input_ptr = pointer to buffer containing the speech signal
+    input_len = filter order
+    residual_ptr = pointer to buffer of residual signal
+
+ Outputs:
+    residual_ptr buffer contains the newly calculated the residual signal
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes the LP residual by filtering the input speech through
+ the LP inverse filter A(z).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ residu.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ Note: Input argument names were changed to be more descriptive. Shown below
+       are the original names. Shown below are the name changes:
+           a[]  <-->  coef_ptr[]
+           x[]  <-->  input_ptr[]
+           y[]  <-->  residual_ptr[]
+           lg   <-->  input_len
+
+
+void Residu (
+    Word16 a[], // (i)     : prediction coefficients
+    Word16 x[], // (i)     : speech signal
+    Word16 y[], // (o)     : residual signal
+    Word16 lg   // (i)     : size of filtering
+)
+{
+    Word16 i, j;
+    Word32 s;
+
+    for (i = 0; i < lg; i++)
+    {
+        s = L_mult (x[i], a[0]);
+        for (j = 1; j <= M; j++)
+        {
+            s = L_mac (s, a[j], x[i - j]);
+        }
+        s = L_shl (s, 3);
+        y[i] = pv_round (s);
+    }
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Residu(
+    Word16 coef_ptr[],      /* (i)     : prediction coefficients*/
+    Word16 input_ptr[],     /* (i)     : speech signal          */
+    Word16 residual_ptr[],  /* (o)     : residual signal        */
+    Word16 input_len        /* (i)     : size of filtering      */
+)
+{
+
+
+    register Word16 i, j;
+    Word32 s1;
+    Word32 s2;
+    Word32 s3;
+    Word32 s4;
+    Word16 *p_input1;
+    Word16 *p_input2;
+    Word16 *p_input3;
+    Word16 *p_input4;
+    Word16 *p_coef;
+    Word16 *p_residual_ptr = &residual_ptr[input_len-1];
+    Word16 *p_input_ptr    = &input_ptr[input_len-1-M];
+
+    for (i = input_len >> 2; i != 0; i--)
+    {
+        s1       = 0x0000800L;
+        s2       = 0x0000800L;
+        s3       = 0x0000800L;
+        s4       = 0x0000800L;
+        p_coef  = &coef_ptr[M];
+        p_input1 = p_input_ptr--;
+        p_input2 = p_input_ptr--;
+        p_input3 = p_input_ptr--;
+        p_input4 = p_input_ptr--;
+
+        for (j = M >> 1; j != 0; j--)
+        {
+            s1 += ((Word32) * (p_coef) * *(p_input1++));
+            s2 += ((Word32) * (p_coef) * *(p_input2++));
+            s3 += ((Word32) * (p_coef) * *(p_input3++));
+            s4 += ((Word32) * (p_coef--) * *(p_input4++));
+            s1 += ((Word32) * (p_coef) * *(p_input1++));
+            s2 += ((Word32) * (p_coef) * *(p_input2++));
+            s3 += ((Word32) * (p_coef) * *(p_input3++));
+            s4 += ((Word32) * (p_coef--) * *(p_input4++));
+        }
+
+        s1 += (((Word32) * (p_coef)) * *(p_input1));
+        s2 += (((Word32) * (p_coef)) * *(p_input2));
+        s3 += (((Word32) * (p_coef)) * *(p_input3));
+        s4 += (((Word32) * (p_coef)) * *(p_input4));
+
+        *(p_residual_ptr--) = (Word16)(s1 >> 12);
+        *(p_residual_ptr--) = (Word16)(s2 >> 12);
+        *(p_residual_ptr--) = (Word16)(s3 >> 12);
+        *(p_residual_ptr--) = (Word16)(s4 >> 12);
+
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp
new file mode 100644 (file)
index 0000000..9fd4abb
--- /dev/null
@@ -0,0 +1,152 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: round.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ Rounding function with saturation.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: pv_round
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_var1 = 32 bit signed integer (Word32) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    None
+
+ Returns:
+        result = MS 16 bits of rounded input L_var1.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function rounds the lower 16 bits of the 32 bit input number into the
+ MS 16 bits with saturation. Shift the resulting bits right by 16 and return
+ the 16 bit number:
+    pv_round(L_var1) = extract_h(L_add(L_var1,32768))
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] round() function in basic_op2.c,  UMTS GSM AMR speech codec, R99 -
+ Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 pv_round (Word32 L_var1)
+{
+    Word16 var_out;
+    Word32 L_rounded;
+
+* The reference ETSI code uses a global flag for Overflow in the L_add() function.
+* In the actual implementation a pointer to Overflow flag is passed in as a
+* parameter to the function.
+
+    L_rounded = L_add (L_var1, (Word32) 0x00008000L);
+#if (WMOPS)
+    multiCounter[currCounter].L_add--;
+#endif
+    var_out = extract_h (L_rounded);
+#if (WMOPS)
+    multiCounter[currCounter].extract_h--;
+    multiCounter[currCounter].round++;
+#endif
+    return (var_out);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+OSCL_EXPORT_REF Word16 pv_round(register Word32 L_var1, Flag *pOverflow)
+{
+    Word16  result;
+
+    L_var1 = L_add(L_var1, (Word32) 0x00008000L, pOverflow);
+    result = (Word16)(L_var1 >> 16);
+
+    return (result);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/set_zero.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/set_zero.cpp
new file mode 100644 (file)
index 0000000..be23b25
--- /dev/null
@@ -0,0 +1,74 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : set_zero.h
+*
+********************************************************************************
+*/
+/*
+********************************************************************************
+*                         MODULE INCLUDE FILE AND VERSION ID
+********************************************************************************
+*/
+#include "set_zero.h"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+#include "basic_op.h"
+
+/*
+********************************************************************************
+*                         PUBLIC PROGRAM CODE
+********************************************************************************
+*/
+void Set_zero(
+    Word16 x[],         /* (o)    : vector to clear     */
+    Word16 L            /* (i)    : length of vector    */
+)
+{
+    Word16 i;
+
+    for (i = 0; i < L; i++)
+    {
+        x[i] = 0;
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp
new file mode 100644 (file)
index 0000000..a0fbd35
--- /dev/null
@@ -0,0 +1,201 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: shr.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+ Shift right function with overflow control
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: shr
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+    var2 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the shift operation resulted in overflow
+
+ Returns:
+    product = Shifted result limited to 16 bits (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function arithmetically shifts the 16 bit input var1 right var2 positions
+ with sign extension. If var2 is negative, arithmetically shift var1 left by
+ -var2 with sign extension. Saturate the result in case of underflows or
+ overflows.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+ None
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] shr() function in basic_op2.c,  UMTS GSM AMR speech codec, R99 -
+ Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 shr_std (Word16 var1, Word16 var2)
+{
+    Word16 var_out;
+
+    if (var2 < 0)
+    {
+        if (var2 < -16)
+            var2 = -16;
+        var_out = shl_std (var1, -var2);
+#if (WMOPS)
+        mult_stdiCounter[currCounter].shl_std--;
+#endif
+    }
+    else
+    {
+        if (var2 >= 15)
+        {
+            var_out = (var1 < 0) ? -1 : 0;
+        }
+        else
+        {
+            if (var1 < 0)
+            {
+                var_out = ~((~var1) >> var2);
+            }
+            else
+            {
+                var_out = var1 >> var2;
+            }
+        }
+    }
+
+#if (WMOPS)
+    mult_stdiCounter[currCounter].shr_std++;
+#endif
+    return (var_out);
+}
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+OSCL_EXPORT_REF Word16 shr(register Word16 var1, register Word16 var2, Flag *pOverflow)
+{
+    register Word16 result;
+
+    if (var2 != 0)
+    {
+        if (var2 > 0)
+        {
+            if (var2 > 15)
+            {
+                var2 = 15;
+            }
+
+            result = var1 >> var2;
+
+        }
+        else
+        {
+            var2 = -var2;   /* Shift right negative is equivalent */
+
+            if (var2 > 15)
+            {
+                var2 = 15;
+            }
+
+            result = (var1 << var2);
+            if ((result >> var2) != var1)
+            {
+                *pOverflow = 1;
+                result = ((var1 > 0) ? MAX_16 : MIN_16);
+            }
+        }
+
+    }
+    else
+    {
+        result = var1;
+    }
+
+    return (result);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp
new file mode 100644 (file)
index 0000000..b403885
--- /dev/null
@@ -0,0 +1,193 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: shr_r.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+    var2 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    var_out = shifted input w/ rounding (Word16)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function arithmetically shifts the 16 bit input var1 right var2 positions
+ with rounding. If var2 is negative, arithmetically shift var1 left by
+ -var2 with rounding. Saturate the result in case of underflows or
+ overflows.
+
+    - If var2 is greater than zero :
+        if (sub(shl(shr(var1,var2),1),shr(var1,sub(var2,1))))
+        is equal to zero
+        then
+            shr_r(var1,var2) = shr(var1,var2)
+        else
+            shr_r(var1,var2) = add(shr(var1,var2),1)
+    - If var2 is less than or equal to zero :
+        shr_r(var1,var2) = shr(var1,var2).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 shr_r (Word16 var1, Word16 var2)
+{
+    Word16 var_out;
+
+    if (var2 > 15)
+    {
+        var_out = 0;
+    }
+    else
+    {
+        var_out = shr (var1, var2);
+#if (WMOPS)
+        multiCounter[currCounter].shr--;
+#endif
+
+        if (var2 > 0)
+        {
+            if ((var1 & ((Word16) 1 << (var2 - 1))) != 0)
+            {
+                var_out++;
+            }
+        }
+    }
+#if (WMOPS)
+    multiCounter[currCounter].shr_r++;
+#endif
+    return (var_out);
+}
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+OSCL_EXPORT_REF Word16 shr_r(register Word16 var1, register Word16 var2, Flag *pOverflow)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+    Word16 var_out;
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+    if (var2 > 15)
+    {
+        var_out = 0;
+    }
+    else
+    {
+        var_out = shr(var1, var2, pOverflow);
+        if (var2 > 0)
+        {
+            if ((var1 & ((Word16) 1 << (var2 - 1))) != 0)
+            {
+                var_out++;
+            }
+        }
+    }
+
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+    return (var_out);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l.cpp
new file mode 100644 (file)
index 0000000..6038388
--- /dev/null
@@ -0,0 +1,235 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: sqrt_l.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "sqrt_l.h"
+#include    "typedef.h"
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: sqrt_l_exp
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_x = input value (Word32)
+    pExp = pointer to right shift to be applied to result
+    pOverflow = pointer to overflow flag
+
+ Outputs:
+    pOverflow -> if the Inv_sqrt operation resulted in an overflow.
+
+ Returns:
+    L_y = squareroot of L_x (Word32)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes sqrt(L_x),  where  L_x is positive.
+ If L_var is negative or zero, the result is 0
+
+ The function sqrt(L_x) is approximated by a table and linear
+ interpolation. The square root is computed using the
+ following steps:
+    1- Normalization of L_x.
+    2- If exponent is even then shift right once.
+    3- exponent = exponent/2
+    4- i = bit25-b31 of L_x;  16<=i<=63  because of normalization.
+    5- a = bit10-b24
+    6- i -=16
+    7- L_y = table[i]<<16 - (table[i] - table[i+1]) * a * 2
+    8- return L_y and exponent so caller can do denormalization
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sqrt_l.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word32 sqrt_l_exp (     // o : output value
+    Word32 L_x,         // i : input value
+    Word16 *exp         // o : right shift to be applied to result
+)
+{
+
+//          y = sqrt(x)
+//          x = f * 2^-e,   0.5 <= f < 1   (normalization)
+//          y = sqrt(f) * 2^(-e/2)
+//
+//          a) e = 2k   --> y = sqrt(f)   * 2^-k  (k = e div 2,
+//                                                 0.707 <= sqrt(f) < 1)
+//          b) e = 2k+1 --> y = sqrt(f/2) * 2^-k  (k = e div 2,
+                                                 0.5 <= sqrt(f/2) < 0.707)
+
+
+    Word16 e, i, a, tmp;
+    Word32 L_y;
+
+    if (L_x <= (Word32) 0)
+    {
+        *exp = 0;
+        return (Word32) 0;
+    }
+
+* The reference ETSI code uses a global Overflow flag. In the actual
+* implementation a pointer to the overflow flag is passed into the function.
+* This pointer is in turn passed into the basic math functions such as add(),
+* L_shl(), L_shr(), sub() called by this module.
+
+    e = norm_l (L_x) & 0xFFFE;              // get next lower EVEN norm. exp
+    L_x = L_shl (L_x, e);                   // L_x is normalized to [0.25..1)
+    *exp = e;                               // return 2*exponent (or Q1)
+
+    L_x = L_shr (L_x, 9);
+    i = extract_h (L_x);                    // Extract b25-b31, 16 <= i <= 63
+                                                because of normalization
+    L_x = L_shr (L_x, 1);
+    a = extract_l (L_x);                    // Extract b10-b24
+    a = a & (Word16) 0x7fff;
+
+    i = sub (i, 16);                        // 0 <= i <= 47
+
+    L_y = L_deposit_h (table[i]);           // table[i] << 16
+    tmp = sub (table[i], table[i + 1]);     // table[i] - table[i+1])
+    L_y = L_msu (L_y, tmp, a);              // L_y -= tmp*a*2
+
+    return (L_y);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF Word32 sqrt_l_exp(      /* o : output value,          Q31 */
+    Word32 L_x,         /* i : input value,                           Q31 */
+    Word16 *pExp,       /* o : right shift to be applied to result,   Q1  */
+    Flag   *pOverflow   /* i : pointer to overflow flag */
+)
+
+{
+    Word16 e;
+    Word16 i;
+    Word16 a;
+    Word16 tmp;
+    Word32 L_y;
+
+    /*
+          y = sqrt(x)
+          x = f * 2^-e,   0.5 <= f < 1   (normalization)
+          y = sqrt(f) * 2^(-e/2)
+          a) e = 2k   --> y = sqrt(f)   * 2^-k  (k = e div 2,
+                                                 0.707 <= sqrt(f) < 1)
+          b) e = 2k+1 --> y = sqrt(f/2) * 2^-k  (k = e div 2,
+                                                 0.5 <= sqrt(f/2) < 0.707)
+     */
+
+    if (L_x <= (Word32) 0)
+    {
+        *pExp = 0;
+        return (Word32) 0;
+    }
+
+    e = norm_l(L_x) & 0xFFFE;               /* get next lower EVEN norm. exp  */
+    L_x = L_shl(L_x, e, pOverflow);         /* L_x is normalized to [0.25..1) */
+    *pExp = e;                              /* return 2*exponent (or Q1)      */
+
+    L_x >>= 10;
+    i = (Word16)(L_x >> 15) & 63;            /* Extract b25-b31, 16<= i <=63  */
+    /* because of normalization       */
+
+    a = (Word16)(L_x);                      /* Extract b10-b24 */
+    a &= (Word16) 0x7fff;
+
+    if (i > 15)
+    {
+        i -= 16;                              /* 0 <= i <= 47                   */
+    }
+
+    L_y = ((Word32) sqrt_l_tbl[i] << 16);      /* sqrt_l_tbl[i] << 16            */
+
+    /* sqrt_l_tbl[i] - sqrt_l_tbl[i+1]) */
+    tmp = sqrt_l_tbl[i] - sqrt_l_tbl[i + 1];
+
+    L_y = L_msu(L_y, tmp, a, pOverflow);    /* L_y -= tmp*a*2                 */
+
+    /* L_y = L_shr (L_y, *exp); */          /* denormalization done by caller */
+
+    return (L_y);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l_tbl.cpp
new file mode 100644 (file)
index 0000000..8b91771
--- /dev/null
@@ -0,0 +1,141 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: sqrt_l_tbl.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the declaration for sqrt_l_table[] used by the sqrt_l_exp
+ function.
+
+    sqrt_l_tbl[i] = sqrt((i+16)*2^-6) * 2^15, i.e. sqrt(x) scaled Q15
+
+ ------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "sqrt_l.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+    const Word16 sqrt_l_tbl[50] =
+    {
+        16384, 16888, 17378, 17854, 18318, 18770, 19212, 19644, 20066, 20480,
+        20886, 21283, 21674, 22058, 22435, 22806, 23170, 23530, 23884, 24232,
+        24576, 24915, 25249, 25580, 25905, 26227, 26545, 26859, 27170, 27477,
+        27780, 28081, 28378, 28672, 28963, 29251, 29537, 29819, 30099, 30377,
+        30652, 30924, 31194, 31462, 31727, 31991, 32252, 32511, 32767, 32767
+    };
+
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] inv_sqrt.tab file,  UMTS GSM AMR speech codec, R99 - Version 3.2.0,
+ March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sub.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sub.cpp
new file mode 100644 (file)
index 0000000..479c40e
--- /dev/null
@@ -0,0 +1,176 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: sub.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ Subtraction function with overflow control
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: sub
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+    var2 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the subtract operation resulted in overflow
+
+ Returns:
+    diff = 16-bit limited difference between var1 and var2 (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the subtraction (var1-var2) with overflow control and
+ saturation; the 16 bit result is set at +32767 when overflow occurs or at
+ -32768 when underflow occurs.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] sub() function in basicop2.c, UMTS GSM AMR speech codec, R99 -
+ Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+
+ PSEUDO-CODE
+
+ Word16 sub (Word16 var1, Word16 var2)
+ {
+    Word16 var_out;
+    Word32 diff;
+
+    diff = (Word32) var1 - var2;
+
+* The reference ETSI code uses a global flag for Overflow inside the function
+* saturate(). In the actual implementation a pointer to Overflow flag is passed
+* in as a parameter to the function
+
+    var_out = saturate (diff);
+
+ #if (WMOPS)
+    multiCounter[currCounter].sub++;
+ #endif
+
+    return (var_out);
+ }
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+OSCL_EXPORT_REF Word16 sub(Word16 var1, Word16 var2, Flag *pOverflow)
+{
+
+    Word32 diff;
+
+    diff = (Word32) var1 - var2;
+
+    /* Saturate result (if necessary). */
+    /* Replaced function call with in-line code             */
+    /*  to conserve MIPS, i.e., var_out = saturate (diff)  */
+
+
+    if ((UWord32)(diff + 32768) > 0x000FFFF)
+    {
+        if (diff > (Word32) 0x0007FFFL)
+        {
+            diff = MAX_16;
+        }
+        else
+        {
+            diff = MIN_16;
+        }
+
+        *pOverflow = 1;
+    }
+
+
+    return ((Word16) diff);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/syn_filt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/syn_filt.cpp
new file mode 100644 (file)
index 0000000..e84ee66
--- /dev/null
@@ -0,0 +1,325 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: syn_filt.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "syn_filt.h"
+#include    "cnst.h"
+#include    "basic_op.h"
+#include    "oscl_mem.h"
+
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Syn_filt
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    a = buffer containing the prediction coefficients (Word16)  max 2^12
+    x = input signal buffer (Word16)                            max 2^15
+    y = output signal buffer (Word16)
+    lg = size of filtering (Word16)
+    mem = memory buffer associated with this filtering (Word16)
+    update = flag to indicate memory update; 0=no update, 1=update memory
+             (Word16)
+
+ Outputs:
+    mem buffer is changed to be the last M data points of the output signal
+      if update was set to 1
+    y buffer contains the newly calculated filter output
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Perform synthesis filtering through 1/A(z)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ syn_filt.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Syn_filt (
+    Word16 a[],     // (i)     : a[M+1] prediction coefficients   (M=10)
+    Word16 x[],     // (i)     : input signal
+    Word16 y[],     // (o)     : output signal
+    Word16 lg,      // (i)     : size of filtering
+    Word16 mem[],   // (i/o)   : memory associated with this filtering.
+    Word16 update   // (i)     : 0=no update, 1=update of memory.
+)
+{
+    Word16 i, j;
+    Word32 s;
+    Word16 tmp[80];   // This is usually done by memory allocation (lg+M)
+    Word16 *yy;
+
+    // Copy mem[] to yy[]
+
+    yy = tmp;
+
+    for (i = 0; i < M; i++)
+    {
+        *yy++ = mem[i];
+    }
+
+    // Do the filtering.
+
+    for (i = 0; i < lg; i++)
+    {
+        s = L_mult (x[i], a[0]);
+        for (j = 1; j <= M; j++)
+        {
+            s = L_msu (s, a[j], yy[-j]);
+        }
+        s = L_shl (s, 3);
+        *yy++ = pv_round (s);
+    }
+
+    for (i = 0; i < lg; i++)
+    {
+        y[i] = tmp[i + M];
+    }
+
+    // Update of memory if update==1
+
+    if (update != 0)
+    {
+        for (i = 0; i < M; i++)
+        {
+            mem[i] = y[lg - M + i];
+        }
+    }
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Syn_filt(
+    Word16 a[],     /* (i)   : a[M+1] prediction coefficients   (M=10)  */
+    Word16 x[],     /* (i)   : input signal                             */
+    Word16 y[],     /* (o)   : output signal                            */
+    Word16 lg,      /* (i)   : size of filtering   (40)                 */
+    Word16 mem[],   /* (i/o) : memory associated with this filtering.   */
+    Word16 update   /* (i)   : 0=no update, 1=update of memory.         */
+)
+{
+    Word16 i, j;
+    Word32 s1;
+    Word32 s2;
+    Word16 tmp[2*M]; /* This is usually done by memory allocation (lg+M) */
+    Word16 *yy;
+
+    Word16 *p_a;
+    Word16 *p_yy1;
+    Word16 *p_y;
+    Word16 *p_x;
+    Word16 temp;
+    /* Copy mem[] to yy[] */
+
+    yy = tmp;
+
+    oscl_memcpy(yy, mem, M*sizeof(Word16));
+
+    yy = yy + M;
+
+    /* Do the filtering. */
+
+    p_y  = y;
+    p_x  = x;
+    p_yy1 = &yy[-1];
+
+    for (i = M >> 1; i != 0; i--)
+    {
+        p_a  = a;
+
+        s1 = amrnb_fxp_mac_16_by_16bb((Word32) * (p_x++), (Word32) * (p_a), 0x00000800L);
+        s2 = amrnb_fxp_mac_16_by_16bb((Word32) * (p_x++), (Word32) * (p_a++), 0x00000800L);
+        s1 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a++), (Word32) * (p_yy1), s1);
+
+        for (j = (M >> 1) - 2; j != 0; j--)
+        {
+            s2 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a), (Word32) * (p_yy1--), s2);
+            s1 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a++), (Word32) * (p_yy1), s1);
+            s2 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a), (Word32) * (p_yy1--), s2);
+            s1 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a++), (Word32) * (p_yy1), s1);
+            s2 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a), (Word32) * (p_yy1--), s2);
+            s1 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a++), (Word32) * (p_yy1), s1);
+        }
+
+        /* check for overflow on s1 */
+        if ((UWord32)(s1 + 134217728) < 0x0fffffffL)
+        {
+            temp = (Word16)(s1 >> 12);
+        }
+        else if (s1 > 0x07ffffffL)
+        {
+            temp = MAX_16;
+        }
+        else
+        {
+            temp = MIN_16;
+        }
+
+        s2 = amrnb_fxp_msu_16_by_16bb((Word32)a[1], (Word32)temp, s2);
+
+        *(yy++)  = temp;
+        *(p_y++) = temp;
+
+        p_yy1 = yy;
+
+        /* check for overflow on s2 */
+        if ((UWord32)(s2 + 134217728) < 0x0fffffffL)
+        {
+            temp = (Word16)(s2 >> 12);
+        }
+        else if (s2 > 0x07ffffffL)
+        {
+            temp = MAX_16;
+        }
+        else
+        {
+            temp = MIN_16;
+        }
+
+        *(yy++)  = temp;
+        *(p_y++) = temp;
+    }
+
+    p_yy1 = &y[M-1];
+
+    for (i = (lg - M) >> 1; i != 0; i--)
+    {
+        p_a  = a;
+
+        s1 = amrnb_fxp_mac_16_by_16bb((Word32) * (p_x++), (Word32) * (p_a), 0x00000800L);
+        s2 = amrnb_fxp_mac_16_by_16bb((Word32) * (p_x++), (Word32) * (p_a++), 0x00000800L);
+        s1 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a++), (Word32) * (p_yy1), s1);
+
+        for (j = (M >> 1) - 2; j != 0; j--)
+        {
+            s2 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a), (Word32) * (p_yy1--), s2);
+            s1 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a++), (Word32) * (p_yy1), s1);
+            s2 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a), (Word32) * (p_yy1--), s2);
+            s1 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a++), (Word32) * (p_yy1), s1);
+            s2 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a), (Word32) * (p_yy1--), s2);
+            s1 = amrnb_fxp_msu_16_by_16bb((Word32) * (p_a++), (Word32) * (p_yy1), s1);
+        }
+
+        if ((UWord32)(s1 + 134217728) < 0x0fffffffL)
+        {
+            temp = (Word16)(s1 >> 12);
+        }
+        else if (s1 > 0x07ffffffL)
+        {
+            temp = MAX_16;
+        }
+        else
+        {
+            temp = MIN_16;
+        }
+
+        s2 = amrnb_fxp_msu_16_by_16bb((Word32)a[1], (Word32)temp, s2);
+
+        *(p_y++) = temp;
+        p_yy1 = p_y;
+
+        if ((UWord32)(s2 + 134217728) < 0x0fffffffL)
+        {
+            *(p_y++) = (Word16)(s2 >> 12);
+        }
+        else if (s2 > 0x07ffffffL)
+        {
+            *(p_y++) = MAX_16;
+        }
+        else
+        {
+            *(p_y++) = MIN_16;
+        }
+    }
+
+    /* Update of memory if update==1 */
+    if (update != 0)
+    {
+        oscl_memcpy(mem, &y[lg-M], M*sizeof(Word16));
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad1.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad1.cpp
new file mode 100644 (file)
index 0000000..d5c42dc
--- /dev/null
@@ -0,0 +1,2001 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: vad1.cpp
+ Functions:
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "vad.h"
+#include "typedef.h"
+#include "shr.h"
+#include "basic_op.h"
+#include "cnst_vad.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: first_filter_stage
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    data -- array of type Word16 -- filter memory
+    in   -- array of type Word16 -- input signal
+
+ Outputs:
+    data -- array of type Word16 -- filter memory
+    out  -- array of type Word16 -- output values, every other
+                                    output is low-pass part and
+                                    other is high-pass part every
+
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Scale input down by one bit. Calculate 5th order
+                half-band lowpass/highpass filter pair with
+                decimation.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void first_filter_stage(
+    Word16 in[],      /* i   : input signal                  */
+    Word16 out[],     /* o   : output values, every other    */
+    /*       output is low-pass part and   */
+    /*       other is high-pass part every */
+    Word16 data[],    /* i/o : filter memory                 */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs   */
+)
+{
+    Word16 temp0;
+    Word16 temp1;
+    Word16 temp2;
+    Word16 temp3;
+    Word16 i;
+    Word16 data0;
+    Word16 data1;
+
+    data0 = data[0];
+    data1 = data[1];
+
+    for (i = 0; i < FRAME_LEN / 4; i++)
+    {
+        temp0 = mult(COEFF5_1, data0, pOverflow);
+        temp1 = shr(in[4*i+0], 2, pOverflow);
+        temp0 = sub(temp1, temp0, pOverflow);
+
+        temp1 = mult(COEFF5_1, temp0, pOverflow);
+        temp1 = add(data0, temp1, pOverflow);
+
+        temp3 = mult(COEFF5_2, data1, pOverflow);
+        temp2 = shr(in[4*i+1], 2, pOverflow);
+
+        temp3 = sub(temp2, temp3, pOverflow);
+
+        temp2 = mult(COEFF5_2, temp3, pOverflow);
+        temp2 = add(data1, temp2, pOverflow);
+
+        out[4*i+0] = add(temp1, temp2, pOverflow);
+        out[4*i+1] = sub(temp1, temp2, pOverflow);
+
+        temp1 = mult(COEFF5_1, temp0, pOverflow);
+        temp2 = shr(in[4*i+2], 2, pOverflow);
+        data0 = sub(temp2, temp1, pOverflow);
+
+        temp1 = mult(COEFF5_1, data0, pOverflow);
+        temp1 = add(temp0, temp1, pOverflow);
+
+        data1 = mult(COEFF5_2, temp3, pOverflow);
+        temp2 = shr(in[4*i+3], 2, pOverflow);
+        data1 = sub(temp2, data1, pOverflow);
+
+        temp2 = mult(COEFF5_2, data1, pOverflow);
+        temp2 = add(temp3, temp2, pOverflow);
+
+        out[4*i+2] = add(temp1, temp2, pOverflow);
+        out[4*i+3] = sub(temp1, temp2, pOverflow);
+    }
+
+    data[0] = data0;
+    data[1] = data1;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: filter5
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    in0 -- array of type Word16 -- input values; output low-pass part
+    in1 -- array of type Word16 -- input values; output high-pass part
+    data -- array of type Word16 -- updated filter memory
+
+ Outputs:
+    in0 -- array of type Word16 -- input values; output low-pass part
+    in1 -- array of type Word16 -- input values; output high-pass part
+    data -- array of type Word16 -- updated filter memory
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Fifth-order half-band lowpass/highpass filter pair with
+                decimation.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void filter5(Word16 *in0,    /* i/o : input values; output low-pass part  */
+                    Word16 *in1,    /* i/o : input values; output high-pass part */
+                    Word16 data[],  /* i/o : updated filter memory               */
+                    Flag  *pOverflow  /* o : Flag set when overflow occurs       */
+                   )
+{
+    Word16 temp0;
+    Word16 temp1;
+    Word16 temp2;
+
+    temp0 = mult(COEFF5_1, data[0], pOverflow);
+    temp0 = sub(*in0, temp0, pOverflow);
+
+    temp1 = mult(COEFF5_1, temp0, pOverflow);
+    temp1 = add(data[0], temp1, pOverflow);
+    data[0] = temp0;
+
+    temp0 = mult(COEFF5_2, data[1], pOverflow);
+    temp0 = sub(*in1, temp0, pOverflow);
+
+    temp2 = mult(COEFF5_2, temp0, pOverflow);
+    temp2 = add(data[1], temp2, pOverflow);
+
+    data[1] = temp0;
+
+    temp0 = add(temp1, temp2, pOverflow);
+    *in0 = shr(temp0, 1, pOverflow);
+
+    temp0 = sub(temp1, temp2, pOverflow);
+    *in1 = shr(temp0, 1, pOverflow);
+}
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: filter3
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+
+ Inputs:
+    in0 -- array of type Word16 -- input values; output low-pass part
+    in1 -- array of type Word16 -- input values; output high-pass part
+    data -- array of type Word16 -- updated filter memory
+
+ Outputs:
+    in0 -- array of type Word16 -- input values; output low-pass part
+    in1 -- array of type Word16 -- input values; output high-pass part
+    data -- array of type Word16 -- updated filter memory
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Third-order half-band lowpass/highpass filter pair with
+                decimation.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void filter3(
+    Word16 *in0,      /* i/o : input values; output low-pass part  */
+    Word16 *in1,      /* i/o : input values; output high-pass part */
+    Word16 *data,     /* i/o : updated filter memory               */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs         */
+)
+{
+    Word16 temp1;
+    Word16 temp2;
+
+    temp1 = mult(COEFF3, *data, pOverflow);
+    temp1 = sub(*in1, temp1, pOverflow);
+
+    temp2 = mult(COEFF3, temp1, pOverflow);
+    temp2 = add(*data, temp2, pOverflow);
+
+    *data = temp1;
+
+    temp1 = sub(*in0, temp2, pOverflow);
+
+    *in1 = shr(temp1, 1, pOverflow);
+
+    temp1 = add(*in0, temp2, pOverflow);
+
+    *in0 = shr(temp1, 1, pOverflow);
+}
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: level_calculation
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    data -- array of type Word16 -- signal buffer
+    sub_level -- pointer to type Word16 -- level calculated at the end of
+                                           the previous frame
+
+    count1 -- Word16 -- number of samples to be counted
+    count2 -- Word16 -- number of samples to be counted
+    ind_m  -- Word16 -- step size for the index of the data buffer
+    ind_a  -- Word16 -- starting index of the data buffer
+    scale  -- Word16 -- scaling for the level calculation
+
+ Outputs:
+    sub_level -- pointer to tyep Word16 -- level of signal calculated from the
+                                           last (count2 - count1) samples.
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    signal level
+
+ Global Variables Used:
+
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Calculate signal level in a sub-band. Level is calculated
+                by summing absolute values of the input data.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 level_calculation(
+    Word16 data[],     /* i   : signal buffer                                */
+    Word16 *sub_level, /* i   : level calculate at the end of                */
+    /*       the previous frame                           */
+    /* o   : level of signal calculated from the last     */
+    /*       (count2 - count1) samples                    */
+    Word16 count1,     /* i   : number of samples to be counted              */
+    Word16 count2,     /* i   : number of samples to be counted              */
+    Word16 ind_m,      /* i   : step size for the index of the data buffer   */
+    Word16 ind_a,      /* i   : starting index of the data buffer            */
+    Word16 scale,      /* i   : scaling for the level calculation            */
+    Flag  *pOverflow   /* o : Flag set when overflow occurs                  */
+)
+{
+    Word32 l_temp1;
+    Word32 l_temp2;
+    Word16 level;
+    Word16 i;
+
+    l_temp1 = 0L;
+
+    for (i = count1; i < count2; i++)
+    {
+        l_temp1 = L_mac(l_temp1, 1, abs_s(data[ind_m*i+ind_a]), pOverflow);
+    }
+
+    l_temp2 = L_add(l_temp1, L_shl(*sub_level, sub(16, scale, pOverflow), pOverflow), pOverflow);
+    *sub_level = extract_h(L_shl(l_temp1, scale, pOverflow));
+
+    for (i = 0; i < count1; i++)
+    {
+        l_temp2 = L_mac(l_temp2, 1, abs_s(data[ind_m*i+ind_a]), pOverflow);
+    }
+    level = extract_h(L_shl(l_temp2, scale, pOverflow));
+
+    return level;
+}
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: filter_bank
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    in -- array of type Word16 -- input frame
+
+ Outputs:
+    level -- array of type Word16 -- signal levels at each band
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Divides input signal into 9-bands and calculas level of
+                the signal in each band
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void filter_bank(
+    vadState1 *st,    /* i/o : State struct                    */
+    Word16 in[],      /* i   : input frame                     */
+    Word16 level[],   /* 0   : signal levels at each band      */
+    Flag  *pOverflow  /* o   : Flag set when overflow occurs   */
+)
+{
+    Word16 i;
+    Word16 tmp_buf[FRAME_LEN];
+
+    /* calculate the filter bank */
+
+    first_filter_stage(in, tmp_buf, st->a_data5[0], pOverflow);
+
+    for (i = 0; i < FRAME_LEN / 4; i++)
+    {
+        filter5(&tmp_buf[4*i], &tmp_buf[4*i+2], st->a_data5[1], pOverflow);
+        filter5(&tmp_buf[4*i+1], &tmp_buf[4*i+3], st->a_data5[2], pOverflow);
+    }
+    for (i = 0; i < FRAME_LEN / 8; i++)
+    {
+        filter3(&tmp_buf[8*i+0], &tmp_buf[8*i+4], &st->a_data3[0], pOverflow);
+        filter3(&tmp_buf[8*i+2], &tmp_buf[8*i+6], &st->a_data3[1], pOverflow);
+        filter3(&tmp_buf[8*i+3], &tmp_buf[8*i+7], &st->a_data3[4], pOverflow);
+    }
+
+    for (i = 0; i < FRAME_LEN / 16; i++)
+    {
+        filter3(&tmp_buf[16*i+0], &tmp_buf[16*i+8], &st->a_data3[2], pOverflow);
+        filter3(&tmp_buf[16*i+4], &tmp_buf[16*i+12], &st->a_data3[3], pOverflow);
+    }
+
+    /* calculate levels in each frequency band */
+
+    /* 3000 - 4000 Hz*/
+    level[8] = level_calculation(tmp_buf, &st->sub_level[8], FRAME_LEN / 4 - 8,
+                                 FRAME_LEN / 4, 4, 1, 15, pOverflow);
+    /* 2500 - 3000 Hz*/
+    level[7] = level_calculation(tmp_buf, &st->sub_level[7], FRAME_LEN / 8 - 4,
+                                 FRAME_LEN / 8, 8, 7, 16, pOverflow);
+    /* 2000 - 2500 Hz*/
+    level[6] = level_calculation(tmp_buf, &st->sub_level[6], FRAME_LEN / 8 - 4,
+                                 FRAME_LEN / 8, 8, 3, 16, pOverflow);
+    /* 1500 - 2000 Hz*/
+    level[5] = level_calculation(tmp_buf, &st->sub_level[5], FRAME_LEN / 8 - 4,
+                                 FRAME_LEN / 8, 8, 2, 16, pOverflow);
+    /* 1000 - 1500 Hz*/
+    level[4] = level_calculation(tmp_buf, &st->sub_level[4], FRAME_LEN / 8 - 4,
+                                 FRAME_LEN / 8, 8, 6, 16, pOverflow);
+    /* 750 - 1000 Hz*/
+    level[3] = level_calculation(tmp_buf, &st->sub_level[3], FRAME_LEN / 16 - 2,
+                                 FRAME_LEN / 16, 16, 4, 16, pOverflow);
+    /* 500 - 750 Hz*/
+    level[2] = level_calculation(tmp_buf, &st->sub_level[2], FRAME_LEN / 16 - 2,
+                                 FRAME_LEN / 16, 16, 12, 16, pOverflow);
+    /* 250 - 500 Hz*/
+    level[1] = level_calculation(tmp_buf, &st->sub_level[1], FRAME_LEN / 16 - 2,
+                                 FRAME_LEN / 16, 16, 8, 16, pOverflow);
+    /* 0 - 250 Hz*/
+    level[0] = level_calculation(tmp_buf, &st->sub_level[0], FRAME_LEN / 16 - 2,
+                                 FRAME_LEN / 16, 16, 0, 16, pOverflow);
+}
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: update_cntrl
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    level -- array of type Word16 -- sub-band levels of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose    : Control update of the background noise estimate.
+ Inputs     : pitch:      flags for pitch detection
+              stat_count: stationary counter
+              tone:       flags indicating presence of a tone
+              complex:      flags for complex  detection
+              vadreg:     intermediate VAD flags
+ Output     : stat_count: stationary counter
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void update_cntrl(
+    vadState1 *st,   /* i/o : State struct                       */
+    Word16 level[],  /* i   : sub-band levels of the input frame */
+    Flag  *pOverflow /* o   : Flag set when overflow occurs      */
+)
+{
+    Word16 i;
+    Word16 temp;
+    Word16 stat_rat;
+    Word16 exp;
+    Word16 num;
+    Word16 denom;
+    Word16 alpha;
+
+    /* handle highband complex signal input  separately       */
+    /* if ther has been highband correlation for some time    */
+    /* make sure that the VAD update speed is low for a while */
+    if (st->complex_warning != 0)
+    {
+        if (st->stat_count < CAD_MIN_STAT_COUNT)
+        {
+            st->stat_count = CAD_MIN_STAT_COUNT;
+        }
+    }
+    /* NB stat_count is allowed to be decreased by one below again  */
+    /* deadlock in speech is not possible unless the signal is very */
+    /* complex and need a high rate                                 */
+
+    /* if fullband pitch or tone have been detected for a while, initialize stat_count */
+    if (((Word16)(st->pitch & 0x6000) == 0x6000) ||
+            ((Word16)(st->tone & 0x7c00) == 0x7c00))
+    {
+        st->stat_count = STAT_COUNT;
+    }
+    else
+    {
+        /* if 8 last vad-decisions have been "0", reinitialize stat_count */
+        if ((st->vadreg & 0x7f80) == 0)
+        {
+            st->stat_count = STAT_COUNT;
+        }
+        else
+        {
+            stat_rat = 0;
+            for (i = 0; i < COMPLEN; i++)
+            {
+                if (level[i] > st->ave_level[i])
+                {
+                    num = level[i];
+                    denom = st->ave_level[i];
+                }
+                else
+                {
+                    num = st->ave_level[i];
+                    denom = level[i];
+                }
+                /* Limit nimimum value of num and denom to STAT_THR_LEVEL */
+                if (num < STAT_THR_LEVEL)
+                {
+                    num = STAT_THR_LEVEL;
+                }
+                if (denom < STAT_THR_LEVEL)
+                {
+                    denom = STAT_THR_LEVEL;
+                }
+
+                exp = norm_s(denom);
+
+                denom = shl(denom, exp, pOverflow);
+
+                /* stat_rat = num/denom * 64 */
+                temp = shr(num, 1, pOverflow);
+                temp = div_s(temp, denom);
+
+                stat_rat = add(stat_rat, shr(temp, sub(8, exp, pOverflow), pOverflow), pOverflow);
+            }
+
+            /* compare stat_rat with a threshold and update stat_count */
+            if (stat_rat > STAT_THR)
+            {
+                st->stat_count = STAT_COUNT;
+            }
+            else
+            {
+                if ((st->vadreg & 0x4000) != 0)
+                {
+                    if (st->stat_count != 0)
+                    {
+                        st->stat_count = sub(st->stat_count, 1, pOverflow);
+                    }
+                }
+            }
+        }
+    }
+
+    /* Update average amplitude estimate for stationarity estimation */
+    alpha = ALPHA4;
+    if (st->stat_count == STAT_COUNT)
+    {
+        alpha = 32767;
+    }
+    else if ((st->vadreg & 0x4000) == 0)
+    {
+        alpha = ALPHA5;
+    }
+
+    for (i = 0; i < COMPLEN; i++)
+    {
+        temp = sub(level[i], st->ave_level[i], pOverflow);
+        temp = mult_r(alpha, temp, pOverflow);
+
+        st->ave_level[i] =
+            add(
+                st->ave_level[i],
+                temp,
+                pOverflow);
+    }
+}
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: hangover_addition
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    noise_level -- Word16 -- average level of the noise estimates
+    low_power   -- Word16 -- flag power of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicato
+
+ Returns:
+    VAD_flag indicating final VAD decision (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Function     : hangover_addition
+ Purpose      : Add hangover for complex signal or after speech bursts
+ Inputs       : burst_count:  counter for the length of speech bursts
+                hang_count:   hangover counter
+                vadreg:       intermediate VAD decision
+ Outputs      : burst_count:  counter for the length of speech bursts
+                hang_count:   hangover counter
+ Return value : VAD_flag indicating final VAD decision
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 hangover_addition(
+    vadState1 *st,      /* i/o : State struct                     */
+    Word16 noise_level, /* i   : average level of the noise       */
+    /*       estimates                        */
+    Word16 low_power,   /* i   : flag power of the input frame    */
+    Flag  *pOverflow    /* o   : Flag set when overflow occurs    */
+)
+{
+    Word16 hang_len;
+    Word16 burst_len;
+
+    /*
+       Calculate burst_len and hang_len
+       burst_len: number of consecutive intermediate vad flags with "1"-decision
+                  required for hangover addition
+       hang_len:  length of the hangover
+       */
+
+    if (noise_level > HANG_NOISE_THR)
+    {
+        burst_len = BURST_LEN_HIGH_NOISE;
+        hang_len = HANG_LEN_HIGH_NOISE;
+    }
+    else
+    {
+        burst_len = BURST_LEN_LOW_NOISE;
+        hang_len = HANG_LEN_LOW_NOISE;
+    }
+
+    /* if the input power (pow_sum) is lower than a threshold, clear
+       counters and set VAD_flag to "0"  "fast exit"                 */
+    if (low_power != 0)
+    {
+        st->burst_count = 0;
+        st->hang_count = 0;
+        st->complex_hang_count = 0;
+        st->complex_hang_timer = 0;
+        return 0;
+    }
+
+    if (st->complex_hang_timer > CVAD_HANG_LIMIT)
+    {
+        if (st->complex_hang_count < CVAD_HANG_LENGTH)
+        {
+            st->complex_hang_count = CVAD_HANG_LENGTH;
+        }
+    }
+
+    /* long time very complex signal override VAD output function */
+    if (st->complex_hang_count != 0)
+    {
+        st->burst_count = BURST_LEN_HIGH_NOISE;
+        st->complex_hang_count = sub(st->complex_hang_count, 1, pOverflow);
+        return 1;
+    }
+    else
+    {
+        /* let hp_corr work in from a noise_period indicated by the VAD */
+        if (((st->vadreg & 0x3ff0) == 0) &&
+                (st->corr_hp_fast > CVAD_THRESH_IN_NOISE))
+        {
+            return 1;
+        }
+    }
+
+    /* update the counters (hang_count, burst_count) */
+    if ((st->vadreg & 0x4000) != 0)
+    {
+        st->burst_count = add(st->burst_count, 1, pOverflow);
+
+        if (st->burst_count >= burst_len)
+        {
+            st->hang_count = hang_len;
+        }
+        return 1;
+    }
+    else
+    {
+        st->burst_count = 0;
+        if (st->hang_count > 0)
+        {
+            st->hang_count = sub(st->hang_count, 1, pOverflow);
+            return 1;
+        }
+    }
+    return 0;
+}
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: noise_estimate_update
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    level -- array of type Word16 -- sub-band levels of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose    : Update of background noise estimate
+ Inputs     : bckr_est:   background noise estimate
+              pitch:      flags for pitch detection
+              stat_count: stationary counter
+ Outputs    : bckr_est:   background noise estimate
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void noise_estimate_update(
+    vadState1 *st,    /* i/o : State struct                       */
+    Word16 level[],   /* i   : sub-band levels of the input frame */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs        */
+)
+{
+    Word16 i;
+    Word16 alpha_up;
+    Word16 alpha_down;
+    Word16 bckr_add;
+
+    /* Control update of bckr_est[] */
+    update_cntrl(st, level, pOverflow);
+
+    /* Choose update speed */
+    bckr_add = 2;
+
+    if (((0x7800 & st->vadreg) == 0) &&
+            ((st->pitch & 0x7800) == 0)
+            && (st->complex_hang_count == 0))
+    {
+        alpha_up = ALPHA_UP1;
+        alpha_down = ALPHA_DOWN1;
+    }
+    else
+    {
+        if ((st->stat_count == 0)
+                && (st->complex_hang_count == 0))
+        {
+            alpha_up = ALPHA_UP2;
+            alpha_down = ALPHA_DOWN2;
+        }
+        else
+        {
+            alpha_up = 0;
+            alpha_down = ALPHA3;
+            bckr_add = 0;
+        }
+    }
+
+    /* Update noise estimate (bckr_est) */
+    for (i = 0; i < COMPLEN; i++)
+    {
+        Word16 temp;
+
+        temp = sub(st->old_level[i], st->bckr_est[i], pOverflow);
+
+        if (temp < 0)
+        { /* update downwards*/
+            temp = mult_r(alpha_down, temp, pOverflow);
+            temp = add(st->bckr_est[i], temp, pOverflow);
+
+            st->bckr_est[i] = add(-2, temp, pOverflow);
+
+            /* limit minimum value of the noise estimate to NOISE_MIN */
+            if (st->bckr_est[i] < NOISE_MIN)
+            {
+                st->bckr_est[i] = NOISE_MIN;
+            }
+        }
+        else
+        { /* update upwards */
+            temp = mult_r(alpha_up, temp, pOverflow);
+            temp = add(st->bckr_est[i], temp, pOverflow);
+            st->bckr_est[i] = add(bckr_add, temp, pOverflow);
+
+            /* limit maximum value of the noise estimate to NOISE_MAX */
+            if (st->bckr_est[i] > NOISE_MAX)
+            {
+                st->bckr_est[i] = NOISE_MAX;
+            }
+        }
+    }
+
+    /* Update signal levels of the previous frame (old_level) */
+    for (i = 0; i < COMPLEN; i++)
+    {
+        st->old_level[i] = level[i];
+    }
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: complex_estimate_adapt
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    low_power -- Word16 -- very low level flag of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Function   : complex_estimate_adapt
+ Purpose    : Update/adapt of complex signal estimate
+ Inputs     : low_power:   low signal power flag
+ Outputs    : st->corr_hp_fast:   long term complex signal estimate
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void complex_estimate_adapt(
+    vadState1 *st,      /* i/o : VAD state struct                       */
+    Word16 low_power,   /* i   : very low level flag of the input frame */
+    Flag  *pOverflow    /* o : Flag set when overflow occurs            */
+)
+{
+    Word16 alpha;            /* Q15 */
+    Word32 L_tmp;            /* Q31 */
+
+
+    /* adapt speed on own state */
+    if (st->best_corr_hp < st->corr_hp_fast) /* decrease */
+    {
+        if (st->corr_hp_fast < CVAD_THRESH_ADAPT_HIGH)
+        {  /* low state  */
+            alpha = CVAD_ADAPT_FAST;
+        }
+        else
+        {  /* high state */
+            alpha = CVAD_ADAPT_REALLY_FAST;
+        }
+    }
+    else  /* increase */
+    {
+        if (st->corr_hp_fast < CVAD_THRESH_ADAPT_HIGH)
+        {
+            alpha = CVAD_ADAPT_FAST;
+        }
+        else
+        {
+            alpha = CVAD_ADAPT_SLOW;
+        }
+    }
+
+    L_tmp = L_deposit_h(st->corr_hp_fast);
+    L_tmp = L_msu(L_tmp, alpha, st->corr_hp_fast, pOverflow);
+    L_tmp = L_mac(L_tmp, alpha, st->best_corr_hp, pOverflow);
+    st->corr_hp_fast = pv_round(L_tmp, pOverflow);           /* Q15 */
+
+    if (st->corr_hp_fast < CVAD_MIN_CORR)
+    {
+        st->corr_hp_fast = CVAD_MIN_CORR;
+    }
+
+    if (low_power != 0)
+    {
+        st->corr_hp_fast = CVAD_MIN_CORR;
+    }
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: complex_vad
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    low_power -- Word16 -- flag power of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+
+ Returns:
+    the complex background decision
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : complex background decision
+ Return value : the complex background decision
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 complex_vad(
+    vadState1 *st,    /* i/o : VAD state struct              */
+    Word16 low_power, /* i   : flag power of the input frame */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs   */
+)
+{
+    st->complex_high = shr(st->complex_high, 1, pOverflow);
+    st->complex_low = shr(st->complex_low, 1, pOverflow);
+
+    if (low_power == 0)
+    {
+        if (st->corr_hp_fast > CVAD_THRESH_ADAPT_HIGH)
+        {
+            st->complex_high |= 0x4000;
+        }
+
+        if (st->corr_hp_fast > CVAD_THRESH_ADAPT_LOW)
+        {
+            st->complex_low |= 0x4000;
+        }
+    }
+
+    if (st->corr_hp_fast > CVAD_THRESH_HANG)
+    {
+        st->complex_hang_timer = add(st->complex_hang_timer, 1, pOverflow);
+    }
+    else
+    {
+        st->complex_hang_timer =  0;
+    }
+
+    return ((Word16)(st->complex_high & 0x7f80) == 0x7f80 ||
+            (Word16)(st->complex_low & 0x7fff) == 0x7fff);
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad_decision
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    level -- array of type Word16 -- sub-band levels of the input frame
+    pow_sum -- Word32 -- power of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    VAD_flag (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Calculates VAD_flag
+ Inputs       : bckr_est:    background noise estimate
+                vadreg:      intermediate VAD flags
+ Outputs      : noise_level: average level of the noise estimates
+                vadreg:      intermediate VAD flags
+ Return value : VAD_flag
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 vad_decision(
+    vadState1 *st,         /* i/o : State struct                       */
+    Word16 level[COMPLEN], /* i   : sub-band levels of the input frame */
+    Word32 pow_sum,        /* i   : power of the input frame           */
+    Flag  *pOverflow       /* o : Flag set when overflow occurs        */
+)
+{
+    Word16 i;
+    Word16 snr_sum;
+    Word32 L_temp;
+    Word16 vad_thr;
+    Word16 temp;
+    Word16 noise_level;
+    Word16 low_power_flag;
+    Word16 temp1;
+
+    /*
+       Calculate squared sum of the input levels (level)
+       divided by the background noise components (bckr_est).
+       */
+    L_temp = 0;
+
+    for (i = 0; i < COMPLEN; i++)
+    {
+        Word16 exp;
+
+        exp = norm_s(st->bckr_est[i]);
+        temp = shl(st->bckr_est[i], exp, pOverflow);
+        temp = div_s(shr(level[i], 1, pOverflow), temp);
+        temp = shl(temp, sub(exp, UNIRSHFT - 1, pOverflow), pOverflow);
+        L_temp = L_mac(L_temp, temp, temp, pOverflow);
+    }
+
+    snr_sum = extract_h(L_shl(L_temp, 6, pOverflow));
+    snr_sum = mult(snr_sum, INV_COMPLEN, pOverflow);
+
+    /* Calculate average level of estimated background noise */
+    L_temp = 0;
+    for (i = 0; i < COMPLEN; i++)
+    {
+        L_temp = L_add(L_temp, st->bckr_est[i], pOverflow);
+    }
+
+    noise_level = extract_h(L_shl(L_temp, 13, pOverflow));
+
+    /* Calculate VAD threshold */
+    temp1 = sub(noise_level, VAD_P1, pOverflow);
+    temp1 = mult(VAD_SLOPE, temp1, pOverflow);
+    vad_thr = add(temp1, VAD_THR_HIGH, pOverflow);
+
+    if (vad_thr < VAD_THR_LOW)
+    {
+        vad_thr = VAD_THR_LOW;
+    }
+
+    /* Shift VAD decision register */
+    st->vadreg = shr(st->vadreg, 1, pOverflow);
+
+    /* Make intermediate VAD decision */
+    if (snr_sum > vad_thr)
+    {
+        st->vadreg |= 0x4000;
+    }
+    /* primary vad decsion made */
+
+    /* check if the input power (pow_sum) is lower than a threshold" */
+    if (L_sub(pow_sum, VAD_POW_LOW, pOverflow) < 0)
+    {
+        low_power_flag = 1;
+    }
+    else
+    {
+        low_power_flag = 0;
+    }
+
+    /* update complex signal estimate st->corr_hp_fast and hangover reset timer using */
+    /* low_power_flag and corr_hp_fast  and various adaptation speeds                 */
+    complex_estimate_adapt(st, low_power_flag, pOverflow);
+
+    /* check multiple thresholds of the st->corr_hp_fast value */
+    st->complex_warning = complex_vad(st, low_power_flag, pOverflow);
+
+    /* Update speech subband vad background noise estimates */
+    noise_estimate_update(st, level, pOverflow);
+
+    /*  Add speech and complex hangover and return speech VAD_flag */
+    /*  long term complex hangover may be added */
+    st->speech_vad_decision = hangover_addition(st, noise_level, low_power_flag, pOverflow);
+
+    return (st->speech_vad_decision);
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad1_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- double pointer to type vadState1 -- pointer to memory to
+                                                 be initialized.
+
+ Outputs:
+    state -- points to initalized area in memory.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Allocates state memory and initializes state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 vad1_init(vadState1 **state)
+{
+    vadState1* s;
+
+    if (state == (vadState1 **) NULL)
+    {
+        return -1;
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (vadState1 *) oscl_malloc(sizeof(vadState1))) == NULL)
+    {
+        return -1;
+    }
+
+    vad1_reset(s);
+
+    *state = s;
+
+    return 0;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad1_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose:    Resets state memory to zero
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 vad1_reset(vadState1 *state)
+{
+    Word16 i;
+    Word16 j;
+
+    if (state == (vadState1 *) NULL)
+    {
+        return -1;
+    }
+
+    /* Initialize pitch detection variables */
+    state->oldlag_count = 0;
+    state->oldlag = 0;
+    state->pitch = 0;
+    state->tone = 0;
+
+    state->complex_high = 0;
+    state->complex_low = 0;
+    state->complex_hang_timer = 0;
+
+    state->vadreg = 0;
+
+    state->stat_count = 0;
+    state->burst_count = 0;
+    state->hang_count = 0;
+    state->complex_hang_count = 0;
+
+    /* initialize memory used by the filter bank */
+    for (i = 0; i < 3; i++)
+    {
+        for (j = 0; j < 2; j++)
+        {
+            state->a_data5[i][j] = 0;
+        }
+    }
+
+    for (i = 0; i < 5; i++)
+    {
+        state->a_data3[i] = 0;
+    }
+
+    /* initialize the rest of the memory */
+    for (i = 0; i < COMPLEN; i++)
+    {
+        state->bckr_est[i] = NOISE_INIT;
+        state->old_level[i] = NOISE_INIT;
+        state->ave_level[i] = NOISE_INIT;
+        state->sub_level[i] = 0;
+    }
+
+    state->best_corr_hp = CVAD_LOWPOW_RESET;
+
+    state->speech_vad_decision = 0;
+    state->complex_warning = 0;
+    state->sp_burst_count = 0;
+
+    state->corr_hp_fast = CVAD_LOWPOW_RESET;
+
+    return 0;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad1_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    The memory used for state memory is freed
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad1_exit(vadState1 **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad_complex_detection_update
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    best_corr_hp -- Word16 -- best Corr
+    state -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : update vad->bestCorr_hp  complex signal feature state
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad_complex_detection_update(
+    vadState1 *st,       /* i/o : State struct */
+    Word16 best_corr_hp) /* i   : best Corr    */
+{
+    st->best_corr_hp = best_corr_hp;
+}
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad_tone_detection
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    t0 -- Word32 -- autocorrelation maxima
+    t1 -- Word32 -- energy
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Set tone flag if pitch gain is high. This is used to detect
+                signaling tones and other signals with high pitch gain.
+ Inputs       : tone: flags indicating presence of a tone
+ Outputs      : tone: flags indicating presence of a tone
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad_tone_detection(
+    vadState1 *st,    /* i/o : State struct                       */
+    Word32 t0,        /* i   : autocorrelation maxima             */
+    Word32 t1,        /* i   : energy                             */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs        */
+)
+{
+    Word16 temp;
+    /*
+       if (t0 > TONE_THR * t1)
+       set tone flag
+       */
+    temp = pv_round(t1, pOverflow);
+
+    if ((temp > 0) && (L_msu(t0, temp, TONE_THR, pOverflow) > 0))
+    {
+        st->tone |= 0x4000;
+    }
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad_tone_detection_update
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    one_lag_per_frame -- Word16 -- 1 if one open-loop lag is calculated per
+                                   each frame, otherwise 0
+    st -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Update the tone flag register. Tone flags are shifted right
+                by one bit. This function should be called from the speech
+                encoder before call to Vad_tone_detection() function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad_tone_detection_update(
+    vadState1 *st,              /* i/o : State struct           */
+    Word16 one_lag_per_frame,   /* i   : 1 if one open-loop lag */
+    /*       is calculated per each */
+    /*       frame, otherwise 0     */
+    Flag *pOverflow             /* o   : Flags overflow         */
+)
+{
+    /* Shift tone flags right by one bit */
+    st->tone = shr(st->tone, 1, pOverflow);
+
+    /* If open-loop lag is calculated only once in each frame, do extra update
+       and assume that the other tone flag of the frame is one. */
+    if (one_lag_per_frame != 0)
+    {
+        st->tone = shr(st->tone, 1, pOverflow);
+        st->tone |= 0x2000;
+    }
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad_pitch_detection
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    T_op -- array of type Word16 -- speech encoder open loop lags
+    st -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Test whether signal contains pitch or other periodic
+                component.
+ Return value : Boolean voiced / unvoiced decision in state variable
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad_pitch_detection(
+    vadState1 *st,    /* i/o : State struct                  */
+    Word16 T_op[],    /* i   : speech encoder open loop lags */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs   */
+)
+{
+    Word16 lagcount;
+    Word16 i;
+    Word16 temp;
+
+    lagcount = 0;
+
+    for (i = 0; i < 2; i++)
+    {
+        temp = sub(st->oldlag, T_op[i], pOverflow);
+        temp = abs_s(temp);
+
+        if (temp < LTHRESH)
+        {
+            lagcount = add(lagcount, 1, pOverflow);
+        }
+
+        /* Save the current LTP lag */
+        st->oldlag = T_op[i];
+    }
+
+    /* Make pitch decision.
+       Save flag of the pitch detection to the variable pitch.
+       */
+    st->pitch = shr(st->pitch, 1, pOverflow);
+
+    temp =
+        add(
+            st->oldlag_count,
+            lagcount,
+            pOverflow);
+
+    if (temp >= NTHRESH)
+    {
+        st->pitch |= 0x4000;
+    }
+
+    /* Update oldlagcount */
+    st->oldlag_count = lagcount;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad1
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    in_buf -- array of type Word16 -- samples of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    VAD Decision, 1 = speech, 0 = noise
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Main program for Voice Activity Detection (VAD) for AMR
+ Return value : VAD Decision, 1 = speech, 0 = noise
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 vad1(
+    vadState1 *st,    /* i/o : State struct                       */
+    Word16 in_buf[],  /* i   : samples of the input frame         */
+    Flag  *pOverflow  /* o   : Flag set when overflow occurs      */
+)
+{
+    Word16 level[COMPLEN];
+    Word32 pow_sum;
+    Word16 i;
+
+    /* Calculate power of the input frame. */
+    pow_sum = 0L;
+
+    for (i = 0; i < FRAME_LEN; i++)
+    {
+        pow_sum = L_mac(pow_sum, in_buf[i-LOOKAHEAD], in_buf[i-LOOKAHEAD], pOverflow);
+    }
+
+    /*
+      If input power is very low, clear pitch flag of the current frame
+      */
+    if (L_sub(pow_sum, POW_PITCH_THR, pOverflow) < 0)
+    {
+        st->pitch = st->pitch & 0x3fff;
+    }
+
+    /*
+      If input power is very low, clear complex flag of the "current" frame
+      */
+    if (L_sub(pow_sum, POW_COMPLEX_THR, pOverflow) < 0)
+    {
+        st->complex_low = st->complex_low & 0x3fff;
+    }
+
+    /*
+      Run the filter bank which calculates signal levels at each band
+      */
+    filter_bank(st, in_buf, level, pOverflow);
+
+    return (vad_decision(st, level, pow_sum, pOverflow));
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad2.cpp
new file mode 100644 (file)
index 0000000..ecd1cf0
--- /dev/null
@@ -0,0 +1,1231 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: vad2.cpp
+ Functions:
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "log2.h"
+#include "pow2.h"
+#include "sub.h"
+#include "l_shr_r.h"
+#include "abs_s.h"
+#include "norm_s.h"
+#include "shl.h"
+#include "l_add.h"
+#include "shr_r.h"
+#include "add.h"
+#include "mult.h"
+#include "l_shr.h"
+#include "mpy_32_16.h"
+#include "l_mac.h"
+#include "l_extract.h"
+#include "l_sub.h"
+#include "l_mult.h"
+#include "round.h"
+#include "shr.h"
+#include "l_shl.h"
+#include "mult_r.h"
+#include "div_s.h"
+#include "oscl_mem.h"
+
+
+#include "vad2.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+ * The channel table is defined below.  In this table, the
+ * lower and higher frequency coefficients for each of the 16
+ * channels are specified.  The table excludes the coefficients
+ * with numbers 0 (DC), 1, and 64 (Foldover frequency).
+ */
+
+const Word16 ch_tbl[NUM_CHAN][2] =
+{
+
+    {2, 3},
+    {4, 5},
+    {6, 7},
+    {8, 9},
+    {10, 11},
+    {12, 13},
+    {14, 16},
+    {17, 19},
+    {20, 22},
+    {23, 26},
+    {27, 30},
+    {31, 35},
+    {36, 41},
+    {42, 48},
+    {49, 55},
+    {56, 63}
+
+};
+
+/* channel energy scaling table - allows efficient division by number
+     * of DFT bins in the channel: 1/2, 1/3, 1/4, etc.
+ */
+
+const Word16 ch_tbl_sh[NUM_CHAN] =
+{
+    16384, 16384, 16384, 16384, 16384, 16384, 10923, 10923,
+    10923, 8192, 8192, 6554, 5461, 4681, 4681, 4096
+};
+
+/*
+ * The voice metric table is defined below.  It is a non-
+ * linear table with a deadband near zero.  It maps the SNR
+ * index (quantized SNR value) to a number that is a measure
+ * of voice quality.
+ */
+
+const Word16 vm_tbl[90] =
+{
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7,
+    8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 15,
+    15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 23, 24,
+    24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34,
+    35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45,
+    46, 47, 48, 49, 50, 50, 50, 50, 50, 50, 50, 50,
+    50, 50
+};
+
+/* hangover as a function of peak SNR (3 dB steps) */
+const Word16 hangover_table[20] =
+{
+    30, 30, 30, 30, 30, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 8, 8, 8
+};
+
+/* burst sensitivity as a function of peak SNR (3 dB steps) */
+const Word16 burstcount_table[20] =
+{
+    8, 8, 8, 8, 8, 8, 8, 8, 7, 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4
+};
+
+/* voice metric sensitivity as a function of peak SNR (3 dB steps) */
+const Word16 vm_threshold_table[20] =
+{
+    34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
+    34, 40, 51, 71, 100, 139, 191, 257, 337, 432
+};
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: fn10Log10
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+   L_Input -- Word32 -- (scaled as 31-fbits,fbits)
+   fbits   -- Word16 -- number of fractional bits on input
+
+ Outputs:
+   pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+   output -- Word16 -- (scaled as 7,8)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE:
+   The purpose of this function is to take the 10*log base 10 of input and
+   divide by 128 and return; i.e. output = 10*log10(input)/128 (scaled as 7,8)
+
+ DESCRIPTION:
+
+   10*log10(x)/128 = 10*(log10(2) * (log2(x<<fbits)-log2(1<<fbits)) >> 7
+                   = 3.0103 * (log2(x<<fbits) - fbits) >> 7
+                   = ((3.0103/4.0 * (log2(x<<fbits) - fbits) << 2) >> 7
+                   = (3.0103/4.0 * (log2(x<<fbits) - fbits) >> 5
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 fn10Log10(Word32 L_Input, Word16 fbits, Flag *pOverflow)
+{
+
+    Word16 integer;     /* Integer part of Log2.   (range: 0<=val<=30) */
+    Word16 fraction;    /* Fractional part of Log2. (range: 0<=val<1) */
+
+    Word32 Ltmp;
+    Word16 tmp;
+
+    Log2(L_Input, &integer, &fraction, pOverflow);
+
+    integer = sub(integer, fbits, pOverflow);
+
+    /* 24660 = 10*log10(2)/4 scaled 0,15 */
+    Ltmp = Mpy_32_16(integer, fraction, 24660, pOverflow);
+
+    /* extra shift for 30,1 => 15,0 extract correction */
+    Ltmp = L_shr_r(Ltmp, 5 + 1, pOverflow);
+
+    tmp = (Word16) Ltmp;
+
+    return (tmp);
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: block_norm
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    in -- array of type Word16 -- pointer to data sequence to be normalised
+    length -- Word16 -- number of elements in data sequence
+    headroom -- Word16 -- number of headroom bits
+
+ Outputs:
+    out -- array of type Word16 -- normalised output data sequence
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    Word16 -- number of bits sequence was left shifted
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ The purpose of this function is block normalise the input data sequence
+
+ 1) Search for maximum absolute valued data element
+ 2) Normalise the max element with "headroom"
+ 3) Transfer/shift the input sequence to the output buffer
+ 4) Return the number of left shifts
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION
+
+     An input sequence of all zeros will return the maximum
+     number of left shifts allowed, NOT the value returned
+     by a norm_s(0) call, since it desired to associate an
+     all zeros sequence with low energy.
+------------------------------------------------------------------------------
+*/
+
+Word16 block_norm(
+    Word16 * in,
+    Word16 * out,
+    Word16 length,
+    Word16 headroom,
+    Flag *pOverflow)
+{
+
+    Word16 i;
+    Word16 max;
+    Word16 scnt;
+    Word16 adata;
+
+    max = abs_s(in[0]);
+
+    for (i = 1; i < length; i++)
+    {
+        adata = abs_s(in[i]);
+
+        if (adata > max)
+        {
+            max = adata;
+        }
+    }
+    if (max != 0)
+    {
+        scnt = sub(norm_s(max), headroom, pOverflow);
+        for (i = 0; i < length; i++)
+        {
+            out[i] = shl(in[i], scnt, pOverflow);
+        }
+    }
+    else
+    {
+        scnt = sub(16, headroom, pOverflow);
+        for (i = 0; i < length; i++)
+        {
+            out[i] = 0;
+        }
+    }
+    return (scnt);
+}
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad2
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    farray_ptr -- array of type Word16, length 80 (input array)
+    vadState2 -- pointer to vadState2 state structure
+
+ Outputs:
+    vadState2 -- pointer to vadState2 state structure --
+                        state variables are updated
+   pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    Word16
+                 VAD(m) - two successive calls to vad2() yield
+                 the VAD decision for the 20 ms frame:
+                 VAD_flag = VAD(m-1) || VAD(m)
+
+ Global Variables Used:
+
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function provides the Voice Activity Detection function option 2
+ for the Adaptive Multi-rate (AMR) codec.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 vad2(Word16 * farray_ptr, vadState2 * st, Flag *pOverflow)
+{
+
+    /* State tables that use 22,9 or 27,4 scaling for ch_enrg[] */
+
+    const Word16 noise_floor_chan[2] = {NOISE_FLOOR_CHAN_0, NOISE_FLOOR_CHAN_1};
+    const Word16 min_chan_enrg[2] =    {MIN_CHAN_ENRG_0, MIN_CHAN_ENRG_1};
+    const Word16 ine_noise[2] =        {INE_NOISE_0, INE_NOISE_1};
+    const Word16 fbits[2] =        {FRACTIONAL_BITS_0, FRACTIONAL_BITS_1};
+    const Word16 state_change_shift_r[2] = {STATE_1_TO_0_SHIFT_R, STATE_0_TO_1_SHIFT_R};
+
+    /* Energy scale table given 30,1 input scaling (also account for -6 dB shift on input) */
+    const Word16 enrg_norm_shift[2] =  {(FRACTIONAL_BITS_0 - 1 + 2), (FRACTIONAL_BITS_1 - 1 + 2)};
+
+
+    /* Automatic variables */
+
+    Word32 Lenrg;               /* scaled as 30,1 */
+    Word32 Ltne;                /* scaled as 22,9 */
+    Word32 Ltce;                /* scaled as 22,9 or 27,4 */
+
+    Word16 tne_db;              /* scaled as 7,8 */
+    Word16 tce_db;              /* scaled as 7,8 */
+
+    Word16 input_buffer[FRM_LEN];       /* used for block normalising input data */
+    Word16 data_buffer[FFT_LEN];        /* used for in-place FFT */
+
+    Word16 ch_snr[NUM_CHAN];        /* scaled as 7,8 */
+    Word16 ch_snrq;             /* scaled as 15,0 (in 0.375 dB steps) */
+    Word16 vm_sum;              /* scaled as 15,0 */
+    Word16 ch_enrg_dev;         /* scaled as 7,8 */
+
+    Word32 Lpeak;               /* maximum channel energy */
+    Word16 p2a_flag;            /* flag to indicate spectral peak-to-average ratio > 10 dB */
+
+    Word16 ch_enrg_db[NUM_CHAN];        /* scaled as 7,8 */
+    Word16 ch_noise_db;         /* scaled as 7,8 */
+
+    Word16 alpha;               /* scaled as 0,15 */
+    Word16 one_m_alpha;         /* scaled as 0,15 */
+    Word16 update_flag;         /* set to indicate a background noise estimate update */
+
+    Word16 i;
+    Word16 j;
+    Word16 j1;
+    Word16 j2;            /* Scratch variables */
+
+    Word16 hi1;
+    Word16 lo1;
+
+    Word32 Ltmp;
+    Word32 Ltmp1;
+    Word32 Ltmp2;
+    Word16 tmp;
+
+    Word16 normb_shift;     /* block norm shift count */
+
+    Word16 ivad;            /* intermediate VAD decision (return value) */
+    Word16 tsnrq;           /* total signal-to-noise ratio (quantized 3 dB steps) scaled as 15,0 */
+    Word16 xt;          /* instantaneous frame SNR in dB, scaled as 7,8 */
+
+    Word16 state_change;
+
+
+    /* Increment frame counter */
+    st->Lframe_cnt = L_add(st->Lframe_cnt, 1, pOverflow);
+
+    /* Block normalize the input */
+    normb_shift = block_norm(farray_ptr, input_buffer, FRM_LEN, FFT_HEADROOM, pOverflow);
+
+    /* Pre-emphasize the input data and store in the data buffer with the appropriate offset */
+    for (i = 0; i < DELAY; i++)
+    {
+        data_buffer[i] = 0;
+    }
+
+    st->pre_emp_mem = shr_r(st->pre_emp_mem, sub(st->last_normb_shift, normb_shift, pOverflow), pOverflow);
+    st->last_normb_shift = normb_shift;
+
+    data_buffer[DELAY] = add(input_buffer[0], mult(PRE_EMP_FAC, st->pre_emp_mem, pOverflow), pOverflow);
+
+    for (i = DELAY + 1, j = 1; i < DELAY + FRM_LEN; i++, j++)
+    {
+        data_buffer[i] = add(input_buffer[j], mult(PRE_EMP_FAC, input_buffer[j-1], pOverflow), pOverflow);
+    }
+    st->pre_emp_mem = input_buffer[FRM_LEN-1];
+
+    for (i = DELAY + FRM_LEN; i < FFT_LEN; i++)
+    {
+        data_buffer[i] = 0;
+    }
+
+
+    /* Perform FFT on the data buffer */
+    r_fft(data_buffer, pOverflow);
+
+
+    /* Use normb_shift factor to determine the scaling of the energy estimates */
+    state_change = 0;
+    if (st->shift_state == 0)
+    {
+        if (normb_shift <= (-FFT_HEADROOM + 2))
+        {
+            state_change = 1;
+            st->shift_state = 1;
+        }
+    }
+    else
+    {
+        if (normb_shift >= (-FFT_HEADROOM + 5))
+        {
+            state_change = 1;
+            st->shift_state = 0;
+        }
+    }
+
+    /* Scale channel energy estimate */
+    if (state_change)
+    {
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            st->Lch_enrg[i] =
+                L_shr(
+                    st->Lch_enrg[i],
+                    state_change_shift_r[st->shift_state],
+                    pOverflow);
+        }
+    }
+
+
+    /* Estimate the energy in each channel */
+    if (st->Lframe_cnt == 1)
+    {
+        alpha = 32767;
+        one_m_alpha = 0;
+    }
+    else
+    {
+        alpha = CEE_SM_FAC;
+        one_m_alpha = ONE_MINUS_CEE_SM_FAC;
+    }
+
+    for (i = LO_CHAN; i <= HI_CHAN; i++)
+    {
+        Lenrg = 0;
+        j1 = ch_tbl[i][0];
+        j2 = ch_tbl[i][1];
+
+        for (j = j1; j <= j2; j++)
+        {
+            Lenrg = L_mac(
+                        Lenrg,
+                        data_buffer[2 * j],
+                        data_buffer[2 * j],
+                        pOverflow);
+
+            Lenrg = L_mac(
+                        Lenrg,
+                        data_buffer[2 * j + 1],
+                        data_buffer[2 * j + 1],
+                        pOverflow);
+        }
+
+        /* Denorm energy & scale 30,1 according to the state */
+        tmp = shl(normb_shift, 1, pOverflow);
+        tmp = sub(tmp, enrg_norm_shift[st->shift_state], pOverflow);
+        Lenrg = L_shr_r(Lenrg, tmp, pOverflow);
+
+        /* integrate over time:
+         * e[i] = (1-alpha)*e[i] + alpha*enrg/num_bins_in_chan
+         */
+        tmp = mult(alpha, ch_tbl_sh[i], pOverflow);
+        L_Extract(Lenrg, &hi1, &lo1, pOverflow);
+        Ltmp = Mpy_32_16(hi1, lo1, tmp, pOverflow);
+
+        L_Extract(st->Lch_enrg[i], &hi1, &lo1, pOverflow);
+
+        Ltmp1 = Mpy_32_16(hi1, lo1, one_m_alpha, pOverflow);
+        st->Lch_enrg[i] = L_add(Ltmp, Ltmp1, pOverflow);
+
+        if (st->Lch_enrg[i] < min_chan_enrg[st->shift_state])
+        {
+            st->Lch_enrg[i] = min_chan_enrg[st->shift_state];
+        }
+
+    }
+
+
+    /* Compute the total channel energy estimate (Ltce) */
+    Ltce = 0;
+    for (i = LO_CHAN; i <= HI_CHAN; i++)
+    {
+        Ltce =
+            L_add(
+                Ltce,
+                st->Lch_enrg[i],
+                pOverflow);
+    }
+
+
+    /* Calculate spectral peak-to-average ratio, set flag if p2a > 10 dB */
+    Lpeak = 0;
+
+    /* Sine waves not valid for low frequencies */
+    for (i = LO_CHAN + 2; i <= HI_CHAN; i++)
+    {
+        if (L_sub(st->Lch_enrg [i], Lpeak, pOverflow) > 0)
+        {
+            Lpeak = st->Lch_enrg [i];
+        }
+    }
+
+    /* Set p2a_flag if peak (dB) > average channel energy (dB) + 10 dB */
+    /*   Lpeak > Ltce/num_channels * 10^(10/10)                        */
+    /*   Lpeak > (10/16)*Ltce                                          */
+
+    L_Extract(Ltce, &hi1, &lo1, pOverflow);
+    Ltmp = Mpy_32_16(hi1, lo1, 20480, pOverflow);
+    if (L_sub(Lpeak, Ltmp, pOverflow) > 0)
+    {
+        p2a_flag = TRUE;
+    }
+    else
+    {
+        p2a_flag = FALSE;
+    }
+
+
+    /* Initialize channel noise estimate to either the channel energy or fixed level  */
+    /*   Scale the energy appropriately to yield state 0 (22,9) scaling for noise */
+    if (st->Lframe_cnt <= 4)
+    {
+        if (p2a_flag == TRUE)
+        {
+            for (i = LO_CHAN; i <= HI_CHAN; i++)
+            {
+                st->Lch_noise[i] = INE_NOISE_0;
+            }
+        }
+        else
+        {
+            for (i = LO_CHAN; i <= HI_CHAN; i++)
+            {
+                if (st->Lch_enrg[i] < ine_noise[st->shift_state])
+                {
+                    st->Lch_noise[i] = INE_NOISE_0;
+                }
+                else
+                {
+                    if (st->shift_state == 1)
+                    {
+                        st->Lch_noise[i] =
+                            L_shr(
+                                st->Lch_enrg[i],
+                                state_change_shift_r[0],
+                                pOverflow);
+                    }
+                    else
+                    {
+                        st->Lch_noise[i] = st->Lch_enrg[i];
+                    }
+                }
+            }
+        }
+    }
+
+
+    /* Compute the channel energy (in dB), the channel SNRs, and the sum of voice metrics */
+    vm_sum = 0;
+    for (i = LO_CHAN; i <= HI_CHAN; i++)
+    {
+        ch_enrg_db[i] =
+            fn10Log10(
+                st->Lch_enrg[i],
+                fbits[st->shift_state],
+                pOverflow);
+
+        ch_noise_db =
+            fn10Log10(
+                st->Lch_noise[i],
+                FRACTIONAL_BITS_0,
+                pOverflow);
+
+        ch_snr[i] = sub(ch_enrg_db[i], ch_noise_db, pOverflow);
+
+        /* quantize channel SNR in 3/8 dB steps (scaled 7,8 => 15,0) */
+        /*   ch_snr = pv_round((snr/(3/8))>>8)                          */
+        /*          = pv_round(((0.6667*snr)<<2)>>8)                    */
+        /*          = pv_round((0.6667*snr)>>6)                         */
+
+        tmp = mult(21845, ch_snr[i], pOverflow);
+
+        ch_snrq = shr_r(tmp, 6, pOverflow);
+
+        /* Accumulate the sum of voice metrics  */
+        if (ch_snrq < 89)
+        {
+            if (ch_snrq > 0)
+            {
+                j = ch_snrq;
+            }
+            else
+            {
+                j = 0;
+            }
+        }
+        else
+        {
+            j = 89;
+        }
+        vm_sum = add(vm_sum, vm_tbl[j], pOverflow);
+    }
+
+
+    /* Initialize NOMINAL peak voice energy and average noise energy, calculate instantaneous SNR */
+    if (st->Lframe_cnt <= 4 || st->fupdate_flag == TRUE)
+    {
+        /* tce_db = (96 - 22 - 10*log10(64) (due to FFT)) scaled as 7,8 */
+        tce_db = 14320;
+        st->negSNRvar = 0;
+        st->negSNRbias = 0;
+
+        /* Compute the total noise estimate (Ltne) */
+        Ltne = 0;
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            Ltne = L_add(Ltne, st->Lch_noise[i], pOverflow);
+        }
+
+        /* Get total noise in dB */
+        tne_db =
+            fn10Log10(
+                Ltne,
+                FRACTIONAL_BITS_0,
+                pOverflow);
+
+        /* Initialise instantaneous and long-term peak signal-to-noise ratios */
+        xt = sub(tce_db, tne_db, pOverflow);
+        st->tsnr = xt;
+    }
+    else
+    {
+        /* Calculate instantaneous frame signal-to-noise ratio */
+        /* xt = 10*log10( sum(2.^(ch_snr*0.1*log2(10)))/length(ch_snr) ) */
+        Ltmp1 = 0;
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            /* Ltmp2 = ch_snr[i] * 0.1 * log2(10); (ch_snr scaled as 7,8) */
+            Ltmp2 = L_mult(ch_snr[i], 10885, pOverflow);
+            Ltmp2 = L_shr(Ltmp2, 8, pOverflow);
+
+            L_Extract(Ltmp2, &hi1, &lo1, pOverflow);
+            hi1 = add(hi1, 3, pOverflow);  /* 2^3 to compensate for negative SNR */
+
+            Ltmp2 = Pow2(hi1, lo1, pOverflow);
+
+            Ltmp1 = L_add(Ltmp1, Ltmp2, pOverflow);
+        }
+        xt =
+            fn10Log10(
+                Ltmp1,
+                4 + 3,
+                pOverflow);     /* average by 16, inverse compensation 2^3 */
+
+        /* Estimate long-term "peak" SNR */
+        if (xt > st->tsnr)
+        {
+            Ltmp1 = L_mult(29491, st->tsnr, pOverflow);
+            Ltmp2 = L_mult(3277, xt, pOverflow);
+            Ltmp1 = L_add(Ltmp1, Ltmp2, pOverflow);
+
+            /* tsnr = 0.9*tsnr + 0.1*xt; */
+            st->tsnr = pv_round(Ltmp1, pOverflow);
+        }
+        /* else if (xt > 0.625*tsnr) */
+        else
+        {
+            tmp = mult(20480, st->tsnr, pOverflow);
+            tmp = sub(xt, tmp, pOverflow);
+
+            if (tmp > 0)
+            {
+                /* tsnr = 0.998*tsnr + 0.002*xt; */
+                Ltmp1 = L_mult(32702, st->tsnr, pOverflow);
+                Ltmp2 = L_mult(66, xt, pOverflow);
+                Ltmp1 = L_add(Ltmp1, Ltmp2, pOverflow);
+
+                st->tsnr = pv_round(Ltmp1, pOverflow);
+            }
+        }
+    }
+
+    /* Quantize the long-term SNR in 3 dB steps, limit to 0 <= tsnrq <= 19 */
+    tmp = mult(st->tsnr, 10923, pOverflow);
+    tsnrq = shr(tmp, 8, pOverflow);
+
+    /* tsnrq = min(19, max(0, tsnrq)); */
+    if (tsnrq > 19)
+    {
+        tsnrq = 19;
+    }
+    else if (tsnrq < 0)
+    {
+        tsnrq = 0;
+    }
+
+    /* Calculate the negative SNR sensitivity bias */
+    if (xt < 0)
+    {
+        /* negSNRvar = 0.99*negSNRvar + 0.01*xt*xt; */
+        /*   xt scaled as 7,8 => xt*xt scaled as 14,17, shift to 7,8 and round */
+        Ltmp1 = L_mult(xt, xt, pOverflow);
+        Ltmp1 = L_shl(Ltmp1, 7, pOverflow);
+        tmp = pv_round(Ltmp1, pOverflow);
+
+        Ltmp1 = L_mult(32440, st->negSNRvar, pOverflow);
+        Ltmp2 = L_mult(328, tmp, pOverflow);
+        Ltmp1 = L_add(Ltmp1, Ltmp2, pOverflow);
+
+        st->negSNRvar = pv_round(Ltmp1, pOverflow);
+
+        /* if (negSNRvar > 4.0) negSNRvar = 4.0;  */
+        if (st->negSNRvar > 1024)
+        {
+            st->negSNRvar = 1024;
+        }
+
+        /* negSNRbias = max(12.0*(negSNRvar - 0.65), 0.0); */
+        tmp = sub(st->negSNRvar, 166, pOverflow);
+        tmp = shl(tmp, 4, pOverflow);
+        tmp = mult_r(tmp, 24576, pOverflow);
+
+        if (tmp < 0)
+        {
+            st->negSNRbias = 0;
+        }
+        else
+        {
+            st->negSNRbias = shr(tmp, 8, pOverflow);
+        }
+    }
+
+
+    /* Determine VAD as a function of the voice metric sum and quantized SNR */
+
+    tmp = add(vm_threshold_table[tsnrq], st->negSNRbias, pOverflow);
+
+    if (vm_sum > tmp)
+    {
+        ivad = 1;
+        st->burstcount = add(st->burstcount, 1, pOverflow);
+        if (st->burstcount > burstcount_table[tsnrq])
+        {
+            st->hangover = hangover_table[tsnrq];
+        }
+    }
+    else
+    {
+        st->burstcount = 0;
+        st->hangover = sub(st->hangover, 1, pOverflow);
+        if (st->hangover <= 0)
+        {
+            ivad = 0;
+            st->hangover = 0;
+        }
+        else
+        {
+            ivad = 1;
+        }
+    }
+
+
+    /* Calculate log spectral deviation */
+    ch_enrg_dev = 0;
+    if (st->Lframe_cnt == 1)
+    {
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            st->ch_enrg_long_db[i] = ch_enrg_db[i];
+        }
+    }
+    else
+    {
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            tmp = sub(st->ch_enrg_long_db[i], ch_enrg_db[i], pOverflow);
+            tmp = abs_s(tmp);
+
+            ch_enrg_dev = add(ch_enrg_dev, tmp, pOverflow);
+        }
+    }
+
+    /*
+     * Calculate long term integration constant as
+     * a function of instantaneous SNR
+     * (i.e., high SNR (tsnr dB) -> slower integration (alpha = HIGH_ALPHA),
+     *         low SNR (0 dB) -> faster integration (alpha = LOW_ALPHA)
+     */
+
+    /* alpha = HIGH_ALPHA - ALPHA_RANGE * (tsnr - xt)
+     * ----------------------------------------------
+     *         tsnr, low <= alpha <= high
+     */
+    tmp = sub(st->tsnr, xt, pOverflow);
+    if (tmp <= 0 || st->tsnr <= 0)
+    {
+        alpha = HIGH_ALPHA;
+        one_m_alpha = 32768L - HIGH_ALPHA;
+    }
+    else if (tmp > st->tsnr)
+    {
+        alpha = LOW_ALPHA;
+        one_m_alpha = 32768L - LOW_ALPHA;
+    }
+    else
+    {
+        tmp = div_s(tmp, st->tsnr);
+        tmp = mult(ALPHA_RANGE, tmp, pOverflow);
+        alpha = sub(HIGH_ALPHA, tmp, pOverflow);
+        one_m_alpha = sub(32767, alpha, pOverflow);
+    }
+
+    /* Calc long term log spectral energy */
+    for (i = LO_CHAN; i <= HI_CHAN; i++)
+    {
+        Ltmp1 = L_mult(one_m_alpha, ch_enrg_db[i], pOverflow);
+        Ltmp2 = L_mult(alpha, st->ch_enrg_long_db[i], pOverflow);
+
+        Ltmp1 = L_add(Ltmp1, Ltmp2, pOverflow);
+        st->ch_enrg_long_db[i] = pv_round(Ltmp1, pOverflow);
+    }
+
+
+    /* Set or clear the noise update flags */
+    update_flag = FALSE;
+    st->fupdate_flag = FALSE;
+    if (vm_sum <= UPDATE_THLD)
+    {
+        if (st->burstcount == 0)
+        {
+            update_flag = TRUE;
+            st->update_cnt = 0;
+        }
+    }
+    else if (L_sub(Ltce, noise_floor_chan[st->shift_state], pOverflow) > 0)
+    {
+        if (ch_enrg_dev < DEV_THLD)
+        {
+            if (p2a_flag == FALSE)
+            {
+                if (st->LTP_flag == FALSE)
+                {
+                    st->update_cnt = add(st->update_cnt, 1, pOverflow);
+                    if (st->update_cnt >= UPDATE_CNT_THLD)
+                    {
+                        update_flag = TRUE;
+                        st->fupdate_flag = TRUE;
+                    }
+                }
+            }
+        }
+    }
+    if (st->update_cnt == st->last_update_cnt)
+    {
+        st->hyster_cnt = add(st->hyster_cnt, 1, pOverflow);
+    }
+    else
+    {
+        st->hyster_cnt = 0;
+    }
+
+    st->last_update_cnt = st->update_cnt;
+
+    if (st->hyster_cnt > HYSTER_CNT_THLD)
+    {
+        st->update_cnt = 0;
+    }
+
+
+    /* Conditionally update the channel noise estimates */
+    if (update_flag == TRUE)
+    {
+        /* Check shift state */
+        if (st->shift_state == 1)
+        {
+            /* get factor to shift ch_enrg[]
+             * from state 1 to 0 (noise always state 0)
+             */
+            tmp = state_change_shift_r[0];
+        }
+        else
+        {
+            /* No shift if already state 0 */
+            tmp = 0;
+        }
+
+        /* Update noise energy estimate */
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            /* integrate over time: en[i] = (1-alpha)*en[i] + alpha*e[n] */
+            /* (extract with shift compensation for state 1) */
+
+            Ltmp1 = L_shr(st->Lch_enrg[i], tmp, pOverflow);
+            L_Extract(Ltmp1, &hi1, &lo1, pOverflow);
+
+            Ltmp = Mpy_32_16(hi1, lo1, CNE_SM_FAC, pOverflow);
+
+            L_Extract(st->Lch_noise[i], &hi1, &lo1, pOverflow);
+
+            Ltmp1 = Mpy_32_16(hi1, lo1, ONE_MINUS_CNE_SM_FAC, pOverflow);
+            st->Lch_noise[i] = L_add(Ltmp, Ltmp1, pOverflow);
+
+            /* Limit low level noise */
+            if (st->Lch_noise[i] <= MIN_NOISE_ENRG_0)
+            {
+                st->Lch_noise[i] = MIN_NOISE_ENRG_0;
+            }
+        }
+    }
+
+    return(ivad);
+}                               /* end of vad2 () */
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad2_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- double pointer to type vadState2 -- pointer to memory to
+                                                 be initialized.
+
+ Outputs:
+    state -- points to initalized area in memory.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Allocates state memory and initializes state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 vad2_init(vadState2 **state)
+{
+    vadState2* s;
+
+    if (state == (vadState2 **) NULL)
+    {
+        return -1;
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (vadState2 *) oscl_malloc(sizeof(vadState2))) == NULL)
+    {
+        return -1;
+    }
+
+    vad2_reset(s);
+
+    *state = s;
+
+    return 0;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad2_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose:    Resets state memory to zero
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 vad2_reset(vadState2 * st)
+{
+    Word16  i;
+    Word16  *ptr;
+
+    if (st == (vadState2 *) NULL)
+    {
+        return -1;
+    }
+    ptr = (Word16 *)st;
+
+    for (i = 0; i < sizeof(vadState2) / 2; i++)
+    {
+        *ptr++ = 0;
+    }
+
+    return 0;
+}                       /* end of vad2_reset () */
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad2_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    The memory used for state memory is freed
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad2_exit(vadState2 **state)
+{
+    if (state == NULL || *state == NULL)
+    {
+        return;
+    }
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp
new file mode 100644 (file)
index 0000000..98382b8
--- /dev/null
@@ -0,0 +1,155 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: weight_a.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "weight_a.h"
+#include    "typedef.h"
+#include    "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Weight_Ai
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    a = LPC coefficients (Word16)
+    fac = Spectral expansion factors (Word16)
+    a_exp = Spectral expanded LPC coefficients (Word16)
+
+ Outputs:
+    a_exp points to the updated spectral expanded LPC coefficients
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates the spectral expansion for the LP coefficients of
+ order M.
+    a_exp[i] = a[i] * fac[i-1]    ; i=1..M
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ weight_a.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Weight_Ai (
+    Word16 a[],         // (i)     : a[M+1]  LPC coefficients   (M=10)
+    const Word16 fac[], // (i)     : Spectral expansion factors.
+    Word16 a_exp[]      // (o)     : Spectral expanded LPC coefficients
+)
+{
+    Word16 i;
+    a_exp[0] = a[0];
+
+    for (i = 1; i <= M; i++)
+    {
+        a_exp[i] = pv_round (L_mult (a[i], fac[i - 1]));
+    }
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF void Weight_Ai(
+    Word16 a[],         /* (i)   : a[M+1]  LPC coefficients   (M=10)    */
+    const Word16 fac[], /* (i)   : Spectral expansion factors.          */
+    Word16 a_exp[]      /* (o)   : Spectral expanded LPC coefficients   */
+)
+{
+    register Word16 i;
+
+    *(a_exp) = *(a);
+
+    for (i = M; i >= 1; i--)
+    {
+        a_exp += 1;
+        a += 1;
+        fac += 1;
+        *(a_exp) = (Word16)((((Word32) * (a)) * *(fac - 1)
+                             + 0x00004000L) >> 15);
+    }
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/window_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/window_tab.cpp
new file mode 100644 (file)
index 0000000..14ecf2e
--- /dev/null
@@ -0,0 +1,244 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: window_tab.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    None
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+      File             : window.tab
+      Purpose          : Hamming_cos window for LPC analysis.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "window_tab.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+    /*************************************************************************
+     *
+     * Hamming_cos windows for LPC analysis.
+     *
+     *************************************************************************/
+
+    /* window for non-EFR modesm; uses 40 samples lookahead */
+
+    const Word16 window_200_40[L_WINDOW] =
+    {
+        2621,  2623,  2629,  2638,  2651,  2668,  2689,  2713,  2741,  2772,
+        2808,  2847,  2890,  2936,  2986,  3040,  3097,  3158,  3223,  3291,
+        3363,  3438,  3517,  3599,  3685,  3774,  3867,  3963,  4063,  4166,
+        4272,  4382,  4495,  4611,  4731,  4853,  4979,  5108,  5240,  5376,
+        5514,  5655,  5800,  5947,  6097,  6250,  6406,  6565,  6726,  6890,
+        7057,  7227,  7399,  7573,  7750,  7930,  8112,  8296,  8483,  8672,
+        8863,  9057,  9252,  9450,  9650,  9852, 10055, 10261, 10468, 10677,
+        10888, 11101, 11315, 11531, 11748, 11967, 12187, 12409, 12632, 12856,
+        13082, 13308, 13536, 13764, 13994, 14225, 14456, 14688, 14921, 15155,
+        15389, 15624, 15859, 16095, 16331, 16568, 16805, 17042, 17279, 17516,
+        17754, 17991, 18228, 18465, 18702, 18939, 19175, 19411, 19647, 19882,
+        20117, 20350, 20584, 20816, 21048, 21279, 21509, 21738, 21967, 22194,
+        22420, 22644, 22868, 23090, 23311, 23531, 23749, 23965, 24181, 24394,
+        24606, 24816, 25024, 25231, 25435, 25638, 25839, 26037, 26234, 26428,
+        26621, 26811, 26999, 27184, 27368, 27548, 27727, 27903, 28076, 28247,
+        28415, 28581, 28743, 28903, 29061, 29215, 29367, 29515, 29661, 29804,
+        29944, 30081, 30214, 30345, 30472, 30597, 30718, 30836, 30950, 31062,
+        31170, 31274, 31376, 31474, 31568, 31659, 31747, 31831, 31911, 31988,
+        32062, 32132, 32198, 32261, 32320, 32376, 32428, 32476, 32521, 32561,
+        32599, 32632, 32662, 32688, 32711, 32729, 32744, 32755, 32763, 32767,
+        32767, 32741, 32665, 32537, 32359, 32129, 31850, 31521, 31143, 30716,
+        30242, 29720, 29151, 28538, 27879, 27177, 26433, 25647, 24821, 23957,
+        23055, 22117, 21145, 20139, 19102, 18036, 16941, 15820, 14674, 13505,
+        12315, 11106,  9879,  8637,  7381,  6114,  4838,  3554,  2264,   971
+    };
+
+
+    /* window for EFR, first two subframes, no lookahead */
+
+    const Word16 window_160_80[L_WINDOW] =
+    {
+        2621, 2624, 2633, 2648, 2668, 2695, 2727, 2765, 2809, 2859,
+        2915, 2976, 3043, 3116, 3194, 3279, 3368, 3464, 3565, 3671,
+        3783, 3900, 4023, 4151, 4285, 4423, 4567, 4716, 4870, 5029,
+        5193, 5362, 5535, 5714, 5897, 6084, 6277, 6473, 6674, 6880,
+        7089, 7303, 7521, 7742, 7968, 8197, 8430, 8667, 8907, 9151,
+        9398, 9648, 9902, 10158, 10417, 10680, 10945, 11212, 11482, 11755,
+        12030, 12307, 12586, 12867, 13150, 13435, 13722, 14010, 14299, 14590,
+        14882, 15175, 15469, 15764, 16060, 16356, 16653, 16950, 17248, 17546,
+        17844, 18141, 18439, 18736, 19033, 19330, 19625, 19920, 20214, 20507,
+        20799, 21090, 21380, 21668, 21954, 22239, 22522, 22803, 23083, 23360,
+        23635, 23907, 24177, 24445, 24710, 24972, 25231, 25488, 25741, 25991,
+        26238, 26482, 26722, 26959, 27192, 27422, 27647, 27869, 28087, 28300,
+        28510, 28715, 28916, 29113, 29305, 29493, 29676, 29854, 30028, 30197,
+        30361, 30519, 30673, 30822, 30966, 31105, 31238, 31366, 31489, 31606,
+        31718, 31825, 31926, 32021, 32111, 32195, 32273, 32346, 32413, 32475,
+        32530, 32580, 32624, 32662, 32695, 32721, 32742, 32756, 32765, 32767,
+        32767, 32756, 32720, 32661, 32578, 32471, 32341, 32188, 32012, 31813,
+        31592, 31349, 31084, 30798, 30492, 30165, 29818, 29453, 29068, 28666,
+        28247, 27810, 27358, 26891, 26408, 25913, 25404, 24883, 24350, 23807,
+        23255, 22693, 22124, 21548, 20965, 20378, 19786, 19191, 18593, 17994,
+        17395, 16796, 16199, 15604, 15012, 14424, 13842, 13265, 12696, 12135,
+        11582, 11039, 10507, 9986, 9477, 8981, 8499, 8031, 7579, 7143,
+        6723, 6321, 5937, 5571, 5225, 4898, 4591, 4305, 4041, 3798,
+        3577, 3378, 3202, 3048, 2918, 2812, 2729, 2669, 2633, 2621
+    };
+
+    /* window for EFR, last two subframes, no lookahead */
+
+    const Word16 window_232_8[L_WINDOW] =
+    {
+        2621, 2623, 2627, 2634, 2644, 2656, 2671, 2689, 2710, 2734,
+        2760, 2789, 2821, 2855, 2893, 2933, 2975, 3021, 3069, 3120,
+        3173, 3229, 3288, 3350, 3414, 3481, 3550, 3622, 3697, 3774,
+        3853, 3936, 4021, 4108, 4198, 4290, 4385, 4482, 4582, 4684,
+        4788, 4895, 5004, 5116, 5230, 5346, 5464, 5585, 5708, 5833,
+        5960, 6090, 6221, 6355, 6491, 6629, 6769, 6910, 7054, 7200,
+        7348, 7498, 7649, 7803, 7958, 8115, 8274, 8434, 8597, 8761,
+        8926, 9093, 9262, 9432, 9604, 9778, 9952, 10129, 10306, 10485,
+        10665, 10847, 11030, 11214, 11399, 11586, 11773, 11962, 12152, 12342,
+        12534, 12727, 12920, 13115, 13310, 13506, 13703, 13901, 14099, 14298,
+        14497, 14698, 14898, 15100, 15301, 15504, 15706, 15909, 16112, 16316,
+        16520, 16724, 16928, 17132, 17337, 17541, 17746, 17950, 18155, 18359,
+        18564, 18768, 18972, 19175, 19379, 19582, 19785, 19987, 20189, 20390,
+        20591, 20792, 20992, 21191, 21390, 21588, 21785, 21981, 22177, 22372,
+        22566, 22759, 22951, 23143, 23333, 23522, 23710, 23897, 24083, 24268,
+        24451, 24633, 24814, 24994, 25172, 25349, 25525, 25699, 25871, 26042,
+        26212, 26380, 26546, 26711, 26874, 27035, 27195, 27353, 27509, 27664,
+        27816, 27967, 28115, 28262, 28407, 28550, 28691, 28830, 28967, 29102,
+        29234, 29365, 29493, 29619, 29743, 29865, 29985, 30102, 30217, 30330,
+        30440, 30548, 30654, 30757, 30858, 30956, 31052, 31146, 31237, 31326,
+        31412, 31495, 31576, 31655, 31730, 31804, 31874, 31942, 32008, 32071,
+        32131, 32188, 32243, 32295, 32345, 32392, 32436, 32477, 32516, 32552,
+        32585, 32615, 32643, 32668, 32690, 32709, 32726, 32740, 32751, 32759,
+        32765, 32767, 32767, 32097, 30112, 26895, 22576, 17333, 11380, 4962
+    };
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL FUNCTION REFERENCES
+    ; Declare functions defined elsewhere and referenced in this module
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; Define all local variables
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Function body here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Return nothing or data or data pointer
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/Android.mk b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/Android.mk
new file mode 100644 (file)
index 0000000..48ecacb
--- /dev/null
@@ -0,0 +1,64 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+       src/decoder_gsm_amr.cpp \
+       src/a_refl.cpp \
+       src/agc.cpp \
+       src/amrdecode.cpp \
+       src/b_cn_cod.cpp \
+       src/bgnscd.cpp \
+       src/c_g_aver.cpp \
+       src/d1035pf.cpp \
+       src/d2_11pf.cpp \
+       src/d2_9pf.cpp \
+       src/d3_14pf.cpp \
+       src/d4_17pf.cpp \
+       src/d8_31pf.cpp \
+       src/d_gain_c.cpp \
+       src/d_gain_p.cpp \
+       src/d_plsf.cpp \
+       src/d_plsf_3.cpp \
+       src/d_plsf_5.cpp \
+       src/dec_amr.cpp \
+       src/dec_gain.cpp \
+       src/dec_input_format_tab.cpp \
+       src/dec_lag3.cpp \
+       src/dec_lag6.cpp \
+       src/dtx_dec.cpp \
+       src/ec_gains.cpp \
+       src/ex_ctrl.cpp \
+       src/if2_to_ets.cpp \
+       src/int_lsf.cpp \
+       src/lsp_avg.cpp \
+       src/ph_disp.cpp \
+       src/post_pro.cpp \
+       src/preemph.cpp \
+       src/pstfilt.cpp \
+       src/qgain475_tab.cpp \
+       src/sp_dec.cpp \
+       src/wmf_to_ets.cpp
+
+
+LOCAL_MODULE := libpvdecoder_gsmamr
+
+LOCAL_CFLAGS :=   $(PV_CFLAGS)
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := 
+
+LOCAL_SHARED_LIBRARIES := 
+
+LOCAL_C_INCLUDES := \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/dec/src \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/dec/include \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/include \
+       $(PV_INCLUDES)
+
+LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO)
+
+LOCAL_COPY_HEADERS := \
+       include/decoder_gsm_amr.h \
+       include/pvamrnbdecoder_api.h
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/build/make/local.mk b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/build/make/local.mk
new file mode 100644 (file)
index 0000000..f5fcc15
--- /dev/null
@@ -0,0 +1,58 @@
+# Get the current local path as the first operation
+LOCAL_PATH := $(call get_makefile_dir)
+
+# Clear out the variables used in the local makefiles
+include $(MK)/clear.mk
+
+TARGET := pvdecoder_gsmamr
+
+
+OPTIMIZE_FOR_PERFORMANCE_OVER_SIZE := true
+
+XINCDIRS := ../../../common/include
+
+SRCDIR := ../../src
+INCSRCDIR := ../../include
+
+SRCS := decoder_gsm_amr.cpp \
+       a_refl.cpp \
+       agc.cpp \
+       amrdecode.cpp \
+       b_cn_cod.cpp \
+       bgnscd.cpp \
+       c_g_aver.cpp \
+       d1035pf.cpp \
+       d2_11pf.cpp \
+       d2_9pf.cpp \
+       d3_14pf.cpp \
+       d4_17pf.cpp \
+       d8_31pf.cpp \
+       d_gain_c.cpp \
+       d_gain_p.cpp \
+       d_plsf.cpp \
+       d_plsf_3.cpp \
+       d_plsf_5.cpp \
+       dec_amr.cpp \
+       dec_gain.cpp \
+       dec_input_format_tab.cpp \
+       dec_lag3.cpp \
+       dec_lag6.cpp \
+       dtx_dec.cpp \
+       ec_gains.cpp \
+       ex_ctrl.cpp \
+       if2_to_ets.cpp \
+       int_lsf.cpp \
+       lsp_avg.cpp \
+       ph_disp.cpp \
+       post_pro.cpp \
+       preemph.cpp \
+       pstfilt.cpp \
+       qgain475_tab.cpp \
+       sp_dec.cpp \
+       wmf_to_ets.cpp
+
+HDRS := decoder_gsm_amr.h pvamrnbdecoder_api.h
+
+include $(MK)/library.mk
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/decoder_gsm_amr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/decoder_gsm_amr.h
new file mode 100644 (file)
index 0000000..5fab78d
--- /dev/null
@@ -0,0 +1,71 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+//////////////////////////////////////////////////////////////////////////////////
+//                                                                              //
+//  File: decoder_amr_nb.h                                                      //
+//                                                                              //
+//////////////////////////////////////////////////////////////////////////////////
+
+#ifndef _DECODER_AMR_NB_H
+#define _DECODER_AMR_NB_H
+
+#include "oscl_base.h"
+#include "pvgsmamrdecoderinterface.h"
+
+// CDecoder_AMR_WB
+class CDecoder_AMRInterface;
+class CDecoder_AMR_NB: public CDecoder_AMRInterface
+{
+    public:
+        OSCL_IMPORT_REF void ConstructL();
+        OSCL_IMPORT_REF static CDecoder_AMR_NB *NewL();
+        OSCL_IMPORT_REF virtual ~CDecoder_AMR_NB();
+
+        OSCL_IMPORT_REF virtual int32 StartL(tPVAmrDecoderExternal * pExt,
+                                             bool aAllocateInputBuffer  = false,
+                                             bool aAllocateOutputBuffer = false);
+
+        OSCL_IMPORT_REF virtual int32 ExecuteL(tPVAmrDecoderExternal * pExt);
+
+        OSCL_IMPORT_REF virtual int32 ResetDecoderL();
+        OSCL_IMPORT_REF virtual void StopL();
+        OSCL_IMPORT_REF virtual void TerminateDecoderL();
+
+    private:
+        void* iDecState;
+
+        int16* iInputBuf;
+        int16* iOutputBuf;
+
+
+};
+
+
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/pvamrnbdecoder_api.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/pvamrnbdecoder_api.h
new file mode 100644 (file)
index 0000000..7c324c5
--- /dev/null
@@ -0,0 +1,116 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Name: pvamrnbdecoder_api.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ Main header file for the Packet Video AMR Narrow  Band  decoder library. The
+ constants, structures, and functions defined within this file, along with
+ a basic data types header file, is all that is needed to use and communicate
+ with the library. The internal data structures within the library are
+ purposely hidden.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef _PVAMRNBDECODER_API_H
+#define _PVAMRNBDECODER_API_H
+
+#include    "oscl_base.h"    /* Basic data types used within the lib */
+#include    "pvgsmamrdecoderinterface.h"
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define MAX_NUM_FRAMES_PER_PACKET 20 /* Max number of frames per packet */
+
+#define MAX_NUM_PACKED_INPUT_BYTES 32 /* Max number of packed input bytes */
+
+#define L_FRAME      160
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* PVMP4AUDIODECODER_API_H */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.cpp
new file mode 100644 (file)
index 0000000..674094f
--- /dev/null
@@ -0,0 +1,283 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: a_refl.cpp
+ Functions: a_refl
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "a_refl.h"
+#include "typedef.h"
+#include "cnst.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS [optional]
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES [optional]
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: AMREncode
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    a[] = pointer to directform coefficients of type Word16
+    refl[] = pointer to reflection coefficients of type Word16
+
+ Outputs:
+    pOverflow = 1 if overflow exists in the math operations else zero.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+     File             : a_refl.c
+     Purpose          : Convert from direct form coefficients to
+                        reflection coefficients
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] a_refl.c , 3GPP TS 26.101 version 4.1.0 Release 4, June 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+void A_Refl(
+   Word16 a[],        // i   : Directform coefficients
+   Word16 refl[]      // o   : Reflection coefficients
+)
+{
+   // local variables
+   Word16 i,j;
+   Word16 aState[M];
+   Word16 bState[M];
+   Word16 normShift;
+   Word16 normProd;
+   Word32 L_acc;
+   Word16 scale;
+   Word32 L_temp;
+   Word16 temp;
+   Word16 mult;
+
+   // initialize states
+   for (i = 0; i < M; i++)
+   {
+      aState[i] = a[i];
+   }
+
+   // backward Levinson recursion
+   for (i = M-1; i >= 0; i--)
+   {
+      if (sub(abs_s(aState[i]), 4096) >= 0)
+      {
+         goto ExitRefl;
+      }
+
+      refl[i] = shl(aState[i], 3);
+
+      L_temp = L_mult(refl[i], refl[i]);
+      L_acc = L_sub(MAX_32, L_temp);
+
+      normShift = norm_l(L_acc);
+      scale = sub(15, normShift);
+
+      L_acc = L_shl(L_acc, normShift);
+      normProd = pv_round(L_acc);
+
+      mult = div_s(16384, normProd);
+
+      for (j = 0; j < i; j++)
+      {
+         L_acc = L_deposit_h(aState[j]);
+         L_acc = L_msu(L_acc, refl[i], aState[i-j-1]);
+
+         temp = pv_round(L_acc);
+         L_temp = L_mult(mult, temp);
+         L_temp = L_shr_r(L_temp, scale);
+
+         if (L_sub(L_abs(L_temp), 32767) > 0)
+         {
+            goto ExitRefl;
+         }
+
+         bState[j] = extract_l(L_temp);
+      }
+
+      for (j = 0; j < i; j++)
+      {
+         aState[j] = bState[j];
+      }
+   }
+   return;
+
+ExitRefl:
+   for (i = 0; i < M; i++)
+   {
+      refl[i] = 0;
+   }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void A_Refl(
+    Word16 a[],        /* i   : Directform coefficients */
+    Word16 refl[],     /* o   : Reflection coefficients */
+    Flag   *pOverflow
+)
+{
+    /* local variables */
+    Word16 i;
+    Word16 j;
+    Word16 aState[M];
+    Word16 bState[M];
+    Word16 normShift;
+    Word16 normProd;
+    Word32 L_acc;
+    Word16 scale;
+    Word32 L_temp;
+    Word16 temp;
+    Word16 mult;
+
+    /* initialize states */
+    for (i = 0; i < M; i++)
+    {
+        aState[i] = a[i];
+    }
+
+    /* backward Levinson recursion */
+    for (i = M - 1; i >= 0; i--)
+    {
+        if (abs_s(aState[i]) >= 4096)
+        {
+            for (i = 0; i < M; i++)
+            {
+                refl[i] = 0;
+            }
+            break;
+        }
+
+        refl[i] = shl(aState[i], 3, pOverflow);
+
+        L_temp = L_mult(refl[i], refl[i], pOverflow);
+        L_acc = L_sub(MAX_32, L_temp, pOverflow);
+
+        normShift = norm_l(L_acc);
+        scale = 15 - normShift;
+
+        L_acc = L_shl(L_acc, normShift, pOverflow);
+        normProd = pv_round(L_acc, pOverflow);
+
+        mult = div_s(16384, normProd);
+
+        for (j = 0; j < i; j++)
+        {
+            L_acc = ((Word32)aState[j] << 16);
+            L_acc = L_msu(L_acc, refl[i], aState[i-j-1], pOverflow);
+
+            temp = pv_round(L_acc, pOverflow);
+            L_temp = L_mult(mult, temp, pOverflow);
+            L_temp = L_shr_r(L_temp, scale, pOverflow);
+
+
+            Word32 L_tmp_abs = L_temp - (L_temp < 0);
+            L_tmp_abs = L_tmp_abs ^(L_tmp_abs >> 31);
+
+            if (L_tmp_abs > 32767)
+            {
+                for (i = 0; i < M; i++)
+                {
+                    refl[i] = 0;
+                }
+                break;
+            }
+
+            bState[j] = (Word16)(L_temp);
+        }
+
+        for (j = 0; j < i; j++)
+        {
+            aState[j] = bState[j];
+        }
+    }
+    return;
+}
+
+
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.h
new file mode 100644 (file)
index 0000000..d16e572
--- /dev/null
@@ -0,0 +1,115 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: a_refl.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+    File             : a_refl.h
+    Purpose          : Convert from direct form coefficients to
+                       reflection coefficients
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef A_REFL_H
+#define A_REFL_H
+#define a_refl_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    /*
+     *   FUNCTION:  A_Refl()
+     *   PURPOSE: Convert from direct form coefficients to reflection coefficients
+     *   DESCRIPTION:
+     *       Directform coeffs in Q12 are converted to
+     *       reflection coefficients Q15
+     */
+    void A_Refl(
+        Word16 a[],        /* i   : Directform coefficients */
+        Word16 refl[],     /* o   : Reflection coefficients */
+        Flag   *pOverflow
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _A_REFL_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.cpp
new file mode 100644 (file)
index 0000000..9f5525d
--- /dev/null
@@ -0,0 +1,954 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: agc.cpp
+ Funtions: energy_old
+           energy_new
+           agc_init
+           agc_reset
+           agc_exit
+           agc
+           agc2
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This set of modules scale the excitation level and output of the speech
+ signals.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include    "agc.h"
+#include    "cnst.h"
+#include    "inv_sqrt.h"
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: energy_old
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    in = input signal (Word16)
+    l_trm = input signal length (Word16)
+    pOverflow = address of overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the energy computation saturates
+
+ Returns:
+    s = return energy of signal (Word32)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Returns the energy of the signal.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ agc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static Word32 energy_old( // o : return energy of signal
+    Word16 in[],          // i : input signal (length l_trm)
+    Word16 l_trm          // i : signal length
+)
+{
+    Word32 s;
+    Word16 i, temp;
+
+    temp = shr (in[0], 2);
+    s = L_mult (temp, temp);
+
+    for (i = 1; i < l_trm; i++)
+    {
+        temp = shr (in[i], 2);
+        s = L_mac (s, temp, temp);
+    }
+
+    return s;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word32 energy_old(       /* o : return energy of signal      */
+    Word16 in[],        /* i : input signal (length l_trm)  */
+    Word16 l_trm,       /* i : signal length                */
+    Flag   *pOverflow   /* overflow: flag to indicate overflow */
+)
+
+{
+    Word32  s = 0;
+    Word16  i;
+    Word16  temp;
+
+    for (i = 0; i < l_trm; i++)
+    {
+        temp = in[i] >> 2;
+        s = L_mac(s, temp, temp, pOverflow);
+    }
+
+    return(s);
+}
+
+/*----------------------------------------------------------------------------*/
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: energy_old__Wrapper
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    in = input signal (Word16)
+    l_trm = input signal length (Word16)
+    pOverflow = address of overflow (Flag)
+ Outputs:
+    pOverflow -> 1 if the energy computation saturates
+
+ Returns:
+    s = return energy of signal (Word32)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function provides external access to the static function energy_old.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ CALL energy_old (  in = in
+            l_trm = l_trm
+            pOverflow = pOverflow )
+   MODIFYING(nothing)
+   RETURNING(energy_old_value = s)
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word32 energy_old_Wrapper(Word16 in[], Word16 l_trm, Flag *pOverflow)
+{
+    Word32 energy_old_value;
+
+    /*----------------------------------------------------------------------------
+     CALL energy_old (  in = in
+                l_trm = l_trm
+                pOverflow = pOverflow )
+
+      MODIFYING(nothing)
+       RETURNING(energy_old_value = s)
+    ----------------------------------------------------------------------------*/
+    energy_old_value = energy_old(in, l_trm, pOverflow);
+    return(energy_old_value);
+}
+/*--------------------------------------------------------------------------*/
+
+/*
+-----------------------------------------------------------------------------
+ FUNCTION NAME: energy_new
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    in = input signal
+    l_trm = input signal length
+    pOverflow = address of overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the energy computation saturates
+
+ Returns:
+    s = return energy of signal
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Returns the energy of the signal.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ agc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static Word32 energy_new( // o : return energy of signal
+    Word16 in[],          // i : input signal (length l_trm)
+    Word16 l_trm )        // i : signal length
+
+{
+    Word32 s;
+    Word16 i;
+    Flag ov_save;
+
+    ov_save = Overflow;            //save overflow flag in case energy_old
+                                   // must be called
+    s = L_mult(in[0], in[0]);
+    for (i = 1; i < l_trm; i++)
+    {
+        s = L_mac(s, in[i], in[i]);
+    }
+
+    // check for overflow
+    if (L_sub (s, MAX_32) == 0L)
+    {
+        Overflow = ov_save; // restore overflow flag
+        s = energy_old (in, l_trm); // function result
+    }
+    else
+    {
+       s = L_shr(s, 4);
+    }
+
+    return(s);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word32 energy_new(       /* o : return energy of signal      */
+    Word16 in[],        /* i : input signal (length l_trm)  */
+    Word16 l_trm,       /* i : signal length                */
+    Flag *pOverflow     /* i : overflow flag                */
+)
+
+{
+    Word32  s = 0;
+    Word16  i;
+    Flag    ov_save;
+
+    ov_save = *(pOverflow);  /* save overflow flag in case energy_old */
+    /* must be called                        */
+
+
+    for (i = 0; i < l_trm; i++)
+    {
+        s = L_mac(s, in[i], in[i], pOverflow);
+    }
+
+    /* check for overflow */
+    if (s != MAX_32)
+    {
+        /* s is a sum of squares, so it won't be negative */
+        s = s >> 4;
+    }
+    else
+    {
+        *(pOverflow) = ov_save;  /* restore overflow flag */
+        s = energy_old(in, l_trm, pOverflow);   /* function result */
+    }
+
+    return (s);
+}
+
+/*--------------------------------------------------------------------------*/
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: energy_new__Wrapper
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    in = input signal (Word16)
+    l_trm = input signal length (Word16)
+    overflow = address of overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the energy computation saturates
+
+ Returns:
+    s = return energy of signal (Word32)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function provides external access to the static function energy_new.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ CALL energy_new (  in = in
+            l_trm = l_trm
+            pOverflow = pOverflow )
+
+   MODIFYING(nothing)
+
+   RETURNING(energy_new_value = s)
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word32 energy_new_Wrapper(Word16 in[], Word16 l_trm, Flag *pOverflow)
+{
+    Word32 energy_new_value;
+
+    /*----------------------------------------------------------------------------
+     CALL energy_new (  in = in
+                l_trm = l_trm
+                pOverflow = pOverflow )
+
+       MODIFYING(nothing)
+       RETURNING(energy_new_value = s)
+
+    ----------------------------------------------------------------------------*/
+    energy_new_value = energy_new(in, l_trm, pOverflow);
+
+    return(energy_new_value);
+
+}
+
+/*--------------------------------------------------------------------------*/
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: agc_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a structure of type agcState
+
+ Outputs:
+    Structure pointed to by state is initialized to zeros
+
+ Returns:
+    Returns 0 if memory was successfully initialized,
+        otherwise returns -1.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Reset of agc (i.e. set state memory to 1.0).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ agc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int agc_reset (agcState *state)
+{
+  if (state == (agcState *) NULL)
+  {
+      fprintf(stderr, "agc_reset: invalid parameter\n");
+      return -1;
+  }
+
+  state->past_gain = 4096;   // initial value of past_gain = 1.0
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 agc_reset(agcState *state)
+{
+    if (state == (agcState *) NULL)
+    {
+        /* fprintf(stderr, "agc_reset: invalid parameter\n"); */
+        return(-1);
+    }
+
+    state->past_gain = 4096;   /* initial value of past_gain = 1.0  */
+
+    return(0);
+}
+
+/*--------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: agc
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to agc state
+    sig_in = pointer to a buffer containing the postfilter input signal
+    sig_out = pointer to a buffer containing the postfilter output signal
+    agc_fac = AGC factor
+    l_trm = subframe size
+    pOverflow = pointer to the overflow flag
+
+ Outputs:
+    st->past_gain = gain
+    buffer pointed to by sig_out contains the new postfilter output signal
+    pOverflow -> 1 if the agc computation saturates
+
+ Returns:
+    return = 0
+
+ Global Variables Used:
+    none.
+
+ Local Variables Needed:
+    none.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Scales the postfilter output on a subframe basis using:
+
+     sig_out[n] = sig_out[n] * gain[n]
+     gain[n] = agc_fac * gain[n-1] + (1 - agc_fac) g_in/g_out
+
+ where: gain[n] = gain at the nth sample given by
+        g_in/g_out = square root of the ratio of energy at
+                     the input and output of the postfilter.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ agc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int agc (
+    agcState *st,      // i/o : agc state
+    Word16 *sig_in,    // i   : postfilter input signal  (l_trm)
+    Word16 *sig_out,   // i/o : postfilter output signal (l_trm)
+    Word16 agc_fac,    // i   : AGC factor
+    Word16 l_trm       // i   : subframe size
+)
+{
+    Word16 i, exp;
+    Word16 gain_in, gain_out, g0, gain;
+    Word32 s;
+
+    // calculate gain_out with exponent
+    s = energy_new(sig_out, l_trm); // function result
+
+    if (s == 0)
+    {
+        st->past_gain = 0;
+        return 0;
+    }
+    exp = sub (norm_l (s), 1);
+    gain_out = pv_round (L_shl (s, exp));
+
+    // calculate gain_in with exponent
+    s = energy_new(sig_in, l_trm); // function result
+
+    if (s == 0)
+    {
+        g0 = 0;
+    }
+    else
+    {
+        i = norm_l (s);
+        gain_in = pv_round (L_shl (s, i));
+        exp = sub (exp, i);
+
+         *---------------------------------------------------*
+         *  g0 = (1-agc_fac) * sqrt(gain_in/gain_out);       *
+         *---------------------------------------------------*
+
+        s = L_deposit_l (div_s (gain_out, gain_in));
+        s = L_shl (s, 7);       // s = gain_out / gain_in
+        s = L_shr (s, exp);     // add exponent
+
+        s = Inv_sqrt (s); // function result
+        i = pv_round (L_shl (s, 9));
+
+        // g0 = i * (1-agc_fac)
+        g0 = mult (i, sub (32767, agc_fac));
+    }
+
+    // compute gain[n] = agc_fac * gain[n-1]
+                        + (1-agc_fac) * sqrt(gain_in/gain_out)
+    // sig_out[n] = gain[n] * sig_out[n]
+
+    gain = st->past_gain;
+
+    for (i = 0; i < l_trm; i++)
+    {
+        gain = mult (gain, agc_fac);
+        gain = add (gain, g0);
+        sig_out[i] = extract_h (L_shl (L_mult (sig_out[i], gain), 3));
+    }
+
+    st->past_gain = gain;
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void agc(
+    agcState *st,      /* i/o : agc state                        */
+    Word16 *sig_in,    /* i   : postfilter input signal  (l_trm) */
+    Word16 *sig_out,   /* i/o : postfilter output signal (l_trm) */
+    Word16 agc_fac,    /* i   : AGC factor                       */
+    Word16 l_trm,      /* i   : subframe size                    */
+    Flag *pOverflow    /* i   : overflow Flag                    */
+
+)
+
+{
+    Word16  i;
+    Word16  exp;
+    Word16  gain_in;
+    Word16  gain_out;
+    Word16  g0;
+    Word16  gain;
+    Word32  s;
+    Word32  L_temp;
+    Word16  temp;
+
+    Word16 *p_sig_out;
+
+    /* calculate gain_out with exponent */
+    s = energy_new(sig_out, l_trm, pOverflow);  /* function result */
+
+    if (s == 0)
+    {
+        st->past_gain = 0;
+        return;
+    }
+    exp = norm_l(s) - 1;
+
+    L_temp = L_shl(s, exp, pOverflow);
+    gain_out = pv_round(L_temp, pOverflow);
+
+    /* calculate gain_in with exponent */
+    s = energy_new(sig_in, l_trm, pOverflow);    /* function result */
+
+    if (s == 0)
+    {
+        g0 = 0;
+    }
+    else
+    {
+        i = norm_l(s);
+
+        /* L_temp = L_shl(s, i, pOverflow); */
+        L_temp = s << i;
+
+        gain_in = pv_round(L_temp, pOverflow);
+
+        exp -= i;
+
+        /*---------------------------------------------------*
+         *  g0 = (1-agc_fac) * sqrt(gain_in/gain_out);       *
+         *---------------------------------------------------*/
+
+        /* s = gain_out / gain_in */
+        temp = div_s(gain_out, gain_in);
+
+        /* s = L_deposit_l (temp); */
+        s = (Word32) temp;
+        s = s << 7;
+        s = L_shr(s, exp, pOverflow);      /* add exponent */
+
+        s = Inv_sqrt(s, pOverflow);    /* function result */
+        L_temp = s << 9;
+
+        i = (Word16)((L_temp + (Word32) 0x00008000L) >> 16);
+
+        /* g0 = i * (1-agc_fac) */
+        temp = 32767 - agc_fac;
+
+        g0 = (Word16)(((Word32) i * temp) >> 15);
+
+    }
+
+    /* compute gain[n] = agc_fac * gain[n-1]
+                        + (1-agc_fac) * sqrt(gain_in/gain_out) */
+    /* sig_out[n] = gain[n] * sig_out[n]                        */
+
+    gain = st->past_gain;
+    p_sig_out = sig_out;
+
+    for (i = 0; i < l_trm; i++)
+    {
+        /* gain = mult (gain, agc_fac, pOverflow); */
+        gain = (Word16)(((Word32) gain * agc_fac) >> 15);
+
+        /* gain = add (gain, g0, pOverflow); */
+        gain += g0;
+
+        /* L_temp = L_mult (sig_out[i], gain, pOverflow); */
+        L_temp = ((Word32)(*(p_sig_out)) * gain) << 1;
+
+        *(p_sig_out++) = (Word16)(L_temp >> 13);
+    }
+
+    st->past_gain = gain;
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: agc2
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    sig_in = pointer to a buffer containing the postfilter input signal
+    sig_out = pointer to a buffer containing the postfilter output signal
+    l_trm = subframe size
+    pOverflow = pointer to overflow flag
+
+ Outputs:
+    sig_out points to a buffer containing the new scaled output signal.
+    pOverflow -> 1 if the agc computation saturates
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Scales the excitation on a subframe basis.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ agc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void agc2 (
+ Word16 *sig_in,        // i   : postfilter input signal
+ Word16 *sig_out,       // i/o : postfilter output signal
+ Word16 l_trm           // i   : subframe size
+)
+{
+    Word16 i, exp;
+    Word16 gain_in, gain_out, g0;
+    Word32 s;
+
+    // calculate gain_out with exponent
+    s = energy_new(sig_out, l_trm); // function result
+
+    if (s == 0)
+    {
+        return;
+    }
+    exp = sub (norm_l (s), 1);
+    gain_out = pv_round (L_shl (s, exp));
+
+    // calculate gain_in with exponent
+    s = energy_new(sig_in, l_trm); // function result
+
+    if (s == 0)
+    {
+        g0 = 0;
+    }
+    else
+    {
+        i = norm_l (s);
+        gain_in = pv_round (L_shl (s, i));
+        exp = sub (exp, i);
+
+         *---------------------------------------------------*
+         *  g0 = sqrt(gain_in/gain_out);                     *
+         *---------------------------------------------------*
+
+        s = L_deposit_l (div_s (gain_out, gain_in));
+        s = L_shl (s, 7);       // s = gain_out / gain_in
+        s = L_shr (s, exp);     // add exponent
+
+        s = Inv_sqrt (s); // function result
+        g0 = pv_round (L_shl (s, 9));
+    }
+
+    // sig_out(n) = gain(n) sig_out(n)
+
+    for (i = 0; i < l_trm; i++)
+    {
+        sig_out[i] = extract_h (L_shl (L_mult (sig_out[i], g0), 3));
+    }
+
+    return;
+}
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void agc2(
+    Word16 *sig_in,        /* i   : postfilter input signal  */
+    Word16 *sig_out,       /* i/o : postfilter output signal */
+    Word16 l_trm,          /* i   : subframe size            */
+    Flag   *pOverflow      /* i   : overflow flag            */
+)
+
+{
+    Word16  i;
+    Word16  exp;
+    Word16  gain_in;
+    Word16  gain_out;
+    Word16  g0;
+    Word32  s;
+    Word32  L_temp;
+    Word16  temp;
+
+    /* calculate gain_out with exponent */
+    s = energy_new(sig_out, l_trm, pOverflow); /* function result */
+
+    if (s == 0)
+    {
+        return;
+    }
+    exp = norm_l(s) - 1;
+    L_temp = L_shl(s, exp, pOverflow);
+    gain_out = pv_round(L_temp, pOverflow);
+
+    /* calculate gain_in with exponent */
+    s = energy_new(sig_in, l_trm, pOverflow); /* function result */
+
+    if (s == 0)
+    {
+        g0 = 0;
+    }
+    else
+    {
+        i = norm_l(s);
+        L_temp = L_shl(s, i, pOverflow);
+        gain_in = pv_round(L_temp, pOverflow);
+        exp -= i;
+
+        /*---------------------------------------------------*
+         *  g0 = sqrt(gain_in/gain_out);                     *
+         *---------------------------------------------------*/
+
+        /* s = gain_out / gain_in */
+        temp = div_s(gain_out, gain_in);
+
+        /* s = L_deposit_l (temp); */
+        s = (Word32)temp;
+
+        if (s > (Word32) 0x00FFFFFFL)
+        {
+            s = MAX_32;
+        }
+        else if (s < (Word32) - 16777216)
+        {
+            s = MIN_32;
+        }
+        else
+        {
+            s = s << 7;
+        }
+        s = L_shr(s, exp, pOverflow);      /* add exponent */
+
+        s = Inv_sqrt(s, pOverflow);    /* function result */
+
+        if (s > (Word32) 0x003FFFFFL)
+        {
+            L_temp = MAX_32;
+        }
+        else if (s < (Word32) - 4194304)
+        {
+            L_temp = MIN_32;
+        }
+        else
+        {
+            L_temp = s << 9;
+        }
+        g0 = pv_round(L_temp, pOverflow);
+    }
+
+    /* sig_out(n) = gain(n) sig_out(n) */
+
+    for (i = l_trm - 1; i >= 0; i--)
+    {
+        L_temp = L_mult(sig_out[i], g0, pOverflow);
+        if (L_temp > (Word32) 0x0FFFFFFFL)
+        {
+            sig_out[i] = MAX_16;
+        }
+        else if (L_temp < (Word32) - 268435456)
+        {
+            sig_out[i] = MIN_16;
+        }
+        else
+        {
+            sig_out[i] = (Word16)(L_temp >> 13);
+        }
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.h
new file mode 100644 (file)
index 0000000..95cb10e
--- /dev/null
@@ -0,0 +1,144 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: agc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : agc.h
+      Purpose          : Scales the postfilter output on a subframe basis
+                       : by automatic control of the subframe gain.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _AGC_H_
+#define _AGC_H_
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 past_gain;
+    } agcState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    /*----------------------------------------------------------------------------
+    ;
+    ;  Function    : agc_reset
+    ;  Purpose     : Reset of agc (i.e. set state memory to 1.0)
+    ;  Returns     : 0 on success
+    ;
+    ----------------------------------------------------------------------------*/
+    Word16 agc_reset(agcState *st);
+
+
+    /*----------------------------------------------------------------------------
+    ;
+    ;  Function    : agc
+    ;  Purpose     : Scales the postfilter output on a subframe basis
+    ;  Description : sig_out[n] = sig_out[n] * gain[n];
+    ;                where gain[n] is the gain at the nth sample given by
+    ;                gain[n] = agc_fac * gain[n-1] + (1 - agc_fac) g_in/g_out
+    ;                g_in/g_out is the square root of the ratio of energy at
+    ;                the input and output of the postfilter.
+    ;
+    ----------------------------------------------------------------------------*/
+    void agc(
+        agcState *st,      /* i/o : agc state                         */
+        Word16 *sig_in,    /* i   : postfilter input signal, (l_trm)  */
+        Word16 *sig_out,   /* i/o : postfilter output signal, (l_trm) */
+        Word16 agc_fac,    /* i   : AGC factor                        */
+        Word16 l_trm,      /* i   : subframe size                     */
+        Flag *pOverflow    /* i   : overflow flag                     */
+    );
+
+    /*----------------------------------------------------------------------------
+    ;
+    ;  Function:  agc2
+    ;  Purpose:   Scales the excitation on a subframe basis
+    ;
+    ----------------------------------------------------------------------------*/
+    void agc2(
+        Word16 *sig_in,    /* i   : postfilter input signal   */
+        Word16 *sig_out,   /* i/o : postfilter output signal  */
+        Word16 l_trm,      /* i   : subframe size             */
+        Flag *pOverflow    /* i   : overflow flag             */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _AGC_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.cpp
new file mode 100644 (file)
index 0000000..7a68676
--- /dev/null
@@ -0,0 +1,469 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+ Filename: amrdecode.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "amrdecode.h"
+#include "cnst.h"
+#include "typedef.h"
+#include "frame.h"
+#include "sp_dec.h"
+#include "wmf_to_ets.h"
+#include "if2_to_ets.h"
+#include "frame_type_3gpp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: AMRDecode
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state_data      = pointer to a structure (type void)
+
+    frame_type      = 3GPP frame type (enum Frame_Type_3GPP)
+
+    speech_bits_ptr = pointer to the beginning of the raw encoded speech bits
+                      for the current frame to be decoded (unsigned char)
+
+    raw_pcm_buffer  = pointer to the output pcm outputs array (Word16)
+
+    input_format    = input format used; valid values are AMR_WMF, AMR_IF2,
+                      and AMR_ETS (Word16)
+
+ Outputs:
+    raw_pcm_buffer contains the newly decoded linear PCM speech samples
+    state_data->prev_mode contains the new mode
+
+ Returns:
+    byte_offset     = address offset of the next frame to be processed or
+                      error condition flag (-1) (int)
+
+ Global Variables Used:
+    WmfDecBytesPerFrame = table containing the number of core AMR data bytes
+                          used by each codec mode for WMF input format (const
+                          int)
+
+    If2DecBytesPerFrame = table containing the number of core AMR data bytes
+                          used by each codec mode for IF2 input format (const
+                          int)
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function is the top level entry function to the GSM AMR Decoder library.
+
+ First, it checks the input format type (input_format) to determine the type
+ of de-formattting that needs to be done. If input_format is AMR_WMF, the input
+ data is in WMF (aka, non-IF2) format and the function wmf_to_ets will be
+ called to convert to the ETS format (1 bit/word, where 1 word = 16 bits),
+ and byte_offset will be updated according to the contents of WmfDecBytesPerFrame
+ table.
+
+ If input_format is AMR_IF2, the input data is in IF2 format [1] and the
+ function if2_to_ets will be called to convert to the ETS format, and
+ byte_offset will be updated according to the contents of If2DecBytesPerFrame
+ table.
+
+ The codec mode and receive frame type is initialized based on the incoming
+ frame_type.
+
+ If input_format is AMR_ETS, the input data is in the ETS format. The receive
+ frame type is set to the value in the first location of the buffer pointed to
+ by speech_bits_ptr. Then, the encoded speech parameters in the buffer pointed
+ to by speech_bits is copied to dec_ets_input_bfr and the type will be changed
+ from unsigned char to Word16. Lastly, if the receive frame type is not
+ RX_NO_DATA, the mode is obtained from the buffer pointed to by
+ speech_bits_ptr, offset by MAX_SERIAL_SIZE+1, otherwise, the mode is set to
+ the previous mode (found the in state_data->prev_mode).
+
+ If input_format is an unsupported format, byte_offset will be set to -1, to
+ indicate an error condition has occurred, and the function will exit.
+
+ If there are no errors, GSMFrameDecode is called to decode a 20 ms frame. It
+ puts the decoded linear PCM samples in the buffer pointed to by
+ raw_pcm_buffer. Then, the prev_mode field of the structure pointed to by
+ state_data is updated to the current mode.
+
+ This function returns the new byte_offset value to indicate the address
+ offset of the next speech frame to be decoded.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] "AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0
+     Release 4, June 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ Note: AMRSID_RXTYPE_BIT_OFFSET = 35
+       AMRSID_RXMODE_BIT_OFFSET = 36
+       NUM_AMRSID_RXMODE_BITS = 3
+
+
+ // Set up Decoder state structure pointer
+ Speech_Decode_FrameState *decoder_state
+            = (Speech_Decode_FrameState *) state_data
+
+ // Determine type of de-formatting
+
+ // Decode WMF or IF2 frames
+ IF ((input_format == AMR_RX_WMF) | (input_format == AMR_RX_IF2))
+ THEN
+     IF (input_format == AMR_RX_WMF)
+     THEN
+         // Convert incoming packetized raw WMF data to ETS format
+         CALL wmf_to_ets(frame_type = frame_type
+                         input_ptr = speech_bits_ptr
+                         output_ptr = &dec_ets_input_bfr)
+           MODIFYING(nothing)
+           RETURNING(nothing)
+
+         // Address offset of the start of next frame
+         byte_offset = WmfDecBytesPerFrame[frame_type]
+
+     ELSEIF (input_format == AMR_RX_IF2)
+     THEN
+         // Convert incoming packetized raw IF2 data to ETS format
+         CALL if2_to_ets(frame_type = frame_type
+                         input_ptr = speech_bits_ptr
+                         output_ptr = &dec_ets_input_bfr)
+           MODIFYING(nothing)
+           RETURNING(nothing)
+
+         // Address offset of the start of next frame
+         byte_offset = If2DecBytesPerFrame[frame_type]
+
+     ENDIF
+
+       // Determine AMR codec mode and AMR RX frame type
+     IF (frame_type <= AMR_122)
+     THEN
+         mode = (enum Mode) frame_type;
+         rx_type = RX_SPEECH_GOOD;
+
+     ELSEIF (frame_type == AMR_SID)
+     THEN
+         // Clear mode store prior to reading mode info from input buffer
+         mode = 0
+
+         FOR i = 0 TO NUM_AMRSID_RXMODE_BITS-1
+
+             mode |= (dec_ets_input_bfr[AMRSID_RXMODE_BIT_OFFSET+i] << i)
+
+         ENDFOR
+
+         IF (dec_ets_input_bfr[AMRSID_RXTYPE_BIT_OFFSET] == 0)
+         THEN
+             rx_type = RX_SID_FIRST
+
+         ELSE
+             rx_type = RX_SID_UPDATE
+
+         ENDIF
+
+     ELSEIF ((frame_type > AMR_SID) && (frame_type < NO_DATA))
+     THEN
+         // Use previous mode
+         mode = decoder_state->prev_mode
+
+         // Unsupported SID frames
+         rx_type = RX_SPEECH_BAD;
+
+     ELSE
+         // Use previous mode
+         mode = decoder_state->prev_mode
+
+         // No data received
+         rx_type = RX_NO_DATA;
+
+     ENDIF
+
+ // Decode ETS frames
+ ELSEIF (input_format == AMR_RX_ETS)
+ THEN
+     // Change type of pointer to incoming raw ETS data
+     ets_word_ptr = (Word16 *) speech_bits_ptr
+
+     // Get RX frame type
+     rx_type = (enum RXFrameType) *ets_word_ptr
+     ets_word_ptr = ets_word_ptr + 1
+
+     // Copy incoming raw ETS data to dec_ets_input_bfr
+     FOR i = 0 TO MAX_SERIAL_SIZE-1
+
+         dec_ets_input_bfr[i] = *ets_word_ptr
+         ets_word_ptr = ets_word_ptr + 1
+
+     ENDFOR
+
+     // Get codec mode
+     IF (rx_type != RX_NO_DATA)
+     THEN
+         mode = (enum Mode) *ets_word_ptr
+
+     ELSE
+         //Use previous mode if no received data
+         mode = decoder_state->prev_mode
+
+     ENDIF
+
+     // Set up byte_offset
+     byte_offset = 2*(MAX_SERIAL_SIZE+2)
+
+ ELSE
+     // Invalid format, return error code
+     byte_offset = -1
+
+ ENDIF
+
+ // Proceed with decoding frame, if there are no errors
+ IF (byte_offset != -1)
+ THEN
+     // Decode a 20 ms frame
+     CALL GSMFrameDecode( st = decoder_state
+                          mode = mode
+                          serial = dec_ets_input_bfr,
+                          frame_type = rx_type,
+                          synth = (Word16 *)raw_pcm_buffer);
+       MODIFYING (nothing)
+       RETURNING (Nothing)
+
+     // Save mode for next frame
+     decoder_state->prev_mode = mode
+
+ ENDIF
+
+ RETURN (byte_offset)
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 AMRDecode(
+    void                      *state_data,
+    enum Frame_Type_3GPP      frame_type,
+    UWord8                    *speech_bits_ptr,
+    Word16                    *raw_pcm_buffer,
+    bitstream_format          input_format
+)
+{
+    Word16 *ets_word_ptr;
+    enum Mode mode = (enum Mode)MR475;
+    int modeStore;
+    int tempInt;
+    enum RXFrameType rx_type = RX_NO_DATA;
+    Word16 dec_ets_input_bfr[MAX_SERIAL_SIZE];
+    Word16 i;
+    Word16 byte_offset = -1;
+
+    /* Type cast state_data to Speech_Decode_FrameState rather than passing
+     * that structure type to this function so the structure make up can't
+     * be viewed from higher level functions than this.
+     */
+    Speech_Decode_FrameState *decoder_state
+    = (Speech_Decode_FrameState *) state_data;
+
+    /* Determine type of de-formatting */
+    /* WMF or IF2 frames */
+    if ((input_format == MIME_IETF) | (input_format == IF2))
+    {
+        if (input_format == MIME_IETF)
+        {
+            /* Convert incoming packetized raw WMF data to ETS format */
+            wmf_to_ets(frame_type, speech_bits_ptr, dec_ets_input_bfr, &(decoder_state->decoder_amrState.common_amr_tbls));
+
+            /* Address offset of the start of next frame */
+            byte_offset = WmfDecBytesPerFrame[frame_type];
+        }
+        else   /* else has to be input_format  IF2 */
+        {
+            /* Convert incoming packetized raw IF2 data to ETS format */
+            if2_to_ets(frame_type, speech_bits_ptr, dec_ets_input_bfr, &(decoder_state->decoder_amrState.common_amr_tbls));
+
+            /* Address offset of the start of next frame */
+            byte_offset = If2DecBytesPerFrame[frame_type];
+        }
+
+        /* At this point, input data is in ETS format     */
+        /* Determine AMR codec mode and AMR RX frame type */
+        if (frame_type <= AMR_122)
+        {
+            mode = (enum Mode) frame_type;
+            rx_type = RX_SPEECH_GOOD;
+        }
+        else if (frame_type == AMR_SID)
+        {
+            /* Clear mode store prior to reading mode info from input buffer */
+            modeStore = 0;
+
+            for (i = 0; i < NUM_AMRSID_RXMODE_BITS; i++)
+            {
+                tempInt = dec_ets_input_bfr[AMRSID_RXMODE_BIT_OFFSET+i] << i;
+                modeStore |= tempInt;
+            }
+            mode = (enum Mode) modeStore;
+
+            /* Get RX frame type */
+            if (dec_ets_input_bfr[AMRSID_RXTYPE_BIT_OFFSET] == 0)
+            {
+                rx_type = RX_SID_FIRST;
+            }
+            else
+            {
+                rx_type = RX_SID_UPDATE;
+            }
+        }
+        else if (frame_type < AMR_NO_DATA)
+        {
+            /* Invalid frame_type, return error code */
+            byte_offset = -1;   /*  !!! */
+        }
+        else
+        {
+            mode = decoder_state->prev_mode;
+
+            /*
+             * RX_NO_DATA, generate exponential decay from latest valid frame for the first 6 frames
+             * after that, create silent frames
+             */
+            rx_type = RX_NO_DATA;
+
+        }
+
+    }
+
+    /* ETS frames */
+    else if (input_format == ETS)
+    {
+        /* Change type of pointer to incoming raw ETS data */
+        ets_word_ptr = (Word16 *) speech_bits_ptr;
+
+        /* Get RX frame type */
+        rx_type = (enum RXFrameType) * ets_word_ptr;
+        ets_word_ptr++;
+
+        /* Copy incoming raw ETS data to dec_ets_input_bfr */
+        for (i = 0; i < MAX_SERIAL_SIZE; i++)
+        {
+            dec_ets_input_bfr[i] = *ets_word_ptr;
+            ets_word_ptr++;
+        }
+
+        /* Get codec mode */
+        if (rx_type != RX_NO_DATA)
+        {
+            /* Get mode from input bitstream */
+            mode = (enum Mode) * ets_word_ptr;
+        }
+        else
+        {
+            /* Use previous mode if no received data */
+            mode = decoder_state->prev_mode;
+        }
+
+        /* Set up byte_offset */
+        byte_offset = 2 * (MAX_SERIAL_SIZE + 2);
+    }
+    else
+    {
+        /* Invalid input format, return error code */
+        byte_offset = -1;
+    }
+
+    /* Proceed with decoding frame, if there are no errors */
+    if (byte_offset != -1)
+    {
+        /* Decode a 20 ms frame */
+
+#ifndef CONSOLE_DECODER_REF
+        /* Use PV version of sp_dec.c */
+        GSMFrameDecode(decoder_state, mode, dec_ets_input_bfr, rx_type,
+                       raw_pcm_buffer);
+
+#else
+        /* Use ETS version of sp_dec.c */
+        Speech_Decode_Frame(decoder_state, mode, dec_ets_input_bfr, rx_type,
+                            raw_pcm_buffer);
+
+#endif
+
+        /* Save mode for next frame */
+        decoder_state->prev_mode = mode;
+    }
+
+    return (byte_offset);
+}
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.h
new file mode 100644 (file)
index 0000000..1715f0d
--- /dev/null
@@ -0,0 +1,114 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: amrdecode.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the norm_s function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef ARMDECODE_H
+#define ARMDECODE_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "typedef.h"
+#include    "mode.h"
+#include    "frame_type_3gpp.h"
+#include    "pvamrnbdecoder_api.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define NUM_AMRSID_RXMODE_BITS   3
+#define AMRSID_RXMODE_BIT_OFFSET 36
+#define AMRSID_RXTYPE_BIT_OFFSET 35
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 WmfDecBytesPerFrame[];
+    extern const Word16 If2DecBytesPerFrame[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    Word16 AMRDecode(
+        void *state_data,
+        enum Frame_Type_3GPP  frame_type,
+        UWord8 *speech_bits_ptr,
+        Word16 *raw_pcm_buffer,
+        bitstream_format input_format
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _AMRDECODE_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.cpp
new file mode 100644 (file)
index 0000000..f5317e6
--- /dev/null
@@ -0,0 +1,456 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: b_cn_cod.cpp
+ Functions: pseudonoise
+            build_CN_code
+            build_CN_param
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This module contains functions for comfort noise(CN) generation.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "b_cn_cod.h"
+#include "basic_op.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+#define  NB_PULSE 10        /* number of random pulses in DTX operation   */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: pseudonoise
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pShift_reg = pointer to Old CN generator shift register state (Word32)
+    no_bits = Number of bits (Word16)
+
+ Outputs:
+    pShift_reg -> Updated CN generator shift register state
+
+ Returns:
+    noise_bits = Generated random integer value (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Generate a random integer value to use in comfort noise generation. The
+ algorithm uses polynomial x^31 + x^3 + 1. Length of the PN sequence
+ is 2^31 - 1
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ b_cn_cod.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 pseudonoise (
+    Word32 *shift_reg, // i/o : Old CN generator shift register state
+    Word16 no_bits     // i   : Number of bits
+)
+{
+   Word16 noise_bits, Sn, i;
+
+   noise_bits = 0;
+   for (i = 0; i < no_bits; i++)
+   {
+      // State n == 31
+      if ((*shift_reg & 0x00000001L) != 0)
+      {
+         Sn = 1;
+      }
+      else
+      {
+         Sn = 0;
+      }
+
+      // State n == 3
+      if ((*shift_reg & 0x10000000L) != 0)
+      {
+         Sn = Sn ^ 1;
+      }
+      else
+      {
+         Sn = Sn ^ 0;
+      }
+
+      noise_bits = shl (noise_bits, 1);
+      noise_bits = noise_bits | (extract_l (*shift_reg) & 1);
+
+      *shift_reg = L_shr (*shift_reg, 1);
+      if (Sn & 1)
+      {
+         *shift_reg = *shift_reg | 0x40000000L;
+      }
+   }
+   return noise_bits;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+Word16 pseudonoise(
+    Word32 *pShift_reg,     /* i/o : Old CN generator shift register state */
+    Word16 no_bits          /* i   : Number of bits                        */
+)
+{
+    Word16 noise_bits;
+    Word16 Sn;
+    Word16 i;
+    Word16 temp;
+
+    noise_bits = 0;
+
+    for (i = 0; i < no_bits; i++)
+    {
+        /* State n == 31 */
+        if ((*pShift_reg & 0x00000001L) != 0)
+        {
+            Sn = 1;
+        }
+        else
+        {
+            Sn = 0;
+        }
+
+        /* State n == 3 */
+        if ((*pShift_reg & 0x10000000L) != 0)
+        {
+            Sn ^= 1;
+        }
+        else
+        {
+            Sn ^= 0;
+        }
+
+        noise_bits <<= 1;
+
+        temp = (Word16)((*pShift_reg) & 1);
+        noise_bits |= temp;
+
+        *pShift_reg >>= 1;
+        if (Sn & 1)
+        {
+            *pShift_reg |= 0x40000000L;
+        }
+    }
+    return noise_bits;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: build_CN_code
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pSeed = pointer to the Old CN generator shift register state (Word32)
+    cod[] = array to hold the generated CN fixed code vector (Word16)
+    pOverflow = pointer to overflow flag (Flag)
+
+ Outputs:
+    cod[] = generated CN fixed code vector (Word16)
+    pSeed = Updated CN generator shift register state (Word16)
+    pOverflow -> 1 if overflow occured
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+This function computes the comfort noise fixed codebook excitation. The gains
+of the pulses are always +/-1.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ b_cn_cod.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void build_CN_code (
+    Word32 *seed,         // i/o : Old CN generator shift register state
+    Word16 cod[]          // o   : Generated CN fixed codebook vector
+)
+{
+   Word16 i, j, k;
+
+   for (i = 0; i < L_SUBFR; i++)
+   {
+      cod[i] = 0;
+   }
+
+// The reference ETSI code uses a global flag for Overflow. However in the
+// actual implementation a pointer to the overflow flag is passed into the
+// function so that it can be passed into the basic math functions L_mult()
+// and add()
+
+   for (k = 0; k < NB_PULSE; k++)
+   {
+      i = pseudonoise (seed, 2);      // generate pulse position
+      i = shr (extract_l (L_mult (i, 10)), 1);
+      i = add (i, k);
+
+      j = pseudonoise (seed, 1);      // generate sign
+
+      if (j > 0)
+      {
+         cod[i] = 4096;
+      }
+      else
+      {
+         cod[i] = -4096;
+      }
+   }
+
+   return;
+}
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void build_CN_code(
+    Word32 *pSeed,          /* i/o : Old CN generator shift register state  */
+    Word16 cod[],           /* o   : Generated CN fixed codebook vector     */
+    Flag   *pOverflow       /* i/o : Overflow flag                          */
+)
+{
+    Word16 i, j, k;
+    Word16 temp;
+
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        cod[i] = 0;
+    }
+
+    for (k = 0; k < NB_PULSE; k++)
+    {
+        i = pseudonoise(pSeed, 2);       /* generate pulse position */
+
+        temp = (Word16)(L_mult(i, 10, pOverflow));
+        i = temp >> 1;
+        i = add_16(i, k, pOverflow);
+
+        j = pseudonoise(pSeed, 1);       /* generate sign */
+
+        if (j > 0)
+        {
+            cod[i] = 4096;
+        }
+        else
+        {
+            cod[i] = -4096;
+        }
+    }
+
+    return;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: build_CN_param
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pSeed = pointer to the Old CN generator shift register state (Word32)
+    n_param = Number of parameters to randomize (Word16)
+    param_size_table = table holding paameter sizes (Word16)
+    param[] = array to hold CN generated paramters (Word16)
+    pOverflow = pointer to overflow flag (Flag)
+
+ Outputs:
+    param[] = CN generated parameters (Word16)
+    pSeed = Updated CN generator shift register state (Word16)
+    pOverflow -> 1 if overflow occured
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+This function randomizes the speech parameters, so that they do not produce
+tonal artifacts if used by ECU.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ b_cn_cod.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+void build_CN_param (
+    Word16 *seed,             // i/o : Old CN generator shift register state
+    const Word16 n_param,           // i  : number of params
+    const Word16 param_size_table[],// i : size of params
+    Word16 parm[]                   // o : CN Generated params
+    )
+{
+   Word16 i;
+   const Word16 *p;
+
+// The reference ETSI code uses a global flag for Overflow. However in the
+// actual implementation a pointer to the overflow flag is passed into the
+// function so that it can be passed into the basic math functions L_add()
+// and L_mult()
+
+   *seed = extract_l(L_add(L_shr(L_mult(*seed, 31821), 1), 13849L));
+
+   p = &window_200_40[*seed & 0x7F];
+   for(i=0; i< n_param;i++){
+     parm[i] = *p++ & ~(0xFFFF<<param_size_table[i]);
+   }
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void build_CN_param(
+    Word16 *pSeed,          /* i/o : Old CN generator shift register state  */
+    const Word16 n_param,           /* i  : number of params                */
+    const Word16 param_size_table[],/* i : size of params                   */
+    Word16 parm[],                  /* o : CN Generated params              */
+    const Word16* window_200_40_ptr, /* i : ptr to read-only table          */
+    Flag  *pOverflow                /* i/o : Overflow Flag                  */
+)
+
+{
+    Word16 i;
+    const Word16 *pTemp;
+    Word32 L_temp;
+    Word16 temp;
+
+    L_temp = L_mult(*pSeed, 31821, pOverflow);
+    L_temp >>= 1;
+
+    *pSeed = (Word16)(L_add(L_temp, 13849L, pOverflow));
+
+    pTemp = &window_200_40_ptr[*pSeed & 0x7F];
+
+    for (i = 0; i < n_param; i++)
+    {
+        temp = ~(0xFFFF << param_size_table[i]);
+        parm[i] = *pTemp++ & temp;
+    }
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.h
new file mode 100644 (file)
index 0000000..aec7c7c
--- /dev/null
@@ -0,0 +1,147 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: b_cn_cod.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the comfort noise(CN) generator functions
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef B_CN_COD_H
+#define B_CN_COD_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+
+    ; FUNCTION NAME: pseudonoise
+    ;
+    ; PURPOSE: Generate a random integer value to use in comfort noise
+    ;          generation. The algorithm uses polynomial x^31 + x^3 + 1
+    ;          (length of PN sequence is 2^31 - 1).
+    ;
+    ----------------------------------------------------------------------------*/
+
+    Word16 pseudonoise(
+        Word32 *pShift_reg,     /* i/o : Old CN generator shift register state */
+        Word16 no_bits          /* i   : Number of bits                        */
+    );
+
+    /*----------------------------------------------------------------------------
+
+    ; FUNCTION NAME: build_CN_code
+    ;
+    ; PURPOSE: Compute the comfort noise fixed codebook excitation. The
+    ;          gains of the pulses are always +/-1.
+    ;
+    ----------------------------------------------------------------------------*/
+
+    void build_CN_code(
+        Word32 *pSeed,          /* i/o : Old CN generator shift register state  */
+        Word16 cod[],           /* o   : Generated CN fixed codebook vector     */
+        Flag   *pOverflow       /* i/o : Overflow flag                          */
+    );
+
+    /*----------------------------------------------------------------------------
+
+    ; FUNCTION NAME: build_CN_param
+    ;
+    ; PURPOSE: Randomize the speech parameters. So that they
+    ;          do not produce tonal artifacts if used by ECU.
+    ;
+    ----------------------------------------------------------------------------*/
+
+    void build_CN_param(
+        Word16 *pSeed,          /* i/o : Old CN generator shift register state  */
+        const Word16 n_param,               /* i  : number of params            */
+        const Word16 param_size_table[],    /* i : size of params               */
+        Word16 parm[],                  /* o : CN Generated params              */
+        const Word16* window_200_40_ptr, /* i : ptr to read-only table          */
+        Flag  *pOverflow                /* i/o : Overflow Flag                  */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _B_CN_COD_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.cpp
new file mode 100644 (file)
index 0000000..e14dbcd
--- /dev/null
@@ -0,0 +1,555 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Filename: bgnscd.cpp
+ Functions:
+           Bgn_scd_reset
+           Bgn_scd
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ Background noise source characteristic detector (SCD)
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "bgnscd.h"
+#include    "typedef.h"
+#include    "basic_op.h"
+#include    "cnst.h"
+#include    "gmed_n.h"
+#include    "sqrt_l.h"
+#include    "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define TRUE  1
+#define FALSE 0
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Bgn_scd_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = points to memory of type Bgn_scdState.
+
+ Outputs:
+    The memory of type Bgn_scdState pointed to by state is set to all
+        zeros.
+
+ Returns:
+    Returns 0 if memory was successfully initialized,
+        otherwise returns -1.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Resets state memory.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ bgnscd.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 Bgn_scd_reset (Bgn_scdState *state)
+{
+   if (state == (Bgn_scdState *) NULL){
+      fprintf(stderr, "Bgn_scd_reset: invalid parameter\n");
+      return -1;
+   }
+
+   // Static vectors to zero
+   Set_zero (state->frameEnergyHist, L_ENERGYHIST);
+
+   // Initialize hangover handling
+   state->bgHangover = 0;
+
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16  Bgn_scd_reset(Bgn_scdState *state)
+{
+    if (state == (Bgn_scdState *) NULL)
+    {
+        /* fprintf(stderr, "Bgn_scd_reset: invalid parameter\n");  */
+        return(-1);
+    }
+
+    /* Static vectors to zero */
+    oscl_memset(state->frameEnergyHist, 0, L_ENERGYHIST*sizeof(Word16));
+
+    /* Initialize hangover handling */
+    state->bgHangover = 0;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Bgn_scd
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to state variables of type Bgn_scdState
+    ltpGainHist[] = LTP gain history (Word16)
+    speech[] = synthesis speech frame (Word16)
+    voicedHangover = pointer to # of frames after last voiced frame (Word16)
+    pOverflow      = pointer to overflow indicator (Flag)
+
+ Outputs:
+    st = function updates the state variables of type Bgn_scdState
+        pointed to by st.
+    voicedHangover = function updates the # of frames after last voiced
+        frame pointed to by voicedHangover.
+    pOverflow = 1 if the basic math function L_add() results in saturation.
+                  else pOverflow is zero.
+
+ Returns:
+    inbgNoise = flag if background noise is present (Word16)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Characterize synthesis speech and detect background noise.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ bgnscd.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 Bgn_scd (Bgn_scdState *st,      // i : State variables for bgn SCD
+                Word16 ltpGainHist[],  // i : LTP gain history
+                Word16 speech[],       // o : synthesis speech frame
+                Word16 *voicedHangover // o : # of frames after last
+                                              voiced frame
+                )
+{
+   Word16 i;
+   Word16 prevVoiced, inbgNoise;
+   Word16 temp;
+   Word16 ltpLimit, frameEnergyMin;
+   Word16 currEnergy, noiseFloor, maxEnergy, maxEnergyLastPart;
+   Word32 s;
+
+   // Update the inBackgroundNoise flag (valid for use in next frame if BFI)
+   // it now works as a energy detector floating on top
+   // not as good as a VAD.
+
+   currEnergy = 0;
+   s = (Word32) 0;
+
+   for (i = 0; i < L_FRAME; i++)
+   {
+       s = L_mac (s, speech[i], speech[i]);
+   }
+
+   s = L_shl(s, 2);
+
+   currEnergy = extract_h (s);
+
+   frameEnergyMin = 32767;
+
+   for (i = 0; i < L_ENERGYHIST; i++)
+   {
+      if (sub(st->frameEnergyHist[i], frameEnergyMin) < 0)
+         frameEnergyMin = st->frameEnergyHist[i];
+   }
+
+   noiseFloor = shl (frameEnergyMin, 4); // Frame Energy Margin of 16
+
+   maxEnergy = st->frameEnergyHist[0];
+   for (i = 1; i < L_ENERGYHIST-4; i++)
+   {
+      if ( sub (maxEnergy, st->frameEnergyHist[i]) < 0)
+      {
+         maxEnergy = st->frameEnergyHist[i];
+      }
+   }
+
+   maxEnergyLastPart = st->frameEnergyHist[2*L_ENERGYHIST/3];
+   for (i = 2*L_ENERGYHIST/3+1; i < L_ENERGYHIST; i++)
+   {
+      if ( sub (maxEnergyLastPart, st->frameEnergyHist[i] ) < 0)
+      {
+         maxEnergyLastPart = st->frameEnergyHist[i];
+      }
+   }
+
+   inbgNoise = 0;        // false
+
+   // Do not consider silence as noise
+   // Do not consider continuous high volume as noise
+   // Or if the current noise level is very low
+   // Mark as noise if under current noise limit
+   // OR if the maximum energy is below the upper limit
+
+   if ( (sub(maxEnergy, LOWERNOISELIMIT) > 0) &&
+        (sub(currEnergy, FRAMEENERGYLIMIT) < 0) &&
+        (sub(currEnergy, LOWERNOISELIMIT) > 0) &&
+        ( (sub(currEnergy, noiseFloor) < 0) ||
+          (sub(maxEnergyLastPart, UPPERNOISELIMIT) < 0)))
+   {
+      if (sub(add(st->bgHangover, 1), 30) > 0)
+      {
+         st->bgHangover = 30;
+      } else
+      {
+         st->bgHangover = add(st->bgHangover, 1);
+      }
+   }
+   else
+   {
+      st->bgHangover = 0;
+   }
+
+   // make final decision about frame state , act somewhat cautiosly
+   if (sub(st->bgHangover,1) > 0)
+      inbgNoise = 1;       // true
+
+   for (i = 0; i < L_ENERGYHIST-1; i++)
+   {
+      st->frameEnergyHist[i] = st->frameEnergyHist[i+1];
+   }
+   st->frameEnergyHist[L_ENERGYHIST-1] = currEnergy;
+
+   // prepare for voicing decision; tighten the threshold after some
+      time in noise
+   ltpLimit = 13926;             // 0.85  Q14
+   if (sub(st->bgHangover, 8) > 0)
+   {
+      ltpLimit = 15565;          // 0.95  Q14
+   }
+   if (sub(st->bgHangover, 15) > 0)
+   {
+      ltpLimit = 16383;          // 1.00  Q14
+   }
+
+   // weak sort of voicing indication.
+   prevVoiced = 0;        // false
+
+   if (sub(gmed_n(&ltpGainHist[4], 5), ltpLimit) > 0)
+   {
+      prevVoiced = 1;     // true
+   }
+   if (sub(st->bgHangover, 20) > 0) {
+      if (sub(gmed_n(ltpGainHist, 9), ltpLimit) > 0)
+      {
+         prevVoiced = 1;  // true
+      }
+      else
+      {
+         prevVoiced = 0;  // false
+      }
+   }
+
+   if (prevVoiced)
+   {
+      *voicedHangover = 0;
+   }
+   else
+   {
+      temp = add(*voicedHangover, 1);
+      if (sub(temp, 10) > 0)
+      {
+         *voicedHangover = 10;
+      }
+      else
+      {
+         *voicedHangover = temp;
+      }
+   }
+
+   return inbgNoise;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16  Bgn_scd(Bgn_scdState *st,       /* i : State variables for bgn SCD  */
+                Word16 ltpGainHist[],  /* i : LTP gain history             */
+                Word16 speech[],       /* o : synthesis speech frame       */
+                Word16 *voicedHangover,/* o : # of frames after last
+                                               voiced frame                 */
+                Flag   *pOverflow
+               )
+{
+    Word16  i;
+    Word16  prevVoiced, inbgNoise;
+    Word16  temp;
+    Word16  ltpLimit, frameEnergyMin;
+    Word16  currEnergy, noiseFloor, maxEnergy, maxEnergyLastPart;
+    Word32  s, L_temp;
+
+
+    /* Update the inBackgroundNoise flag (valid for use in next frame if BFI)   */
+    /* it now works as a energy detector floating on top                        */
+    /* not as good as a VAD.                                                    */
+
+    s = (Word32) 0;
+
+    for (i = L_FRAME - 1; i >= 0; i--)
+    {
+        L_temp = ((Word32) speech[i]) * speech[i];
+        if (L_temp != (Word32) 0x40000000L)
+        {
+            L_temp = L_temp << 1;
+        }
+        else
+        {
+            L_temp = MAX_32;
+        }
+        s = L_add(s, L_temp, pOverflow);
+    }
+
+    /* s is a sum of squares, so don't need to check for neg overflow */
+    if (s > (Word32)0x1fffffffL)
+    {
+        currEnergy = MAX_16;
+    }
+    else
+    {
+        currEnergy = (Word16)(s >> 14);
+    }
+
+    frameEnergyMin = 32767;
+    for (i = L_ENERGYHIST - 1; i >= 0; i--)
+    {
+        if (st->frameEnergyHist[i] < frameEnergyMin)
+        {
+            frameEnergyMin = st->frameEnergyHist[i];
+        }
+    }
+
+    /* Frame Energy Margin of 16 */
+    L_temp = (Word32)frameEnergyMin << 4;
+    if (L_temp != (Word32)((Word16) L_temp))
+    {
+        if (L_temp > 0)
+        {
+            noiseFloor = MAX_16;
+        }
+        else
+        {
+            noiseFloor = MIN_16;
+        }
+    }
+    else
+    {
+        noiseFloor = (Word16)(L_temp);
+    }
+
+    maxEnergy = st->frameEnergyHist[0];
+    for (i = L_ENERGYHIST - 5; i >= 1; i--)
+    {
+        if (maxEnergy < st->frameEnergyHist[i])
+        {
+            maxEnergy = st->frameEnergyHist[i];
+        }
+    }
+
+    maxEnergyLastPart = st->frameEnergyHist[2*L_ENERGYHIST/3];
+    for (i = 2 * L_ENERGYHIST / 3 + 1; i < L_ENERGYHIST; i++)
+    {
+        if (maxEnergyLastPart < st->frameEnergyHist[i])
+        {
+            maxEnergyLastPart = st->frameEnergyHist[i];
+        }
+    }
+
+    /* Do not consider silence as noise */
+    /* Do not consider continuous high volume as noise */
+    /* Or if the current noise level is very low */
+    /* Mark as noise if under current noise limit */
+    /* OR if the maximum energy is below the upper limit */
+
+    if ((maxEnergy > LOWERNOISELIMIT) &&
+            (currEnergy < FRAMEENERGYLIMIT) &&
+            (currEnergy > LOWERNOISELIMIT) &&
+            ((currEnergy < noiseFloor) ||
+             (maxEnergyLastPart < UPPERNOISELIMIT)))
+    {
+        if ((st->bgHangover + 1) > 30)
+        {
+            st->bgHangover = 30;
+        }
+        else
+        {
+            st->bgHangover += 1;
+        }
+    }
+    else
+    {
+        st->bgHangover = 0;
+    }
+
+    /* make final decision about frame state , act somewhat cautiosly */
+
+    if (st->bgHangover > 1)
+    {
+        inbgNoise = TRUE;
+    }
+    else
+    {
+        inbgNoise = FALSE;
+    }
+
+    for (i = 0; i < L_ENERGYHIST - 1; i++)
+    {
+        st->frameEnergyHist[i] = st->frameEnergyHist[i+1];
+    }
+    st->frameEnergyHist[L_ENERGYHIST-1] = currEnergy;
+
+    /* prepare for voicing decision; tighten the threshold after some
+       time in noise */
+
+    if (st->bgHangover > 15)
+    {
+        ltpLimit = 16383;       /* 1.00  Q14 */
+    }
+    else if (st->bgHangover > 8)
+    {
+        ltpLimit = 15565;       /* 0.95  Q14 */
+    }
+    else
+    {
+        ltpLimit = 13926;       /* 0.85  Q14 */
+    }
+
+    /* weak sort of voicing indication. */
+    prevVoiced = FALSE;
+
+    if (gmed_n(&ltpGainHist[4], 5) > ltpLimit)
+    {
+        prevVoiced = TRUE;
+    }
+
+    if (st->bgHangover > 20)
+    {
+        if (gmed_n(ltpGainHist, 9) > ltpLimit)
+        {
+            prevVoiced = TRUE;
+        }
+        else
+        {
+            prevVoiced = FALSE;
+        }
+    }
+
+
+    if (prevVoiced)
+    {
+        *voicedHangover = 0;
+    }
+    else
+    {
+        temp = *voicedHangover + 1;
+
+        if (temp > 10)
+        {
+            *voicedHangover = 10;
+        }
+        else
+        {
+            *voicedHangover = temp;
+        }
+    }
+
+    return(inbgNoise);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.h
new file mode 100644 (file)
index 0000000..f98eab9
--- /dev/null
@@ -0,0 +1,150 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: bgnscd.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : bgnscd.h
+      Purpose          : Background noise source charateristic detector (SCD)
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _BGNSCD_H_
+#define _BGNSCD_H_
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+#define L_ENERGYHIST 60
+#define INV_L_FRAME 102
+
+
+    /* 2*(160*x)^2 / 65536  where x is FLP values 150,5 and 50 */
+#define FRAMEENERGYLIMIT  17578         /* 150 */
+#define LOWERNOISELIMIT      20         /*   5 */
+#define UPPERNOISELIMIT    1953         /*  50 */
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        /* history vector of past synthesis speech energy */
+        Word16 frameEnergyHist[L_ENERGYHIST];
+
+        /* state flags */
+        Word16 bgHangover; /* counter; number of frames after last speech frame */
+
+    } Bgn_scdState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    /*
+     *  Function    : Bgn_scd_init
+     *  Purpose     : Allocates initializes state memory
+     *  Description : Stores pointer to filter status struct in *st. This
+     *                pointer has to be passed to Bgn_scd in each call.
+     *  Returns     : 0 on success
+     */
+    Word16 Bgn_scd_init(Bgn_scdState **st);
+
+    /*
+     *  Function    : Bgn_scd_reset
+     *  Purpose     : Resets state memory
+     *  Returns     : 0 on success
+     */
+    Word16 Bgn_scd_reset(Bgn_scdState *st);
+
+    /*
+     *  Function    : Bgn_scd_exit
+     *  Purpose     : The memory used for state memory is freed
+     *  Description : Stores NULL in *s
+     *  Returns     : void
+     */
+    void Bgn_scd_exit(Bgn_scdState **st);
+
+    /*
+     *  Function    : Bgn_scd
+     *  Purpose     : Charaterice synthesis speech and detect background noise
+     *  Returns     : background noise decision; 0 = bgn, 1 = no bgn
+     */
+    Word16 Bgn_scd(Bgn_scdState *st,       /* i : State variables for bgn SCD         */
+                   Word16 ltpGainHist[],  /* i : LTP gain history                    */
+                   Word16 speech[],       /* o : synthesis speech frame              */
+                   Word16 *voicedHangover,/* o : # of frames after last voiced frame */
+                   Flag   *pOverflow
+                  );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _BGNSCD_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.cpp
new file mode 100644 (file)
index 0000000..7a86760
--- /dev/null
@@ -0,0 +1,584 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c_g_aver.cpp
+ Functions:
+            Cb_gain_average_reset
+            Cb_gain_average
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains functions that reset and perform
+ codebook gain calculations.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "c_g_aver.h"
+#include    "typedef.h"
+#include    "mode.h"
+#include    "cnst.h"
+
+#include    "basic_op.h"
+#include    "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Cb_gain_average_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a structure of type Cb_gain_averageState
+
+ Outputs:
+    Structure pointed to by state is initialized to zeros
+
+ Returns:
+    Returns 0 if memory was successfully initialized,
+        otherwise returns -1.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Resets state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ c_g_aver.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 Cb_gain_average_reset (Cb_gain_averageState *state)
+{
+   if (state == (Cb_gain_averageState *) NULL){
+      fprintf(stderr, "Cb_gain_average_reset: invalid parameter\n");
+      return -1;
+   }
+
+   // Static vectors to zero
+   Set_zero (state->cbGainHistory, L_CBGAINHIST);
+
+   // Initialize hangover handling
+   state->hangVar = 0;
+   state->hangCount= 0;
+
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16  Cb_gain_average_reset(Cb_gain_averageState *state)
+{
+    if (state == (Cb_gain_averageState *) NULL)
+    {
+        /* fprint(stderr, "Cb_gain_average_reset: invalid parameter\n");  */
+        return(-1);
+    }
+
+    /* Static vectors to zero */
+    oscl_memset(state->cbGainHistory, 0, L_CBGAINHIST*sizeof(Word16));
+
+    /* Initialize hangover handling */
+    state->hangVar = 0;
+    state->hangCount = 0;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Cb_gain_average
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to structure of type Cb_gain_averageState
+    mode = AMR mode (enum Mode)
+    gain_code = CB gain (Word16)
+    lsp = the LSP for the current frame (Word16)
+    lspAver = the average of LSP for 8 frames (Word16)
+    bfi = bad frame indication flag (Word16)
+    prev_bf = previous bad frame indication flag (Word16)
+    pdfi = potential degraded bad frame ind flag (Word16)
+    prev_pdf = prev pot. degraded bad frame ind flag (Word16)
+    inBackgroundNoise = background noise decision (Word16)
+    voicedHangover = # of frames after last voiced frame (Word16)
+    pOverflow = address of overflow (Flag)
+
+ Returns:
+    cbGainMix = codebook gain (Word16)
+
+ Outputs:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ The mix cb gains for MR475, MR515, MR59, MR67, MR102; gain_code other modes
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ c_g_aver.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 Cb_gain_average (
+   Cb_gain_averageState *st, // i/o : State variables for CB gain avergeing
+   enum Mode mode,           // i   : AMR mode
+   Word16 gain_code,         // i   : CB gain                              Q1
+   Word16 lsp[],             // i   : The LSP for the current frame       Q15
+   Word16 lspAver[],         // i   : The average of LSP for 8 frames     Q15
+   Word16 bfi,               // i   : bad frame indication flag
+   Word16 prev_bf,           // i   : previous bad frame indication flag
+   Word16 pdfi,              // i   : potential degraded bad frame ind flag
+   Word16 prev_pdf,          // i   : prev pot. degraded bad frame ind flag
+   Word16 inBackgroundNoise, // i   : background noise decision
+   Word16 voicedHangover     // i   : # of frames after last voiced frame
+   )
+{
+   //---------------------------------------------------------*
+    * Compute mixed cb gain, used to make cb gain more        *
+    * smooth in background noise for modes 5.15, 5.9 and 6.7  *
+    * states that needs to be updated by all                  *
+    *---------------------------------------------------------
+   Word16 i;
+   Word16 cbGainMix, diff, tmp_diff, bgMix, cbGainMean;
+   Word32 L_sum;
+   Word16 tmp[M], tmp1, tmp2, shift1, shift2, shift;
+
+   // set correct cbGainMix for MR74, MR795, MR122
+   cbGainMix = gain_code;
+
+    *-------------------------------------------------------*
+    *   Store list of CB gain needed in the CB gain         *
+    *   averaging                                           *
+    *-------------------------------------------------------*
+   for (i = 0; i < (L_CBGAINHIST-1); i++)
+   {
+      st->cbGainHistory[i] = st->cbGainHistory[i+1];
+   }
+   st->cbGainHistory[L_CBGAINHIST-1] = gain_code;
+
+   // compute lsp difference
+   for (i = 0; i < M; i++) {
+      tmp1 = abs_s(sub(lspAver[i], lsp[i]));  // Q15
+      shift1 = sub(norm_s(tmp1), 1);          // Qn
+      tmp1 = shl(tmp1, shift1);               // Q15+Qn
+      shift2 = norm_s(lspAver[i]);            // Qm
+      tmp2 = shl(lspAver[i], shift2);         // Q15+Qm
+      tmp[i] = div_s(tmp1, tmp2);             // Q15+(Q15+Qn)-(Q15+Qm)
+      shift = sub(add(2, shift1), shift2);
+      if (shift >= 0)
+      {
+         tmp[i] = shr(tmp[i], shift); // Q15+Qn-Qm-Qx=Q13
+      }
+      else
+      {
+         tmp[i] = shl(tmp[i], negate(shift)); // Q15+Qn-Qm-Qx=Q13
+      }
+   }
+
+   diff = tmp[0];
+   for (i = 1; i < M; i++) {
+      diff = add(diff, tmp[i]);       // Q13
+   }
+
+   // Compute hangover
+   if (sub(diff, 5325) > 0)  // 0.65 in Q11
+   {
+      st->hangVar = add(st->hangVar, 1);
+   }
+   else
+   {
+      st->hangVar = 0;
+   }
+
+   if (sub(st->hangVar, 10) > 0)
+   {
+      st->hangCount = 0;  // Speech period, reset hangover variable
+   }
+
+   // Compute mix constant (bgMix)
+   bgMix = 8192;    // 1 in Q13
+   if ((sub(mode, MR67) <= 0) || (sub(mode, MR102) == 0))
+      // MR475, MR515, MR59, MR67, MR102
+   {
+      // if errors and presumed noise make smoothing probability stronger
+      if (((((pdfi != 0) && (prev_pdf != 0)) || (bfi != 0) || (prev_bf != 0)) &&
+          (sub(voicedHangover, 1) > 0) && (inBackgroundNoise != 0) &&
+          ((sub(mode, MR475) == 0) ||
+           (sub(mode, MR515) == 0) ||
+           (sub(mode, MR59) == 0)) ))
+      {
+         // bgMix = min(0.25, max(0.0, diff-0.55)) / 0.25;
+         tmp_diff = sub(diff, 4506);   // 0.55 in Q13
+
+         // max(0.0, diff-0.55)
+         if (tmp_diff > 0)
+         {
+            tmp1 = tmp_diff;
+         }
+         else
+         {
+            tmp1 = 0;
+         }
+
+         // min(0.25, tmp1)
+         if (sub(2048, tmp1) < 0)
+         {
+            bgMix = 8192;
+         }
+         else
+         {
+            bgMix = shl(tmp1, 2);
+         }
+      }
+      else
+      {
+         // bgMix = min(0.25, max(0.0, diff-0.40)) / 0.25;
+         tmp_diff = sub(diff, 3277); // 0.4 in Q13
+
+         // max(0.0, diff-0.40)
+         if (tmp_diff > 0)
+         {
+            tmp1 = tmp_diff;
+         }
+         else
+         {
+            tmp1 = 0;
+         }
+
+         // min(0.25, tmp1)
+         if (sub(2048, tmp1) < 0)
+         {
+            bgMix = 8192;
+         }
+         else
+         {
+            bgMix = shl(tmp1, 2);
+         }
+      }
+
+      if ((sub(st->hangCount, 40) < 0) || (sub(diff, 5325) > 0)) // 0.65 in Q13
+      {
+         bgMix = 8192;  // disable mix if too short time since
+      }
+
+      // Smoothen the cb gain trajectory
+      // smoothing depends on mix constant bgMix
+      L_sum = L_mult(6554, st->cbGainHistory[2]); // 0.2 in Q15; L_sum in Q17
+      for (i = 3; i < L_CBGAINHIST; i++)
+      {
+         L_sum = L_mac(L_sum, 6554, st->cbGainHistory[i]);
+      }
+      cbGainMean = pv_round(L_sum);                      // Q1
+
+      // more smoothing in error and bg noise (NB no DFI used  here)
+      if (((bfi != 0) || (prev_bf != 0)) && (inBackgroundNoise != 0) &&
+          ((sub(mode, MR475) == 0) ||
+           (sub(mode, MR515) == 0) ||
+           (sub(mode, MR59) == 0)) )
+      {
+         L_sum = L_mult(4681, st->cbGainHistory[0]); // 0.143 in Q15; L_sum in Q17
+         for (i = 1; i < L_CBGAINHIST; i++)
+         {
+            L_sum = L_mac(L_sum, 4681, st->cbGainHistory[i]);
+         }
+         cbGainMean = pv_round(L_sum);                   // Q1
+      }
+
+      // cbGainMix = bgMix*cbGainMix + (1-bgMix)*cbGainMean;
+      L_sum = L_mult(bgMix, cbGainMix);               // L_sum in Q15
+      L_sum = L_mac(L_sum, 8192, cbGainMean);
+      L_sum = L_msu(L_sum, bgMix, cbGainMean);
+      cbGainMix = pv_round(L_shl(L_sum, 2));             // Q1
+   }
+
+   st->hangCount = add(st->hangCount, 1);
+   return cbGainMix;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Cb_gain_average(
+    Cb_gain_averageState *st, /* i/o : State variables for CB gain averaging */
+    enum Mode mode,           /* i   : AMR mode                              */
+    Word16 gain_code,         /* i   : CB gain                            Q1 */
+    Word16 lsp[],             /* i   : The LSP for the current frame     Q15 */
+    Word16 lspAver[],         /* i   : The average of LSP for 8 frames   Q15 */
+    Word16 bfi,               /* i   : bad frame indication flag             */
+    Word16 prev_bf,           /* i   : previous bad frame indication flag    */
+    Word16 pdfi,              /* i   : potential degraded bad frame ind flag */
+    Word16 prev_pdf,          /* i   : prev pot. degraded bad frame ind flag */
+    Word16 inBackgroundNoise, /* i   : background noise decision             */
+    Word16 voicedHangover,    /* i   : # of frames after last voiced frame   */
+    Flag   *pOverflow
+)
+{
+    Word16 i;
+    Word16 cbGainMix;
+    Word16 diff;
+    Word16 tmp_diff;
+    Word16 bgMix;
+    Word16 cbGainMean;
+    Word32 L_sum;
+    Word16 tmp[M];
+    Word16 tmp1;
+    Word16 tmp2;
+    Word16 shift1;
+    Word16 shift2;
+    Word16 shift;
+
+    /*---------------------------------------------------------*
+     * Compute mixed cb gain, used to make cb gain more        *
+     * smooth in background noise for modes 5.15, 5.9 and 6.7  *
+     * states that needs to be updated by all                  *
+     *---------------------------------------------------------*/
+
+    /* set correct cbGainMix for MR74, MR795, MR122 */
+    cbGainMix = gain_code;
+
+    /*-------------------------------------------------------*
+     *   Store list of CB gain needed in the CB gain         *
+     *   averaging                                           *
+     *-------------------------------------------------------*/
+    for (i = 0; i < (L_CBGAINHIST - 1); i++)
+    {
+        st->cbGainHistory[i] = st->cbGainHistory[i+1];
+    }
+    st->cbGainHistory[L_CBGAINHIST-1] = gain_code;
+
+    diff = 0;
+
+    /* compute lsp difference */
+    for (i = 0; i < M; i++)
+    {
+        tmp1 = abs_s(sub(*(lspAver + i), *(lsp + i), pOverflow));
+        /* Q15      */
+        shift1 = norm_s(tmp1) - 1 ;                     /* Qn       */
+        tmp1 = shl(tmp1, shift1, pOverflow);            /* Q15+Qn   */
+        shift2 = norm_s(*(lspAver + i));                /* Qm       */
+        tmp2 = shl(*(lspAver + i), shift2, pOverflow);  /* Q15+Qm   */
+        tmp[i] = div_s(tmp1, tmp2);        /* Q15+(Q15+Qn)-(Q15+Qm) */
+
+        shift = 2 + shift1 - shift2;
+
+        if (shift >= 0)
+        {
+            *(tmp + i) = shr(*(tmp + i), shift, pOverflow);
+            /* Q15+Qn-Qm-Qx=Q13 */
+        }
+        else
+        {
+            *(tmp + i) = shl(*(tmp + i), negate(shift), pOverflow);
+            /* Q15+Qn-Qm-Qx=Q13 */
+        }
+
+        diff = add_16(diff, *(tmp + i), pOverflow);           /* Q13 */
+    }
+
+    /* Compute hangover */
+
+    if (diff > 5325)                /* 0.65 in Q11 */
+    {
+        st->hangVar += 1;
+    }
+    else
+    {
+        st->hangVar = 0;
+    }
+
+
+    if (st->hangVar > 10)
+    {
+        /* Speech period, reset hangover variable */
+        st->hangCount = 0;
+    }
+
+    /* Compute mix constant (bgMix) */
+    bgMix = 8192;    /* 1 in Q13 */
+
+    if ((mode <= MR67) || (mode == MR102))
+        /* MR475, MR515, MR59, MR67, MR102 */
+    {
+        /* if errors and presumed noise make smoothing probability stronger */
+
+        if (((((pdfi != 0) && (prev_pdf != 0)) || (bfi != 0) ||
+                (prev_bf != 0))
+                && (voicedHangover > 1)
+                && (inBackgroundNoise != 0)
+                && ((mode == MR475) || (mode == MR515) ||
+                    (mode == MR59))))
+        {
+            /* bgMix = min(0.25, max(0.0, diff-0.55)) / 0.25; */
+            tmp_diff = diff - 4506;   /* 0.55 in Q13 */
+        }
+        else
+        {
+            /* bgMix = min(0.25, max(0.0, diff-0.40)) / 0.25; */
+            tmp_diff = diff - 3277; /* 0.4 in Q13 */
+        }
+
+        /* max(0.0, diff-0.55)  or  */
+        /* max(0.0, diff-0.40) */
+        if (tmp_diff > 0)
+        {
+            tmp1 = tmp_diff;
+        }
+        else
+        {
+            tmp1 = 0;
+        }
+
+        /* min(0.25, tmp1) */
+        if (2048 < tmp1)
+        {
+            bgMix = 8192;
+        }
+        else
+        {
+            bgMix = shl(tmp1, 2, pOverflow);
+        }
+
+        if ((st->hangCount < 40) || (diff > 5325)) /* 0.65 in Q13 */
+        {
+            /* disable mix if too short time since */
+            bgMix = 8192;
+        }
+
+        /* Smoothen the cb gain trajectory  */
+        /* smoothing depends on mix constant bgMix */
+        L_sum = L_mult(6554, st->cbGainHistory[2], pOverflow);
+        /* 0.2 in Q15; L_sum in Q17 */
+
+        for (i = 3; i < L_CBGAINHIST; i++)
+        {
+            L_sum = L_mac(L_sum, 6554, st->cbGainHistory[i], pOverflow);
+        }
+        cbGainMean = pv_round(L_sum, pOverflow);               /* Q1 */
+
+        /* more smoothing in error and bg noise (NB no DFI used here) */
+
+        if (((bfi != 0) || (prev_bf != 0)) && (inBackgroundNoise != 0)
+                && ((mode == MR475) || (mode == MR515)
+                    || (mode == MR59)))
+        {
+            /* 0.143 in Q15; L_sum in Q17    */
+            L_sum = L_mult(4681, st->cbGainHistory[0], pOverflow);
+            for (i = 1; i < L_CBGAINHIST; i++)
+            {
+                L_sum =
+                    L_mac(L_sum, 4681, st->cbGainHistory[i], pOverflow);
+            }
+            cbGainMean = pv_round(L_sum, pOverflow);              /* Q1 */
+        }
+
+        /* cbGainMix = bgMix*cbGainMix + (1-bgMix)*cbGainMean; */
+        /* L_sum in Q15 */
+        L_sum = L_mult(bgMix, cbGainMix, pOverflow);
+        L_sum = L_mac(L_sum, 8192, cbGainMean, pOverflow);
+        L_sum = L_msu(L_sum, bgMix, cbGainMean, pOverflow);
+        cbGainMix = pv_round(L_shl(L_sum, 2, pOverflow), pOverflow);  /* Q1 */
+    }
+
+    st->hangCount += 1;
+
+    return (cbGainMix);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.h
new file mode 100644 (file)
index 0000000..ac56383
--- /dev/null
@@ -0,0 +1,154 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c_g_aver.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : c_g_aver.h
+      Purpose          : Background noise source charateristic detector (SCD)
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _C_G_AVER_H_
+#define _C_G_AVER_H_
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+#define L_CBGAINHIST 7
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        /* history vector of past synthesis speech energy */
+        Word16 cbGainHistory[L_CBGAINHIST];
+
+        /* state flags */
+        Word16 hangVar;       /* counter; */
+        Word16 hangCount;     /* counter; */
+
+    } Cb_gain_averageState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    /*
+     *  Function    : Cb_gain_average_init
+     *  Purpose     : Allocates initializes state memory
+     *  Description : Stores pointer to filter status struct in *st. This
+     *                pointer has to be passed to Cb_gain_average in each call.
+     *  Returns     : 0 on success
+     */
+    Word16 Cb_gain_average_init(Cb_gain_averageState **st);
+
+    /*
+     *  Function    : Cb_gain_average_reset
+     *  Purpose     : Resets state memory
+     *  Returns     : 0 on success
+     */
+    Word16 Cb_gain_average_reset(Cb_gain_averageState *st);
+
+    /*
+     *  Function    : Cb_gain_average_exit
+     *  Purpose     : The memory used for state memory is freed
+     *  Description : Stores NULL in *s
+     *  Returns     : void
+     */
+    void Cb_gain_average_exit(Cb_gain_averageState **st);
+
+    /*
+     *  Function    : Cb_gain_average
+     *  Purpose     : Charaterice synthesis speech and detect background noise
+     *  Returns     : background noise decision; 0 = bgn, 1 = no bgn
+     */
+    Word16 Cb_gain_average(
+        Cb_gain_averageState *st, /* i/o : State variables for CB gain avergeing   */
+        enum Mode mode,           /* i   : AMR mode                                */
+        Word16 gain_code,         /* i   : CB gain                              Q1 */
+        Word16 lsp[],             /* i   : The LSP for the current frame       Q15 */
+        Word16 lspAver[],         /* i   : The average of LSP for 8 frames     Q15 */
+        Word16 bfi,               /* i   : bad frame indication flag               */
+        Word16 prev_bf,           /* i   : previous bad frame indication flag      */
+        Word16 pdfi,              /* i   : potential degraded bad frame ind flag   */
+        Word16 prev_pdf,          /* i   : prev pot. degraded bad frame ind flag   */
+        Word16 inBackgroundNoise, /* i   : background noise decision               */
+        Word16 voicedHangover,    /* i   : # of frames after last voiced frame     */
+        Flag   *pOverflow
+    );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _C_G_AVER_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp
new file mode 100644 (file)
index 0000000..d56b922
--- /dev/null
@@ -0,0 +1,231 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d1035pf.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "d1035pf.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NB_PULSE  10            /* number of pulses  */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dec_10i40_35bits
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    index = buffer containing index of 10 pulses; each element is
+        represented by sign+position
+    cod = buffer of algebraic (fixed) codebook excitation
+
+ Outputs:
+    cod buffer contains the new algebraic codebook excitation
+
+ Returns:
+    None
+
+ Global Variables Used:
+    dgray = gray decoding table
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function builds the innovative codevector from the received index of
+ algebraic codebook. See c1035pf.c for more details about the algebraic
+ codebook structure.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d1035pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void dec_10i40_35bits (
+    Word16 index[],    // (i)     : index of 10 pulses (sign+position)
+    Word16 cod[]       // (o)     : algebraic (fixed) codebook excitation
+)
+{
+    Word16 i, j, pos1, pos2, sign, tmp;
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        cod[i] = 0;
+    }
+
+    // decode the positions and signs of pulses and build the codeword
+
+    for (j = 0; j < NB_TRACK; j++)
+    {
+        // compute index i
+
+        tmp = index[j];
+        i = tmp & 7;
+        i = dgray[i];
+
+        i = extract_l (L_shr (L_mult (i, 5), 1));
+        pos1 = add (i, j); // position of pulse "j"
+
+        i = shr (tmp, 3) & 1;
+        if (i == 0)
+        {
+            sign = 4096; // +1.0
+        }
+        else
+        {
+            sign = -4096; // -1.0
+        }
+
+        cod[pos1] = sign;
+
+        // compute index i
+
+        i = index[add (j, 5)] & 7;
+        i = dgray[i];
+        i = extract_l (L_shr (L_mult (i, 5), 1));
+
+        pos2 = add (i, j);      // position of pulse "j+5"
+
+        if (sub (pos2, pos1) < 0)
+        {
+            sign = negate (sign);
+        }
+        cod[pos2] = add (cod[pos2], sign);
+    }
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void dec_10i40_35bits(
+    Word16 index[],    /* (i)     : index of 10 pulses (sign+position)       */
+    Word16 cod[],       /* (o)     : algebraic (fixed) codebook excitation    */
+    const Word16* dgray_ptr /* i : ptr to read-only tbl                       */
+)
+{
+    register Word16 i, j, pos1, pos2;
+    Word16 sign, tmp;
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        *(cod + i) = 0;
+    }
+
+    /* decode the positions and signs of pulses and build the codeword */
+
+    for (j = 0; j < NB_TRACK; j++)
+    {
+        /* compute index i */
+
+        tmp = *(index + j);
+        i = tmp & 7;
+        i = *(dgray_ptr + i);
+
+        i = (Word16)(i * 5);
+        pos1 = i + j; /* position of pulse "j" */
+
+        i = (tmp >> 3) & 1;
+
+        if (i == 0)
+        {
+            sign = 4096;                                 /* +1.0 */
+        }
+        else
+        {
+            sign = -4096;                                /* -1.0 */
+        }
+
+        *(cod + pos1) = sign;
+
+        /* compute index i */
+
+        i = *(index + j + 5) & 7;
+        i = *(dgray_ptr + i);
+        i = (Word16)(i * 5);
+
+        pos2 = i + j;      /* position of pulse "j+5" */
+
+
+        if (pos2 < pos1)
+        {
+            sign = negate(sign);
+        }
+        *(cod + pos2) += sign;
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.h
new file mode 100644 (file)
index 0000000..ac15905
--- /dev/null
@@ -0,0 +1,106 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d1035pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the prototype declaration for dec_10i40_35bits function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef D1035PF_H
+#define D1035PF_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void dec_10i40_35bits(
+        Word16 index[],    /* (i)   : index of 10 pulses (sign+position)        */
+        Word16 cod[],       /* (o)   : algebraic (fixed) codebook excitation     */
+        const Word16* dgray_ptr /* i : ptr to read-only tbl                      */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _D1035PF_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.cpp
new file mode 100644 (file)
index 0000000..8a70032
--- /dev/null
@@ -0,0 +1,192 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d2_11pf.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "d2_11pf.h"
+#include "typedef.h"
+#include "cnst.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NB_PULSE  2
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: decode_2i40_11bits
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    sign  -- Word16 -- signs of 2 pulses.
+    index -- Word16 -- Positions of the 2 pulses.
+
+ Outputs:
+    cod[] -- array of type Word16 -- algebraic (fixed) codebook excitation
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d2_11pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void decode_2i40_11bits(
+    Word16 sign,   /* i : signs of 2 pulses.                       */
+    Word16 index,  /* i : Positions of the 2 pulses.               */
+    Word16 cod[]   /* o : algebraic (fixed) codebook excitation    */
+)
+
+{
+    Word16 i;
+    Word16 j;
+
+    Word16 pos[NB_PULSE];
+
+    /* Decode the positions */
+
+    j = index & 0x1;
+
+    index >>= 1;
+
+    i = index & 0x7;
+
+    pos[0] = i * 5 + j * 2 + 1;
+
+
+
+
+    index >>= 3;
+
+    j = index & 0x3;
+
+    index >>= 2;
+
+    i = index & 0x7;
+
+    if (j == 3)
+    {
+        pos[1] = i * 5 + 4;
+    }
+    else
+    {
+        pos[1] = i * 5 + j;
+    }
+
+
+
+
+    /* decode the signs  and build the codeword */
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        cod[i] = 0;
+    }
+
+    for (j = 0; j < NB_PULSE; j++)
+    {
+        i = sign & 1;
+
+        /* This line is equivalent to...
+         *
+         *
+         *  if (i == 1)
+         *  {
+         *      cod[pos[j]] = 8191;
+         *  }
+         *  if (i == 0)
+         *  {
+         *      cod[pos[j]] = -8192;
+         *  }
+         */
+
+        cod[pos[j]] = i * 16383 - 8192;
+
+        sign >>= 1;
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.h
new file mode 100644 (file)
index 0000000..aaf2e08
--- /dev/null
@@ -0,0 +1,93 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : d2_11pf.h
+*      Purpose          : Algebraic codebook decoder
+*
+********************************************************************************
+*/
+#ifndef d2_11pf_h
+#define d2_11pf_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         LOCAL VARIABLES AND TABLES
+    ********************************************************************************
+    */
+
+    /*
+    ********************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    ********************************************************************************
+    */
+
+    /*
+    ********************************************************************************
+    *                         DECLARATION OF PROTOTYPES
+    ********************************************************************************
+    */
+    /*************************************************************************
+     *
+     *  FUNCTION:  decode_2i40_11bits (decod_ACELP())
+     *
+     *  PURPOSE:   Algebraic codebook decoder for 2 pulses coded with 11 bits
+     *
+     *************************************************************************/
+
+    void decode_2i40_11bits(
+        Word16 sign,   /* i : signs of 2 pulses.                       */
+        Word16 index,  /* i : Positions of the 2 pulses.               */
+        Word16 cod[]   /* o : algebraic (fixed) codebook excitation    */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.cpp
new file mode 100644 (file)
index 0000000..fca7a8a
--- /dev/null
@@ -0,0 +1,212 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d2_9pf.cpp
+ Functions: decode_2i40_9bits
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+ FUNCTION:  decode_2i40_9bits (decod_ACELP())
+
+ PURPOSE:   Algebraic codebook decoder. For details about the encoding see
+            c2_9pf.c
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "d2_9pf.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "cnst.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+#define NB_PULSE  2
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: decode_2i40_11bits
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    sign  -- Word16 -- signs of 2 pulses.
+    index -- Word16 -- Positions of the 2 pulses.
+
+ Outputs:
+    cod[] -- array of type Word16 -- algebraic (fixed) codebook excitation
+    pOverflow = pointer to overflow flag
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d2_9pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void decode_2i40_9bits(
+    Word16 subNr,  /* i : subframe number                          */
+    Word16 sign,   /* i : signs of 2 pulses.                       */
+    Word16 index,  /* i : Positions of the 2 pulses.               */
+    const Word16* startPos_ptr, /*  i: ptr to read only table          */
+    Word16 cod[],  /* o : algebraic (fixed) codebook excitation    */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs         */
+)
+{
+    Word16 i;
+    Word16 j;
+    Word16 k;
+
+    Word16 pos[NB_PULSE];
+
+    /* Decode the positions */
+    /* table bit  is the MSB */
+
+    j = (Word16)(index & 64);
+
+    j >>= 3;
+
+    i = index & 7;
+
+    k =
+        shl(
+            subNr,
+            1,
+            pOverflow);
+
+    k += j;
+
+    /* pos0 =i*5+startPos_ptr[j*8+subNr*2] */
+    pos[0] = i * 5 + startPos_ptr[k++];
+
+
+    index >>= 3;
+
+    i = index & 7;
+
+    /* pos1 =i*5+startPos_ptr[j*8+subNr*2 + 1] */
+    pos[1] = i * 5 + startPos_ptr[k];
+
+
+    /* decode the signs  and build the codeword */
+
+    for (i = L_SUBFR - 1; i >= 0; i--)
+    {
+        cod[i] = 0;
+    }
+
+    for (j = 0; j < NB_PULSE; j++)
+    {
+        i = sign & 0x1;
+
+        /* This line is equivalent to...
+         *
+         *
+         *  if (i == 1)
+         *  {
+         *      cod[pos[j]] = 8191;
+         *  }
+         *  if (i == 0)
+         *  {
+         *      cod[pos[j]] = -8192;
+         *  }
+         */
+
+        cod[pos[j]] = i * 16383 - 8192;
+
+        sign >>= 1;
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.h
new file mode 100644 (file)
index 0000000..ef7c16b
--- /dev/null
@@ -0,0 +1,111 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d2_9pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the d2_9pf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef d2_9pf_h
+#define d2_9pf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void decode_2i40_9bits(
+        Word16 subNr,       /* i : subframe number                          */
+        Word16 sign,        /* i : signs of 2 pulses.                       */
+        Word16 index,       /* i : Positions of the 2 pulses.               */
+        const Word16* startPos_ptr, /*  i: ptr to read only table               */
+        Word16 cod[],       /* o : algebraic (fixed) codebook excitation    */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs            */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _d2_9PF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.cpp
new file mode 100644 (file)
index 0000000..193b7de
--- /dev/null
@@ -0,0 +1,201 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d3_14pf.cpp
+ Functions: decode_3i40_14bits
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+ FUNCTION:  decode_3i40_14bits (decod_ACELP())
+
+ PURPOSE:   Algebraic codebook decoder. For details about the encoding see
+            c3_14pf.c
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "d3_14pf.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NB_PULSE 3           /* number of pulses  */
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: decode_3i40_14bits
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    sign  -- Word16 -- signs of 3 pulses.
+    index -- Word16 -- Positions of the 3 pulses.
+
+ Outputs:
+    cod[] -- array of type Word16 -- algebraic (fixed) codebook excitation
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d2_9pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void decode_3i40_14bits(
+    Word16 sign,   /* i : signs of 3 pulses.                       */
+    Word16 index,  /* i : Positions of the 3 pulses.               */
+    Word16 cod[]   /* o : algebraic (fixed) codebook excitation    */
+)
+{
+    Word16 i;
+    Word16 j;
+
+    Word16 pos[NB_PULSE];
+
+    /* Decode the positions */
+
+    i = index & 0x7;
+
+    pos[0] = i * 5;
+
+
+
+
+
+    index >>= 3;
+
+    j = index & 0x1;
+
+    index >>= 1;
+
+    i = index & 0x7;
+
+    pos[1] = i * 5 + j * 2 + 1;
+
+
+
+
+
+    index >>= 3;
+
+    j = index & 0x1;
+
+    index >>= 1;
+
+    i = index & 0x7;
+
+    pos[2] = i * 5 + j * 2 + 2;
+
+
+    /* decode the signs  and build the codeword */
+
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        cod[i] = 0;
+    }
+
+    for (j = 0; j < NB_PULSE; j++)
+    {
+        i = sign & 1;
+
+        /* This line is equivalent to...
+         *
+         *
+         *  if (i == 1)
+         *  {
+         *      cod[pos[j]] = 8191;
+         *  }
+         *  if (i == 0)
+         *  {
+         *      cod[pos[j]] = -8192;
+         *  }
+         */
+
+        cod[pos[j]] = i * 16383 - 8192;
+
+        sign >>= 1;
+
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.h
new file mode 100644 (file)
index 0000000..e8a0de1
--- /dev/null
@@ -0,0 +1,107 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d3_14pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the d3_14pf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef d3_14pf_h
+#define d3_14pf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void decode_3i40_14bits(
+        Word16 sign,   /* i : signs of 3 pulses.                       */
+        Word16 index,  /* i : Positions of the 3 pulses.               */
+        Word16 cod[]   /* o : algebraic (fixed) codebook excitation    */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _d3_14PF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.cpp
new file mode 100644 (file)
index 0000000..62838bd
--- /dev/null
@@ -0,0 +1,237 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d4_17pf.cpp
+ Functions: decode_4i40_17bits
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+ FUNCTION:  decode_4i40_17bits (decod_ACELP())
+
+ PURPOSE:   Algebraic codebook decoder. For details about the encoding see
+            c4_17pf.c
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "basic_op.h"
+#include "cnst.h"
+#include "d4_17pf.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+#define NB_PULSE 4           /* number of pulses  */
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: decode_4i40_17bits
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    sign  -- Word16 -- signs of 3 pulses.
+    index -- Word16 -- Positions of the 3 pulses.
+
+ Outputs:
+    cod[] -- array of type Word16 -- algebraic (fixed) codebook excitation
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d4_17pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void decode_4i40_17bits(
+    Word16 sign,   /* i : signs of 4 pulses.                       */
+    Word16 index,  /* i : Positions of the 4 pulses.               */
+    const Word16* dgray_ptr, /* i : Pointer to read-only table         */
+    Word16 cod[]   /* o : algebraic (fixed) codebook excitation    */
+)
+{
+    Word16 i;
+    Word16 j;
+
+    Word16 pos[NB_PULSE];
+
+    /* Index is a 13-bit value.  3 bits each correspond to the
+     * positions 0-2, with 4 bits allocated for position 3.
+     *
+     *
+     * [][][][] [][][] [][][] [][][]
+     *    |       |      |     |
+     *    |       |      |     |
+     *   pos3    pos2   pos1  pos0
+     */
+
+    /* Decode the positions */
+
+    i = index & 0x7;
+
+    i = dgray_ptr[i];
+
+    pos[0] = i * 5; /* pos0 =i*5 */
+
+
+    index >>= 3;
+
+    i = index & 0x7;
+
+    i = dgray_ptr[i];
+
+    pos[1] = i * 5 + 1;  /* pos1 =i*5+1 */
+
+
+
+    index >>= 3;
+
+    i = index & 0x7;
+
+    i = dgray_ptr[i];
+
+    pos[2] = i * 5 + 2; /* pos2 =i*5+2 */
+
+
+
+
+
+    index >>= 3;
+
+    j = index & 0x1;
+
+    index >>= 1;
+
+    i = index & 0x7;
+
+    i = dgray_ptr[i];
+
+    pos[3] = i * 5 + 3 + j; /* pos3 =i*5+3+j */
+
+
+    /* decode the signs  and build the codeword */
+
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        cod[i] = 0;
+    }
+
+    for (j = 0; j < NB_PULSE; j++)
+    {
+        i = sign & 0x1;
+
+        /* This line is equivalent to...
+         *
+         *
+         *  if (i == 1)
+         *  {
+         *      cod[pos[j]] = 8191;
+         *  }
+         *  if (i == 0)
+         *  {
+         *      cod[pos[j]] = -8192;
+         *  }
+         */
+
+        cod[pos[j]] = i * 16383 - 8192;
+
+        sign >>= 1;
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.h
new file mode 100644 (file)
index 0000000..b69cfae
--- /dev/null
@@ -0,0 +1,109 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d4_17pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the d4_17pf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef d4_17pf_h
+#define d4_17pf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void decode_4i40_17bits(
+        Word16 sign,   /* i : signs of 4 pulses.                       */
+        Word16 index,  /* i : Positions of the 4 pulses.               */
+        const Word16* dgray_ptr, /* i : Pointer to read-only table         */
+        Word16 cod[]   /* o : algebraic (fixed) codebook excitation    */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _d4_17PF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.cpp
new file mode 100644 (file)
index 0000000..6195896
--- /dev/null
@@ -0,0 +1,556 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d8_31pf.cpp
+
+------------------------------------------------------------------------------
+
+ MODULE DESCRIPTION
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "d8_31pf.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "cnst.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NB_PULSE  8           /* number of pulses  */
+
+/* define values/representation for output codevector and sign */
+#define POS_CODE  8191
+#define NEG_CODE  8191
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: decompress10
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+   MSBs -- Word16 -- MSB part of the index
+   LSBs -- Word16 -- LSB part of the index
+   index1 -- Word16 -- index for first pos in pos_index[]
+   index2 -- Word16 -- index for second pos in pos_index[]
+   index3 -- Word16 -- index for third pos in pos_index[]
+
+ Outputs:
+   pos_indx[] -- array of type Word16 -- position of 3 pulses (decompressed)
+
+   pOverflow  Flag set when overflow occurs, pointer of type Flag *
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d8_31pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void decompress10(
+    Word16 MSBs,        /* i : MSB part of the index                 */
+    Word16 LSBs,        /* i : LSB part of the index                 */
+    Word16 index1,      /* i : index for first pos in pos_index[]    */
+    Word16 index2,      /* i : index for second pos in pos_index[]   */
+    Word16 index3,      /* i : index for third pos in pos_index[]    */
+    Word16 pos_indx[],  /* o : position of 3 pulses (decompressed)   */
+    Flag  *pOverflow)   /* o : Flag set when overflow occurs         */
+{
+    Word16 ia;
+    Word16 ib;
+    Word16 ic;
+    Word32 tempWord32;
+
+    /*
+      pos_indx[index1] = ((MSBs-25*(MSBs/25))%5)*2 + (LSBs-4*(LSBs/4))%2;
+      pos_indx[index2] = ((MSBs-25*(MSBs/25))/5)*2 + (LSBs-4*(LSBs/4))/2;
+      pos_indx[index3] = (MSBs/25)*2 + LSBs/4;
+    */
+
+    if (MSBs > 124)
+    {
+        MSBs = 124;
+    }
+
+    ia =
+        mult(
+            MSBs,
+            1311,
+            pOverflow);
+
+    tempWord32 =
+        L_mult(
+            ia,
+            25,
+            pOverflow);
+
+
+    ia = (Word16)(MSBs - (tempWord32 >> 1));
+    ib =
+        mult(
+            ia,
+            6554,
+            pOverflow);
+
+    tempWord32 =
+        L_mult(
+            ib,
+            5,
+            pOverflow);
+
+    ib = ia - (Word16)(tempWord32 >> 1);
+
+    ib =
+        shl(
+            ib,
+            1,
+            pOverflow);
+
+
+    ic = LSBs - ((LSBs >> 2) << 2);
+
+
+    pos_indx[index1] = ib + (ic & 1);
+
+
+    ib =
+        mult(
+            ia,
+            6554,
+            pOverflow);
+
+    ib =
+        shl(
+            ib,
+            1,
+            pOverflow);
+
+
+    pos_indx[index2] = ib + (ic >> 1);
+
+
+    ib = LSBs >> 2;
+
+    ic =
+        mult(
+            MSBs,
+            1311,
+            pOverflow);
+
+    ic =
+        shl(
+            ic,
+            1,
+            pOverflow);
+
+    pos_indx[index3] = add_16(ib, ic, pOverflow);
+
+    return;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: decompress_code
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    indx[] -- array of type Word16 -- position and sign of
+                                      8 pulses (compressed)
+
+ Outputs:
+    sign_indx[] -- array of type Word16 -- signs of 4 pulses (signs only)
+    pos_indx[]  -- array of type Word16 -- position index of 8 pulses
+                                           (position only)
+    pOverflow pointer to type Flag -- Flag set when overflow occurs
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    PURPOSE: decompression of the linear codewords to 4+three indeces
+             one bit from each pulse is made robust to errors by
+             minimizing the phase shift of a bit error.
+             4 signs (one for each track)
+             i0,i4,i1 => one index (7+3) bits, 3   LSBs more robust
+             i2,i6,i5 => one index (7+3) bits, 3   LSBs more robust
+             i3,i7    => one index (5+2) bits, 2-3 LSbs more robust
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d8_31pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void decompress_code(
+    Word16 indx[],      /* i : position and sign of 8 pulses (compressed) */
+    Word16 sign_indx[], /* o : signs of 4 pulses (signs only)             */
+    Word16 pos_indx[],  /* o : position index of 8 pulses (position only) */
+    Flag  *pOverflow    /* o : Flag set when overflow occurs              */
+)
+{
+    Word16 i;
+    Word16 ia;
+    Word16 ib;
+    Word16 MSBs;
+    Word16 LSBs;
+    Word16 MSBs0_24;
+    Word32 tempWord32;
+
+    for (i = 0; i < NB_TRACK_MR102; i++)
+    {
+        sign_indx[i] = indx[i];
+    }
+
+    /*
+      First index: 10x10x10 -> 2x5x2x5x2x5-> 125x2x2x2 -> 7+1x3 bits
+      MSBs = indx[NB_TRACK]/8;
+      LSBs = indx[NB_TRACK]%8;
+      */
+    MSBs = indx[NB_TRACK_MR102] >> 3;
+
+    LSBs = indx[NB_TRACK_MR102] & 0x7;
+
+    decompress10(
+        MSBs,
+        LSBs,
+        0,
+        4,
+        1,
+        pos_indx,
+        pOverflow);
+
+    /*
+      Second index: 10x10x10 -> 2x5x2x5x2x5-> 125x2x2x2 -> 7+1x3 bits
+      MSBs = indx[NB_TRACK+1]/8;
+      LSBs = indx[NB_TRACK+1]%8;
+      */
+    MSBs = indx[NB_TRACK_MR102+1] >> 3;
+
+    LSBs = indx[NB_TRACK_MR102+1] & 0x7;
+
+    decompress10(
+        MSBs,
+        LSBs,
+        2,
+        6,
+        5,
+        pos_indx,
+        pOverflow);
+
+    /*
+      Third index: 10x10 -> 2x5x2x5-> 25x2x2 -> 5+1x2 bits
+      MSBs = indx[NB_TRACK+2]/4;
+      LSBs = indx[NB_TRACK+2]%4;
+      MSBs0_24 = (MSBs*25+12)/32;
+      if ((MSBs0_24/5)%2==1)
+         pos_indx[3] = (4-(MSBs0_24%5))*2 + LSBs%2;
+      else
+         pos_indx[3] = (MSBs0_24%5)*2 + LSBs%2;
+      pos_indx[7] = (MSBs0_24/5)*2 + LSBs/2;
+      */
+
+    MSBs = indx[NB_TRACK_MR102+2] >> 2;
+
+    LSBs = indx[NB_TRACK_MR102+2] & 0x3;
+
+    tempWord32 =
+        L_mult(
+            MSBs,
+            25,
+            pOverflow);
+
+    ia =
+        (Word16)
+        L_shr(
+            tempWord32,
+            1,
+            pOverflow);
+
+    ia += 12;
+
+    MSBs0_24 = ia >> 5;
+
+
+    ia =
+        mult(
+            MSBs0_24,
+            6554,
+            pOverflow);
+
+    ia &= 1;
+
+
+    ib =
+        mult(
+            MSBs0_24,
+            6554,
+            pOverflow);
+
+    tempWord32 =
+        L_mult(
+            ib,
+            5,
+            pOverflow);
+
+
+    ib = MSBs0_24 - (Word16)(tempWord32 >> 1);
+
+    if (ia == 1)
+    {
+        ib = 4 - ib;
+
+    }
+
+
+    ib =
+        shl(
+            ib,
+            1,
+            pOverflow);
+
+    ia = LSBs & 0x1;
+
+    pos_indx[3] =
+        add_16(
+            ib,
+            ia,
+            pOverflow);
+
+    ia =
+        mult(
+            MSBs0_24,
+            6554,
+            pOverflow);
+
+    ia =
+        shl(
+            ia,
+            1,
+            pOverflow);
+
+    pos_indx[7] = ia + (LSBs >> 1);
+
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dec_8i40_31bits
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    index   array of type Word16 --  index of 8 pulses (sign+position)
+
+ Outputs:
+    cod     array of type Word16 --  algebraic (fixed) codebook excitation
+    pOverflow pointer to type Flag -- Flag set when overflow occurs
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE:  Builds the innovative codevector from the received
+           index of algebraic codebook.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d8_31pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void dec_8i40_31bits(
+    Word16 index[],    /* i : index of 8 pulses (sign+position)         */
+    Word16 cod[],      /* o : algebraic (fixed) codebook excitation     */
+    Flag  *pOverflow   /* o : Flag set when overflow occurs             */
+)
+{
+    Word16 i;
+    Word16 j;
+    Word16 pos1;
+    Word16 pos2;
+    Word16 sign;
+
+    Word16 linear_signs[NB_TRACK_MR102];
+    Word16 linear_codewords[NB_PULSE];
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        cod[i] = 0;
+    }
+
+    decompress_code(
+        index,
+        linear_signs,
+        linear_codewords,
+        pOverflow);
+
+    /* decode the positions and signs of pulses and build the codeword */
+    for (j = 0; j < NB_TRACK_MR102; j++)    /* NB_TRACK_MR102 = 4 */
+    {
+        /* position of pulse "j" */
+
+        pos1 = (linear_codewords[j] << 2) + j;
+
+
+        if (linear_signs[j] == 0)
+        {
+            sign = POS_CODE; /* +1.0 */
+        }
+        else
+        {
+            sign = -NEG_CODE; /* -1.0 */
+        }
+
+        if (pos1 < L_SUBFR)
+        {
+            cod[pos1] = sign;    /* avoid buffer overflow */
+        }
+
+        /* compute index i */
+        /* position of pulse "j+4" */
+
+        pos2 = (linear_codewords[j + 4] << 2) + j;
+
+
+        if (pos2 < pos1)
+        {
+            sign = negate(sign);
+        }
+
+        if (pos2 < L_SUBFR)
+        {
+            cod[pos2] += sign;     /* avoid buffer overflow */
+        }
+
+
+    } /* for (j = 0; j < NB_TRACK_MR102; j++) */
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.h
new file mode 100644 (file)
index 0000000..d46e236
--- /dev/null
@@ -0,0 +1,108 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d8_31pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the d8_31pf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef d8_31pf_h
+#define d8_31pf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void dec_8i40_31bits(
+        Word16 index[],     /* i : index of 8 pulses (sign+position)         */
+        Word16 cod[],       /* o : algebraic (fixed) codebook excitation     */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs             */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _d8_31PF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_c.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_c.cpp
new file mode 100644 (file)
index 0000000..9cc14c0
--- /dev/null
@@ -0,0 +1,214 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d_gain_c.cpp
+ Functions: d_gain_c
+
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pred_state  = pointer to sturcture type gc_predState. MA predictor state
+    mode        = AMR mode (MR795 or MR122) of type enum Mode
+    index       = received quantization index of type Word16
+    code[]      = pointer to innovation codevector of type Word16
+    pOverflow= pointer to value indicating existence of overflow (Flag)
+
+ Outputs:
+    pred_state  = pointer to sturcture type gc_predState. MA predictor state
+    gain_code   = pointer to decoded innovation gain of type Word16
+    pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function    : d_gain_code
+  Purpose     : Decode the fixed codebook gain using the received index.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d_gain_c.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "d_gain_c.h"
+#include "typedef.h"
+#include "mode.h"
+
+#include "oper_32b.h"
+#include "cnst.h"
+#include "log2.h"
+#include "pow2.h"
+#include "gc_pred.h"
+
+#include "basic_op.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL FUNCTION REFERENCES
+    ; Declare functions defined elsewhere and referenced in this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void d_gain_code(
+    gc_predState *pred_state, /* i/o : MA predictor state               */
+    enum Mode mode,           /* i   : AMR mode (MR795 or MR122)        */
+    Word16 index,             /* i   : received quantization index      */
+    Word16 code[],            /* i   : innovation codevector            */
+    const Word16* qua_gain_code_ptr, /* i : Pointer to read-only table      */
+    Word16 *gain_code,        /* o   : decoded innovation gain          */
+    Flag   *pOverflow
+)
+{
+    Word16 gcode0, exp, frac;
+    const Word16 *p;
+    Word16 qua_ener_MR122, qua_ener;
+    Word16 exp_inn_en;
+    Word16 frac_inn_en;
+    Word32 L_tmp;
+    Word16 tbl_tmp;
+    Word16 temp;
+    /*-------------- Decode codebook gain ---------------*/
+
+    /*-------------------------------------------------------------------*
+     *  predict codebook gain                                            *
+     *  ~~~~~~~~~~~~~~~~~~~~~                                            *
+     *  gc0     = Pow2(int(d)+frac(d))                                   *
+     *          = 2^exp + 2^frac                                         *
+     *                                                                   *
+     *-------------------------------------------------------------------*/
+
+    gc_pred(pred_state, mode, code, &exp, &frac,
+            &exp_inn_en, &frac_inn_en, pOverflow);
+
+    index &= 31;                    /* index < 32, to avoid buffer overflow */
+    tbl_tmp = index + (index << 1);
+
+    p = &qua_gain_code_ptr[tbl_tmp];
+
+    /* Different scalings between MR122 and the other modes */
+    temp = sub((Word16)mode, (Word16)MR122, pOverflow);
+    if (temp == 0)
+    {
+        gcode0 = (Word16)(Pow2(exp, frac, pOverflow));    /* predicted gain */
+        gcode0 = shl(gcode0, 4, pOverflow);
+        *gain_code = shl(mult(gcode0, *p++, pOverflow), 1, pOverflow);
+    }
+    else
+    {
+        gcode0 = (Word16)(Pow2(14, frac, pOverflow));
+        L_tmp = L_mult(*p++, gcode0, pOverflow);
+        L_tmp = L_shr(L_tmp, sub(9, exp, pOverflow), pOverflow);
+        *gain_code = (Word16)(L_tmp >> 16);        /* Q1 */
+    }
+
+    /*-------------------------------------------------------------------*
+     *  update table of past quantized energies                          *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                          *
+     *-------------------------------------------------------------------*/
+    qua_ener_MR122 = *p++;
+    qua_ener = *p++;
+    gc_pred_update(pred_state, qua_ener_MR122, qua_ener);
+
+    return;
+}
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_p.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_p.cpp
new file mode 100644 (file)
index 0000000..ac39950
--- /dev/null
@@ -0,0 +1,153 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d_gain_p.cpp
+ Functions: d_gain_p
+
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode  -- enumerated type -- AMR mode
+    index -- Word16          -- index of quantization
+ Outputs:
+    None
+
+ Returns:
+    Word16 gain -- (Q14)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Function    : d_gain_pitch
+ Purpose     : Decodes the pitch gain using the received index.
+               output is in Q14
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d_gain_p.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "d_gain_p.h"
+#include "typedef.h"
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL FUNCTION REFERENCES
+    ; Declare functions defined elsewhere and referenced in this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+Word16 d_gain_pitch(       /* return value: gain (Q14)                */
+    enum Mode mode,        /* i   : AMR mode                          */
+    Word16 index,          /* i   : index of quantization             */
+    const Word16* qua_gain_pitch_ptr /* i : pointer to read-only tables   */
+)
+{
+    Word16 gain;
+
+    gain = qua_gain_pitch_ptr[index];
+
+    if (mode == MR122)
+    {
+        /* clear 2 LSBits */
+        gain &= 0xFFFC;
+    }
+
+    return gain;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf.cpp
new file mode 100644 (file)
index 0000000..7ac56b4
--- /dev/null
@@ -0,0 +1,170 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d_plsf.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ common part (reset) of LSF decoder
+ module (rest in d_plsf_3.c and d_plsf_5.c)
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "basic_op.h"
+#include "cnst.h"
+#include "oscl_mem.h"
+#include "d_plsf.h"
+#include "q_plsf_5_tbl.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: D_plsf_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to structure of type D_plsf_reset
+
+ Outputs:
+    fields of the structure pointed to by state is initialized to zero
+
+ Returns:
+    return_value = 0, if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Resets state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d_plsf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int D_plsf_reset (D_plsfState *state)
+{
+  Word16 i;
+
+  if (state == (D_plsfState *) NULL){
+      // fprintf(stderr, "D_plsf_reset: invalid parameter\n");
+      return -1;
+  }
+
+  for (i = 0; i < M; i++){
+      state->past_r_q[i] = 0;             // Past quantized prediction error
+  }
+
+  // Past dequantized lsfs
+  Copy(mean_lsf, &state->past_lsf_q[0], M);
+
+  return 0;
+}
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 D_plsf_reset(D_plsfState *state, const Word16* mean_lsf_5_ptr)
+{
+    Word16 i;
+
+    if (state == (D_plsfState *) NULL)
+    {
+        /* fprintf(stderr, "D_plsf_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    for (i = 0; i < M; i++)
+    {
+        state->past_r_q[i] = 0;             /* Past quantized prediction error */
+    }
+
+    /* Past dequantized lsfs */
+    oscl_memmove((void *)&state->past_lsf_q[0], mean_lsf_5_ptr, M*sizeof(*mean_lsf_5_ptr));
+
+    return 0;
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_3.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_3.cpp
new file mode 100644 (file)
index 0000000..2d3a4ef
--- /dev/null
@@ -0,0 +1,468 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d_plsf_3.cpp
+ Functions: D_plsf_3
+
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- Pointer to type struct D_plsfState
+    mode -- enum Mode -- coder mode
+    bfi -- Word16 -- bad frame indicator (set to 1 if a bad frame is received)
+    indice -- Pointer to type Word16 -- quantization indices of
+                                        3 submatrices, Q0
+
+ Outputs:
+    st -- Pointer to type struct D_plsfState
+    lsp1_q -- Pointer to type Word16 -- quantized 1st LSP vector Q15
+    pOverflow -- Pointer to type Flag -- Flag set when overflow occurs
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE: Decodes the LSP parameters using the received quantization
+          indices.1st order MA prediction and split by 3 vector
+          quantization (split-VQ)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d_plsf_3.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "d_plsf.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "lsp_lsf.h"
+#include "reorder.h"
+#include "oscl_mem.h"
+#include "q_plsf_3_tbl.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define ALPHA     29491     /* ALPHA    ->  0.9                            */
+#define ONE_ALPHA 3277      /* ONE_ALPHA-> (1.0-ALPHA)                     */
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void D_plsf_3(
+    D_plsfState *st,   /* i/o: State struct                               */
+    enum Mode mode,    /* i  : coder mode                                 */
+    Word16 bfi,        /* i  : bad frame indicator (set to 1 if a         */
+    /*      bad frame is received)                     */
+    Word16 * indice,   /* i  : quantization indices of 3 submatrices, Q0  */
+    CommonAmrTbls* common_amr_tbls, /* i : structure containing ptrs to read-only tables */
+    Word16 * lsp1_q,   /* o  : quantized 1st LSP vector,              Q15 */
+    Flag  *pOverflow   /* o : Flag set when overflow occurs               */
+)
+{
+    Word16 i;
+    Word16 temp;
+    Word16 index;
+
+    Word16 lsf1_r[M];
+    Word16 lsf1_q[M];
+
+    const Word16* mean_lsf_3_ptr = common_amr_tbls->mean_lsf_3_ptr;
+    const Word16* pred_fac_3_ptr = common_amr_tbls->pred_fac_3_ptr;
+    const Word16* dico1_lsf_3_ptr = common_amr_tbls->dico1_lsf_3_ptr;
+    const Word16* dico2_lsf_3_ptr = common_amr_tbls->dico2_lsf_3_ptr;
+    const Word16* dico3_lsf_3_ptr = common_amr_tbls->dico3_lsf_3_ptr;
+    const Word16* mr515_3_lsf_ptr = common_amr_tbls->mr515_3_lsf_ptr;
+    const Word16* mr795_1_lsf_ptr = common_amr_tbls->mr795_1_lsf_ptr;
+
+    if (bfi != 0)   /* if bad frame */
+    {
+        /* use the past LSFs slightly shifted towards their mean */
+
+        for (i = 0; i < M; i++)
+        {
+            /* lsfi_q[i] = ALPHA*past_lsf_q[i] + ONE_ALPHA*mean_lsf[i]; */
+            temp =
+                mult(
+                    st->past_lsf_q[i],
+                    ALPHA,
+                    pOverflow);
+
+            index =
+                mult(
+                    mean_lsf_3_ptr[i],
+                    ONE_ALPHA,
+                    pOverflow);
+
+            lsf1_q[i] =
+                add_16(
+                    index,
+                    temp,
+                    pOverflow);
+        }
+
+        /* estimate past quantized residual to be used in next frame */
+        if (mode != MRDTX)
+        {
+            for (i = 0; i < M; i++)
+            {
+                /* temp  = mean_lsf[i] +  past_r2_q[i] * PRED_FAC; */
+
+                temp =
+                    mult(
+                        st->past_r_q[i],
+                        pred_fac_3_ptr[i],
+                        pOverflow);
+
+                temp =
+                    add_16(
+                        mean_lsf_3_ptr[i],
+                        temp,
+                        pOverflow);
+
+                st->past_r_q[i] =
+                    sub(
+                        lsf1_q[i],
+                        temp,
+                        pOverflow);
+            }
+
+        } /* if (mode == MRDTX) */
+        else
+        {
+            for (i = 0; i < M; i++)
+            {
+                /* temp  = mean_lsf[i] +  past_r2_q[i]; */
+
+                temp =
+                    add_16(
+                        mean_lsf_3_ptr[i],
+                        st->past_r_q[i],
+                        pOverflow);
+
+                st->past_r_q[i] =
+                    sub(
+                        lsf1_q[i],
+                        temp,
+                        pOverflow);
+            }
+        }
+
+    } /* if (bfi != 0) */
+
+    else  /* if good LSFs received */
+    {
+
+        Word16 index_limit_1 = 0;
+        Word16 index_limit_2 = (DICO2_SIZE - 1) * 3;
+        Word16 index_limit_3 = 0;
+
+        const Word16 *p_cb1;
+        const Word16 *p_cb2;
+        const Word16 *p_cb3;
+        const Word16 *p_dico;
+
+
+        p_cb2 = dico2_lsf_3_ptr;    /* size DICO2_SIZE*3 */
+
+        if ((mode == MR475) || (mode == MR515))
+        {   /* MR475, MR515 */
+            p_cb1 = dico1_lsf_3_ptr;    /* size DICO1_SIZE*3 */
+            p_cb3 = mr515_3_lsf_ptr;    /* size MR515_3_SIZE*4 */
+
+            index_limit_1 = (DICO1_SIZE - 1) * 3;
+            index_limit_3 = (MR515_3_SIZE - 1) * 4;
+
+        }
+        else if (mode == MR795)
+        {   /* MR795 */
+            p_cb1 = mr795_1_lsf_ptr;    /* size MR795_1_SIZE*3 */
+            p_cb3 = dico3_lsf_3_ptr;    /* size DICO3_SIZE*4 */
+
+            index_limit_1 = (MR795_1_SIZE - 1) * 3;
+            index_limit_3 = (DICO3_SIZE - 1) * 4;
+
+        }
+        else
+        {   /* MR59, MR67, MR74, MR102, MRDTX */
+            p_cb1 = dico1_lsf_3_ptr;    /* size DICO1_SIZE*3 */
+            p_cb3 = dico3_lsf_3_ptr;    /* size DICO3_SIZE*4 */
+
+            index_limit_1 = (DICO1_SIZE - 1) * 3;
+            index_limit_3 = (DICO3_SIZE - 1) * 4;
+
+        }
+
+        /* decode prediction residuals from 3 received indices */
+
+        index = *indice++;
+
+        /* temp = 3*index; */
+        temp = index + (index << 1);
+
+        if (temp > index_limit_1)
+        {
+            temp = index_limit_1;  /* avoid buffer overrun */
+        }
+
+        p_dico = &p_cb1[temp];
+
+        lsf1_r[0] = *p_dico++;
+        lsf1_r[1] = *p_dico++;
+        lsf1_r[2] = *p_dico++;
+
+        index = *indice++;
+
+        if (mode == MR475 || mode == MR515)
+        {   /* MR475, MR515 only using every second entry */
+            index <<= 1;
+        }
+
+        /* temp = 3*index */
+        temp = index + (index << 1);
+
+        if (temp > index_limit_2)
+        {
+            temp = index_limit_2;  /* avoid buffer overrun */
+        }
+
+        p_dico = &p_cb2[temp];
+
+        lsf1_r[3] = *p_dico++;
+        lsf1_r[4] = *p_dico++;
+        lsf1_r[5] = *p_dico++;
+
+        index = *indice++;
+
+        temp = index << 2;
+
+        if (temp > index_limit_3)
+        {
+            temp = index_limit_3;  /* avoid buffer overrun */
+        }
+
+
+        p_dico = &p_cb3[temp];
+
+        lsf1_r[6] = *p_dico++;
+        lsf1_r[7] = *p_dico++;
+        lsf1_r[8] = *p_dico++;
+        lsf1_r[9] = *p_dico++;
+
+        /* Compute quantized LSFs and update the past quantized residual */
+
+        if (mode != MRDTX)
+        {
+            for (i = 0; i < M; i++)
+            {
+                temp =
+                    mult(
+                        st->past_r_q[i],
+                        pred_fac_3_ptr[i],
+                        pOverflow);
+
+                temp =
+                    add_16(
+                        mean_lsf_3_ptr[i],
+                        temp,
+                        pOverflow);
+
+                lsf1_q[i] =
+                    add_16(
+                        lsf1_r[i],
+                        temp,
+                        pOverflow);
+
+                st->past_r_q[i] = lsf1_r[i];
+            }
+        }
+        else
+        {
+            for (i = 0; i < M; i++)
+            {
+                temp =
+                    add_16(
+                        mean_lsf_3_ptr[i],
+                        st->past_r_q[i],
+                        pOverflow);
+
+                lsf1_q[i] =
+                    add_16(
+                        lsf1_r[i],
+                        temp,
+                        pOverflow);
+
+                st->past_r_q[i] = lsf1_r[i];
+            }
+        }
+
+    }
+
+    /* verification that LSFs has minimum distance of LSF_GAP Hz */
+
+    Reorder_lsf(
+        lsf1_q,
+        LSF_GAP,
+        M,
+        pOverflow);
+
+    oscl_memmove(
+        (void *)st->past_lsf_q,
+        lsf1_q,
+        M*sizeof(*lsf1_q));
+
+    /*  convert LSFs to the cosine domain */
+
+    Lsf_lsp(
+        lsf1_q,
+        lsp1_q,
+        M,
+        pOverflow);
+
+    return;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Init_D_plsf_3
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type D_plsfState
+    index = Word16, past_rq_init[] index [0, 7]
+
+ Outputs:
+    st = pointer to a structure of type D_plsfState
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function initializes the D_plsfState structure.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d_plsf_3.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void Init_D_plsf_3(
+    D_plsfState *st,      /* i/o: State struct                */
+    Word16       index,   /* i  : past_rq_init[] index [0, 7] */
+    const Word16* past_rq_init_ptr /* ptr to read-only table */)
+{
+    oscl_memmove(
+        (void *)st->past_r_q,
+        &past_rq_init_ptr[index * M],
+        M*sizeof(*past_rq_init_ptr));
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp
new file mode 100644 (file)
index 0000000..8a4e763
--- /dev/null
@@ -0,0 +1,459 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: d_plsf_5.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "d_plsf.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "lsp_lsf.h"
+#include "reorder.h"
+#include "cnst.h"
+#include "oscl_mem.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+    /* ALPHA    ->  0.95       */
+    /* ONE_ALPHA-> (1.0-ALPHA) */
+#define ALPHA     31128
+#define ONE_ALPHA 1639
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: D_plsf_5
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type D_plsfState
+    bfi = bad frame indicator; set to 1 if a bad frame is received (Word16)
+    indice = pointer to quantization indices of 5 submatrices (Word16)
+    lsp1_q = pointer to the quantized 1st LSP vector (Word16)
+    lsp2_q = pointer to the quantized 2nd LSP vector (Word16)
+
+ Outputs:
+    lsp1_q points to the updated quantized 1st LSP vector
+    lsp2_q points to the updated quantized 2nd LSP vector
+    Flag  *pOverflow  -- Flag set when overflow occurs.
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function decodes the 2 sets of LSP parameters in a frame using the
+ received quantization indices.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ d_plsf_5.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int D_plsf_5 (
+    D_plsfState *st,    // i/o: State variables
+    Word16 bfi,         // i  : bad frame indicator (set to 1 if a bad
+                                frame is received)
+    Word16 *indice,     // i  : quantization indices of 5 submatrices, Q0
+    Word16 *lsp1_q,     // o  : quantized 1st LSP vector (M),          Q15
+    Word16 *lsp2_q      // o  : quantized 2nd LSP vector (M),          Q15
+)
+{
+    Word16 i;
+    const Word16 *p_dico;
+    Word16 temp, sign;
+    Word16 lsf1_r[M], lsf2_r[M];
+    Word16 lsf1_q[M], lsf2_q[M];
+
+    if (bfi != 0)                               // if bad frame
+    {
+        // use the past LSFs slightly shifted towards their mean
+
+        for (i = 0; i < M; i++)
+        {
+            // lsfi_q[i] = ALPHA*st->past_lsf_q[i] + ONE_ALPHA*mean_lsf[i];
+
+            lsf1_q[i] = add (mult (st->past_lsf_q[i], ALPHA),
+                             mult (mean_lsf[i], ONE_ALPHA));
+
+            lsf2_q[i] = lsf1_q[i];
+        }
+
+        // estimate past quantized residual to be used in next frame
+
+        for (i = 0; i < M; i++)
+        {
+            // temp  = mean_lsf[i] +  st->past_r_q[i] * LSP_PRED_FAC_MR122;
+
+            temp = add (mean_lsf[i], mult (st->past_r_q[i],
+                                           LSP_PRED_FAC_MR122));
+
+            st->past_r_q[i] = sub (lsf2_q[i], temp);
+        }
+    }
+    else
+        // if good LSFs received
+    {
+        // decode prediction residuals from 5 received indices
+
+        p_dico = &dico1_lsf[shl (indice[0], 2)];
+        lsf1_r[0] = *p_dico++;
+        lsf1_r[1] = *p_dico++;
+        lsf2_r[0] = *p_dico++;
+        lsf2_r[1] = *p_dico++;
+
+        p_dico = &dico2_lsf[shl (indice[1], 2)];
+        lsf1_r[2] = *p_dico++;
+        lsf1_r[3] = *p_dico++;
+        lsf2_r[2] = *p_dico++;
+        lsf2_r[3] = *p_dico++;
+
+        sign = indice[2] & 1;
+        i = shr (indice[2], 1);
+        p_dico = &dico3_lsf[shl (i, 2)];
+
+        if (sign == 0)
+        {
+            lsf1_r[4] = *p_dico++;
+            lsf1_r[5] = *p_dico++;
+            lsf2_r[4] = *p_dico++;
+            lsf2_r[5] = *p_dico++;
+        }
+        else
+        {
+            lsf1_r[4] = negate (*p_dico++);
+            lsf1_r[5] = negate (*p_dico++);
+            lsf2_r[4] = negate (*p_dico++);
+            lsf2_r[5] = negate (*p_dico++);
+        }
+
+        p_dico = &dico4_lsf[shl (indice[3], 2)];
+        lsf1_r[6] = *p_dico++;
+        lsf1_r[7] = *p_dico++;
+        lsf2_r[6] = *p_dico++;
+        lsf2_r[7] = *p_dico++;
+
+        p_dico = &dico5_lsf[shl (indice[4], 2)];
+        lsf1_r[8] = *p_dico++;
+        lsf1_r[9] = *p_dico++;
+        lsf2_r[8] = *p_dico++;
+        lsf2_r[9] = *p_dico++;
+
+        // Compute quantized LSFs and update the past quantized residual
+        for (i = 0; i < M; i++)
+        {
+            temp = add (mean_lsf[i], mult (st->past_r_q[i],
+                                           LSP_PRED_FAC_MR122));
+            lsf1_q[i] = add (lsf1_r[i], temp);
+            lsf2_q[i] = add (lsf2_r[i], temp);
+            st->past_r_q[i] = lsf2_r[i];
+        }
+    }
+
+    // verification that LSFs have minimum distance of LSF_GAP Hz
+
+    Reorder_lsf (lsf1_q, LSF_GAP, M);
+    Reorder_lsf (lsf2_q, LSF_GAP, M);
+
+    Copy (lsf2_q, st->past_lsf_q, M);
+
+    //  convert LSFs to the cosine domain
+
+    Lsf_lsp (lsf1_q, lsp1_q, M);
+    Lsf_lsp (lsf2_q, lsp2_q, M);
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void D_plsf_5(
+    D_plsfState *st,    /* i/o: State variables                             */
+    Word16 bfi,         /* i  : bad frame indicator (set to 1 if a bad
+                                frame is received)                          */
+    Word16 *indice,     /* i  : quantization indices of 5 submatrices, Q0   */
+    CommonAmrTbls* common_amr_tbls, /* i : structure containing ptrs to read-only tables */
+    Word16 *lsp1_q,     /* o  : quantized 1st LSP vector (M),          Q15  */
+    Word16 *lsp2_q,     /* o  : quantized 2nd LSP vector (M),          Q15  */
+    Flag  *pOverflow    /* o : Flag set when overflow occurs                */
+)
+{
+    register Word16 i;
+    Word16 temp;
+    Word16 sign;
+
+    const Word16 *p_dico;
+
+    Word16 lsf1_r[M];
+    Word16 lsf2_r[M];
+    Word16 lsf1_q[M];
+    Word16 lsf2_q[M];
+
+    /* These tables are defined in q_plsf_5_tbl.c */
+    const Word16* mean_lsf_5_ptr = common_amr_tbls->mean_lsf_5_ptr;
+    const Word16* dico1_lsf_5_ptr = common_amr_tbls->dico1_lsf_5_ptr;
+    const Word16* dico2_lsf_5_ptr = common_amr_tbls->dico2_lsf_5_ptr;
+    const Word16* dico3_lsf_5_ptr = common_amr_tbls->dico3_lsf_5_ptr;
+    const Word16* dico4_lsf_5_ptr = common_amr_tbls->dico4_lsf_5_ptr;
+    const Word16* dico5_lsf_5_ptr = common_amr_tbls->dico5_lsf_5_ptr;
+
+    if (bfi != 0)                               /* if bad frame */
+    {
+        /* use the past LSFs slightly shifted towards their mean */
+
+        for (i = 0; i < M; i++)
+        {
+            /*
+             *  lsfi_q[i] = ALPHA*st->past_lsf_q[i] +
+             *  ONE_ALPHA*mean_lsf[i];
+             */
+
+            temp = (Word16)(((Word32)  st->past_lsf_q[i] * ALPHA) >> 15);
+
+            sign = (Word16)(((Word32)  * (mean_lsf_5_ptr + i) * ONE_ALPHA) >> 15);
+
+            *(lsf1_q + i) = add_16(sign, temp,  pOverflow);
+
+            *(lsf2_q + i) = *(lsf1_q + i);
+
+            /*
+             * estimate past quantized residual to be used in
+             * next frame
+             */
+
+            /*
+             * temp  = mean_lsf[i] +
+             * st->past_r_q[i] * LSP_PRED_FAC_MR122;
+             */
+
+            temp = (Word16)(((Word32)  st->past_r_q[i] * LSP_PRED_FAC_MR122) >> 15);
+
+            temp = add_16(*(mean_lsf_5_ptr + i), temp, pOverflow);
+
+            st->past_r_q[i] = sub(*(lsf2_q + i), temp, pOverflow);
+        }
+    }
+    else
+        /* if good LSFs received */
+    {
+        /* decode prediction residuals from 5 received indices */
+
+        temp =
+            shl(
+                *(indice),
+                2,
+                pOverflow);
+
+        p_dico = &dico1_lsf_5_ptr[temp];
+
+        *(lsf1_r + 0) = *p_dico++;
+        *(lsf1_r + 1) = *p_dico++;
+        *(lsf2_r + 0) = *p_dico++;
+        *(lsf2_r + 1) = *p_dico++;
+
+        temp = shl(*(indice + 1), 2, pOverflow);
+
+        p_dico = &dico2_lsf_5_ptr[temp];
+
+        *(lsf1_r + 2) = *p_dico++;
+        *(lsf1_r + 3) = *p_dico++;
+        *(lsf2_r + 2) = *p_dico++;
+        *(lsf2_r + 3) = *p_dico++;
+
+        sign = *(indice + 2) & 1;
+
+        if (*(indice + 2) < 0)
+        {
+            i = ~(~(*(indice + 2)) >> 1);
+        }
+        else
+        {
+            i = *(indice + 2) >> 1;
+        }
+
+        temp = shl(i, 2, pOverflow);
+
+        p_dico = &dico3_lsf_5_ptr[temp];
+
+        if (sign == 0)
+        {
+            *(lsf1_r + 4) = *p_dico++;
+            *(lsf1_r + 5) = *p_dico++;
+            *(lsf2_r + 4) = *p_dico++;
+            *(lsf2_r + 5) = *p_dico++;
+        }
+        else
+        {
+            *(lsf1_r + 4) = negate(*p_dico++);
+            *(lsf1_r + 5) = negate(*p_dico++);
+            *(lsf2_r + 4) = negate(*p_dico++);
+            *(lsf2_r + 5) = negate(*p_dico++);
+        }
+
+        temp = shl(*(indice + 3), 2, pOverflow);
+
+        p_dico = &dico4_lsf_5_ptr[temp];
+
+        *(lsf1_r + 6) = *p_dico++;
+        *(lsf1_r + 7) = *p_dico++;
+        *(lsf2_r + 6) = *p_dico++;
+        *(lsf2_r + 7) = *p_dico++;
+
+        temp = shl(*(indice + 4), 2, pOverflow);
+
+        p_dico = &dico5_lsf_5_ptr[temp];
+
+        *(lsf1_r + 8) = *p_dico++;
+        *(lsf1_r + 9) = *p_dico++;
+        *(lsf2_r + 8) = *p_dico++;
+        *(lsf2_r + 9) = *p_dico++;
+
+        /* Compute quantized LSFs and update the past quantized
+        residual */
+        for (i = 0; i < M; i++)
+        {
+            temp =
+                mult(
+                    st->past_r_q[i],
+                    LSP_PRED_FAC_MR122,
+                    pOverflow);
+
+            temp =
+                add_16(
+                    *(mean_lsf_5_ptr + i),
+                    temp,
+                    pOverflow);
+
+            *(lsf1_q + i) =
+                add_16(
+                    *(lsf1_r + i),
+                    temp,
+                    pOverflow);
+
+            *(lsf2_q + i) =
+                add_16(
+                    *(lsf2_r + i),
+                    temp,
+                    pOverflow);
+
+            st->past_r_q[i] = *(lsf2_r + i);
+        }
+    }
+
+    /* verification that LSFs have minimum distance of LSF_GAP Hz */
+
+    Reorder_lsf(
+        lsf1_q,
+        LSF_GAP,
+        M,
+        pOverflow);
+
+    Reorder_lsf(
+        lsf2_q,
+        LSF_GAP,
+        M,
+        pOverflow);
+
+    oscl_memmove((void *)st->past_lsf_q, lsf2_q, M*sizeof(*lsf2_q));
+
+    /*  convert LSFs to the cosine domain */
+
+    Lsf_lsp(
+        lsf1_q,
+        lsp1_q,
+        M,
+        pOverflow);
+
+    Lsf_lsp(
+        lsf2_q,
+        lsp2_q,
+        M,
+        pOverflow);
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.cpp
new file mode 100644 (file)
index 0000000..1e62c15
--- /dev/null
@@ -0,0 +1,2333 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Filename: dec_amr.cpp
+ Funtions: Decoder_amr_init
+           Decoder_amr_reset
+           Decoder_amr
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the function used to decode one speech frame using a given
+ codec mode. The functions used to initialize, reset, and exit are also
+ included in this file.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "dec_amr.h"
+#include "typedef.h"
+#include "cnst.h"
+#include "set_zero.h"
+#include "syn_filt.h"
+#include "d_plsf.h"
+#include "agc.h"
+#include "int_lpc.h"
+#include "dec_gain.h"
+#include "dec_lag3.h"
+#include "dec_lag6.h"
+#include "d2_9pf.h"
+#include "d2_11pf.h"
+#include "d3_14pf.h"
+#include "d4_17pf.h"
+#include "d8_31pf.h"
+#include "d1035pf.h"
+#include "pred_lt.h"
+#include "d_gain_p.h"
+#include "d_gain_c.h"
+#include "dec_gain.h"
+#include "ec_gains.h"
+#include "ph_disp.h"
+#include "c_g_aver.h"
+#include "int_lsf.h"
+#include "lsp_lsf.h"
+#include "lsp_avg.h"
+#include "bgnscd.h"
+#include "ex_ctrl.h"
+#include "sqrt_l.h"
+#include "frame.h"
+#include "b_cn_cod.h"
+#include "basic_op.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Decoder_amr_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a pointer to structures of type Decoder_amrState
+
+ Outputs:
+    structure pointed to by the pointer which is pointed to by state is
+      initialized to each field's initial values
+
+    state pointer points to the address of the memory allocated by
+      Decoder_amr_init function
+
+ Returns:
+    return_value = 0, if the initialization was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function allocates and initializes state memory used by the Decoder_amr
+ function. It stores the pointer to the filter status structure in state. This
+ pointer has to be passed to Decoder_amr in each call. The function returns
+ 0, if initialization was successful and -1, otherwise.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dec_amr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Decoder_amr_init (Decoder_amrState **state)
+{
+  Decoder_amrState* s;
+  Word16 i;
+
+  if (state == (Decoder_amrState **) NULL){
+      fprintf(stderr, "Decoder_amr_init: invalid parameter\n");
+      return -1;
+  }
+  *state = NULL;
+
+  // allocate memory
+  if ((s= (Decoder_amrState *) malloc(sizeof(Decoder_amrState))) == NULL){
+      fprintf(stderr, "Decoder_amr_init: can not malloc state structure\n");
+      return -1;
+  }
+
+  s->T0_lagBuff = 40;
+  s->inBackgroundNoise = 0;
+  s->voicedHangover = 0;
+  for (i = 0; i < 9; i++)
+     s->ltpGainHistory[i] = 0;
+
+  s->lsfState = NULL;
+  s->ec_gain_p_st = NULL;
+  s->ec_gain_c_st = NULL;
+  s->pred_state = NULL;
+  s->ph_disp_st = NULL;
+  s->dtxDecoderState = NULL;
+
+  if (D_plsf_init(&s->lsfState) ||
+      ec_gain_pitch_init(&s->ec_gain_p_st) ||
+      ec_gain_code_init(&s->ec_gain_c_st) ||
+      gc_pred_init(&s->pred_state) ||
+      Cb_gain_average_init(&s->Cb_gain_averState) ||
+      lsp_avg_init(&s->lsp_avg_st) ||
+      Bgn_scd_init(&s->background_state) ||
+      ph_disp_init(&s->ph_disp_st) ||
+      dtx_dec_init(&s->dtxDecoderState)) {
+      Decoder_amr_exit(&s);
+      return -1;
+  }
+
+  Decoder_amr_reset(s, (enum Mode)0);
+  *state = s;
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Decoder_amr_init(Decoder_amrState *s)
+{
+    Word16 i;
+
+    if (s == (Decoder_amrState *) NULL)
+    {
+        /* fprint(stderr, "Decoder_amr_init: invalid parameter\n");  */
+        return(-1);
+    }
+
+    get_const_tbls(&s->common_amr_tbls);
+
+    s->T0_lagBuff = 40;
+    s->inBackgroundNoise = 0;
+    s->voicedHangover = 0;
+
+    /* Initialize overflow Flag */
+
+    s->overflow = 0;
+
+    for (i = 0; i < LTP_GAIN_HISTORY_LEN; i++)
+    {
+        s->ltpGainHistory[i] = 0;
+    }
+
+    D_plsf_reset(&s->lsfState, s->common_amr_tbls.mean_lsf_5_ptr);
+    ec_gain_pitch_reset(&s->ec_gain_p_st);
+    ec_gain_code_reset(&s->ec_gain_c_st);
+    Cb_gain_average_reset(&s->Cb_gain_averState);
+    lsp_avg_reset(&s->lsp_avg_st, s->common_amr_tbls.mean_lsf_5_ptr);
+    Bgn_scd_reset(&s->background_state);
+    ph_disp_reset(&s->ph_disp_st);
+    dtx_dec_reset(&s->dtxDecoderState);
+    gc_pred_reset(&s->pred_state);
+
+    Decoder_amr_reset(s, MR475);
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Decoder_amr_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a structure of type Decoder_amrState
+    mode = codec mode (enum Mode)
+
+ Outputs:
+    structure pointed to by state is initialized to its reset value
+
+ Returns:
+    return_value = 0, if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function resets the state memory used by the Decoder_amr function. It
+ returns a 0, if reset was successful and -1, otherwise.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dec_amr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Decoder_amr_reset (Decoder_amrState *state, enum Mode mode)
+{
+  Word16 i;
+
+  if (state == (Decoder_amrState *) NULL){
+      fprintf(stderr, "Decoder_amr_reset: invalid parameter\n");
+      return -1;
+  }
+
+  // Initialize static pointer
+  state->exc = state->old_exc + PIT_MAX + L_INTERPOL;
+
+  // Static vectors to zero
+  Set_zero (state->old_exc, PIT_MAX + L_INTERPOL);
+
+  if (mode != MRDTX)
+     Set_zero (state->mem_syn, M);
+
+  // initialize pitch sharpening
+  state->sharp = SHARPMIN;
+  state->old_T0 = 40;
+
+  // Initialize state->lsp_old []
+
+  if (mode != MRDTX) {
+      Copy(lsp_init_data, &state->lsp_old[0], M);
+  }
+
+  // Initialize memories of bad frame handling
+  state->prev_bf = 0;
+  state->prev_pdf = 0;
+  state->state = 0;
+
+  state->T0_lagBuff = 40;
+  state->inBackgroundNoise = 0;
+  state->voicedHangover = 0;
+  if (mode != MRDTX) {
+      for (i=0;i<9;i++)
+          state->excEnergyHist[i] = 0;
+  }
+
+  for (i = 0; i < 9; i++)
+     state->ltpGainHistory[i] = 0;
+
+  Cb_gain_average_reset(state->Cb_gain_averState);
+  if (mode != MRDTX)
+     lsp_avg_reset(state->lsp_avg_st);
+  D_plsf_reset(state->lsfState);
+  ec_gain_pitch_reset(state->ec_gain_p_st);
+  ec_gain_code_reset(state->ec_gain_c_st);
+
+  if (mode != MRDTX)
+     gc_pred_reset(state->pred_state);
+
+  Bgn_scd_reset(state->background_state);
+  state->nodataSeed = 21845;
+  ph_disp_reset(state->ph_disp_st);
+  if (mode != MRDTX)
+     dtx_dec_reset(state->dtxDecoderState);
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Decoder_amr_reset(Decoder_amrState *state, enum Mode mode)
+{
+    Word16 i;
+
+    if (state == (Decoder_amrState *) NULL)
+    {
+        /* fprint(stderr, "Decoder_amr_reset: invalid parameter\n");  */
+        return(-1);
+    }
+
+    /* Initialize static pointer */
+    state->exc = state->old_exc + PIT_MAX + L_INTERPOL;
+
+    /* Static vectors to zero */
+    oscl_memset(state->old_exc, 0, sizeof(Word16)*(PIT_MAX + L_INTERPOL));
+
+    if (mode != MRDTX)
+    {
+        oscl_memset(state->mem_syn, 0, sizeof(Word16)*M);
+    }
+    /* initialize pitch sharpening */
+    state->sharp = SHARPMIN;
+    state->old_T0 = 40;
+
+    /* Initialize overflow Flag */
+
+    state->overflow = 0;
+
+    /* Initialize state->lsp_old [] */
+
+    if (mode != MRDTX)
+    {
+        state->lsp_old[0] = 30000;
+        state->lsp_old[1] = 26000;
+        state->lsp_old[2] = 21000;
+        state->lsp_old[3] = 15000;
+        state->lsp_old[4] = 8000;
+        state->lsp_old[5] = 0;
+        state->lsp_old[6] = -8000;
+        state->lsp_old[7] = -15000;
+        state->lsp_old[8] = -21000;
+        state->lsp_old[9] = -26000;
+    }
+
+    /* Initialize memories of bad frame handling */
+    state->prev_bf = 0;
+    state->prev_pdf = 0;
+    state->state = 0;
+
+    state->T0_lagBuff = 40;
+    state->inBackgroundNoise = 0;
+    state->voicedHangover = 0;
+    if (mode != MRDTX)
+    {
+        for (i = 0; i < EXC_ENERGY_HIST_LEN; i++)
+        {
+            state->excEnergyHist[i] = 0;
+        }
+    }
+
+    for (i = 0; i < LTP_GAIN_HISTORY_LEN; i++)
+    {
+        state->ltpGainHistory[i] = 0;
+    }
+
+    Cb_gain_average_reset(&(state->Cb_gain_averState));
+    if (mode != MRDTX)
+    {
+        lsp_avg_reset(&(state->lsp_avg_st), state->common_amr_tbls.mean_lsf_5_ptr);
+    }
+    D_plsf_reset(&(state->lsfState), state->common_amr_tbls.mean_lsf_5_ptr);
+    ec_gain_pitch_reset(&(state->ec_gain_p_st));
+    ec_gain_code_reset(&(state->ec_gain_c_st));
+
+    if (mode != MRDTX)
+    {
+        gc_pred_reset(&(state->pred_state));
+    }
+
+    Bgn_scd_reset(&(state->background_state));
+    state->nodataSeed = 21845;
+    ph_disp_reset(&(state->ph_disp_st));
+    if (mode != MRDTX)
+    {
+        dtx_dec_reset(&(state->dtxDecoderState));
+    }
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Decoder_amr
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type Decoder_amrState
+    mode = codec mode (enum Mode)
+    parm = buffer of synthesis parameters (Word16)
+    frame_type = received frame type (enum RXFrameType)
+    synth = buffer containing synthetic speech (Word16)
+    A_t = buffer containing decoded LP filter in 4 subframes (Word16)
+
+ Outputs:
+    structure pointed to by st contains the newly calculated decoder
+      parameters
+    synth buffer contains the decoded speech samples
+    A_t buffer contains the decoded LP filter parameters
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the decoding of one speech frame for a given codec
+ mode.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dec_amr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Decoder_amr (
+    Decoder_amrState *st,      // i/o : State variables
+    enum Mode mode,            // i   : AMR mode
+    Word16 parm[],             // i   : vector of synthesis parameters
+                                        (PRM_SIZE)
+    enum RXFrameType frame_type, // i   : received frame type
+    Word16 synth[],            // o   : synthesis speech (L_FRAME)
+    Word16 A_t[]               // o   : decoded LP filter in 4 subframes
+                                        (AZ_SIZE)
+)
+{
+    // LPC coefficients
+
+    Word16 *Az;                // Pointer on A_t
+
+    // LSPs
+
+    Word16 lsp_new[M];
+    Word16 lsp_mid[M];
+
+    // LSFs
+
+    Word16 prev_lsf[M];
+    Word16 lsf_i[M];
+
+    // Algebraic codevector
+
+    Word16 code[L_SUBFR];
+
+    // excitation
+
+    Word16 excp[L_SUBFR];
+    Word16 exc_enhanced[L_SUBFR];
+
+    // Scalars
+
+    Word16 i, i_subfr;
+    Word16 T0, T0_frac, index, index_mr475 = 0;
+    Word16 gain_pit, gain_code, gain_code_mix, pit_sharp, pit_flag, pitch_fac;
+    Word16 t0_min, t0_max;
+    Word16 delta_frc_low, delta_frc_range;
+    Word16 tmp_shift;
+    Word16 temp;
+    Word32 L_temp;
+    Word16 flag4;
+    Word16 carefulFlag;
+    Word16 excEnergy;
+    Word16 subfrNr;
+    Word16 evenSubfr = 0;
+
+    Word16 bfi = 0;   // bad frame indication flag
+    Word16 pdfi = 0;  // potential degraded bad frame flag
+
+    enum DTXStateType newDTXState;  // SPEECH , DTX, DTX_MUTE
+
+    // find the new  DTX state  SPEECH OR DTX
+    newDTXState = rx_dtx_handler(st->dtxDecoderState, frame_type);
+
+    // DTX actions
+    if (sub(newDTXState, SPEECH) != 0 )
+    {
+       Decoder_amr_reset (st, MRDTX);
+
+       dtx_dec(st->dtxDecoderState,
+               st->mem_syn,
+               st->lsfState,
+               st->pred_state,
+               st->Cb_gain_averState,
+               newDTXState,
+               mode,
+               parm, synth, A_t);
+       // update average lsp
+
+       Lsf_lsp(st->lsfState->past_lsf_q, st->lsp_old, M);
+       lsp_avg(st->lsp_avg_st, st->lsfState->past_lsf_q);
+       goto the_end;
+    }
+
+    // SPEECH action state machine
+    if ((sub(frame_type, RX_SPEECH_BAD) == 0) ||
+        (sub(frame_type, RX_NO_DATA) == 0) ||
+        (sub(frame_type, RX_ONSET) == 0))
+    {
+       bfi = 1;
+       if ((sub(frame_type, RX_NO_DATA) == 0) ||
+           (sub(frame_type, RX_ONSET) == 0))
+       {
+      build_CN_param(&st->nodataSeed,
+             prmno[mode],
+             bitno[mode],
+             parm);
+       }
+    }
+    else if (sub(frame_type, RX_SPEECH_DEGRADED) == 0)
+    {
+       pdfi = 1;
+    }
+
+    if (bfi != 0)
+    {
+        st->state = add (st->state, 1);
+    }
+    else if (sub (st->state, 6) == 0)
+
+    {
+        st->state = 5;
+    }
+    else
+    {
+        st->state = 0;
+    }
+
+    if (sub (st->state, 6) > 0)
+    {
+        st->state = 6;
+    }
+
+    // If this frame is the first speech frame after CNI period,
+    // set the BFH state machine to an appropriate state depending
+    // on whether there was DTX muting before start of speech or not
+    // If there was DTX muting, the first speech frame is muted.
+    // If there was no DTX muting, the first speech frame is not
+    // muted. The BFH state machine starts from state 5, however, to
+    // keep the audible noise resulting from a SID frame which is
+    // erroneously interpreted as a good speech frame as small as
+    // possible (the decoder output in this case is quickly muted)
+
+    if (sub(st->dtxDecoderState->dtxGlobalState, DTX) == 0)
+    {
+       st->state = 5;
+       st->prev_bf = 0;
+    }
+    else if (sub(st->dtxDecoderState->dtxGlobalState, DTX_MUTE) == 0)
+    {
+       st->state = 5;
+       st->prev_bf = 1;
+    }
+
+    // save old LSFs for CB gain smoothing
+    Copy (st->lsfState->past_lsf_q, prev_lsf, M);
+
+    // decode LSF parameters and generate interpolated lpc coefficients
+       for the 4 subframes
+    if (sub (mode, MR122) != 0)
+    {
+       D_plsf_3(st->lsfState, mode, bfi, parm, lsp_new);
+
+       // Advance synthesis parameters pointer
+       parm += 3;
+
+       Int_lpc_1to3(st->lsp_old, lsp_new, A_t);
+    }
+    else
+    {
+       D_plsf_5 (st->lsfState, bfi, parm, lsp_mid, lsp_new);
+
+       // Advance synthesis parameters pointer
+       parm += 5;
+
+       Int_lpc_1and3 (st->lsp_old, lsp_mid, lsp_new, A_t);
+    }
+
+    // update the LSPs for the next frame
+    for (i = 0; i < M; i++)
+    {
+       st->lsp_old[i] = lsp_new[i];
+    }
+
+    *------------------------------------------------------------------------*
+    *          Loop for every subframe in the analysis frame                 *
+    *------------------------------------------------------------------------*
+    * The subframe size is L_SUBFR and the loop is repeated L_FRAME/L_SUBFR  *
+    *  times                                                                 *
+    *     - decode the pitch delay                                           *
+    *     - decode algebraic code                                            *
+    *     - decode pitch and codebook gains                                  *
+    *     - find the excitation and compute synthesis speech                 *
+    *------------------------------------------------------------------------*
+
+    // pointer to interpolated LPC parameters
+    Az = A_t;
+
+    evenSubfr = 0;
+    subfrNr = -1;
+    for (i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
+    {
+       subfrNr = add(subfrNr, 1);
+       evenSubfr = sub(1, evenSubfr);
+
+       // flag for first and 3th subframe
+       pit_flag = i_subfr;
+
+       if (sub (i_subfr, L_FRAME_BY2) == 0)
+       {
+          if (sub(mode, MR475) != 0 && sub(mode, MR515) != 0)
+          {
+             pit_flag = 0;
+          }
+       }
+
+       // pitch index
+       index = *parm++;
+
+        *-------------------------------------------------------*
+        * - decode pitch lag and find adaptive codebook vector. *
+        *-------------------------------------------------------*
+
+       if (sub(mode, MR122) != 0)
+       {
+          // flag4 indicates encoding with 4 bit resolution;
+          // this is needed for mode MR475, MR515, MR59 and MR67
+
+          flag4 = 0;
+          if ((sub (mode, MR475) == 0) ||
+              (sub (mode, MR515) == 0) ||
+              (sub (mode, MR59) == 0) ||
+              (sub (mode, MR67) == 0) ) {
+             flag4 = 1;
+          }
+
+           *-------------------------------------------------------*
+           * - get ranges for the t0_min and t0_max                *
+           * - only needed in delta decoding                       *
+           *-------------------------------------------------------*
+
+          delta_frc_low = 5;
+          delta_frc_range = 9;
+
+          if ( sub(mode, MR795) == 0 )
+          {
+             delta_frc_low = 10;
+             delta_frc_range = 19;
+          }
+
+          t0_min = sub(st->old_T0, delta_frc_low);
+          if (sub(t0_min, PIT_MIN) < 0)
+          {
+             t0_min = PIT_MIN;
+          }
+          t0_max = add(t0_min, delta_frc_range);
+          if (sub(t0_max, PIT_MAX) > 0)
+          {
+             t0_max = PIT_MAX;
+             t0_min = sub(t0_max, delta_frc_range);
+          }
+
+          Dec_lag3 (index, t0_min, t0_max, pit_flag, st->old_T0,
+                    &T0, &T0_frac, flag4);
+
+          st->T0_lagBuff = T0;
+
+          if (bfi != 0)
+          {
+             if (sub (st->old_T0, PIT_MAX) < 0)
+             {                                      // Graceful pitch
+                st->old_T0 = add(st->old_T0, 1);    // degradation
+             }
+             T0 = st->old_T0;
+             T0_frac = 0;
+
+             if ( st->inBackgroundNoise != 0 &&
+                  sub(st->voicedHangover, 4) > 0 &&
+                  ((sub(mode, MR475) == 0 ) ||
+                   (sub(mode, MR515) == 0 ) ||
+                   (sub(mode, MR59) == 0) )
+                  )
+             {
+                T0 = st->T0_lagBuff;
+             }
+          }
+
+          Pred_lt_3or6 (st->exc, T0, T0_frac, L_SUBFR, 1);
+       }
+       else
+       {
+          Dec_lag6 (index, PIT_MIN_MR122,
+                    PIT_MAX, pit_flag, &T0, &T0_frac);
+
+          if ( bfi == 0 && (pit_flag == 0 || sub (index, 61) < 0))
+          {
+          }
+          else
+          {
+             st->T0_lagBuff = T0;
+             T0 = st->old_T0;
+             T0_frac = 0;
+          }
+
+          Pred_lt_3or6 (st->exc, T0, T0_frac, L_SUBFR, 0);
+       }
+
+        *-------------------------------------------------------*
+        * - (MR122 only: Decode pitch gain.)                    *
+        * - Decode innovative codebook.                         *
+        * - set pitch sharpening factor                         *
+        *-------------------------------------------------------*
+
+        if (sub (mode, MR475) == 0 || sub (mode, MR515) == 0)
+        {   // MR475, MR515
+           index = *parm++;        // index of position
+           i = *parm++;            // signs
+
+           decode_2i40_9bits (subfrNr, i, index, code);
+
+           pit_sharp = shl (st->sharp, 1);
+        }
+        else if (sub (mode, MR59) == 0)
+        {   // MR59
+           index = *parm++;        // index of position
+           i = *parm++;            // signs
+
+           decode_2i40_11bits (i, index, code);
+
+           pit_sharp = shl (st->sharp, 1);
+        }
+        else if (sub (mode, MR67) == 0)
+        {   // MR67
+           index = *parm++;        // index of position
+           i = *parm++;            // signs
+
+           decode_3i40_14bits (i, index, code);
+
+           pit_sharp = shl (st->sharp, 1);
+        }
+        else if (sub (mode, MR795) <= 0)
+        {   // MR74, MR795
+           index = *parm++;        // index of position
+           i = *parm++;            // signs
+
+           decode_4i40_17bits (i, index, code);
+
+           pit_sharp = shl (st->sharp, 1);
+        }
+        else if (sub (mode, MR102) == 0)
+        {  // MR102
+           dec_8i40_31bits (parm, code);
+           parm += 7;
+
+           pit_sharp = shl (st->sharp, 1);
+        }
+        else
+        {  // MR122
+           index = *parm++;
+           if (bfi != 0)
+           {
+              ec_gain_pitch (st->ec_gain_p_st, st->state, &gain_pit);
+           }
+           else
+           {
+              gain_pit = d_gain_pitch (mode, index);
+           }
+           ec_gain_pitch_update (st->ec_gain_p_st, bfi, st->prev_bf,
+                                 &gain_pit);
+
+           dec_10i40_35bits (parm, code);
+           parm += 10;
+
+           // pit_sharp = gain_pit;
+           // if (pit_sharp > 1.0) pit_sharp = 1.0;
+
+           pit_sharp = shl (gain_pit, 1);
+        }
+
+         *-------------------------------------------------------*
+         * - Add the pitch contribution to code[].               *
+         *-------------------------------------------------------*
+        for (i = T0; i < L_SUBFR; i++)
+        {
+           temp = mult (code[i - T0], pit_sharp);
+           code[i] = add (code[i], temp);
+        }
+
+         *------------------------------------------------------------*
+         * - Decode codebook gain (MR122) or both pitch               *
+         *   gain and codebook gain (all others)                      *
+         * - Update pitch sharpening "sharp" with quantized gain_pit  *
+         *------------------------------------------------------------*
+
+        if (sub (mode, MR475) == 0)
+        {
+           // read and decode pitch and code gain
+           if (evenSubfr != 0)
+           {
+              index_mr475 = *parm++; // index of gain(s)
+           }
+
+           if (bfi == 0)
+           {
+              Dec_gain(st->pred_state, mode, index_mr475, code,
+                       evenSubfr, &gain_pit, &gain_code);
+           }
+           else
+           {
+              ec_gain_pitch (st->ec_gain_p_st, st->state, &gain_pit);
+              ec_gain_code (st->ec_gain_c_st, st->pred_state, st->state,
+                            &gain_code);
+           }
+           ec_gain_pitch_update (st->ec_gain_p_st, bfi, st->prev_bf,
+                                 &gain_pit);
+           ec_gain_code_update (st->ec_gain_c_st, bfi, st->prev_bf,
+                                &gain_code);
+
+           pit_sharp = gain_pit;
+           if (sub (pit_sharp, SHARPMAX) > 0)
+           {
+               pit_sharp = SHARPMAX;
+           }
+
+        }
+        else if ((sub (mode, MR74) <= 0) ||
+                 (sub (mode, MR102) == 0))
+        {
+            // read and decode pitch and code gain
+            index = *parm++; // index of gain(s)
+
+            if (bfi == 0)
+            {
+               Dec_gain(st->pred_state, mode, index, code,
+                        evenSubfr, &gain_pit, &gain_code);
+            }
+            else
+            {
+               ec_gain_pitch (st->ec_gain_p_st, st->state, &gain_pit);
+               ec_gain_code (st->ec_gain_c_st, st->pred_state, st->state,
+                             &gain_code);
+            }
+            ec_gain_pitch_update (st->ec_gain_p_st, bfi, st->prev_bf,
+                                  &gain_pit);
+            ec_gain_code_update (st->ec_gain_c_st, bfi, st->prev_bf,
+                                 &gain_code);
+
+            pit_sharp = gain_pit;
+            if (sub (pit_sharp, SHARPMAX) > 0)
+            {
+               pit_sharp = SHARPMAX;
+            }
+
+            if (sub (mode, MR102) == 0)
+            {
+               if (sub (st->old_T0, add(L_SUBFR, 5)) > 0)
+               {
+                  pit_sharp = shr(pit_sharp, 2);
+               }
+            }
+        }
+        else
+        {
+           // read and decode pitch gain
+           index = *parm++; // index of gain(s)
+
+           if (sub (mode, MR795) == 0)
+           {
+              // decode pitch gain
+              if (bfi != 0)
+              {
+                 ec_gain_pitch (st->ec_gain_p_st, st->state, &gain_pit);
+              }
+              else
+              {
+                 gain_pit = d_gain_pitch (mode, index);
+              }
+              ec_gain_pitch_update (st->ec_gain_p_st, bfi, st->prev_bf,
+                                    &gain_pit);
+
+              // read and decode code gain
+              index = *parm++;
+              if (bfi == 0)
+              {
+                 d_gain_code (st->pred_state, mode, index, code, &gain_code);
+              }
+              else
+              {
+                 ec_gain_code (st->ec_gain_c_st, st->pred_state, st->state,
+                               &gain_code);
+              }
+              ec_gain_code_update (st->ec_gain_c_st, bfi, st->prev_bf,
+                                   &gain_code);
+
+              pit_sharp = gain_pit;
+              if (sub (pit_sharp, SHARPMAX) > 0)
+              {
+                 pit_sharp = SHARPMAX;
+              }
+           }
+           else
+           { // MR122
+              if (bfi == 0)
+              {
+                 d_gain_code (st->pred_state, mode, index, code, &gain_code);
+              }
+              else
+              {
+                 ec_gain_code (st->ec_gain_c_st, st->pred_state, st->state,
+                               &gain_code);
+              }
+              ec_gain_code_update (st->ec_gain_c_st, bfi, st->prev_bf,
+                                   &gain_code);
+
+              pit_sharp = gain_pit;
+           }
+        }
+
+        // store pitch sharpening for next subframe
+        // (for modes which use the previous pitch gain for
+        // pitch sharpening in the search phase)
+        // do not update sharpening in even subframes for MR475
+        if (sub(mode, MR475) != 0 || evenSubfr == 0)
+        {
+            st->sharp = gain_pit;
+            if (sub (st->sharp, SHARPMAX) > 0)
+            {
+                st->sharp = SHARPMAX;
+            }
+        }
+
+        pit_sharp = shl (pit_sharp, 1);
+        if (sub (pit_sharp, 16384) > 0)
+        {
+           for (i = 0; i < L_SUBFR; i++)
+            {
+               temp = mult (st->exc[i], pit_sharp);
+               L_temp = L_mult (temp, gain_pit);
+               if (sub(mode, MR122)==0)
+               {
+                  L_temp = L_shr (L_temp, 1);
+               }
+               excp[i] = pv_round (L_temp);
+            }
+        }
+
+         *-------------------------------------------------------*
+         * - Store list of LTP gains needed in the source        *
+         *   characteristic detector (SCD)                       *
+         *-------------------------------------------------------*
+        if ( bfi == 0 )
+        {
+           for (i = 0; i < 8; i++)
+           {
+              st->ltpGainHistory[i] = st->ltpGainHistory[i+1];
+           }
+           st->ltpGainHistory[8] = gain_pit;
+        }
+
+         *-------------------------------------------------------*
+         * - Limit gain_pit if in background noise and BFI       *
+         *   for MR475, MR515, MR59                              *
+         *-------------------------------------------------------*
+
+        if ( (st->prev_bf != 0 || bfi != 0) && st->inBackgroundNoise != 0 &&
+             ((sub(mode, MR475) == 0) ||
+              (sub(mode, MR515) == 0) ||
+              (sub(mode, MR59) == 0))
+             )
+        {
+           if ( sub (gain_pit, 12288) > 0)    // if (gain_pit > 0.75) in Q14
+              gain_pit = add( shr( sub(gain_pit, 12288), 1 ), 12288 );
+              // gain_pit = (gain_pit-0.75)/2.0 + 0.75;
+
+           if ( sub (gain_pit, 14745) > 0)    // if (gain_pit > 0.90) in Q14
+           {
+              gain_pit = 14745;
+           }
+        }
+
+         *-------------------------------------------------------*
+         *  Calculate CB mixed gain                              *
+         *-------------------------------------------------------*
+        Int_lsf(prev_lsf, st->lsfState->past_lsf_q, i_subfr, lsf_i);
+        gain_code_mix = Cb_gain_average(
+            st->Cb_gain_averState, mode, gain_code,
+            lsf_i, st->lsp_avg_st->lsp_meanSave, bfi,
+            st->prev_bf, pdfi, st->prev_pdf,
+            st->inBackgroundNoise, st->voicedHangover);
+
+        // make sure that MR74, MR795, MR122 have original code_gain
+        if ((sub(mode, MR67) > 0) && (sub(mode, MR102) != 0) )
+           // MR74, MR795, MR122
+        {
+           gain_code_mix = gain_code;
+        }
+
+         *-------------------------------------------------------*
+         * - Find the total excitation.                          *
+         * - Find synthesis speech corresponding to st->exc[].   *
+         *-------------------------------------------------------*
+        if (sub(mode, MR102) <= 0) // MR475, MR515, MR59, MR67, MR74, MR795, MR102
+        {
+           pitch_fac = gain_pit;
+           tmp_shift = 1;
+        }
+        else       // MR122
+        {
+           pitch_fac = shr (gain_pit, 1);
+           tmp_shift = 2;
+        }
+
+        // copy unscaled LTP excitation to exc_enhanced (used in phase
+         * dispersion below) and compute total excitation for LTP feedback
+
+        for (i = 0; i < L_SUBFR; i++)
+        {
+           exc_enhanced[i] = st->exc[i];
+
+           // st->exc[i] = gain_pit*st->exc[i] + gain_code*code[i];
+           L_temp = L_mult (st->exc[i], pitch_fac);
+                                                      // 12.2: Q0 * Q13
+                                                      //  7.4: Q0 * Q14
+           L_temp = L_mac (L_temp, code[i], gain_code);
+                                                      // 12.2: Q12 * Q1
+                                                      //  7.4: Q13 * Q1
+           L_temp = L_shl (L_temp, tmp_shift);                   // Q16
+           st->exc[i] = pv_round (L_temp);
+        }
+
+         *-------------------------------------------------------*
+         * - Adaptive phase dispersion                           *
+         *-------------------------------------------------------*
+        ph_disp_release(st->ph_disp_st); // free phase dispersion adaption
+
+        if ( ((sub(mode, MR475) == 0) ||
+              (sub(mode, MR515) == 0) ||
+              (sub(mode, MR59) == 0))   &&
+             sub(st->voicedHangover, 3) > 0 &&
+             st->inBackgroundNoise != 0 &&
+             bfi != 0 )
+        {
+           ph_disp_lock(st->ph_disp_st); // Always Use full Phase Disp.
+        }                                // if error in bg noise
+
+        // apply phase dispersion to innovation (if enabled) and
+           compute total excitation for synthesis part
+        ph_disp(st->ph_disp_st, mode,
+                exc_enhanced, gain_code_mix, gain_pit, code,
+                pitch_fac, tmp_shift);
+
+         *-------------------------------------------------------*
+         * - The Excitation control module are active during BFI.*
+         * - Conceal drops in signal energy if in bg noise.      *
+         *-------------------------------------------------------*
+
+        L_temp = 0;
+        for (i = 0; i < L_SUBFR; i++)
+        {
+            L_temp = L_mac (L_temp, exc_enhanced[i], exc_enhanced[i] );
+        }
+
+        L_temp = L_shr (L_temp, 1);     // excEnergy = sqrt(L_temp) in Q0
+        L_temp = sqrt_l_exp(L_temp, &temp); // function result
+        L_temp = L_shr(L_temp, add( shr(temp, 1), 15));
+        L_temp = L_shr(L_temp, 2);       // To cope with 16-bit and
+        excEnergy = extract_l(L_temp);   // scaling in ex_ctrl()
+
+        if ( ((sub (mode, MR475) == 0) ||
+              (sub (mode, MR515) == 0) ||
+              (sub (mode, MR59) == 0))  &&
+             sub(st->voicedHangover, 5) > 0 &&
+             st->inBackgroundNoise != 0 &&
+             sub(st->state, 4) < 0 &&
+             ( (pdfi != 0 && st->prev_pdf != 0) ||
+                bfi != 0 ||
+                st->prev_bf != 0) )
+        {
+           carefulFlag = 0;
+           if ( pdfi != 0 && bfi == 0 )
+           {
+              carefulFlag = 1;
+           }
+
+           Ex_ctrl(exc_enhanced,
+                   excEnergy,
+                   st->excEnergyHist,
+                   st->voicedHangover,
+                   st->prev_bf,
+                   carefulFlag);
+        }
+
+        if ( st->inBackgroundNoise != 0 &&
+             ( bfi != 0 || st->prev_bf != 0 ) &&
+             sub(st->state, 4) < 0 )
+        {
+           ; // do nothing!
+        }
+        else
+        {
+           // Update energy history for all modes
+           for (i = 0; i < 8; i++)
+           {
+              st->excEnergyHist[i] = st->excEnergyHist[i+1];
+           }
+           st->excEnergyHist[8] = excEnergy;
+        }
+         *-------------------------------------------------------*
+         * Excitation control module end.                        *
+         *-------------------------------------------------------*
+
+        if (sub (pit_sharp, 16384) > 0)
+        {
+           for (i = 0; i < L_SUBFR; i++)
+           {
+              excp[i] = add (excp[i], exc_enhanced[i]);
+           }
+           agc2 (exc_enhanced, excp, L_SUBFR);
+           Overflow = 0;
+           Syn_filt (Az, excp, &synth[i_subfr], L_SUBFR,
+                     st->mem_syn, 0);
+        }
+        else
+        {
+           Overflow = 0;
+           Syn_filt (Az, exc_enhanced, &synth[i_subfr], L_SUBFR,
+                     st->mem_syn, 0);
+        }
+
+        if (Overflow != 0)    // Test for overflow
+        {
+           for (i = 0; i < PIT_MAX + L_INTERPOL + L_SUBFR; i++)
+           {
+              st->old_exc[i] = shr(st->old_exc[i], 2);
+           }
+           for (i = 0; i < L_SUBFR; i++)
+           {
+              exc_enhanced[i] = shr(exc_enhanced[i], 2);
+           }
+           Syn_filt(Az, exc_enhanced, &synth[i_subfr], L_SUBFR, st->mem_syn, 1);
+        }
+        else
+        {
+           Copy(&synth[i_subfr+L_SUBFR-M], st->mem_syn, M);
+        }
+
+         *--------------------------------------------------*
+         * Update signal for next frame.                    *
+         * -> shift to the left by L_SUBFR  st->exc[]       *
+         *--------------------------------------------------*
+
+        Copy (&st->old_exc[L_SUBFR], &st->old_exc[0], PIT_MAX + L_INTERPOL);
+
+        // interpolated LPC parameters for next subframe
+        Az += MP1;
+
+        // store T0 for next subframe
+        st->old_T0 = T0;
+    }
+
+     *-------------------------------------------------------*
+     * Call the Source Characteristic Detector which updates *
+     * st->inBackgroundNoise and st->voicedHangover.         *
+     *-------------------------------------------------------*
+
+    st->inBackgroundNoise = Bgn_scd(st->background_state,
+                                    &(st->ltpGainHistory[0]),
+                                    &(synth[0]),
+                                    &(st->voicedHangover) );
+
+    dtx_dec_activity_update(st->dtxDecoderState,
+                            st->lsfState->past_lsf_q,
+                            synth);
+
+    // store bfi for next subframe
+    st->prev_bf = bfi;
+    st->prev_pdf = pdfi;
+
+     *--------------------------------------------------*
+     * Calculate the LSF averages on the eight          *
+     * previous frames                                  *
+     *--------------------------------------------------*
+
+    lsp_avg(st->lsp_avg_st, st->lsfState->past_lsf_q);
+
+the_end:
+    st->dtxDecoderState->dtxGlobalState = newDTXState;
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Decoder_amr(
+    Decoder_amrState *st,      /* i/o : State variables                   */
+    enum Mode mode,            /* i   : AMR mode                          */
+    Word16 parm[],             /* i   : vector of synthesis parameters
+                                        (PRM_SIZE)                        */
+    enum RXFrameType frame_type, /* i   : received frame type             */
+    Word16 synth[],            /* o   : synthesis speech (L_FRAME)        */
+    Word16 A_t[]               /* o   : decoded LP filter in 4 subframes
+                                        (AZ_SIZE)                         */
+)
+{
+    /* LPC coefficients */
+
+    Word16 *Az;                /* Pointer on A_t */
+
+    /* LSPs */
+
+    Word16 lsp_new[M];
+    Word16 lsp_mid[M];
+
+    /* LSFs */
+
+    Word16 prev_lsf[M];
+    Word16 lsf_i[M];
+
+    /* Algebraic codevector */
+
+    Word16 code[L_SUBFR];
+
+    /* excitation */
+
+    Word16 excp[L_SUBFR];
+    Word16 exc_enhanced[L_SUBFR];
+
+    /* Scalars */
+
+    Word16 i;
+    Word16 i_subfr;
+    Word16 T0;
+    Word16 T0_frac;
+    Word16 index;
+    Word16 index_mr475 = 0;
+    Word16 gain_pit;
+    Word16 gain_code;
+    Word16 gain_code_mix;
+    Word16 pit_sharp;
+    Word16 pit_flag;
+    Word16 pitch_fac;
+    Word16 t0_min;
+    Word16 t0_max;
+    Word16 delta_frc_low;
+    Word16 delta_frc_range;
+    Word16 tmp_shift;
+    Word16 temp;
+    Word32 L_temp;
+    Word16 flag4;
+    Word16 carefulFlag;
+    Word16 excEnergy;
+    Word16 subfrNr;
+    Word16 evenSubfr = 0;
+
+    Word16 bfi = 0;   /* bad frame indication flag                          */
+    Word16 pdfi = 0;  /* potential degraded bad frame flag                  */
+
+    enum DTXStateType newDTXState;  /* SPEECH , DTX, DTX_MUTE */
+    Flag   *pOverflow = &(st->overflow);     /* Overflow flag            */
+
+
+    /* find the new  DTX state  SPEECH OR DTX */
+    newDTXState = rx_dtx_handler(&(st->dtxDecoderState), frame_type, pOverflow);
+
+    /* DTX actions */
+
+    if (newDTXState != SPEECH)
+    {
+        Decoder_amr_reset(st, MRDTX);
+
+        dtx_dec(&(st->dtxDecoderState),
+                st->mem_syn,
+                &(st->lsfState),
+                &(st->pred_state),
+                &(st->Cb_gain_averState),
+                newDTXState,
+                mode,
+                parm, &(st->common_amr_tbls), synth, A_t, pOverflow);
+
+        /* update average lsp */
+        Lsf_lsp(
+            st->lsfState.past_lsf_q,
+            st->lsp_old,
+            M,
+            pOverflow);
+
+        lsp_avg(
+            &(st->lsp_avg_st),
+            st->lsfState.past_lsf_q,
+            pOverflow);
+
+        goto the_end;
+    }
+
+    /* SPEECH action state machine  */
+    if ((frame_type == RX_SPEECH_BAD) || (frame_type == RX_NO_DATA) ||
+            (frame_type == RX_ONSET))
+    {
+        bfi = 1;
+
+        if ((frame_type == RX_NO_DATA) || (frame_type == RX_ONSET))
+        {
+            build_CN_param(&st->nodataSeed,
+                           st->common_amr_tbls.prmno_ptr[mode],
+                           st->common_amr_tbls.bitno_ptr[mode],
+                           parm,
+                           st->common_amr_tbls.window_200_40_ptr,
+                           pOverflow);
+        }
+    }
+    else if (frame_type == RX_SPEECH_DEGRADED)
+    {
+        pdfi = 1;
+    }
+
+    if (bfi != 0)
+    {
+        st->state += 1;
+    }
+    else if (st->state == 6)
+
+    {
+        st->state = 5;
+    }
+    else
+    {
+        st->state = 0;
+    }
+
+
+    if (st->state > 6)
+    {
+        st->state = 6;
+    }
+
+    /* If this frame is the first speech frame after CNI period,     */
+    /* set the BFH state machine to an appropriate state depending   */
+    /* on whether there was DTX muting before start of speech or not */
+    /* If there was DTX muting, the first speech frame is muted.     */
+    /* If there was no DTX muting, the first speech frame is not     */
+    /* muted. The BFH state machine starts from state 5, however, to */
+    /* keep the audible noise resulting from a SID frame which is    */
+    /* erroneously interpreted as a good speech frame as small as    */
+    /* possible (the decoder output in this case is quickly muted)   */
+
+    if (st->dtxDecoderState.dtxGlobalState == DTX)
+    {
+        st->state = 5;
+        st->prev_bf = 0;
+    }
+    else if (st->dtxDecoderState.dtxGlobalState == DTX_MUTE)
+    {
+        st->state = 5;
+        st->prev_bf = 1;
+    }
+
+    /* save old LSFs for CB gain smoothing */
+    oscl_memmove((void *)prev_lsf, st->lsfState.past_lsf_q, M*sizeof(*st->lsfState.past_lsf_q));
+
+    /* decode LSF parameters and generate interpolated lpc coefficients
+       for the 4 subframes */
+
+    if (mode != MR122)
+    {
+        D_plsf_3(
+            &(st->lsfState),
+            mode,
+            bfi,
+            parm,
+            &st->common_amr_tbls,
+            lsp_new,
+            pOverflow);
+
+        /* Advance synthesis parameters pointer */
+        parm += 3;
+
+        Int_lpc_1to3(
+            st->lsp_old,
+            lsp_new,
+            A_t,
+            pOverflow);
+    }
+    else
+    {
+        D_plsf_5(
+            &(st->lsfState),
+            bfi,
+            parm,
+            &(st->common_amr_tbls),
+            lsp_mid,
+            lsp_new,
+            pOverflow);
+
+        /* Advance synthesis parameters pointer */
+        parm += 5;
+
+        Int_lpc_1and3(
+            st->lsp_old,
+            lsp_mid,
+            lsp_new,
+            A_t,
+            pOverflow);
+    }
+
+    /* update the LSPs for the next frame */
+    for (i = 0; i < M; i++)
+    {
+        st->lsp_old[i] = lsp_new[i];
+    }
+
+    /*------------------------------------------------------------------------*
+     *          Loop for every subframe in the analysis frame                 *
+     *------------------------------------------------------------------------*
+     * The subframe size is L_SUBFR and the loop is repeated L_FRAME/L_SUBFR  *
+     *  times                                                                 *
+     *     - decode the pitch delay                                           *
+     *     - decode algebraic code                                            *
+     *     - decode pitch and codebook gains                                  *
+     *     - find the excitation and compute synthesis speech                 *
+     *------------------------------------------------------------------------*/
+
+    /* pointer to interpolated LPC parameters */
+    Az = A_t;
+
+    evenSubfr = 0;
+    subfrNr = -1;
+    for (i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
+    {
+        subfrNr += 1;
+        evenSubfr = 1 - evenSubfr;
+
+        /* flag for first and 3th subframe */
+        pit_flag = i_subfr;
+
+
+        if (i_subfr == L_FRAME_BY2)
+        {
+            if ((mode != MR475) && (mode != MR515))
+            {
+                pit_flag = 0;
+            }
+        }
+
+        /* pitch index */
+        index = *parm++;
+
+        /*-------------------------------------------------------*
+        * - decode pitch lag and find adaptive codebook vector. *
+        *-------------------------------------------------------*/
+
+        if (mode != MR122)
+        {
+            /* flag4 indicates encoding with 4 bit resolution;     */
+            /* this is needed for mode MR475, MR515, MR59 and MR67 */
+
+            flag4 = 0;
+
+            if ((mode == MR475) || (mode == MR515) || (mode == MR59) ||
+                    (mode == MR67))
+            {
+                flag4 = 1;
+            }
+
+            /*-------------------------------------------------------*
+            * - get ranges for the t0_min and t0_max                *
+            * - only needed in delta decoding                       *
+            *-------------------------------------------------------*/
+
+            delta_frc_low = 5;
+            delta_frc_range = 9;
+
+            if (mode == MR795)
+            {
+                delta_frc_low = 10;
+                delta_frc_range = 19;
+            }
+
+            t0_min = st->old_T0 - delta_frc_low;
+
+            if (t0_min < PIT_MIN)
+            {
+                t0_min = PIT_MIN;
+            }
+            t0_max = t0_min + delta_frc_range;
+
+            if (t0_max > PIT_MAX)
+            {
+                t0_max = PIT_MAX;
+                t0_min = t0_max - delta_frc_range;
+            }
+
+            Dec_lag3(index, t0_min, t0_max, pit_flag, st->old_T0,
+                     &T0, &T0_frac, flag4, pOverflow);
+
+            st->T0_lagBuff = T0;
+
+            if (bfi != 0)
+            {
+                if (st->old_T0 < PIT_MAX)
+                {                               /* Graceful pitch */
+                    st->old_T0 += 1;            /* degradation    */
+                }
+                T0 = st->old_T0;
+                T0_frac = 0;
+
+                if ((st->inBackgroundNoise != 0) && (st->voicedHangover > 4) &&
+                        ((mode == MR475) || (mode == MR515) || (mode == MR59)))
+                {
+                    T0 = st->T0_lagBuff;
+                }
+            }
+
+            Pred_lt_3or6(st->exc, T0, T0_frac, L_SUBFR, 1, pOverflow);
+        }
+        else
+        {
+            Dec_lag6(index, PIT_MIN_MR122,
+                     PIT_MAX, pit_flag, &T0, &T0_frac, pOverflow);
+
+
+            if (!(bfi == 0 && (pit_flag == 0 || index < 61)))
+            {
+                st->T0_lagBuff = T0;
+                T0 = st->old_T0;
+                T0_frac = 0;
+            }
+
+            Pred_lt_3or6(st->exc, T0, T0_frac, L_SUBFR, 0, pOverflow);
+        }
+
+        /*-------------------------------------------------------*
+         * - (MR122 only: Decode pitch gain.)                    *
+         * - Decode innovative codebook.                         *
+         * - set pitch sharpening factor                         *
+         *-------------------------------------------------------*/
+        if ((mode == MR475) || (mode == MR515))
+        {   /* MR475, MR515 */
+            index = *parm++;        /* index of position */
+            i = *parm++;            /* signs             */
+
+            decode_2i40_9bits(subfrNr, i, index, st->common_amr_tbls.startPos_ptr, code, pOverflow);
+
+            L_temp = (Word32)st->sharp << 1;
+            if (L_temp != (Word32)((Word16) L_temp))
+            {
+                pit_sharp = (st->sharp > 0) ? MAX_16 : MIN_16;
+            }
+            else
+            {
+                pit_sharp = (Word16) L_temp;
+            }
+        }
+        else if (mode == MR59)
+        {   /* MR59 */
+            index = *parm++;        /* index of position */
+            i = *parm++;            /* signs             */
+
+            decode_2i40_11bits(i, index, code);
+
+            L_temp = (Word32)st->sharp << 1;
+            if (L_temp != (Word32)((Word16) L_temp))
+            {
+                pit_sharp = (st->sharp > 0) ? MAX_16 : MIN_16;
+            }
+            else
+            {
+                pit_sharp = (Word16) L_temp;
+            }
+        }
+        else if (mode == MR67)
+        {   /* MR67 */
+            index = *parm++;        /* index of position */
+            i = *parm++;            /* signs             */
+
+            decode_3i40_14bits(i, index, code);
+
+            L_temp = (Word32)st->sharp << 1;
+            if (L_temp != (Word32)((Word16) L_temp))
+            {
+                pit_sharp = (st->sharp > 0) ? MAX_16 : MIN_16;
+            }
+            else
+            {
+                pit_sharp = (Word16) L_temp;
+            }
+        }
+        else if (mode <= MR795)
+        {   /* MR74, MR795 */
+            index = *parm++;        /* index of position */
+            i = *parm++;            /* signs             */
+
+            decode_4i40_17bits(i, index, st->common_amr_tbls.dgray_ptr, code);
+
+            L_temp = (Word32)st->sharp << 1;
+            if (L_temp != (Word32)((Word16) L_temp))
+            {
+                pit_sharp = (st->sharp > 0) ? MAX_16 : MIN_16;
+            }
+            else
+            {
+                pit_sharp = (Word16) L_temp;
+            }
+        }
+        else if (mode == MR102)
+        {  /* MR102 */
+            dec_8i40_31bits(parm, code, pOverflow);
+            parm += 7;
+
+            L_temp = (Word32)st->sharp << 1;
+            if (L_temp != (Word32)((Word16) L_temp))
+            {
+                pit_sharp = (st->sharp > 0) ? MAX_16 : MIN_16;
+            }
+            else
+            {
+                pit_sharp = (Word16) L_temp;
+            }
+        }
+        else
+        {  /* MR122 */
+            index = *parm++;
+
+            if (bfi != 0)
+            {
+                ec_gain_pitch(
+                    &(st->ec_gain_p_st),
+                    st->state,
+                    &gain_pit,
+                    pOverflow);
+            }
+            else
+            {
+                gain_pit = d_gain_pitch(mode, index, st->common_amr_tbls.qua_gain_pitch_ptr);
+            }
+            ec_gain_pitch_update(
+                &(st->ec_gain_p_st),
+                bfi,
+                st->prev_bf,
+                &gain_pit,
+                pOverflow);
+
+
+            dec_10i40_35bits(parm, code, st->common_amr_tbls.dgray_ptr);
+            parm += 10;
+
+            /* pit_sharp = gain_pit;                   */
+            /* if (pit_sharp > 1.0) pit_sharp = 1.0;   */
+
+            L_temp = (Word32)gain_pit << 1;
+            if (L_temp != (Word32)((Word16) L_temp))
+            {
+                pit_sharp = (gain_pit > 0) ? MAX_16 : MIN_16;
+            }
+            else
+            {
+                pit_sharp = (Word16) L_temp;
+            }
+        }
+        /*-------------------------------------------------------*
+         * - Add the pitch contribution to code[].               *
+         *-------------------------------------------------------*/
+        for (i = T0; i < L_SUBFR; i++)
+        {
+            temp = mult(*(code + i - T0), pit_sharp, pOverflow);
+            *(code + i) = add_16(*(code + i), temp, pOverflow);
+
+        }
+
+        /*------------------------------------------------------------*
+         * - Decode codebook gain (MR122) or both pitch               *
+         *   gain and codebook gain (all others)                      *
+         * - Update pitch sharpening "sharp" with quantized gain_pit  *
+         *------------------------------------------------------------*/
+        if (mode == MR475)
+        {
+            /* read and decode pitch and code gain */
+
+            if (evenSubfr != 0)
+            {
+                index_mr475 = *parm++;         /* index of gain(s) */
+            }
+
+            if (bfi == 0)
+            {
+                Dec_gain(
+                    &(st->pred_state),
+                    mode,
+                    index_mr475,
+                    code,
+                    evenSubfr,
+                    &gain_pit,
+                    &gain_code,
+                    &(st->common_amr_tbls),
+                    pOverflow);
+            }
+            else
+            {
+                ec_gain_pitch(
+                    &(st->ec_gain_p_st),
+                    st->state,
+                    &gain_pit,
+                    pOverflow);
+
+                ec_gain_code(
+                    &(st->ec_gain_c_st),
+                    &(st->pred_state),
+                    st->state,
+                    &gain_code,
+                    pOverflow);
+            }
+            ec_gain_pitch_update(
+                &st->ec_gain_p_st,
+                bfi,
+                st->prev_bf,
+                &gain_pit,
+                pOverflow);
+
+            ec_gain_code_update(
+                &st->ec_gain_c_st,
+                bfi,
+                st->prev_bf,
+                &gain_code,
+                pOverflow);
+
+            pit_sharp = gain_pit;
+
+            if (pit_sharp > SHARPMAX)
+            {
+                pit_sharp = SHARPMAX;
+            }
+
+        }
+        else if ((mode <= MR74) || (mode == MR102))
+        {
+            /* read and decode pitch and code gain */
+            index = *parm++;                 /* index of gain(s) */
+
+            if (bfi == 0)
+            {
+                Dec_gain(
+                    &(st->pred_state),
+                    mode,
+                    index,
+                    code,
+                    evenSubfr,
+                    &gain_pit,
+                    &gain_code,
+                    &(st->common_amr_tbls),
+                    pOverflow);
+            }
+            else
+            {
+                ec_gain_pitch(
+                    &(st->ec_gain_p_st),
+                    st->state,
+                    &gain_pit,
+                    pOverflow);
+
+                ec_gain_code(
+                    &(st->ec_gain_c_st),
+                    &(st->pred_state),
+                    st->state,
+                    &gain_code,
+                    pOverflow);
+            }
+
+            ec_gain_pitch_update(
+                &(st->ec_gain_p_st),
+                bfi,
+                st->prev_bf,
+                &gain_pit,
+                pOverflow);
+
+            ec_gain_code_update(
+                &(st->ec_gain_c_st),
+                bfi,
+                st->prev_bf,
+                &gain_code,
+                pOverflow);
+
+            pit_sharp = gain_pit;
+
+            if (pit_sharp > SHARPMAX)
+            {
+                pit_sharp = SHARPMAX;
+            }
+
+            if (mode == MR102)
+            {
+                if (st->old_T0 > (L_SUBFR + 5))
+                {
+                    if (pit_sharp < 0)
+                    {
+                        pit_sharp = ~((~pit_sharp) >> 2);
+                    }
+                    else
+                    {
+                        pit_sharp = pit_sharp >> 2;
+                    }
+                }
+            }
+        }
+        else
+        {
+            /* read and decode pitch gain */
+            index = *parm++;                 /* index of gain(s) */
+
+            if (mode == MR795)
+            {
+                /* decode pitch gain */
+                if (bfi != 0)
+                {
+                    ec_gain_pitch(
+                        &(st->ec_gain_p_st),
+                        st->state,
+                        &gain_pit,
+                        pOverflow);
+                }
+                else
+                {
+                    gain_pit = d_gain_pitch(mode, index, st->common_amr_tbls.qua_gain_pitch_ptr);
+                }
+                ec_gain_pitch_update(
+                    &(st->ec_gain_p_st),
+                    bfi,
+                    st->prev_bf,
+                    &gain_pit,
+                    pOverflow);
+
+                /* read and decode code gain */
+                index = *parm++;
+
+                if (bfi == 0)
+                {
+                    d_gain_code(
+                        &(st->pred_state),
+                        mode,
+                        index,
+                        code,
+                        st->common_amr_tbls.qua_gain_code_ptr,
+                        &gain_code,
+                        pOverflow);
+                }
+                else
+                {
+                    ec_gain_code(
+                        &(st->ec_gain_c_st),
+                        &(st->pred_state),
+                        st->state,
+                        &gain_code,
+                        pOverflow);
+                }
+
+                ec_gain_code_update(
+                    &(st->ec_gain_c_st),
+                    bfi,
+                    st->prev_bf,
+                    &gain_code,
+                    pOverflow);
+
+                pit_sharp = gain_pit;
+
+                if (pit_sharp > SHARPMAX)
+                {
+                    pit_sharp = SHARPMAX;
+                }
+            }
+            else
+            { /* MR122 */
+
+                if (bfi == 0)
+                {
+                    d_gain_code(
+                        &(st->pred_state),
+                        mode,
+                        index,
+                        code,
+                        st->common_amr_tbls.qua_gain_code_ptr,
+                        &gain_code,
+                        pOverflow);
+                }
+                else
+                {
+                    ec_gain_code(
+                        &(st->ec_gain_c_st),
+                        &(st->pred_state),
+                        st->state,
+                        &gain_code,
+                        pOverflow);
+                }
+
+                ec_gain_code_update(
+                    &(st->ec_gain_c_st),
+                    bfi,
+                    st->prev_bf,
+                    &gain_code,
+                    pOverflow);
+
+                pit_sharp = gain_pit;
+            }
+        }
+
+        /* store pitch sharpening for next subframe             */
+        /* (for modes which use the previous pitch gain for     */
+        /* pitch sharpening in the search phase)                */
+        /* do not update sharpening in even subframes for MR475 */
+        if ((mode != MR475) || (evenSubfr == 0))
+        {
+            st->sharp = gain_pit;
+
+            if (st->sharp > SHARPMAX)
+            {
+                st->sharp = SHARPMAX;
+            }
+        }
+
+        pit_sharp = shl(pit_sharp, 1, pOverflow);
+
+        if (pit_sharp > 16384)
+        {
+            for (i = 0; i < L_SUBFR; i++)
+            {
+                temp = mult(st->exc[i], pit_sharp, pOverflow);
+                L_temp = L_mult(temp, gain_pit, pOverflow);
+
+                if (mode == MR122)
+                {
+                    if (L_temp < 0)
+                    {
+                        L_temp = ~((~L_temp) >> 1);
+                    }
+                    else
+                    {
+                        L_temp = L_temp >> 1;
+                    }
+                }
+                *(excp + i) = pv_round(L_temp, pOverflow);
+            }
+        }
+
+        /*-------------------------------------------------------*
+         * - Store list of LTP gains needed in the source        *
+         *   characteristic detector (SCD)                       *
+         *-------------------------------------------------------*/
+
+        if (bfi == 0)
+        {
+            for (i = 0; i < 8; i++)
+            {
+                st->ltpGainHistory[i] = st->ltpGainHistory[i+1];
+            }
+            st->ltpGainHistory[8] = gain_pit;
+        }
+
+        /*-------------------------------------------------------*
+        * - Limit gain_pit if in background noise and BFI       *
+        *   for MR475, MR515, MR59                              *
+        *-------------------------------------------------------*/
+
+
+        if ((st->prev_bf != 0 || bfi != 0) && st->inBackgroundNoise != 0 &&
+                ((mode == MR475) || (mode == MR515) || (mode == MR59)))
+        {
+
+            if (gain_pit > 12288)    /* if (gain_pit > 0.75) in Q14*/
+            {
+                gain_pit = ((gain_pit - 12288) >> 1) + 12288;
+                /* gain_pit = (gain_pit-0.75)/2.0 + 0.75; */
+            }
+
+            if (gain_pit > 14745)    /* if (gain_pit > 0.90) in Q14*/
+            {
+                gain_pit = 14745;
+            }
+        }
+
+        /*-------------------------------------------------------*
+         *  Calculate CB mixed gain                              *
+         *-------------------------------------------------------*/
+        Int_lsf(
+            prev_lsf,
+            st->lsfState.past_lsf_q,
+            i_subfr,
+            lsf_i,
+            pOverflow);
+
+        gain_code_mix =
+            Cb_gain_average(
+                &(st->Cb_gain_averState),
+                mode,
+                gain_code,
+                lsf_i,
+                st->lsp_avg_st.lsp_meanSave,
+                bfi,
+                st->prev_bf,
+                pdfi,
+                st->prev_pdf,
+                st->inBackgroundNoise,
+                st->voicedHangover,
+                pOverflow);
+
+        /* make sure that MR74, MR795, MR122 have original code_gain*/
+        if ((mode > MR67) && (mode != MR102))
+            /* MR74, MR795, MR122 */
+        {
+            gain_code_mix = gain_code;
+        }
+
+        /*-------------------------------------------------------*
+         * - Find the total excitation.                          *
+         * - Find synthesis speech corresponding to st->exc[].   *
+         *-------------------------------------------------------*/
+        if (mode <= MR102) /* MR475, MR515, MR59, MR67, MR74, MR795, MR102*/
+        {
+            pitch_fac = gain_pit;
+            tmp_shift = 1;
+        }
+        else       /* MR122 */
+        {
+            if (gain_pit < 0)
+            {
+                pitch_fac = ~((~gain_pit) >> 1);
+            }
+            else
+            {
+                pitch_fac = gain_pit >> 1;
+            }
+            tmp_shift = 2;
+        }
+
+        /* copy unscaled LTP excitation to exc_enhanced (used in phase
+         * dispersion below) and compute total excitation for LTP feedback
+         */
+        for (i = 0; i < L_SUBFR; i++)
+        {
+            exc_enhanced[i] = st->exc[i];
+
+            /* st->exc[i] = gain_pit*st->exc[i] + gain_code*code[i]; */
+            L_temp = L_mult(st->exc[i], pitch_fac, pOverflow);
+            /* 12.2: Q0 * Q13 */
+            /*  7.4: Q0 * Q14 */
+            L_temp = L_mac(L_temp, code[i], gain_code, pOverflow);
+            /* 12.2: Q12 * Q1 */
+            /*  7.4: Q13 * Q1 */
+            L_temp = L_shl(L_temp, tmp_shift, pOverflow);     /* Q16 */
+            st->exc[i] = pv_round(L_temp, pOverflow);
+        }
+
+        /*-------------------------------------------------------*
+         * - Adaptive phase dispersion                           *
+         *-------------------------------------------------------*/
+        ph_disp_release(&(st->ph_disp_st)); /* free phase dispersion adaption */
+
+
+        if (((mode == MR475) || (mode == MR515) || (mode == MR59)) &&
+                (st->voicedHangover > 3) && (st->inBackgroundNoise != 0) &&
+                (bfi != 0))
+        {
+            ph_disp_lock(&(st->ph_disp_st)); /* Always Use full Phase Disp. */
+        }                                 /* if error in bg noise       */
+
+        /* apply phase dispersion to innovation (if enabled) and
+           compute total excitation for synthesis part           */
+        ph_disp(
+            &(st->ph_disp_st),
+            mode,
+            exc_enhanced,
+            gain_code_mix,
+            gain_pit,
+            code,
+            pitch_fac,
+            tmp_shift,
+            &(st->common_amr_tbls),
+            pOverflow);
+
+        /*-------------------------------------------------------*
+         * - The Excitation control module are active during BFI.*
+         * - Conceal drops in signal energy if in bg noise.      *
+         *-------------------------------------------------------*/
+        L_temp = 0;
+        for (i = 0; i < L_SUBFR; i++)
+        {
+            L_temp = L_mac(L_temp, *(exc_enhanced + i), *(exc_enhanced + i), pOverflow);
+        }
+
+        /* excEnergy = sqrt(L_temp) in Q0 */
+        if (L_temp < 0)
+        {
+            L_temp = ~((~L_temp) >> 1);
+        }
+        else
+        {
+            L_temp = L_temp >> 1;
+        }
+
+        L_temp = sqrt_l_exp(L_temp, &temp, pOverflow);
+        /* To cope with 16-bit and scaling in ex_ctrl() */
+        L_temp = L_shr(L_temp, (Word16)((temp >> 1) + 15), pOverflow);
+        if (L_temp < 0)
+        {
+            excEnergy = (Word16)(~((~L_temp) >> 2));
+        }
+        else
+        {
+            excEnergy = (Word16)(L_temp >> 2);
+        }
+
+        if (((mode == MR475) || (mode == MR515) || (mode == MR59))  &&
+                (st->voicedHangover > 5) && (st->inBackgroundNoise != 0) &&
+                (st->state < 4) &&
+                ((pdfi != 0 && st->prev_pdf != 0) || bfi != 0 || st->prev_bf != 0))
+        {
+            carefulFlag = 0;
+
+            if (pdfi != 0 && bfi == 0)
+            {
+                carefulFlag = 1;
+            }
+
+            Ex_ctrl(exc_enhanced,
+                    excEnergy,
+                    st->excEnergyHist,
+                    st->voicedHangover,
+                    st->prev_bf,
+                    carefulFlag, pOverflow);
+        }
+
+        if (!((st->inBackgroundNoise != 0) && (bfi != 0 || st->prev_bf != 0) &&
+                (st->state < 4)))
+        {
+            /* Update energy history for all modes */
+            for (i = 0; i < 8; i++)
+            {
+                st->excEnergyHist[i] = st->excEnergyHist[i+1];
+            }
+            st->excEnergyHist[8] = excEnergy;
+        }
+        /*-------------------------------------------------------*
+         * Excitation control module end.                        *
+         *-------------------------------------------------------*/
+        if (pit_sharp > 16384)
+        {
+            for (i = 0; i < L_SUBFR; i++)
+            {
+                *(excp + i) = add_16(*(excp + i), *(exc_enhanced + i), pOverflow);
+
+            }
+            agc2(exc_enhanced, excp, L_SUBFR, pOverflow);
+            *pOverflow = 0;
+            Syn_filt(Az, excp, &synth[i_subfr], L_SUBFR,
+                     st->mem_syn, 0);
+        }
+        else
+        {
+            *pOverflow = 0;
+            Syn_filt(Az, exc_enhanced, &synth[i_subfr], L_SUBFR,
+                     st->mem_syn, 0);
+        }
+
+        if (*pOverflow != 0)    /* Test for overflow */
+        {
+            for (i = PIT_MAX + L_INTERPOL + L_SUBFR - 1; i >= 0; i--)
+            {
+                if (st->old_exc[i] < 0)
+                {
+                    st->old_exc[i] = ~((~st->old_exc[i]) >> 2);
+                }
+                else
+                {
+                    st->old_exc[i] = st->old_exc[i] >> 2;
+                }
+
+            }
+
+            for (i = L_SUBFR - 1; i >= 0; i--)
+            {
+                if (*(exc_enhanced + i) < 0)
+                {
+                    *(exc_enhanced + i) = ~((~(*(exc_enhanced + i))) >> 2);
+                }
+                else
+                {
+                    *(exc_enhanced + i) = *(exc_enhanced + i) >> 2;
+                }
+            }
+            Syn_filt(Az, exc_enhanced, &synth[i_subfr], L_SUBFR, st->mem_syn, 1);
+        }
+        else
+        {
+            oscl_memmove((void *)st->mem_syn, &synth[i_subfr+L_SUBFR-M], M*sizeof(synth[0]));
+        }
+
+        /*--------------------------------------------------*
+         * Update signal for next frame.                    *
+         * -> shift to the left by L_SUBFR  st->exc[]       *
+         *--------------------------------------------------*/
+
+        oscl_memmove((void *)&st->old_exc[0], &st->old_exc[L_SUBFR], (PIT_MAX + L_INTERPOL)*sizeof(st->old_exc[0]));
+
+        /* interpolated LPC parameters for next subframe */
+        Az += MP1;
+
+        /* store T0 for next subframe */
+        st->old_T0 = T0;
+    }
+
+    /*-------------------------------------------------------*
+     * Call the Source Characteristic Detector which updates *
+     * st->inBackgroundNoise and st->voicedHangover.         *
+     *-------------------------------------------------------*/
+
+    st->inBackgroundNoise =
+        Bgn_scd(
+            &(st->background_state),
+            &(st->ltpGainHistory[0]),
+            &(synth[0]),
+            &(st->voicedHangover),
+            pOverflow);
+
+    dtx_dec_activity_update(
+        &(st->dtxDecoderState),
+        st->lsfState.past_lsf_q,
+        synth,
+        pOverflow);
+
+    /* store bfi for next subframe */
+    st->prev_bf = bfi;
+    st->prev_pdf = pdfi;
+
+    /*--------------------------------------------------*
+     * Calculate the LSF averages on the eight          *
+     * previous frames                                  *
+     *--------------------------------------------------*/
+    lsp_avg(
+        &(st->lsp_avg_st),
+        st->lsfState.past_lsf_q,
+        pOverflow);
+
+the_end:
+    st->dtxDecoderState.dtxGlobalState = newDTXState;
+
+//    return(0);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.h
new file mode 100644 (file)
index 0000000..3066ff7
--- /dev/null
@@ -0,0 +1,202 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_amr.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+     File             : dec_amr.h
+     Purpose          : Speech decoder routine.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef DEC_AMR_H
+#define DEC_AMR_H "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "mode.h"
+#include "dtx_dec.h"
+#include "d_plsf.h"
+#include "gc_pred.h"
+#include "ec_gains.h"
+#include "ph_disp.h"
+#include "c_g_aver.h"
+#include "bgnscd.h"
+#include "lsp_avg.h"
+#include "frame.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define EXC_ENERGY_HIST_LEN  9
+#define LTP_GAIN_HISTORY_LEN 9
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        /* Excitation vector */
+        Word16 old_exc[L_SUBFR + PIT_MAX + L_INTERPOL];
+        Word16 *exc;
+
+        /* Lsp (Line spectral pairs) */
+        /* Word16 lsp[M]; */      /* Used by CN codec */
+        Word16 lsp_old[M];
+
+        /* Filter's memory */
+        Word16 mem_syn[M];
+
+        /* pitch sharpening */
+        Word16 sharp;
+        Word16 old_T0;
+
+        /* Memories for bad frame handling */
+        Word16 prev_bf;
+        Word16 prev_pdf;
+        Word16 state;
+        Word16 excEnergyHist[EXC_ENERGY_HIST_LEN];
+
+        /* Variable holding received ltpLag, used in background noise and BFI */
+        Word16 T0_lagBuff;
+
+        /* Variables for the source characteristic detector (SCD) */
+        Word16 inBackgroundNoise;
+        Word16 voicedHangover;
+        Word16 ltpGainHistory[LTP_GAIN_HISTORY_LEN];
+
+        Bgn_scdState background_state;
+        Word16 nodataSeed;
+
+        Cb_gain_averageState Cb_gain_averState;
+        lsp_avgState lsp_avg_st;
+
+        D_plsfState lsfState;
+        ec_gain_pitchState ec_gain_p_st;
+        ec_gain_codeState ec_gain_c_st;
+        gc_predState pred_state;
+        ph_dispState ph_disp_st;
+        dtx_decState dtxDecoderState;
+        Flag overflow;
+        CommonAmrTbls common_amr_tbls;
+    } Decoder_amrState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    /*
+     *  Function    : Decoder_amr_init
+     *  Purpose     : Allocates initializes state memory
+     *  Description : Stores pointer to filter status struct in *st. This
+     *                pointer has to be passed to Decoder_amr in each call.
+     *  Returns     : 0 on success
+     */
+    Word16 Decoder_amr_init(Decoder_amrState *st);
+
+    /*
+     *  Function    : Decoder_amr_reset
+     *  Purpose     : Resets state memory
+     *  Returns     : 0 on success
+     */
+    Word16 Decoder_amr_reset(Decoder_amrState *st, enum Mode mode);
+
+    /*
+     *  Function    : Decoder_amr_exit
+     *  Purpose     : The memory used for state memory is freed
+     *  Description : Stores NULL in *s
+     *  Returns     : void
+     */
+    void Decoder_amr_exit(Decoder_amrState **st);
+
+    /*
+     *  Function    : Decoder_amr
+     *  Purpose     : Speech decoder routine.
+     *  Returns     : 0
+     */
+    void Decoder_amr(
+        Decoder_amrState *st,  /* i/o : State variables                       */
+        enum Mode mode,        /* i   : AMR mode                              */
+        Word16 parm[],         /* i   : vector of synthesis parameters
+                                    (PRM_SIZE)                            */
+        enum RXFrameType frame_type, /* i   : received frame type               */
+        Word16 synth[],        /* o   : synthesis speech (L_FRAME)            */
+        Word16 A_t[]           /* o   : decoded LP filter in 4 subframes
+                                    (AZ_SIZE)                             */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEC_AMR_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.cpp
new file mode 100644 (file)
index 0000000..7fd54c1
--- /dev/null
@@ -0,0 +1,265 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_gain.cpp
+ Functions: dec_gain
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "dec_gain.h"
+#include "typedef.h"
+#include "mode.h"
+#include "cnst.h"
+#include "pow2.h"
+#include "log2.h"
+#include "gc_pred.h"
+#include "basic_op.h"
+#include "qua_gain_tbl.h"
+#include "qgain475_tab.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dec_gain
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pred_state = pointer to MA predictor state of type gc_predState
+    index = AMR mode of type enum Mode
+    code[] = pointer to innovative vector of type Word16
+    evenSubfr = Flag for even subframes of type Word16
+    pOverflow = pointer to overflow flag
+
+
+ Outputs:
+    pred_state = pointer to MA predictor state of type gc_predState
+    gain_pit = pointer to pitch gain of type Word16
+    gain_cod = pointer to code gain of type Word16
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+      File             : dec_gain.c
+      Purpose          : Decode the pitch and codebook gains
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ agc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+
+
+
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+
+void Dec_gain(
+    gc_predState *pred_state, /* i/o: MA predictor state           */
+    enum Mode mode,           /* i  : AMR mode                     */
+    Word16 index,             /* i  : index of quantization.       */
+    Word16 code[],            /* i  : Innovative vector.           */
+    Word16 evenSubfr,         /* i  : Flag for even subframes      */
+    Word16 * gain_pit,        /* o  : Pitch gain.                  */
+    Word16 * gain_cod,        /* o  : Code gain.                   */
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of tbls ptrs */
+    Flag   * pOverflow
+)
+{
+    const Word16 *p;
+    Word16 frac;
+    Word16 gcode0;
+    Word16 exp;
+    Word16 qua_ener;
+    Word16 qua_ener_MR122;
+    Word16 g_code;
+    Word32 L_tmp;
+    Word16 temp1;
+    Word16 temp2;
+
+    /* Read the quantized gains (table depends on mode) */
+    index = shl(index, 2, pOverflow);
+
+    if (mode == MR102 || mode == MR74 || mode == MR67)
+    {
+        p = &(common_amr_tbls->table_gain_highrates_ptr[index]);
+
+        *gain_pit = *p++;
+        g_code = *p++;
+        qua_ener_MR122 = *p++;
+        qua_ener = *p;
+    }
+    else
+    {
+        if (mode == MR475)
+        {
+            index += (1 ^ evenSubfr) << 1; /* evenSubfr is 0 or 1 */
+
+            if (index > (MR475_VQ_SIZE*4 - 2))
+            {
+                index = (MR475_VQ_SIZE * 4 - 2); /* avoid possible buffer overflow */
+            }
+
+            p = &table_gain_MR475[index];
+
+            *gain_pit = *p++;
+            g_code = *p++;
+
+            /*---------------------------------------------------------*
+             *  calculate predictor update values (not stored in 4.75  *
+             *  quantizer table to save space):                        *
+             *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  *
+             *                                                         *
+             *   qua_ener       = log2(g)                              *
+             *   qua_ener_MR122 = 20*log10(g)                          *
+             *---------------------------------------------------------*/
+
+            /* Log2(x Q12) = log2(x) + 12 */
+            temp1 = g_code;
+            Log2(temp1, &exp, &frac, pOverflow);
+            exp -= 12;
+
+            temp1 = shr_r(frac, 5, pOverflow);
+            temp2 = shl(exp, 10, pOverflow);
+            qua_ener_MR122 = add_16(temp1, temp2, pOverflow);
+
+            /* 24660 Q12 ~= 6.0206 = 20*log10(2) */
+            L_tmp = Mpy_32_16(exp, frac, 24660, pOverflow);
+            L_tmp = L_shl(L_tmp, 13, pOverflow);
+            qua_ener = pv_round(L_tmp, pOverflow);
+            /* Q12 * Q0 = Q13 -> Q10 */
+        }
+        else
+        {
+            p = &(common_amr_tbls->table_gain_lowrates_ptr[index]);
+
+            *gain_pit = *p++;
+            g_code = *p++;
+            qua_ener_MR122 = *p++;
+            qua_ener = *p;
+        }
+    }
+
+    /*-------------------------------------------------------------------*
+     *  predict codebook gain                                            *
+     *  ~~~~~~~~~~~~~~~~~~~~~                                            *
+     *  gc0     = Pow2(int(d)+frac(d))                                   *
+     *          = 2^exp + 2^frac                                         *
+     *                                                                   *
+     *  gcode0 (Q14) = 2^14*2^frac = gc0 * 2^(14-exp)                    *
+     *-------------------------------------------------------------------*/
+
+    gc_pred(pred_state, mode, code, &exp, &frac, NULL, NULL, pOverflow);
+
+    gcode0 = (Word16) Pow2(14, frac, pOverflow);
+
+    /*------------------------------------------------------------------*
+     *  read quantized gains, update table of past quantized energies   *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   *
+     *  st->past_qua_en(Q10) = 20 * Log10(g_fac) / constant             *
+     *                       = Log2(g_fac)                              *
+     *                       = qua_ener                                 *
+     *                                           constant = 20*Log10(2) *
+     *------------------------------------------------------------------*/
+
+    L_tmp = L_mult(g_code, gcode0, pOverflow);
+    temp1 = 10 - exp;
+    L_tmp = L_shr(L_tmp, temp1, pOverflow);
+    *gain_cod = (Word16)(L_tmp >> 16);
+
+    /* update table of past quantized energies */
+
+    gc_pred_update(pred_state, qua_ener_MR122, qua_ener);
+
+    return;
+}
+
+
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.h
new file mode 100644 (file)
index 0000000..ceb6bba
--- /dev/null
@@ -0,0 +1,120 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_gain.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : dec_gain.h
+      Purpose          : Decode the pitch and codebook gains
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _DEC_GAIN_H_
+#define _DEC_GAIN_H_
+#define dec_gain_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "gc_pred.h"
+#include "mode.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*
+     *   FUNCTION:  Dec_gain()
+     *   PURPOSE: Decode the pitch and codebook gains
+     */
+    void Dec_gain(
+        gc_predState *pred_state, /* i/o: MA predictor state           */
+        enum Mode mode,           /* i  : AMR mode                     */
+        Word16 index,             /* i  : index of quantization.       */
+        Word16 code[],            /* i  : Innovative vector.           */
+        Word16 evenSubfr,         /* i  : Flag for even subframes      */
+        Word16 * gain_pit,        /* o  : Pitch gain.                  */
+        Word16 * gain_cod,        /* o  : Code gain.                   */
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of tbls ptrs */
+        Flag   * pOverflow
+    );
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _DEC_GAIN_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_input_format_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_input_format_tab.cpp
new file mode 100644 (file)
index 0000000..867df28
--- /dev/null
@@ -0,0 +1,190 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+ Filename: dec_input_format_tab.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This file contains the tables of the number of data bytes per codec mode in
+ both WMF and IF2 input formats.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] AMR Speech Codec Frame Structure, 3GPP TS 26.101 version 4.1.0 Release 4,
+     June 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "amrdecode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+    /* Table containing the number of core AMR data bytes for                */
+    /* each codec mode for WMF input format(number excludes frame type byte) */
+    const Word16 WmfDecBytesPerFrame[16] =
+    {
+        12, /* 4.75 */
+        13, /* 5.15 */
+        15, /* 5.90 */
+        17, /* 6.70 */
+        19, /* 7.40 */
+        20, /* 7.95 */
+        26, /* 10.2 */
+        31, /* 12.2 */
+        5, /* GsmAmr comfort noise */
+        6, /* Gsm-Efr comfort noise */
+        5, /* IS-641 comfort noise */
+        5, /* Pdc-Efr comfort noise */
+        0, /* future use */
+        0, /* future use */
+        0, /* future use */
+        0 /* No transmission */
+    };
+
+    /* Table containing the number of core AMR data bytes for   */
+    /* each codec mode for IF2 input format.                    */
+    const Word16 If2DecBytesPerFrame[16] =
+    {
+        13, /* 4.75 */
+        14, /* 5.15 */
+        16, /* 5.90 */
+        18, /* 6.70 */
+        19, /* 7.40 */
+        21, /* 7.95 */
+        26, /* 10.2 */
+        31, /* 12.2 */
+        6, /* GsmAmr comfort noise */
+        6, /* Gsm-Efr comfort noise */
+        6, /* IS-641 comfort noise */
+        6, /* Pdc-Efr comfort noise */
+        0, /* future use */
+        0, /* future use */
+        0, /* future use */
+        1 /* No transmission */
+    };
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL FUNCTION REFERENCES
+    ; Declare functions defined elsewhere and referenced in this module
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; Define all local variables
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Function body here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Return nothing or data or data pointer
+----------------------------------------------------------------------------*/
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.cpp
new file mode 100644 (file)
index 0000000..07d58ad
--- /dev/null
@@ -0,0 +1,284 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_lag3.cpp
+ Functions: Dec_lag3
+
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    index   -- Word16 -- received pitch index
+    t0_min  -- Word16 -- minimum of search range
+    t0_max  -- Word16 -- maximum of search range
+    i_subfr -- Word16 -- subframe flag
+    T0_prev -- Word16 -- integer pitch delay of last subframe
+                         used in 2nd and 4th subframes
+    flag4   -- Word16 -- flag for encoding with 4 bits
+
+ Outputs:
+
+    T0 -- Pointer to type Word16 -- integer part of pitch lag
+    T0_frac -- Pointer to type Word16 -- fractional part of pitch lag
+    pOverflow -- Pointer to type Flag -- Flag set when overflow occurs
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+
+              )
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE:  Decoding of fractional pitch lag with 1/3 resolution.
+           Extract the integer and fraction parts of the pitch lag from
+           the received adaptive codebook index.
+
+  See "Enc_lag3.c" for more details about the encoding procedure.
+
+  The fractional lag in 1st and 3rd subframes is encoded with 8 bits
+  while that in 2nd and 4th subframes is relatively encoded with 4, 5
+  and 6 bits depending on the mode.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dec_lag3.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "dec_lag3.h"
+#include "typedef.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void Dec_lag3(Word16 index,     /* i : received pitch index                 */
+              Word16 t0_min,    /* i : minimum of search range              */
+              Word16 t0_max,    /* i : maximum of search range              */
+              Word16 i_subfr,   /* i : subframe flag                        */
+              Word16 T0_prev,   /* i : integer pitch delay of last subframe
+                                       used in 2nd and 4th subframes        */
+              Word16 * T0,      /* o : integer part of pitch lag            */
+              Word16 * T0_frac, /* o : fractional part of pitch lag         */
+              Word16 flag4,     /* i : flag for encoding with 4 bits        */
+              Flag  *pOverflow  /* o : Flag set when overflow occurs        */
+             )
+{
+    Word16 i;
+    Word16 tmp_lag;
+
+    if (i_subfr == 0)    /* if 1st or 3rd subframe */
+    {
+
+        if (index < 197)
+        {
+
+            tmp_lag = index + 2;
+
+            tmp_lag =
+                mult(
+                    tmp_lag,
+                    10923,
+                    pOverflow);
+
+            i = tmp_lag + 19;
+
+            *T0 = i;
+
+            /* i = 3 * (*T0) */
+
+            i <<=  1;
+            i += *T0;
+
+            tmp_lag = index - i;
+
+            *T0_frac = tmp_lag + 58;
+        }
+        else
+        {
+            *T0 = index - 112;
+
+            *T0_frac = 0;
+        }
+
+    }
+    else
+    {  /* 2nd or 4th subframe */
+
+        if (flag4 == 0)
+        {
+
+            /* 'normal' decoding: either with 5 or 6 bit resolution */
+
+            i = index + 2;
+
+            i = ((Word32) i * 10923) >> 15;
+
+
+            i -= 1;
+
+            *T0 = i + t0_min;
+
+            /* i = 3* (*T0) */
+            i = i + (i << 1);
+
+            tmp_lag = index - 2;
+
+            *T0_frac = tmp_lag - i;
+        }
+        else
+        {
+
+            /* decoding with 4 bit resolution */
+
+            tmp_lag = T0_prev;
+
+            i =
+                sub(
+                    tmp_lag,
+                    t0_min,
+                    pOverflow);
+
+            if (i > 5)
+            {
+                tmp_lag = t0_min + 5;
+            }
+
+            i = t0_max - tmp_lag;
+
+            if (i > 4)
+            {
+                tmp_lag = t0_max - 4;
+            }
+
+            if (index < 4)
+            {
+                i = tmp_lag - 5;
+
+                *T0 = i + index;
+
+                *T0_frac = 0;
+            }
+            else
+            {
+                /* 4 >= index < 12 */
+                if (index < 12)
+                {
+                    i = index - 5;
+                    i = ((Word32) i * 10923) >> 15;
+
+
+                    i--;
+
+                    *T0 =  i + tmp_lag;
+
+                    i = i + (i << 1);
+
+                    tmp_lag = index - 9;
+
+                    *T0_frac = tmp_lag - i;
+                }
+                else
+                {
+                    i = index - 12;
+
+                    i = i + tmp_lag;
+
+                    *T0 = i + 1;
+
+                    *T0_frac = 0;
+                }
+            }
+
+        } /* end if (decoding with 4 bit resolution) */
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.h
new file mode 100644 (file)
index 0000000..c90e459
--- /dev/null
@@ -0,0 +1,115 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_lag3.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the dec_lag3.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef dec_lag3_h
+#define dec_lag3_h "$Id $"
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void Dec_lag3(Word16 index,     /* i : received pitch index                 */
+    Word16 T0_min,    /* i : minimum of search range              */
+    Word16 T0_max,    /* i : maximum of search range              */
+    Word16 i_subfr,   /* i : subframe flag                        */
+    Word16 T0_prev,   /* i : integer pitch delay of last subframe
+                                       used in 2nd and 4th subframes        */
+    Word16 * T0,      /* o : integer part of pitch lag            */
+    Word16 * T0_frac, /* o : fractional part of pitch lag         */
+    Word16 flag4,     /* i : flag for encoding with 4 bits        */
+    Flag   * pOverflow  /* o : Flag set when overflow occurs      */
+                 );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DEC_LAG_3_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.cpp
new file mode 100644 (file)
index 0000000..8d580ad
--- /dev/null
@@ -0,0 +1,229 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_lag6.cpp
+ Functions: Dec_lag6
+
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    index   -- Word16 -- received pitch index
+    pit_min  -- Word16 -- minimum pitch lag
+    pit_max  -- Word16 -- maximum pitch lag
+    i_subfr -- Word16 -- subframe flag
+    T0 -- Pointer to type Word16 -- integer part of pitch lag
+
+ Outputs:
+
+    T0 -- Pointer to type Word16 -- integer part of pitch lag
+    T0_frac -- Pointer to type Word16 -- fractional part of pitch lag
+    pOverflow -- Pointer to type Flag -- Flag set when overflow occurs
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE:  Decoding of fractional pitch lag with 1/6 resolution.
+           Extract the integer and fraction parts of the pitch lag from
+           the received adaptive codebook index.
+
+  See "Enc_lag6.c" for more details about the encoding procedure.
+
+  The fractional lag in 1st and 3rd subframes is encoded with 9 bits
+  while that in 2nd and 4th subframes is relatively encoded with 6 bits.
+  Note that in relative encoding only 61 values are used. If the
+  decoder receives 61, 62, or 63 as the relative pitch index, it means
+  that a transmission error occurred. In this case, the pitch lag from
+  previous subframe (actually from previous frame) is used.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dec_lag6.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "dec_lag6.h"
+#include "typedef.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void Dec_lag6(
+    Word16 index,      /* input : received pitch index           */
+    Word16 pit_min,    /* input : minimum pitch lag              */
+    Word16 pit_max,    /* input : maximum pitch lag              */
+    Word16 i_subfr,    /* input : subframe flag                  */
+    Word16 *T0,        /* in/out: integer part of pitch lag      */
+    Word16 *T0_frac,   /* output: fractional part of pitch lag   */
+    Flag   *pOverflow  /* o : Flag set when overflow occurs      */
+)
+{
+    Word16 i;
+    Word16 T0_min;
+    Word16 T0_max;
+    Word16 k;
+
+    if (i_subfr == 0)          /* if 1st or 3rd subframe */
+    {
+        if (index < 463)
+        {
+            /* T0 = (index+5)/6 + 17 */
+            i = index + 5;
+            i = ((Word32) i * 5462) >> 15;
+
+
+            i += 17;
+
+            *T0 = i;
+
+            /* i = 3* (*T0) */
+
+            i <<= 1;
+            i += *T0;
+
+            /* *T0_frac = index - T0*6 + 105 */
+
+            i <<= 1;
+
+            i = index - i;
+
+            *T0_frac = i + 105;
+        }
+        else
+        {
+            *T0 = index - 368;
+
+            *T0_frac = 0;
+        }
+    }
+    else       /* second or fourth subframe */
+    {
+        /* find T0_min and T0_max for 2nd (or 4th) subframe */
+
+        T0_min = *T0 - 5;
+
+        if (T0_min < pit_min)
+        {
+            T0_min = pit_min;
+        }
+
+        T0_max = T0_min + 9;
+
+        if (T0_max > pit_max)
+        {
+            T0_max = pit_max;
+
+            T0_min = T0_max - 9;
+        }
+
+        /* i = (index+5)/6 - 1 */
+        i = index + 5;
+
+        i = ((Word32) i * 5462) >> 15;
+
+
+        i -= 1;
+
+        *T0 = i + T0_min;
+
+        /* i = 3* (*T0) */
+
+        i = i + (i << 1);
+
+        i <<= 1;
+
+        k = index - 3;
+
+        *T0_frac = k - i;
+    }
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.h
new file mode 100644 (file)
index 0000000..5b0073d
--- /dev/null
@@ -0,0 +1,113 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_lag6.h
+
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the dec_lag6.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef dec_lag6_h
+#define dec_lag6_h "$Id $"
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void Dec_lag6(
+        Word16 index,      /* input : received pitch index           */
+        Word16 pit_min,    /* input : minimum pitch lag              */
+        Word16 pit_max,    /* input : maximum pitch lag              */
+        Word16 i_subfr,    /* input : subframe flag                  */
+        Word16 *T0,        /* in/out: integer part of pitch lag      */
+        Word16 *T0_frac,   /* output: fractional part of pitch lag   */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs     */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DEC_LAG_6_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/decoder_gsm_amr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/decoder_gsm_amr.cpp
new file mode 100644 (file)
index 0000000..90a9832
--- /dev/null
@@ -0,0 +1,262 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+#include "decoder_gsm_amr.h"
+#include "sp_dec.h"
+#include "amrdecode.h"
+#include "pvamrnbdecoder_api.h"
+
+// Use default DLL entry point
+#include "oscl_dll.h"
+#include "oscl_error_codes.h"
+#include "oscl_exception.h"
+#include "oscl_mem.h"
+
+#define KCAI_CODEC_INIT_FAILURE -1
+
+OSCL_DLL_ENTRY_POINT_DEFAULT()
+
+OSCL_EXPORT_REF CDecoder_AMR_NB *CDecoder_AMR_NB::NewL()
+{
+    CDecoder_AMR_NB *dec = new CDecoder_AMR_NB;
+    if (dec == NULL)
+        OSCL_LEAVE(OsclErrNoMemory);
+    else
+        dec->ConstructL();
+    return dec;
+}
+
+OSCL_EXPORT_REF void CDecoder_AMR_NB::ConstructL()
+{
+    iDecState = NULL;
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_NB
+
+    ~CDecoder_AMR_NB
+
+    Empty decoder destructor.
+
+    Parameters:     none
+
+    Return Values:  none
+
+-----------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF CDecoder_AMR_NB::~CDecoder_AMR_NB()
+{
+    if (iDecState)
+        oscl_free(iDecState);
+    iDecState = NULL;
+
+    if (iInputBuf)
+    {
+        OSCL_ARRAY_DELETE(iInputBuf);
+        iInputBuf = NULL;
+    }
+
+    if (iOutputBuf)
+    {
+        OSCL_ARRAY_DELETE(iOutputBuf);
+        iOutputBuf = NULL;
+    }
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_NB
+
+    StartL
+
+    Start decoder object. Initialize codec status.
+
+    Parameters:     none
+
+    Return Values:  status
+
+-----------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF int32 CDecoder_AMR_NB::StartL(tPVAmrDecoderExternal * pExt,
+        bool aAllocateInputBuffer,
+        bool aAllocateOutputBuffer)
+{
+
+    if (aAllocateInputBuffer)
+    {
+        iInputBuf = OSCL_ARRAY_NEW(int16, MAX_NUM_PACKED_INPUT_BYTES);
+        if (iInputBuf == NULL)
+        {
+            return KCAI_CODEC_INIT_FAILURE;
+        }
+    }
+    else
+    {
+        iInputBuf = NULL;
+    }
+    pExt->pInputBuffer = (uint8 *)iInputBuf;
+
+    if (aAllocateOutputBuffer)
+    {
+        iOutputBuf = OSCL_ARRAY_NEW(int16, L_FRAME);
+
+        if (iOutputBuf == NULL)
+        {
+            return KCAI_CODEC_INIT_FAILURE;
+        }
+    }
+    else
+    {
+        iOutputBuf = NULL;
+    }
+    pExt->pOutputBuffer = iOutputBuf;
+
+    pExt->samplingRate = 8000;
+    pExt->desiredChannels = 1;
+
+    pExt->reset_flag = 0;
+    pExt->reset_flag_old = 1;
+    pExt->mode_old = 0;
+
+    return GSMInitDecode(&iDecState, (int8*)"Decoder");
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_NB
+
+    ExecuteL
+
+    Execute decoder object. Read one encoded speech frame from the input
+    stream,  decode it and write the decoded frame to output stream.
+
+    Parameters:
+
+    Return Values:  status
+
+
+-----------------------------------------------------------------------------
+*/
+
+OSCL_EXPORT_REF int32 CDecoder_AMR_NB::ExecuteL(tPVAmrDecoderExternal * pExt)
+{
+
+
+    if (pExt->input_format == WMF)
+        pExt->input_format = MIME_IETF;
+
+    return AMRDecode(iDecState,
+                     (enum Frame_Type_3GPP)pExt->mode,
+                     (uint8*) pExt->pInputBuffer,
+                     (int16*) pExt->pOutputBuffer,
+                     pExt->input_format);
+
+}
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_NB
+
+    StopL
+
+    Stop decoder object. Flush out last frames, if necessary.
+
+    Parameters:     none
+
+    Return Values:  none
+
+-----------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF void CDecoder_AMR_NB::StopL()
+{
+}
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_NB
+
+    ResetDecoderL
+
+    Stop decoder object. Reset decoder.
+
+    Parameters:     none
+
+    Return Values:  status
+
+-----------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF int32 CDecoder_AMR_NB::ResetDecoderL()
+{
+    return Speech_Decode_Frame_reset(iDecState);
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_NB
+
+    TerminateDecoderL
+
+    Stop decoder object. close decoder.
+
+    Parameters:     none
+
+    Return Values:  none
+
+-----------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF void CDecoder_AMR_NB::TerminateDecoderL()
+{
+    GSMDecodeFrameExit(&iDecState);
+    iDecState = NULL;
+
+    if (iInputBuf)
+    {
+        OSCL_ARRAY_DELETE(iInputBuf);
+        iInputBuf = NULL;
+    }
+
+    if (iOutputBuf)
+    {
+        OSCL_ARRAY_DELETE(iOutputBuf);
+        iOutputBuf = NULL;
+    }
+}
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.cpp
new file mode 100644 (file)
index 0000000..665a6ec
--- /dev/null
@@ -0,0 +1,1895 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dtx_dec.cpp
+ Functions:
+           dtx_dec_reset
+           dtx_dec
+           dtx_dec_activity_update
+           rx_dtx_handler
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ These modules decode the comfort noise when in DTX.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "dtx_dec.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "set_zero.h"
+#include "mode.h"
+#include "log2.h"
+#include "lsp_az.h"
+#include "pow2.h"
+#include "a_refl.h"
+#include "b_cn_cod.h"
+#include "syn_filt.h"
+#include "lsp_lsf.h"
+#include "reorder.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define PN_INITIAL_SEED 0x70816958L   /* Pseudo noise generator seed value  */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/***************************************************
+ * Scaling factors for the lsp variability operation *
+ ***************************************************/
+static const Word16 lsf_hist_mean_scale[M] =
+{
+    20000,
+    20000,
+    20000,
+    20000,
+    20000,
+    18000,
+    16384,
+    8192,
+    0,
+    0
+};
+
+/*************************************************
+ * level adjustment for different modes Q11      *
+ *************************************************/
+static const Word16 dtx_log_en_adjust[9] =
+{
+    -1023, /* MR475 */
+    -878, /* MR515 */
+    -732, /* MR59  */
+    -586, /* MR67  */
+    -440, /* MR74  */
+    -294, /* MR795 */
+    -148, /* MR102 */
+    0, /* MR122 */
+    0, /* MRDTX */
+};
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dtx_dec_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type dtx_decState
+
+ Outputs:
+    Structure pointed to by st is initialized to a set of initial values.
+
+ Returns:
+    return_value = 0 if memory was successfully initialized,
+        otherwise returns -1 (int)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Reset of state memory for dtx_dec.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dtx_dec.c, UMTS GSM AMR speech codec, R99 - Version 3.3.0, December 12, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int dtx_dec_reset (dtx_decState *st)
+{
+   int i;
+
+   if (st == (dtx_decState *) NULL){
+      fprintf(stderr, "dtx_dec_reset: invalid parameter\n");
+      return -1;
+   }
+
+   st->since_last_sid = 0;
+   st->true_sid_period_inv = (1 << 13);
+
+   st->log_en = 3500;
+   st->old_log_en = 3500;
+   // low level noise for better performance in  DTX handover cases
+
+   st->L_pn_seed_rx = PN_INITIAL_SEED;
+
+   // Initialize state->lsp [] and state->lsp_old []
+   Copy(lsp_init_data, &st->lsp[0], M);
+   Copy(lsp_init_data, &st->lsp_old[0], M);
+
+   st->lsf_hist_ptr = 0;
+   st->log_pg_mean = 0;
+   st->log_en_hist_ptr = 0;
+
+   // initialize decoder lsf history
+   Copy(mean_lsf, &st->lsf_hist[0], M);
+
+   for (i = 1; i < DTX_HIST_SIZE; i++)
+   {
+      Copy(&st->lsf_hist[0], &st->lsf_hist[M*i], M);
+   }
+   Set_zero(st->lsf_hist_mean, M*DTX_HIST_SIZE);
+
+   // initialize decoder log frame energy
+   for (i = 0; i < DTX_HIST_SIZE; i++)
+   {
+      st->log_en_hist[i] = st->log_en;
+   }
+
+   st->log_en_adjust = 0;
+
+   st->dtxHangoverCount = DTX_HANG_CONST;
+   st->decAnaElapsedCount = 32767;
+
+   st->sid_frame = 0;
+   st->valid_data = 0;
+   st->dtxHangoverAdded = 0;
+
+   st->dtxGlobalState = DTX;
+   st->data_updated = 0;
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 dtx_dec_reset(dtx_decState *st)
+{
+    Word16 i;
+
+    if (st == (dtx_decState *) NULL)
+    {
+        /* fprint(stderr, "dtx_dec_reset: invalid parameter\n");  */
+        return(-1);
+    }
+
+    st->since_last_sid = 0;
+    st->true_sid_period_inv = (1 << 13);
+
+    st->log_en = 3500;
+    st->old_log_en = 3500;
+    /* low level noise for better performance in  DTX handover cases*/
+
+    st->L_pn_seed_rx = PN_INITIAL_SEED;
+
+    /* Initialize state->lsp [] */
+    st->lsp[0] = 30000;
+    st->lsp[1] = 26000;
+    st->lsp[2] = 21000;
+    st->lsp[3] = 15000;
+    st->lsp[4] = 8000;
+    st->lsp[5] = 0;
+    st->lsp[6] = -8000;
+    st->lsp[7] = -15000;
+    st->lsp[8] = -21000;
+    st->lsp[9] = -26000;
+
+    /* Initialize state->lsp_old [] */
+    st->lsp_old[0] = 30000;
+    st->lsp_old[1] = 26000;
+    st->lsp_old[2] = 21000;
+    st->lsp_old[3] = 15000;
+    st->lsp_old[4] = 8000;
+    st->lsp_old[5] = 0;
+    st->lsp_old[6] = -8000;
+    st->lsp_old[7] = -15000;
+    st->lsp_old[8] = -21000;
+    st->lsp_old[9] = -26000;
+
+    st->lsf_hist_ptr = 0;
+    st->log_pg_mean = 0;
+    st->log_en_hist_ptr = 0;
+
+    /* initialize decoder lsf history */
+    st->lsf_hist[0] =  1384;
+    st->lsf_hist[1] =  2077;
+    st->lsf_hist[2] =  3420;
+    st->lsf_hist[3] =  5108;
+    st->lsf_hist[4] =  6742;
+    st->lsf_hist[5] =  8122;
+    st->lsf_hist[6] =  9863;
+    st->lsf_hist[7] = 11092;
+    st->lsf_hist[8] = 12714;
+    st->lsf_hist[9] = 13701;
+
+    for (i = 1; i < DTX_HIST_SIZE; i++)
+    {
+        oscl_memmove((void *)&st->lsf_hist[M*i], &st->lsf_hist[0], M*sizeof(st->lsf_hist[0]));
+    }
+    oscl_memset(st->lsf_hist_mean, 0, sizeof(Word16)*M*DTX_HIST_SIZE);
+
+    /* initialize decoder log frame energy */
+    for (i = 0; i < DTX_HIST_SIZE; i++)
+    {
+        st->log_en_hist[i] = st->log_en;
+    }
+
+    st->log_en_adjust = 0;
+
+    st->dtxHangoverCount = DTX_HANG_CONST;
+    st->decAnaElapsedCount = 32767;
+
+    st->sid_frame = 0;
+    st->valid_data = 0;
+    st->dtxHangoverAdded = 0;
+
+    st->dtxGlobalState = DTX;
+    st->data_updated = 0;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dtx_dec
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type dtx_decState
+    mem_syn = AMR decoder state
+    lsfState = decoder lsf states
+    predState = prediction states
+    averState = CB gain average states
+    new_state = new DTX state
+    mode = AMR mode
+    parm = Vector of synthesis parameters
+
+ Outputs:
+    st points to an updated structure of type dtx_decState
+    mem_syn = AMR decoder state
+    lsfState = decoder lsf states
+    predState = prediction states
+    averState = CB gain average states
+    synth = synthesised speech
+    A_t = decoded LP filter in 4 subframes
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Decode comfort noise when in DTX.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dtx_dec.c, UMTS GSM AMR speech codec, R99 - Version 3.3.0, December 12, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int dtx_dec(
+   dtx_decState *st,                // i/o : State struct
+   Word16 mem_syn[],                // i/o : AMR decoder state
+   D_plsfState* lsfState,           // i/o : decoder lsf states
+   gc_predState* predState,         // i/o : prediction states
+   Cb_gain_averageState* averState, // i/o : CB gain average states
+   enum DTXStateType new_state,     // i   : new DTX state
+   enum Mode mode,                  // i   : AMR mode
+   Word16 parm[],                   // i   : Vector of synthesis parameters
+   Word16 synth[],                  // o   : synthesised speech
+   Word16 A_t[]                     // o   : decoded LP filter in 4 subframes
+   )
+{
+   Word16 log_en_index;
+   Word16 i, j;
+   Word16 int_fac;
+   Word32 L_log_en_int;
+   Word16 lsp_int[M];
+   Word16 log_en_int_e;
+   Word16 log_en_int_m;
+   Word16 level;
+   Word16 acoeff[M + 1];
+   Word16 refl[M];
+   Word16 pred_err;
+   Word16 ex[L_SUBFR];
+   Word16 ma_pred_init;
+   Word16 log_pg_e, log_pg_m;
+   Word16 log_pg;
+   Flag negative;
+   Word16 lsf_mean;
+   Word32 L_lsf_mean;
+   Word16 lsf_variab_index;
+   Word16 lsf_variab_factor;
+   Word16 lsf_int[M];
+   Word16 lsf_int_variab[M];
+   Word16 lsp_int_variab[M];
+   Word16 acoeff_variab[M + 1];
+
+   Word16 lsf[M];
+   Word32 L_lsf[M];
+   Word16 ptr;
+   Word16 tmp_int_length;
+
+
+    // This function is called if synthesis state is not SPEECH
+    // the globally passed  inputs to this function are
+    // st->sid_frame
+    // st->valid_data
+    // st->dtxHangoverAdded
+    // new_state  (SPEECH, DTX, DTX_MUTE)
+
+   if ((st->dtxHangoverAdded != 0) &&
+       (st->sid_frame != 0))
+   {
+      // sid_first after dtx hangover period
+      // or sid_upd after dtxhangover
+
+      // set log_en_adjust to correct value
+      st->log_en_adjust = dtx_log_en_adjust[mode];
+
+      ptr = add(st->lsf_hist_ptr, M);
+      if (sub(ptr, 80) == 0)
+      {
+         ptr = 0;
+      }
+      Copy( &st->lsf_hist[st->lsf_hist_ptr],&st->lsf_hist[ptr],M);
+
+      ptr = add(st->log_en_hist_ptr,1);
+      if (sub(ptr, DTX_HIST_SIZE) == 0)
+      {
+         ptr = 0;
+      }
+      st->log_en_hist[ptr] = st->log_en_hist[st->log_en_hist_ptr]; // Q11
+
+      // compute mean log energy and lsp
+      // from decoded signal (SID_FIRST)
+      st->log_en = 0;
+      for (i = 0; i < M; i++)
+      {
+         L_lsf[i] = 0;
+      }
+
+      // average energy and lsp
+      for (i = 0; i < DTX_HIST_SIZE; i++)
+      {
+         st->log_en = add(st->log_en,
+                          shr(st->log_en_hist[i],3));
+         for (j = 0; j < M; j++)
+         {
+            L_lsf[j] = L_add(L_lsf[j],
+                             L_deposit_l(st->lsf_hist[i * M + j]));
+         }
+      }
+
+      for (j = 0; j < M; j++)
+      {
+         lsf[j] = extract_l(L_shr(L_lsf[j],3)); // divide by 8
+      }
+
+      Lsf_lsp(lsf, st->lsp, M);
+
+      // make log_en speech coder mode independent
+      // added again later before synthesis
+      st->log_en = sub(st->log_en, st->log_en_adjust);
+
+      // compute lsf variability vector
+      Copy(st->lsf_hist, st->lsf_hist_mean, 80);
+
+      for (i = 0; i < M; i++)
+      {
+         L_lsf_mean = 0;
+         // compute mean lsf
+         for (j = 0; j < 8; j++)
+         {
+            L_lsf_mean = L_add(L_lsf_mean,
+                               L_deposit_l(st->lsf_hist_mean[i+j*M]));
+         }
+
+         lsf_mean = extract_l(L_shr(L_lsf_mean, 3));
+          // subtract mean and limit to within reasonable limits
+          // moreover the upper lsf's are attenuated
+         for (j = 0; j < 8; j++)
+         {
+            // subtract mean
+            st->lsf_hist_mean[i+j*M] =
+               sub(st->lsf_hist_mean[i+j*M], lsf_mean);
+
+            // attenuate deviation from mean, especially for upper lsf's
+            st->lsf_hist_mean[i+j*M] =
+               mult(st->lsf_hist_mean[i+j*M], lsf_hist_mean_scale[i]);
+
+            // limit the deviation
+            if (st->lsf_hist_mean[i+j*M] < 0)
+            {
+               negative = 1;
+            }
+            else
+            {
+               negative = 0;
+            }
+            st->lsf_hist_mean[i+j*M] = abs_s(st->lsf_hist_mean[i+j*M]);
+
+            // apply soft limit
+            if (sub(st->lsf_hist_mean[i+j*M], 655) > 0)
+            {
+               st->lsf_hist_mean[i+j*M] =
+                  add(655, shr(sub(st->lsf_hist_mean[i+j*M], 655), 2));
+            }
+
+            // apply hard limit
+            if (sub(st->lsf_hist_mean[i+j*M], 1310) > 0)
+            {
+               st->lsf_hist_mean[i+j*M] = 1310;
+            }
+            if (negative != 0)
+            {
+               st->lsf_hist_mean[i+j*M] = -st->lsf_hist_mean[i+j*M];
+            }
+
+         }
+      }
+   }
+
+   if (st->sid_frame != 0 )
+   {
+      // Set old SID parameters, always shift
+      // even if there is no new valid_data
+      Copy(st->lsp, st->lsp_old, M);
+      st->old_log_en = st->log_en;
+
+      if (st->valid_data != 0 )  // new data available (no CRC)
+      {
+         // Compute interpolation factor, since the division only works
+         // for values of since_last_sid < 32 we have to limit the
+         // interpolation to 32 frames
+         tmp_int_length = st->since_last_sid;
+         st->since_last_sid = 0;
+
+         if (sub(tmp_int_length, 32) > 0)
+         {
+            tmp_int_length = 32;
+         }
+         if (sub(tmp_int_length, 2) >= 0)
+         {
+            st->true_sid_period_inv = div_s(1 << 10, shl(tmp_int_length, 10));
+         }
+         else
+         {
+            st->true_sid_period_inv = 1 << 14; // 0.5 it Q15
+         }
+
+         Init_D_plsf_3(lsfState, parm[0]);  // temporay initialization
+         D_plsf_3(lsfState, MRDTX, 0, &parm[1], st->lsp);
+         Set_zero(lsfState->past_r_q, M);   // reset for next speech frame
+
+         log_en_index = parm[4];
+         // Q11 and divide by 4
+         st->log_en = shl(log_en_index, (11 - 2));
+
+         // Subtract 2.5 in Q11
+         st->log_en = sub(st->log_en, (2560 * 2));
+
+         // Index 0 is reserved for silence
+         if (log_en_index == 0)
+         {
+            st->log_en = MIN_16;
+         }
+
+         // no interpolation at startup after coder reset
+         // or when SID_UPD has been received right after SPEECH
+         if ((st->data_updated == 0) ||
+             (sub(st->dtxGlobalState, SPEECH) == 0)
+             )
+         {
+            Copy(st->lsp, st->lsp_old, M);
+            st->old_log_en = st->log_en;
+         }
+      } // endif valid_data
+
+      // initialize gain predictor memory of other modes
+      ma_pred_init = sub(shr(st->log_en,1), 9000);
+      if (ma_pred_init > 0)
+      {
+         ma_pred_init = 0;
+      }
+      if (sub(ma_pred_init, -14436) < 0)
+      {
+         ma_pred_init = -14436;
+      }
+
+      predState->past_qua_en[0] = ma_pred_init;
+      predState->past_qua_en[1] = ma_pred_init;
+      predState->past_qua_en[2] = ma_pred_init;
+      predState->past_qua_en[3] = ma_pred_init;
+
+      // past_qua_en for other modes than MR122
+      ma_pred_init = mult(5443, ma_pred_init);
+      // scale down by factor 20*log10(2) in Q15
+      predState->past_qua_en_MR122[0] = ma_pred_init;
+      predState->past_qua_en_MR122[1] = ma_pred_init;
+      predState->past_qua_en_MR122[2] = ma_pred_init;
+      predState->past_qua_en_MR122[3] = ma_pred_init;
+   } // endif sid_frame
+
+   // CN generation
+   // recompute level adjustment factor Q11
+   // st->log_en_adjust = 0.9*st->log_en_adjust +
+   //                     0.1*dtx_log_en_adjust[mode]);
+   st->log_en_adjust = add(mult(st->log_en_adjust, 29491),
+                           shr(mult(shl(dtx_log_en_adjust[mode],5),3277),5));
+
+   // Interpolate SID info
+   int_fac = shl(add(1,st->since_last_sid), 10); // Q10
+   int_fac = mult(int_fac, st->true_sid_period_inv); // Q10 * Q15 -> Q10
+
+   // Maximize to 1.0 in Q10
+   if (sub(int_fac, 1024) > 0)
+   {
+      int_fac = 1024;
+   }
+   int_fac = shl(int_fac, 4); // Q10 -> Q14
+
+   L_log_en_int = L_mult(int_fac, st->log_en); // Q14 * Q11->Q26
+   for(i = 0; i < M; i++)
+   {
+      lsp_int[i] = mult(int_fac, st->lsp[i]);// Q14 * Q15 -> Q14
+   }
+
+   int_fac = sub(16384, int_fac); // 1-k in Q14
+
+   // (Q14 * Q11 -> Q26) + Q26 -> Q26
+   L_log_en_int = L_mac(L_log_en_int, int_fac, st->old_log_en);
+   for(i = 0; i < M; i++)
+   {
+      // Q14 + (Q14 * Q15 -> Q14) -> Q14
+      lsp_int[i] = add(lsp_int[i], mult(int_fac, st->lsp_old[i]));
+      lsp_int[i] = shl(lsp_int[i], 1); // Q14 -> Q15
+   }
+
+   // compute the amount of lsf variability
+   lsf_variab_factor = sub(st->log_pg_mean,2457); // -0.6 in Q12
+   // *0.3 Q12*Q15 -> Q12
+   lsf_variab_factor = sub(4096, mult(lsf_variab_factor, 9830));
+
+   // limit to values between 0..1 in Q12
+   if (sub(lsf_variab_factor, 4096) > 0)
+   {
+      lsf_variab_factor = 4096;
+   }
+   if (lsf_variab_factor < 0)
+   {
+      lsf_variab_factor = 0;
+   }
+   lsf_variab_factor = shl(lsf_variab_factor, 3); // -> Q15
+
+   // get index of vector to do variability with
+   lsf_variab_index = pseudonoise(&st->L_pn_seed_rx, 3);
+
+   // convert to lsf
+   Lsp_lsf(lsp_int, lsf_int, M);
+
+   // apply lsf variability
+   Copy(lsf_int, lsf_int_variab, M);
+   for(i = 0; i < M; i++)
+   {
+      lsf_int_variab[i] = add(lsf_int_variab[i],
+                              mult(lsf_variab_factor,
+                                   st->lsf_hist_mean[i+lsf_variab_index*M]));
+   }
+
+   // make sure that LSP's are ordered
+   Reorder_lsf(lsf_int, LSF_GAP, M);
+   Reorder_lsf(lsf_int_variab, LSF_GAP, M);
+
+   // copy lsf to speech decoders lsf state
+   Copy(lsf_int, lsfState->past_lsf_q, M);
+
+   // convert to lsp
+   Lsf_lsp(lsf_int, lsp_int, M);
+   Lsf_lsp(lsf_int_variab, lsp_int_variab, M);
+
+   // Compute acoeffs Q12 acoeff is used for level
+   // normalization and postfilter, acoeff_variab is
+   // used for synthesis filter
+   // by doing this we make sure that the level
+   // in high frequenncies does not jump up and down
+
+   Lsp_Az(lsp_int, acoeff);
+   Lsp_Az(lsp_int_variab, acoeff_variab);
+
+   // For use in postfilter
+   Copy(acoeff, &A_t[0],           M + 1);
+   Copy(acoeff, &A_t[M + 1],       M + 1);
+   Copy(acoeff, &A_t[2 * (M + 1)], M + 1);
+   Copy(acoeff, &A_t[3 * (M + 1)], M + 1);
+
+   // Compute reflection coefficients Q15
+   A_Refl(&acoeff[1], refl);
+
+   // Compute prediction error in Q15
+   pred_err = MAX_16; // 0.99997 in Q15
+   for (i = 0; i < M; i++)
+   {
+      pred_err = mult(pred_err, sub(MAX_16, mult(refl[i], refl[i])));
+   }
+
+   // compute logarithm of prediction gain
+   Log2(L_deposit_l(pred_err), &log_pg_e, &log_pg_m);
+
+   // convert exponent and mantissa to Word16 Q12
+   log_pg = shl(sub(log_pg_e,15), 12);  // Q12
+   log_pg = shr(sub(0,add(log_pg, shr(log_pg_m, 15-12))), 1);
+   st->log_pg_mean = add(mult(29491,st->log_pg_mean),
+                         mult(3277, log_pg));
+
+   // Compute interpolated log energy
+   L_log_en_int = L_shr(L_log_en_int, 10); // Q26 -> Q16
+
+   // Add 4 in Q16
+   L_log_en_int = L_add(L_log_en_int, 4 * 65536L);
+
+   // subtract prediction gain
+   L_log_en_int = L_sub(L_log_en_int, L_shl(L_deposit_l(log_pg), 4));
+
+   // adjust level to speech coder mode
+   L_log_en_int = L_add(L_log_en_int,
+                        L_shl(L_deposit_l(st->log_en_adjust), 5));
+
+   log_en_int_e = extract_h(L_log_en_int);
+   log_en_int_m = extract_l(L_shr(L_sub(L_log_en_int,
+                                        L_deposit_h(log_en_int_e)), 1));
+   level = extract_l(Pow2(log_en_int_e, log_en_int_m)); // Q4
+
+   for (i = 0; i < 4; i++)
+   {
+      // Compute innovation vector
+      build_CN_code(&st->L_pn_seed_rx, ex);
+      for (j = 0; j < L_SUBFR; j++)
+      {
+         ex[j] = mult(level, ex[j]);
+      }
+      // Synthesize
+      Syn_filt(acoeff_variab, ex, &synth[i * L_SUBFR], L_SUBFR,
+               mem_syn, 1);
+
+   } // next i
+
+   // reset codebook averaging variables
+   averState->hangVar = 20;
+   averState->hangCount = 0;
+
+   if (sub(new_state, DTX_MUTE) == 0)
+   {
+      // mute comfort noise as it has been quite a long time since
+       * last SID update  was performed
+
+      tmp_int_length = st->since_last_sid;
+      if (sub(tmp_int_length, 32) > 0)
+      {
+         tmp_int_length = 32;
+      }
+
+      // safety guard against division by zero
+      if(tmp_int_length <= 0) {
+         tmp_int_length = 8;
+      }
+
+      st->true_sid_period_inv = div_s(1 << 10, shl(tmp_int_length, 10));
+
+      st->since_last_sid = 0;
+      Copy(st->lsp, st->lsp_old, M);
+      st->old_log_en = st->log_en;
+      // subtract 1/8 in Q11 i.e -6/8 dB
+      st->log_en = sub(st->log_en, 256);
+   }
+
+   // reset interpolation length timer
+   // if data has been updated.
+   if ((st->sid_frame != 0) &&
+       ((st->valid_data != 0) ||
+        ((st->valid_data == 0) &&  (st->dtxHangoverAdded) != 0)))
+   {
+      st->since_last_sid =  0;
+      st->data_updated = 1;
+   }
+
+   return 0;
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void dtx_dec(
+    dtx_decState *st,                /* i/o : State struct                    */
+    Word16 mem_syn[],                /* i/o : AMR decoder state               */
+    D_plsfState* lsfState,           /* i/o : decoder lsf states              */
+    gc_predState* predState,         /* i/o : prediction states               */
+    Cb_gain_averageState* averState, /* i/o : CB gain average states          */
+    enum DTXStateType new_state,     /* i   : new DTX state                   */
+    enum Mode mode,                  /* i   : AMR mode                        */
+    Word16 parm[],                   /* i   : Vector of synthesis parameters  */
+    CommonAmrTbls* common_amr_tbls,  /* i   : Ptr to struct of table ptrs     */
+    Word16 synth[],                  /* o   : synthesised speech              */
+    Word16 A_t[],                    /* o   : decoded LP filter in 4 subframes*/
+    Flag   *pOverflow
+)
+{
+    Word16 log_en_index;
+    Word16 i;
+    Word16 j;
+    Word16 int_fac;
+    Word32 L_log_en_int;
+    Word16 lsp_int[M];
+    Word16 log_en_int_e;
+    Word16 log_en_int_m;
+    Word16 level;
+    Word16 acoeff[M + 1];
+    Word16 refl[M];
+    Word16 pred_err;
+    Word16 ex[L_SUBFR];
+    Word16 ma_pred_init;
+    Word16 log_pg_e;
+    Word16 log_pg_m;
+    Word16 log_pg;
+    Flag negative;
+    Word16 lsf_mean;
+    Word32 L_lsf_mean;
+    Word16 lsf_variab_index;
+    Word16 lsf_variab_factor;
+    Word16 lsf_int[M];
+    Word16 lsf_int_variab[M];
+    Word16 lsp_int_variab[M];
+    Word16 acoeff_variab[M + 1];
+
+    Word16 lsf[M];
+    Word32 L_lsf[M];
+    Word16 ptr;
+    Word16 tmp_int_length;
+
+    Word32 L_temp;
+    Word16 temp;
+
+    /*  This function is called if synthesis state is not SPEECH
+     *  the globally passed  inputs to this function are
+     * st->sid_frame
+     * st->valid_data
+     * st->dtxHangoverAdded
+     * new_state  (SPEECH, DTX, DTX_MUTE)
+     */
+
+    if ((st->dtxHangoverAdded != 0) &&
+            (st->sid_frame != 0))
+    {
+        /* sid_first after dtx hangover period */
+        /* or sid_upd after dtxhangover        */
+
+        /* set log_en_adjust to correct value */
+        st->log_en_adjust = dtx_log_en_adjust[mode];
+
+        ptr = st->lsf_hist_ptr + M;
+
+        if (ptr == 80)
+        {
+            ptr = 0;
+        }
+        oscl_memmove((void *)&st->lsf_hist[ptr], &st->lsf_hist[st->lsf_hist_ptr], M*sizeof(*st->lsf_hist));
+
+        ptr = st->log_en_hist_ptr + 1;
+
+        if (ptr == DTX_HIST_SIZE)
+        {
+            ptr = 0;
+        }
+
+        st->log_en_hist[ptr] = st->log_en_hist[st->log_en_hist_ptr]; /* Q11 */
+
+        /* compute mean log energy and lsp *
+         * from decoded signal (SID_FIRST) */
+        st->log_en = 0;
+        for (i = M - 1; i >= 0; i--)
+        {
+            L_lsf[i] = 0;
+        }
+
+        /* average energy and lsp */
+        for (i = DTX_HIST_SIZE - 1; i >= 0; i--)
+        {
+            if (st->log_en_hist[i] < 0)
+            {
+                temp = ~((~st->log_en_hist[i]) >> 3);
+            }
+            else
+            {
+                temp = st->log_en_hist[i] >> 3;
+            }
+            st->log_en = add_16(st->log_en, temp, pOverflow);
+            for (j = M - 1; j >= 0; j--)
+            {
+                L_lsf[j] = L_add(L_lsf[j],
+                                 (Word32)(st->lsf_hist[i * M + j]), pOverflow);
+            }
+        }
+
+        for (j = M - 1; j >= 0; j--)
+        {
+            if (L_lsf[j] < 0)
+            {
+                lsf[j] = (Word16)(~((~L_lsf[j]) >> 3));
+            }
+            else
+            {
+                lsf[j] = (Word16)(L_lsf[j] >> 3);
+            }
+        }
+
+        Lsf_lsp(lsf, st->lsp, M, pOverflow);
+
+        /* make log_en speech coder mode independent */
+        /* added again later before synthesis        */
+        st->log_en = sub(st->log_en, st->log_en_adjust, pOverflow);
+
+        /* compute lsf variability vector */
+        oscl_memmove((void *)st->lsf_hist_mean, st->lsf_hist, 80*sizeof(*st->lsf_hist));
+
+        for (i = M - 1; i >= 0; i--)
+        {
+            L_lsf_mean = 0;
+            /* compute mean lsf */
+            for (j = 8 - 1; j >= 0; j--)
+            {
+                L_lsf_mean = L_add(L_lsf_mean,
+                                   (Word32)(st->lsf_hist_mean[i+j*M]), pOverflow);
+            }
+
+            if (L_lsf_mean < 0)
+            {
+                lsf_mean = (Word16)(~((~L_lsf_mean) >> 3));
+            }
+            else
+            {
+                lsf_mean = (Word16)(L_lsf_mean >> 3);
+            }
+            /* subtract mean and limit to within reasonable limits  *
+            * moreover the upper lsf's are attenuated              */
+            for (j = 8 - 1; j >= 0; j--)
+            {
+                /* subtract mean */
+                st->lsf_hist_mean[i+j*M] =
+                    sub(st->lsf_hist_mean[i+j*M], lsf_mean, pOverflow);
+
+                /* attenuate deviation from mean, especially for upper lsf's */
+                st->lsf_hist_mean[i+j*M] =
+                    mult(st->lsf_hist_mean[i+j*M], lsf_hist_mean_scale[i], pOverflow);
+
+                /* limit the deviation */
+                if (st->lsf_hist_mean[i+j*M] < 0)
+                {
+                    negative = 1;
+                }
+                else
+                {
+                    negative = 0;
+                }
+                st->lsf_hist_mean[i+j*M] = abs_s(st->lsf_hist_mean[i+j*M]);
+
+                /* apply soft limit */
+                if (st->lsf_hist_mean[i+j*M] > 655)
+                {
+                    st->lsf_hist_mean[i+j*M] = 655 + ((st->lsf_hist_mean[i+j*M]
+                                                       - 655) >> 2);
+                }
+
+                /* apply hard limit */
+                if (st->lsf_hist_mean[i+j*M] > 1310)
+                {
+                    st->lsf_hist_mean[i+j*M] = 1310;
+                }
+
+                if (negative != 0)
+                {
+                    st->lsf_hist_mean[i+j*M] = -st->lsf_hist_mean[i+j*M];
+                }
+            }
+        }
+    }
+
+
+    if (st->sid_frame != 0)
+    {
+        /* Set old SID parameters, always shift */
+        /* even if there is no new valid_data   */
+        oscl_memmove((void *)st->lsp_old, st->lsp, M*sizeof(*st->lsp));
+        st->old_log_en = st->log_en;
+
+        if (st->valid_data != 0)   /* new data available (no CRC) */
+        {
+            /* Compute interpolation factor, since the division only works *
+             * for values of since_last_sid < 32 we have to limit the      *
+             * interpolation to 32 frames                                  */
+            tmp_int_length = st->since_last_sid;
+            st->since_last_sid = 0;
+
+            if (tmp_int_length >= 32)
+            {
+                tmp_int_length = 32;
+            }
+
+            L_temp = ((Word32) tmp_int_length) << 10;
+            if (L_temp != (Word32)((Word16) L_temp))
+            {
+                *pOverflow = 1;
+                L_temp = (Word32)((tmp_int_length > 0) ? MAX_16 : MIN_16);
+            }
+            temp = (Word16) L_temp;
+
+            if (tmp_int_length >= 2)
+            {
+                st->true_sid_period_inv = div_s(1 << 10, temp);
+            }
+            else
+            {
+                st->true_sid_period_inv = 1 << 14; /* 0.5 it Q15 */
+            }
+
+            Init_D_plsf_3(lsfState, parm[0], common_amr_tbls->past_rq_init_ptr);
+            D_plsf_3(lsfState, MRDTX, 0, &parm[1], common_amr_tbls, st->lsp, pOverflow);
+            /* reset for next speech frame */
+            oscl_memset((void *)lsfState->past_r_q, 0, M*sizeof(*lsfState->past_r_q));
+
+            log_en_index = parm[4];
+            /* Q11 and divide by 4 */
+            if ((log_en_index > 63) || (log_en_index < -64))
+            {
+                st->log_en = (log_en_index > 0) ? MAX_16 : MIN_16;
+            }
+            else
+            {
+                st->log_en = (log_en_index) << (11 - 2);
+            }
+
+            /* Subtract 2.5 in Q11 */
+            st->log_en -= (2560 * 2);
+
+            /* Index 0 is reserved for silence */
+            if (log_en_index == 0)
+            {
+                st->log_en = MIN_16;
+            }
+
+            /* no interpolation at startup after coder reset        */
+            /* or when SID_UPD has been received right after SPEECH */
+
+            if ((st->data_updated == 0) ||
+                    (st->dtxGlobalState == SPEECH))
+            {
+                oscl_memmove((void *)st->lsp_old, st->lsp, M*sizeof(*st->lsp));
+                st->old_log_en = st->log_en;
+            }
+        } /* endif valid_data */
+
+        /* initialize gain predictor memory of other modes */
+        if (st->log_en < 0)
+        {
+            temp = ~((~st->log_en) >> 1);
+        }
+        else
+        {
+            temp = st->log_en >> 1;
+        }
+        ma_pred_init = temp - 9000;
+
+        if (ma_pred_init > 0)
+        {
+            ma_pred_init = 0;
+        }
+        else if (ma_pred_init < -14436)
+        {
+            ma_pred_init = -14436;
+        }
+
+        predState->past_qua_en[0] = ma_pred_init;
+        predState->past_qua_en[1] = ma_pred_init;
+        predState->past_qua_en[2] = ma_pred_init;
+        predState->past_qua_en[3] = ma_pred_init;
+
+        /* past_qua_en for other modes than MR122 */
+        ma_pred_init = ((Word32) ma_pred_init * 5443) >> 15;
+
+        /* scale down by factor 20*log10(2) in Q15 */
+        predState->past_qua_en_MR122[0] = ma_pred_init;
+        predState->past_qua_en_MR122[1] = ma_pred_init;
+        predState->past_qua_en_MR122[2] = ma_pred_init;
+        predState->past_qua_en_MR122[3] = ma_pred_init;
+    } /* endif sid_frame */
+
+    /* CN generation */
+    /* recompute level adjustment factor Q11             *
+     * st->log_en_adjust = 0.9*st->log_en_adjust +       *
+     *                     0.1*dtx_log_en_adjust[mode]); */
+    if (dtx_log_en_adjust[mode] > 1023)
+    {
+        temp = MAX_16;
+    }
+    else if (dtx_log_en_adjust[mode] < -1024)
+    {
+        temp = MIN_16;
+    }
+    else
+    {
+        temp = (((Word32) dtx_log_en_adjust[mode] << 5) * 3277) >> 15;
+
+
+    }
+
+    if (temp < 0)
+    {
+        temp = ~((~temp) >> 5);
+    }
+    else
+    {
+        temp >>= 5;
+    }
+    st->log_en_adjust = add_16(((Word32)st->log_en_adjust * 29491) >> 15, temp, pOverflow);
+
+
+    /* Interpolate SID info */
+    int_fac = shl((st->since_last_sid + 1), 10, pOverflow); /* Q10 */
+    int_fac = mult(int_fac, st->true_sid_period_inv, pOverflow); /* Q10 * Q15 -> Q10 */
+
+    /* Maximize to 1.0 in Q10 */
+    if (int_fac > 1024)
+    {
+        int_fac = 16384;
+    }
+    else if (int_fac < -2048)
+    {
+        int_fac = MIN_16;
+    }
+    else
+    {
+        int_fac <<= 4;      /* Q10 -> Q14 */
+    }
+
+    L_log_en_int = L_mult(int_fac, st->log_en, pOverflow); /* Q14 * Q11->Q26 */
+    for (i = M - 1; i >= 0; i--)
+    {
+        lsp_int[i] = mult(int_fac, st->lsp[i], pOverflow);/* Q14 * Q15 -> Q14 */
+    }
+
+    int_fac = 16384 - int_fac; /* 1-k in Q14 */
+
+    /* (Q14 * Q11 -> Q26) + Q26 -> Q26 */
+    L_log_en_int = L_mac(L_log_en_int, int_fac, st->old_log_en, pOverflow);
+    for (i = M - 1; i >= 0; i--)
+    {
+        /* Q14 + (Q14 * Q15 -> Q14) -> Q14 */
+        lsp_int[i] = add_16(lsp_int[i], mult(int_fac, st->lsp_old[i], pOverflow), pOverflow);
+
+        L_temp = ((Word32) lsp_int[i]) << 1;    /* Q14 -> Q15 */
+        if (L_temp != (Word32)((Word16) L_temp))
+        {
+            *pOverflow = 1;
+            L_temp = (Word32)((lsp_int[i] > 0) ? MAX_16 : MIN_16);
+        }
+        lsp_int[i] = (Word16) L_temp;
+    }
+
+    /* compute the amount of lsf variability */
+    lsf_variab_factor = st->log_pg_mean - 2457; /* -0.6 in Q12 */
+    /* *0.3 Q12*Q15 -> Q12 */
+    lsf_variab_factor = 4096 - mult(lsf_variab_factor, 9830, pOverflow);
+
+    /* limit to values between 0..1 in Q12 */
+    if (lsf_variab_factor > 4095)
+    {
+        lsf_variab_factor = MAX_16;
+    }
+    else if (lsf_variab_factor < 0)
+    {
+        lsf_variab_factor = 0;
+    }
+    else
+    {
+        lsf_variab_factor <<= 3; /* -> Q15 */
+    }
+
+    /* get index of vector to do variability with */
+    lsf_variab_index = pseudonoise(&st->L_pn_seed_rx, 3);
+
+    /* convert to lsf */
+    Lsp_lsf(lsp_int, lsf_int, M, pOverflow);
+
+    /* apply lsf variability */
+    oscl_memmove((void *)lsf_int_variab, lsf_int, M*sizeof(*lsf_int));
+    for (i = M - 1; i >= 0; i--)
+    {
+        lsf_int_variab[i] = add_16(lsf_int_variab[i],
+                                   mult(lsf_variab_factor,
+                                        st->lsf_hist_mean[i+lsf_variab_index*M], pOverflow)
+                                   , pOverflow);
+    }
+
+    /* make sure that LSP's are ordered */
+    Reorder_lsf(lsf_int, LSF_GAP, M, pOverflow);
+    Reorder_lsf(lsf_int_variab, LSF_GAP, M, pOverflow);
+
+    /* copy lsf to speech decoders lsf state */
+    oscl_memmove((void *)lsfState->past_lsf_q, lsf_int, M*sizeof(*lsf_int));
+
+    /* convert to lsp */
+    Lsf_lsp(lsf_int, lsp_int, M, pOverflow);
+    Lsf_lsp(lsf_int_variab, lsp_int_variab, M, pOverflow);
+
+    /* Compute acoeffs Q12 acoeff is used for level    *
+     * normalization and postfilter, acoeff_variab is  *
+     * used for synthesis filter                       *
+     * by doing this we make sure that the level       *
+     * in high frequenncies does not jump up and down  */
+
+    Lsp_Az(lsp_int, acoeff, pOverflow);
+    Lsp_Az(lsp_int_variab, acoeff_variab, pOverflow);
+
+    /* For use in postfilter */
+    oscl_memmove((void *)&A_t[0],          acoeff, (M + 1)*sizeof(*acoeff));
+    oscl_memmove((void *)&A_t[M + 1],      acoeff, (M + 1)*sizeof(*acoeff));
+    oscl_memmove((void *)&A_t[2 *(M + 1)], acoeff, (M + 1)*sizeof(*acoeff));
+    oscl_memmove((void *)&A_t[3 *(M + 1)], acoeff, (M + 1)*sizeof(*acoeff));
+
+    /* Compute reflection coefficients Q15 */
+    A_Refl(&acoeff[1], refl, pOverflow);
+
+    /* Compute prediction error in Q15 */
+    pred_err = MAX_16; /* 0.99997 in Q15 */
+    for (i = 0; i < M; i++)
+    {
+        L_temp = (((Word32) refl[i]) * refl[i]) >> 15;
+        if (L_temp <= 0x00007fffL)
+        {
+            temp = MAX_16 - (Word16) L_temp;
+        }
+        else
+        {
+            *pOverflow = 1;
+            temp = 0;
+        }
+        pred_err = mult(pred_err, temp, pOverflow);
+    }
+
+    /* compute logarithm of prediction gain */
+    Log2((Word32)(pred_err), &log_pg_e, &log_pg_m, pOverflow);
+
+    /* convert exponent and mantissa to Word16 Q12 */
+    log_pg = shl((log_pg_e - 15), 12, pOverflow); /* Q12 */
+    log_pg = shr(sub(0, add_16(log_pg, shr(log_pg_m, 15 - 12, pOverflow),
+                               pOverflow), pOverflow), 1, pOverflow);
+    st->log_pg_mean = add_16(mult(29491, st->log_pg_mean, pOverflow),
+                             mult(3277, log_pg, pOverflow), pOverflow);
+
+    /* Compute interpolated log energy */
+    L_log_en_int = L_shr(L_log_en_int, 10, pOverflow); /* Q26 -> Q16 */
+
+    /* Add 4 in Q16 */
+    L_log_en_int = L_add(L_log_en_int, 4 * 65536L, pOverflow);
+
+    /* subtract prediction gain */
+    L_log_en_int = L_sub(L_log_en_int, L_shl((Word32)(log_pg), 4, pOverflow), pOverflow);
+
+    /* adjust level to speech coder mode */
+    L_log_en_int = L_add(L_log_en_int,
+                         L_shl((Word32)(st->log_en_adjust), 5, pOverflow), pOverflow);
+
+    log_en_int_e = (Word16)(L_log_en_int >> 16);
+
+    log_en_int_m = (Word16)(L_shr(L_sub(L_log_en_int,
+                                        ((Word32)log_en_int_e << 16), pOverflow), 1, pOverflow));
+    level = (Word16)(Pow2(log_en_int_e, log_en_int_m, pOverflow));  /* Q4 */
+
+    for (i = 0; i < 4; i++)
+    {
+        /* Compute innovation vector */
+        build_CN_code(&st->L_pn_seed_rx, ex, pOverflow);
+        for (j = L_SUBFR - 1; j >= 0; j--)
+        {
+            ex[j] = mult(level, ex[j], pOverflow);
+        }
+        /* Synthesize */
+        Syn_filt(acoeff_variab, ex, &synth[i * L_SUBFR], L_SUBFR,
+                 mem_syn, 1);
+
+    } /* next i */
+
+    /* reset codebook averaging variables */
+    averState->hangVar = 20;
+    averState->hangCount = 0;
+
+    if (new_state == DTX_MUTE)
+    {
+        /* mute comfort noise as it has been quite a long time since
+         * last SID update  was performed                            */
+
+        tmp_int_length = st->since_last_sid;
+
+        if (tmp_int_length > 32)
+        {
+            tmp_int_length = 32;
+        }
+        else if (tmp_int_length <= 0)
+        {
+            /* safety guard against division by zero */
+            tmp_int_length = 8;
+        }
+
+        L_temp = ((Word32) tmp_int_length) << 10;
+        if (L_temp != (Word32)((Word16) L_temp))
+        {
+            *pOverflow = 1;
+            L_temp = (Word32)((tmp_int_length > 0) ? MAX_16 : MIN_16);
+        }
+        temp = (Word16) L_temp;
+
+        st->true_sid_period_inv = div_s(1 << 10, temp);
+
+        st->since_last_sid = 0;
+        oscl_memmove((void *)st->lsp_old, st->lsp, M*sizeof(*st->lsp));
+        st->old_log_en = st->log_en;
+        /* subtract 1/8 in Q11 i.e -6/8 dB */
+        st->log_en = st->log_en - 256;
+    }
+
+    /* reset interpolation length timer
+     * if data has been updated.        */
+    if ((st->sid_frame != 0) &&
+            ((st->valid_data != 0) ||
+             ((st->valid_data == 0) && (st->dtxHangoverAdded) != 0)))
+    {
+        st->since_last_sid =  0;
+        st->data_updated = 1;
+    }
+
+    return;
+}
+
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dtx_dec_activity_update
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type dtx_decState
+    lsf =
+        frame =
+
+ Outputs:
+    st points to an updated structure of type dtx_decState
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function updates the DTX parameters.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dtx_dec.c, UMTS GSM AMR speech codec, R99 - Version 3.3.0, December 12, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void dtx_dec_activity_update(dtx_decState *st,
+                             Word16 lsf[],
+                             Word16 frame[])
+{
+   Word16 i;
+
+   Word32 L_frame_en;
+   Word16 log_en_e, log_en_m, log_en;
+
+   // update lsp history
+   st->lsf_hist_ptr = add(st->lsf_hist_ptr,M);
+   if (sub(st->lsf_hist_ptr, 80) == 0)
+   {
+      st->lsf_hist_ptr = 0;
+   }
+   Copy(lsf, &st->lsf_hist[st->lsf_hist_ptr], M);
+
+   // compute log energy based on frame energy
+   L_frame_en = 0;     // Q0
+   for (i=0; i < L_FRAME; i++)
+   {
+      L_frame_en = L_mac(L_frame_en, frame[i], frame[i]);
+   }
+   Log2(L_frame_en, &log_en_e, &log_en_m);
+
+   // convert exponent and mantissa to Word16 Q10
+   log_en = shl(log_en_e, 10);  // Q10
+   log_en = add(log_en, shr(log_en_m, 15-10));
+
+   // divide with L_FRAME i.e subtract with log2(L_FRAME) = 7.32193
+   log_en = sub(log_en, 7497+1024);
+
+   // insert into log energy buffer, no division by two as  *
+    * log_en in decoder is Q11
+   st->log_en_hist_ptr = add(st->log_en_hist_ptr, 1);
+   if (sub(st->log_en_hist_ptr, DTX_HIST_SIZE) == 0)
+   {
+      st->log_en_hist_ptr = 0;
+   }
+   st->log_en_hist[st->log_en_hist_ptr] = log_en; // Q11
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void dtx_dec_activity_update(dtx_decState *st,
+                             Word16 lsf[],
+                             Word16 frame[],
+                             Flag   *pOverflow)
+{
+    Word16 i;
+
+    Word32 L_frame_en;
+    Word32 L_temp;
+    Word16 log_en_e;
+    Word16 log_en_m = 0;
+    Word16 log_en = 0;
+
+    /* update lsp history */
+    st->lsf_hist_ptr += M;
+
+    if (st->lsf_hist_ptr == 80)
+    {
+        st->lsf_hist_ptr = 0;
+    }
+    oscl_memmove((void *)&st->lsf_hist[st->lsf_hist_ptr], lsf, M*sizeof(*lsf));
+
+    /* compute log energy based on frame energy */
+    L_frame_en = 0;     /* Q0 */
+    for (i = L_FRAME - 1; i >= 0; i--)
+    {
+        L_temp = ((Word32) frame[i]) * frame[i];
+        if (L_temp != (Word32) 0x40000000L)
+        {
+            L_temp = L_temp << 1;
+        }
+        else
+        {
+            L_temp = MAX_32;
+        }
+        L_frame_en = L_add(L_frame_en, L_temp, pOverflow);
+    }
+    Log2(L_frame_en, &log_en_e, &log_en_m, pOverflow);
+
+    /* convert exponent and mantissa to Word16 Q10 */
+    L_temp = ((Word32) log_en_e) << 10;
+
+    if (L_temp != (Word32)((Word16) L_temp))
+    {
+        *pOverflow = 1;
+        L_temp = (Word32)((log_en_e > 0) ? MAX_16 : MIN_16);
+    }
+    log_en_e = (Word16) L_temp;
+
+    if (log_en_m < 0)
+    {
+        log_en_m = ~((~log_en_m) >> 5);
+    }
+    else
+    {
+        log_en_m >>= 5;
+    }
+    log_en = log_en_e + log_en_m;
+
+    /* divide with L_FRAME i.e subtract with log2(L_FRAME) = 7.32193 */
+    log_en -= 7497 + 1024;
+
+    /* insert into log energy buffer, no division by two as  *
+    * log_en in decoder is Q11                              */
+    st->log_en_hist_ptr += 1;
+
+    if (st->log_en_hist_ptr == DTX_HIST_SIZE)
+    {
+        st->log_en_hist_ptr = 0;
+    }
+    st->log_en_hist[st->log_en_hist_ptr] = log_en; /* Q11 */
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: rx_dtx_handler
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type dtx_decState
+    frame_type = RX frame type
+
+ Returns:
+    newState = variable of type DTXStateType
+
+ Outputs:
+    st points to an updated structure of type dtx_decState
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function determines the new state of the decoder based on the frame_type
+ and sets up the decoder parameters according to newState.
+
+ Table of new SPD synthesis states
+
+                           |     previous SPD_synthesis_state
+     Incoming              |
+     frame_type            | SPEECH       | DTX           | DTX_MUTE
+     ---------------------------------------------------------------
+     RX_SPEECH_GOOD ,      |              |               |
+     RX_SPEECH_PR_DEGRADED | SPEECH       | SPEECH        | SPEECH
+     ----------------------------------------------------------------
+     RX_SPEECH_PR_BAD,     |              |               |
+     RX_SPEECH_BAD,        | SPEECH       | DTX           | DTX_MUTE
+     ----------------------------------------------------------------
+     RX_SID_FIRST,         | DTX          | DTX/(DTX_MUTE)| DTX_MUTE
+     ----------------------------------------------------------------
+     RX_SID_UPDATE,        | DTX          | DTX           | DTX
+     ----------------------------------------------------------------
+     RX_SID_BAD,           | DTX          | DTX/(DTX_MUTE)| DTX_MUTE
+     ----------------------------------------------------------------
+     RX_NO_DATA            | SPEECH       | DTX/(DTX_MUTE)| DTX_MUTE
+                           |(class2 garb.)|               |
+     ----------------------------------------------------------------
+     RX_ONSET              | SPEECH       | DTX/(DTX_MUTE)| DTX_MUTE
+                           |(class2 garb.)|               |
+     ----------------------------------------------------------------
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dtx_dec.c, UMTS GSM AMR speech codec, R99 - Version 3.3.0, December 12, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+enum DTXStateType rx_dtx_handler(
+                      dtx_decState *st,           // i/o : State struct
+                      enum RXFrameType frame_type // i   : Frame type
+                      )
+{
+   enum DTXStateType newState;
+   enum DTXStateType encState;
+
+   // DTX if SID frame or previously in DTX{_MUTE} and (NO_RX OR BAD_SPEECH)
+   if ((sub(frame_type, RX_SID_FIRST) == 0)   ||
+       (sub(frame_type, RX_SID_UPDATE) == 0)  ||
+       (sub(frame_type, RX_SID_BAD) == 0)     ||
+       (((sub(st->dtxGlobalState, DTX) == 0) ||
+         (sub(st->dtxGlobalState, DTX_MUTE) == 0)) &&
+        ((sub(frame_type, RX_NO_DATA) == 0) ||
+         (sub(frame_type, RX_SPEECH_BAD) == 0) ||
+         (sub(frame_type, RX_ONSET) == 0))))
+   {
+      newState = DTX;
+
+      // stay in mute for these input types
+      if ((sub(st->dtxGlobalState, DTX_MUTE) == 0) &&
+          ((sub(frame_type, RX_SID_BAD) == 0) ||
+           (sub(frame_type, RX_SID_FIRST) ==  0) ||
+           (sub(frame_type, RX_ONSET) ==  0) ||
+           (sub(frame_type, RX_NO_DATA) == 0)))
+      {
+         newState = DTX_MUTE;
+      }
+
+      // evaluate if noise parameters are too old
+      // since_last_sid is reset when CN parameters have been updated
+      st->since_last_sid = add(st->since_last_sid, 1);
+
+      // no update of sid parameters in DTX for a long while
+      // Due to the delayed update of  st->since_last_sid counter
+      // SID_UPDATE frames need to be handled separately to avoid
+      // entering DTX_MUTE for late SID_UPDATE frames
+      if((sub(frame_type, RX_SID_UPDATE) != 0) &&
+         (sub(st->since_last_sid, DTX_MAX_EMPTY_THRESH) > 0))
+      {
+         newState = DTX_MUTE;
+      }
+   }
+   else
+   {
+      newState = SPEECH;
+      st->since_last_sid = 0;
+   }
+
+    // reset the decAnaElapsed Counter when receiving CNI data the first
+    // time, to robustify counter missmatch after handover
+    // this might delay the bwd CNI analysis in the new decoder slightly.
+
+   if ((st->data_updated == 0) &&
+       (sub(frame_type, RX_SID_UPDATE) == 0))
+   {
+      st->decAnaElapsedCount = 0;
+   }
+
+   // update the SPE-SPD DTX hangover synchronization
+   // to know when SPE has added dtx hangover
+   st->decAnaElapsedCount = add(st->decAnaElapsedCount, 1);
+   st->dtxHangoverAdded = 0;
+
+   if ((sub(frame_type, RX_SID_FIRST) == 0)  ||
+       (sub(frame_type, RX_SID_UPDATE) == 0) ||
+       (sub(frame_type, RX_SID_BAD) == 0)    ||
+       (sub(frame_type, RX_ONSET) == 0)      ||
+       (sub(frame_type, RX_NO_DATA) == 0))
+   {
+      encState = DTX;
+
+      // In frame errors simulations RX_NO_DATA may occasionally mean that
+      // a speech packet was probably sent by the encoder,
+      // the assumed _encoder_ state should be SPEECH in such cases.
+      if((sub(frame_type, RX_NO_DATA) == 0) &&
+         (sub(newState, SPEECH) == 0))
+      {
+         encState = SPEECH;
+      }
+
+      // Note on RX_ONSET operation differing from RX_NO_DATA operation:
+      // If a  RX_ONSET is received in the decoder (by "accident")
+      // it is still most likely that the encoder  state
+      // for the "ONSET frame" was DTX.
+
+   }
+   else
+   {
+      encState = SPEECH;
+   }
+
+   if (sub(encState, SPEECH) == 0)
+   {
+      st->dtxHangoverCount = DTX_HANG_CONST;
+   }
+   else
+   {
+      if (sub(st->decAnaElapsedCount, DTX_ELAPSED_FRAMES_THRESH) > 0)
+      {
+         st->dtxHangoverAdded = 1;
+         st->decAnaElapsedCount = 0;
+         st->dtxHangoverCount = 0;
+      }
+      else if (st->dtxHangoverCount == 0)
+      {
+         st->decAnaElapsedCount = 0;
+      }
+      else
+      {
+         st->dtxHangoverCount = sub(st->dtxHangoverCount, 1);
+      }
+   }
+
+   if (sub(newState, SPEECH) != 0)
+   {
+      // DTX or DTX_MUTE
+      // CN data is not in a first SID, first SIDs are marked as SID_BAD
+      //  but will do backwards analysis if a hangover period has been added
+      // according to the state machine above
+
+      st->sid_frame = 0;
+      st->valid_data = 0;
+
+      if (sub(frame_type, RX_SID_FIRST) == 0)
+      {
+         st->sid_frame = 1;
+      }
+      else if (sub(frame_type, RX_SID_UPDATE) == 0)
+      {
+         st->sid_frame = 1;
+         st->valid_data = 1;
+      }
+      else if (sub(frame_type, RX_SID_BAD) == 0)
+      {
+         st->sid_frame = 1;
+         st->dtxHangoverAdded = 0; // use old data
+      }
+   }
+
+   return newState;
+   // newState is used by both SPEECH AND DTX synthesis routines
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+enum DTXStateType rx_dtx_handler(
+    dtx_decState *st,           /* i/o : State struct     */
+    enum RXFrameType frame_type,/* i   : Frame type       */
+    Flag *pOverflow)
+{
+    enum DTXStateType newState;
+    enum DTXStateType encState;
+
+
+    /* DTX if SID frame or previously in DTX{_MUTE} and (NO_RX OR BAD_SPEECH) */
+
+    if ((frame_type == RX_SID_FIRST)   ||
+            (frame_type == RX_SID_UPDATE)  ||
+            (frame_type == RX_SID_BAD)     ||
+            (((st->dtxGlobalState == DTX) || (st->dtxGlobalState == DTX_MUTE)) &&
+             ((frame_type == RX_NO_DATA) || (frame_type == RX_SPEECH_BAD) ||
+              (frame_type == RX_ONSET))))
+    {
+        newState = DTX;
+
+        /* stay in mute for these input types */
+
+        if ((st->dtxGlobalState == DTX_MUTE) &&
+                ((frame_type == RX_SID_BAD) ||
+                 (frame_type == RX_SID_FIRST) ||
+                 (frame_type == RX_ONSET) ||
+                 (frame_type == RX_NO_DATA)))
+        {
+            newState = DTX_MUTE;
+        }
+
+        /* evaluate if noise parameters are too old                     */
+        /* since_last_sid is reset when CN parameters have been updated */
+        st->since_last_sid += 1;
+
+        /* no update of sid parameters in DTX for a long while      */
+        /* Due to the delayed update of  st->since_last_sid counter */
+        /* SID_UPDATE frames need to be handled separately to avoid */
+        /* entering DTX_MUTE for late SID_UPDATE frames             */
+        if ((frame_type != RX_SID_UPDATE) &&
+                (st->since_last_sid > DTX_MAX_EMPTY_THRESH))
+        {
+            newState = DTX_MUTE;
+        }
+    }
+    else
+    {
+        newState = SPEECH;
+        st->since_last_sid = 0;
+    }
+
+    /*
+    reset the decAnaElapsed Counter when receiving CNI data the first
+    time, to robustify counter missmatch after handover
+    this might delay the bwd CNI analysis in the new decoder slightly.
+    */
+
+    if ((st->data_updated == 0) &&
+            (frame_type == RX_SID_UPDATE))
+    {
+        st->decAnaElapsedCount = 0;
+    }
+
+    /* update the SPE-SPD DTX hangover synchronization */
+    /* to know when SPE has added dtx hangover         */
+    st->decAnaElapsedCount = add_16(st->decAnaElapsedCount, 1, pOverflow);
+    st->dtxHangoverAdded = 0;
+
+    if ((frame_type == RX_SID_FIRST)  ||
+            (frame_type == RX_SID_UPDATE) ||
+            (frame_type == RX_SID_BAD)    ||
+            (frame_type == RX_ONSET) ||
+            (frame_type == RX_NO_DATA))
+    {
+        encState = DTX;
+
+        /*
+         In frame errors simulations RX_NO_DATA may occasionally mean that
+         a speech packet was probably sent by the encoder,
+         the assumed _encoder_ state should be SPEECH in such cases.
+        */
+        if ((frame_type == RX_NO_DATA) &&
+                (newState == SPEECH))
+        {
+            encState = SPEECH;
+        }
+
+        /*
+         Note on RX_ONSET operation differing from RX_NO_DATA operation:
+         If a  RX_ONSET is received in the decoder (by "accident")
+         it is still most likely that the encoder  state
+         for the "ONSET frame" was DTX.
+        */
+    }
+    else
+    {
+        encState = SPEECH;
+    }
+
+
+    if (encState == SPEECH)
+    {
+        st->dtxHangoverCount = DTX_HANG_CONST;
+    }
+    else
+    {
+
+        if (st->decAnaElapsedCount > DTX_ELAPSED_FRAMES_THRESH)
+        {
+            st->dtxHangoverAdded = 1;
+            st->decAnaElapsedCount = 0;
+            st->dtxHangoverCount = 0;
+        }
+        else if (st->dtxHangoverCount == 0)
+        {
+            st->decAnaElapsedCount = 0;
+        }
+        else
+        {
+            st->dtxHangoverCount -= 1;
+        }
+    }
+
+    if (newState != SPEECH)
+    {
+        /* DTX or DTX_MUTE
+         * CN data is not in a first SID, first SIDs are marked as SID_BAD
+         *  but will do backwards analysis if a hangover period has been added
+         *  according to the state machine above
+        */
+
+        st->sid_frame = 0;
+        st->valid_data = 0;
+
+        if (frame_type == RX_SID_FIRST)
+        {
+            st->sid_frame = 1;
+        }
+        else if (frame_type == RX_SID_UPDATE)
+        {
+            st->sid_frame = 1;
+            st->valid_data = 1;
+        }
+        else if (frame_type == RX_SID_BAD)
+        {
+            st->sid_frame = 1;
+            st->dtxHangoverAdded = 0; /* use old data */
+        }
+    }
+
+    /* newState is used by both SPEECH AND DTX synthesis routines */
+    return(newState);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.h
new file mode 100644 (file)
index 0000000..af462f7
--- /dev/null
@@ -0,0 +1,181 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dtx_dec.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+    File             : dtx_dec.h
+    Purpose          : Decode comfort noice when in DTX
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef DTX_DEC_H
+#define DTX_DEC_H
+#define dtx_dec_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "d_plsf.h"
+#include "gc_pred.h"
+#include "c_g_aver.h"
+#include "frame.h"
+#include "dtx_common_def.h"
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    enum DTXStateType {SPEECH = 0, DTX, DTX_MUTE};
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 since_last_sid;
+        Word16 true_sid_period_inv;
+        Word16 log_en;
+        Word16 old_log_en;
+        Word32 L_pn_seed_rx;
+        Word16 lsp[M];
+        Word16 lsp_old[M];
+
+        Word16 lsf_hist[M*DTX_HIST_SIZE];
+        Word16 lsf_hist_ptr;
+        Word16 lsf_hist_mean[M*DTX_HIST_SIZE];
+        Word16 log_pg_mean;
+        Word16 log_en_hist[DTX_HIST_SIZE];
+        Word16 log_en_hist_ptr;
+
+        Word16 log_en_adjust;
+
+        Word16 dtxHangoverCount;
+        Word16 decAnaElapsedCount;
+
+        Word16 sid_frame;
+        Word16 valid_data;
+        Word16 dtxHangoverAdded;
+
+        enum DTXStateType dtxGlobalState;     /* contains previous state */
+        /* updated in main decoder */
+
+        Word16 data_updated;      /* marker to know if CNI data is ever renewed */
+
+    } dtx_decState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*
+     *  Function    : dtx_dec_reset
+     *  Purpose     : Resets state memory
+     *  Returns     : 0 on success
+     */
+    Word16 dtx_dec_reset(dtx_decState *st);
+
+    /*
+     *  Function    : dtx_dec
+     *  Purpose     :
+     *  Description :
+     */
+    void dtx_dec(
+        dtx_decState *st,                /* i/o : State struct                    */
+        Word16 mem_syn[],                /* i/o : AMR decoder state               */
+        D_plsfState* lsfState,           /* i/o : decoder lsf states              */
+        gc_predState* predState,         /* i/o : prediction states               */
+        Cb_gain_averageState* averState, /* i/o : CB gain average states          */
+        enum DTXStateType new_state,     /* i   : new DTX state                   */
+        enum Mode mode,                  /* i   : AMR mode                        */
+        Word16 parm[],                   /* i   : Vector of synthesis parameters  */
+        CommonAmrTbls* common_amr_tbls,  /* i   : Ptr to struct of table ptrs     */
+        Word16 synth[],                  /* o   : synthesised speech              */
+        Word16 A_t[],                    /* o   : decoded LP filter in 4 subframes*/
+        Flag   *pOverflow
+    );
+
+    void dtx_dec_activity_update(dtx_decState *st,
+                                 Word16 lsf[],
+                                 Word16 frame[],
+                                 Flag   *pOverflow);
+
+    /*
+     *  Function    : rx_dtx_handler
+     *  Purpose     : reads the frame type and checks history
+     *  Description : to decide what kind of DTX/CNI action to perform
+     */
+    enum DTXStateType rx_dtx_handler(dtx_decState *st,           /* i/o : State struct */
+                                     enum RXFrameType frame_type,/* i   : Frame type   */
+                                     Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEC_AMR_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.cpp
new file mode 100644 (file)
index 0000000..f5d4a9d
--- /dev/null
@@ -0,0 +1,720 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+
+ Filename: ec_gains.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ These modules execute the code book gains for error concealment. This module
+ contains the init, reset, exit, and "main" functions in this process.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "ec_gains.h"
+#include "typedef.h"
+#include "cnst.h"
+#include "gmed_n.h"
+#include "gc_pred.h"
+#include "basic_op.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ec_gain_code_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+  state = pointer to a pointer to a structure containing code state data of
+          stucture type ec_gain_codeState
+
+ Outputs:
+    None.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function resets the state data for the ec_gain module.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int ec_gain_code_reset (ec_gain_codeState *state)
+{
+  Word16 i;
+
+  if (state == (ec_gain_codeState *) NULL){
+      // fprintf(stderr, "ec_gain_code_reset: invalid parameter\n");
+      return -1;
+  }
+
+  for ( i = 0; i < 5; i++)
+      state->gbuf[i] = 1;
+  state->past_gain_code = 0;
+  state->prev_gc = 1;
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 ec_gain_code_reset(ec_gain_codeState *state)
+{
+    Word16 i;
+
+    if (state == (ec_gain_codeState *) NULL)
+    {
+        /* fprintf(stderr, "ec_gain_code_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    for (i = 0; i < 5; i++)
+        state->gbuf[i] = 1;
+    state->past_gain_code = 0;
+    state->prev_gc = 1;
+
+    return 0;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ec_gain_code
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+  st = pointer to a pointer to a structure containing code state data of
+       stucture type ec_gain_codeState
+  pred_state = pointer to MA predictor state of type gc_predState
+  state  = state of the state machine of type Word16
+  gain_code = pointer to decoded innovation gain of type Word16
+  pOverflow = pointer to overflow indicator of type Flag
+
+ Outputs:
+  st = pointer to a pointer to a structure containing code state data of
+       stucture type ec_gain_codeState
+  pred_state = pointer to MA predictor state of type gc_predState
+  pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+This function does error concealment using the codebook. Call this function
+only in BFI (instead of normal gain decoding function).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ec_gain.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+    static const Word16 cdown[7] =
+    {
+        32767, 32112, 32112, 32112,
+        32112, 32112, 22937
+    };
+
+    Word16 tmp;
+    Word16 qua_ener_MR122;
+    Word16 qua_ener;
+
+    // calculate median of last five gain values
+    tmp = gmed_n (st->gbuf,5);
+
+    // new gain = minimum(median, past_gain) * cdown[state]
+    if (sub (tmp, st->past_gain_code) > 0)
+    {
+        tmp = st->past_gain_code;
+    }
+    tmp = mult (tmp, cdown[state]);
+    *gain_code = tmp;
+
+    // update table of past quantized energies with average of
+    // current values
+
+    gc_pred_average_limited(pred_state, &qua_ener_MR122, &qua_ener);
+    gc_pred_update(pred_state, qua_ener_MR122, qua_ener);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void ec_gain_code(
+    ec_gain_codeState *st,    /* i/o : State struct                     */
+    gc_predState *pred_state, /* i/o : MA predictor state               */
+    Word16 state,             /* i   : state of the state machine       */
+    Word16 *gain_code,        /* o   : decoded innovation gain          */
+    Flag   *pOverflow
+)
+{
+    static const Word16 cdown[7] =
+    {
+        32767, 32112, 32112, 32112,
+        32112, 32112, 22937
+    };
+
+    Word16 tmp;
+    Word16 qua_ener_MR122;
+    Word16 qua_ener;
+
+    /* calculate median of last five gain values */
+    tmp = gmed_n(st->gbuf, 5);
+
+    /* new gain = minimum(median, past_gain) * cdown[state] */
+    if (sub(tmp, st->past_gain_code, pOverflow) > 0)
+    {
+        tmp = st->past_gain_code;
+    }
+    tmp = mult(tmp, cdown[state], pOverflow);
+    *gain_code = tmp;
+
+    /* update table of past quantized energies with average of
+     * current values
+     */
+    gc_pred_average_limited(pred_state, &qua_ener_MR122, &qua_ener, pOverflow);
+    gc_pred_update(pred_state, qua_ener_MR122, qua_ener);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ec_gain_code_update
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+  st = pointer to a pointer to a structure containing code state data of
+       stucture type ec_gain_codeState
+  bfi = a flag that indicates if the frame is bad of type Word16
+  prev_bf = a flag that indicates if the previous frame was bad of type Word16
+  gain_code = pointer to decoded innovation gain of type Word16
+  pOverflow = pointer to overflow indicator of type Flag
+
+ Outputs:
+  st = pointer to a pointer to a structure containing code state data of
+       stucture type ec_gain_codeState
+  gain_code = pointer to decoded innovation gain of type Word16
+  pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Purpose     : update the codebook gain concealment state;
+                limit gain_code if the previous frame was bad
+                Call this function always after decoding (or concealing)
+                the gain
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ec_gain.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+    Word16 i;
+
+    // limit gain_code by previous good gain if previous frame was bad
+    if (bfi == 0)
+    {
+        if (prev_bf != 0)
+        {
+            if (sub (*gain_code, st->prev_gc) > 0)
+            {
+                *gain_code = st->prev_gc;
+            }
+        }
+        st->prev_gc = *gain_code;
+    }
+
+    // update EC states: previous gain, gain buffer
+    st->past_gain_code = *gain_code;
+
+    for (i = 1; i < 5; i++)
+    {
+        st->gbuf[i - 1] = st->gbuf[i];
+    }
+    st->gbuf[4] = *gain_code;
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void ec_gain_code_update(
+    ec_gain_codeState *st,    /* i/o : State struct                     */
+    Word16 bfi,               /* i   : flag: frame is bad               */
+    Word16 prev_bf,           /* i   : flag: previous frame was bad     */
+    Word16 *gain_code,        /* i/o : decoded innovation gain          */
+    Flag   *pOverflow
+)
+{
+    Word16 i;
+
+    /* limit gain_code by previous good gain if previous frame was bad */
+    if (bfi == 0)
+    {
+        if (prev_bf != 0)
+        {
+            if (sub(*gain_code, st->prev_gc, pOverflow) > 0)
+            {
+                *gain_code = st->prev_gc;
+            }
+        }
+        st->prev_gc = *gain_code;
+    }
+
+    /* update EC states: previous gain, gain buffer */
+    st->past_gain_code = *gain_code;
+
+    for (i = 1; i < 5; i++)
+    {
+        st->gbuf[i - 1] = st->gbuf[i];
+    }
+    st->gbuf[4] = *gain_code;
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ec_gain_pitch
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+  st = pointer to a pointer to a structure containing code
+       state data of stucture type ec_gain_pitchState
+  state = state of the state machine of type Word16
+  pOverflow = pointer to overflow indicator of type Flag
+
+  Outputs:
+  state = pointer to a pointer to a structure containing code
+          state data of stucture type ec_gain_pitchState
+  gain_pitch = pointer to pitch gain (Q14) of type Word16
+  pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function conceals the error using code gain implementation in this
+ function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ec_gain.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+    static const Word16 pdown[7] =
+    {
+        32767, 32112, 32112, 26214,
+        9830, 6553, 6553
+    };
+
+    Word16 tmp;
+
+    // calculate median of last five gains
+    tmp = gmed_n (st->pbuf, 5);
+
+    // new gain = minimum(median, past_gain) * pdown[state]
+    if (sub (tmp, st->past_gain_pit) > 0)
+    {
+        tmp = st->past_gain_pit;
+    }
+    *gain_pitch = mult (tmp, pdown[state]);
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void ec_gain_pitch(
+    ec_gain_pitchState *st, /* i/o : state variables                   */
+    Word16 state,           /* i   : state of the state machine        */
+    Word16 *gain_pitch,     /* o   : pitch gain (Q14)                  */
+    Flag   *pOverflow
+)
+{
+    static const Word16 pdown[7] =
+    {
+        32767, 32112, 32112, 26214,
+        9830, 6553, 6553
+    };
+
+    Word16 tmp;
+
+    /* calculate median of last five gains */
+    tmp = gmed_n(st->pbuf, 5);
+
+    /* new gain = minimum(median, past_gain) * pdown[state] */
+    if (sub(tmp, st->past_gain_pit, pOverflow) > 0)
+    {
+        tmp = st->past_gain_pit;
+    }
+    *gain_pitch = mult(tmp, pdown[state], pOverflow);
+}
+
+/****************************************************************************/
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ec_gain_pitch_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+  state = state of the state machine of type Word16
+  pOverflow = pointer to overflow indicator of type Flag
+
+  Outputs:
+  state = pointer to a pointer to a structure containing code
+          state data of stucture type ec_gain_pitchState
+  pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Function:   ec_gain_pitch_reset
+ Purpose:    Resets state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ec_gain.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int ec_gain_pitch_reset (ec_gain_pitchState *state)
+{
+  Word16 i;
+
+  if (state == (ec_gain_pitchState *) NULL){
+      // fprintf(stderr, "ec_gain_pitch_reset: invalid parameter\n");
+      return -1;
+  }
+
+  for(i = 0; i < 5; i++)
+      state->pbuf[i] = 1640;
+  state->past_gain_pit = 0;
+  state->prev_gp = 16384;
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 ec_gain_pitch_reset(ec_gain_pitchState *state)
+{
+    Word16 i;
+
+    if (state == (ec_gain_pitchState *) NULL)
+    {
+        /* fprintf(stderr, "ec_gain_pitch_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    for (i = 0; i < 5; i++)
+        state->pbuf[i] = 1640;
+    state->past_gain_pit = 0;
+    state->prev_gp = 16384;
+
+    return 0;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ec_gain_pitch_update
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+  st = pointer to a pointer to a structure containing code
+       state data of stucture type ec_gain_pitchState
+  bfi = flag indicating the frame is bad of type Word16
+  prev_bf = flag indicating the previous frame was bad of type Word16
+  gain_pitch = pointer to pitch gain of type Word16
+  pOverflow = pointer to overflow indicator of type Flag
+
+  Outputs:
+  state = pointer to a pointer to a structure containing code
+          state data of stucture type ec_gain_pitchState
+  gain_pitch = pointer to pitch gain of type Word16
+  pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Purpose     : update the pitch gain concealment state;
+                limit gain_pitch if the previous frame was bad
+                Call this function always after decoding (or concealing)
+                the gain
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ec_gain.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+    Word16 i;
+
+    if (bfi == 0)
+    {
+        if (prev_bf != 0)
+        {
+            if (sub (*gain_pitch, st->prev_gp) > 0)
+            {
+                *gain_pitch = st->prev_gp;
+            }
+        }
+        st->prev_gp = *gain_pitch;
+    }
+
+    st->past_gain_pit = *gain_pitch;
+
+    if (sub (st->past_gain_pit, 16384) > 0)  // if (st->past_gain_pit > 1.0)
+    {
+        st->past_gain_pit = 16384;
+    }
+    for (i = 1; i < 5; i++)
+    {
+        st->pbuf[i - 1] = st->pbuf[i];
+    }
+    st->pbuf[4] = st->past_gain_pit;
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void ec_gain_pitch_update(
+    ec_gain_pitchState *st, /* i/o : state variables                   */
+    Word16 bfi,             /* i   : flag: frame is bad                */
+    Word16 prev_bf,         /* i   : flag: previous frame was bad      */
+    Word16 *gain_pitch,     /* i/o : pitch gain                        */
+    Flag   *pOverflow
+)
+{
+    Word16 i;
+
+    if (bfi == 0)
+    {
+        if (prev_bf != 0)
+        {
+            if (sub(*gain_pitch, st->prev_gp, pOverflow) > 0)
+            {
+                *gain_pitch = st->prev_gp;
+            }
+        }
+        st->prev_gp = *gain_pitch;
+    }
+
+    st->past_gain_pit = *gain_pitch;
+
+    if (sub(st->past_gain_pit, 16384, pOverflow) > 0)
+        /* if (st->past_gain_pit > 1.0) */
+    {
+        st->past_gain_pit = 16384;
+    }
+    for (i = 1; i < 5; i++)
+    {
+        st->pbuf[i - 1] = st->pbuf[i];
+    }
+    st->pbuf[4] = st->past_gain_pit;
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.h
new file mode 100644 (file)
index 0000000..6a16e0f
--- /dev/null
@@ -0,0 +1,196 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Filename: ec_gains.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : ec_gains.c
+      Purpose:         : Error concealment for pitch and codebook gains
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _EC_GAINS_H_
+#define _EC_GAINS_H_
+#define ec_gains_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "gc_pred.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 pbuf[5];
+        Word16 past_gain_pit;
+        Word16 prev_gp;
+    } ec_gain_pitchState;
+
+    typedef struct
+    {
+        Word16 gbuf[5];
+        Word16 past_gain_code;
+        Word16 prev_gc;
+    } ec_gain_codeState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*
+     *  Function    : ec_gain_code_reset
+     *  Purpose     : Resets state memory
+     *
+     */
+    Word16 ec_gain_code_reset(
+        ec_gain_codeState *state
+    );
+
+
+    /*
+     *  Function    : ec_gain_code
+     *  Purpose     : conceal the codebook gain
+     *                Call this function only in BFI (instead of normal gain
+     *                decoding function)
+     */
+    void ec_gain_code(
+        ec_gain_codeState *st,    /* i/o : State struct                     */
+        gc_predState *pred_state, /* i/o : MA predictor state               */
+        Word16 state,             /* i   : state of the state machine       */
+        Word16 *gain_code,        /* o   : decoded innovation gain          */
+        Flag   *pOverflow
+    );
+
+    /*
+     *  Function    : ec_gain_code_update
+     *  Purpose     : update the codebook gain concealment state;
+     *                limit gain_code if the previous frame was bad
+     *                Call this function always after decoding (or concealing)
+     *                the gain
+     */
+    void ec_gain_code_update(
+        ec_gain_codeState *st,    /* i/o : State struct                     */
+        Word16 bfi,               /* i   : flag: frame is bad               */
+        Word16 prev_bf,           /* i   : flag: previous frame was bad     */
+        Word16 *gain_code,        /* i/o : decoded innovation gain          */
+        Flag   *pOverflow
+    );
+
+
+    /*
+     *  Function:   ec_gain_pitch_reset
+     *  Purpose:    Resets state memory
+     */
+    Word16 ec_gain_pitch_reset(
+        ec_gain_pitchState *state
+    );
+
+    /*
+     *  Function    : ec_gain_pitch_exit
+     *  Purpose     : The memory used for state memory is freed
+     */
+    void ec_gain_pitch_exit(
+        ec_gain_pitchState **state
+    );
+
+    /*
+     *  Function    : ec_gain_pitch
+     *  Purpose     : conceal the pitch gain
+     *                Call this function only in BFI (instead of normal gain
+     *                decoding function)
+     */
+    void ec_gain_pitch(
+        ec_gain_pitchState *st, /* i/o : state variables                   */
+        Word16 state,           /* i   : state of the state machine        */
+        Word16 *gain_pitch,     /* o   : pitch gain (Q14)                  */
+        Flag   *pOverflow
+    );
+
+    /*
+     *  Function    : ec_gain_pitch_update
+     *  Purpose     : update the pitch gain concealment state;
+     *                limit gain_pitch if the previous frame was bad
+     *                Call this function always after decoding (or concealing)
+     *                the gain
+     */
+    void ec_gain_pitch_update(
+        ec_gain_pitchState *st, /* i/o : state variables                   */
+        Word16 bfi,             /* i   : flag: frame is bad                */
+        Word16 prev_bf,         /* i   : flag: previous frame was bad      */
+        Word16 *gain_pitch,     /* i/o : pitch gain                        */
+        Flag   *pOverflow
+    );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _EC_GAINS_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.cpp
new file mode 100644 (file)
index 0000000..9fae32a
--- /dev/null
@@ -0,0 +1,191 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ex_ctrl.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "ex_ctrl.h"
+#include "typedef.h"
+#include "cnst.h"
+#include "set_zero.h"
+#include "gmed_n.h"
+#include "sqrt_l.h"
+#include "basic_op.h"
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ex_ctrl
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ excitation = pointer to current subframe excitation of type Word16
+ excEnergy = Exc. Energy, sqrt(totEx*totEx) of type Word16
+ exEnergyHist = pointer to history of subframe energies of type Word16
+ voicedHangover = # of fr. after last voiced fr  of type Word16
+ carefulFlag = restrict dynamic in scaling of type Word16
+ pOverflow = pointer to overflow indicator
+
+ Outputs:
+ pOverflow = 1 if overflow exists in the math functions called by this function.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Function    : Ex_ctrl
+ Purpose     : Charaterice synthesis speech and detect background noise
+ Returns     : background noise decision; 0 = no bgn, 1 = bgn
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ex_ctrl.c, 3GPP TS 26.101 version 4.1.0 Release 4, June 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 Ex_ctrl(Word16 excitation[],    /*i/o: Current subframe excitation   */
+               Word16 excEnergy,      /* i : Exc. Energy, sqrt(totEx*totEx)*/
+               Word16 exEnergyHist[], /* i : History of subframe energies  */
+               Word16 voicedHangover, /* i : # of fr. after last voiced fr.*/
+               Word16 prevBFI,        /* i : Set i previous BFI            */
+               Word16 carefulFlag,    /* i : Restrict dymamic in scaling   */
+               Flag   *pOverflow
+              )
+{
+    Word16 i, exp;
+    Word16 testEnergy, scaleFactor, avgEnergy, prevEnergy;
+    Word32 t0;
+
+    /* get target level */
+    avgEnergy = gmed_n(exEnergyHist, 9);
+
+    prevEnergy = (exEnergyHist[7] + exEnergyHist[8]) >> 1;
+    if (exEnergyHist[8] < prevEnergy)
+    {
+        prevEnergy = exEnergyHist[8];
+    }
+
+    /* upscaling to avoid too rapid energy rises  for some cases */
+    if ((excEnergy < avgEnergy) && (excEnergy > 5))
+    {
+        testEnergy = shl(prevEnergy, 2, pOverflow);  /* testEnergy = 4*prevEnergy; */
+
+        if ((voicedHangover < 7) || prevBFI != 0)
+        {
+            /* testEnergy = 3*prevEnergy */
+            testEnergy = sub(testEnergy, prevEnergy, pOverflow);
+        }
+
+        if (avgEnergy > testEnergy)
+        {
+            avgEnergy = testEnergy;
+        }
+
+        /* scaleFactor=avgEnergy/excEnergy in Q0 (const 29 below)*/
+        exp = norm_s(excEnergy);
+        excEnergy = shl(excEnergy, exp, pOverflow);
+        excEnergy = div_s((Word16) 16383, excEnergy);
+        t0 = L_mult(avgEnergy, excEnergy, pOverflow);
+        t0 = L_shr(t0, sub(20, exp, pOverflow), pOverflow);
+        /* const=30 for t0 in Q0, 20 for Q10 */
+        if (t0 > 32767)
+        {
+            t0 = 32767; /* saturate  */
+        }
+        scaleFactor = (Word16)(t0);
+
+        /* test if scaleFactor > 3.0 */
+        if (carefulFlag != 0 && (scaleFactor > 3072))
+        {
+            scaleFactor = 3072;
+        }
+
+        /* scale the excitation by scaleFactor */
+        for (i = 0; i < L_SUBFR; i++)
+        {
+            t0 = L_mult(scaleFactor, excitation[i], pOverflow);
+            t0 = L_shr(t0, 11, pOverflow);
+            excitation[i] = (Word16)(t0);
+        }
+    }
+
+    return 0;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.h
new file mode 100644 (file)
index 0000000..8f6472f
--- /dev/null
@@ -0,0 +1,122 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ex_ctrl.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+     File             : ex_ctrl.h
+     Purpose          : Excitation Control module in background noise
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef ex_ctrl_h
+#define ex_ctrl_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define L_ENERGYHIST 60
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    /*
+     *  Function    : Ex_ctrl
+     *  Purpose     : Charaterice synthesis speech and detect background noise
+     *  Returns     : background noise decision; 0 = bgn, 1 = no bgn
+     */
+    Word16 Ex_ctrl(Word16 excitation[],    /*i/o: Current subframe excitation   */
+    Word16 excEnergy,      /* i : Exc. Energy, sqrt(totEx*totEx)*/
+    Word16 exEnergyHist[], /* i : History of subframe energies  */
+    Word16 voicedHangover, /* i : # of fr. after last voiced fr.*/
+    Word16 prevBFI,        /* i : Set i previous BFI            */
+    Word16 carefulFlag,    /* i : Restrict dymamic in scaling   */
+    Flag   *pOverflow
+                  );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ex_ctrl_h_ */
+
+
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/gsmamr_dec.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/gsmamr_dec.h
new file mode 100644 (file)
index 0000000..4b43c9b
--- /dev/null
@@ -0,0 +1,150 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: gsmamr_dec.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This header contains all the necessary information needed to allow the gsm amr
+ decoder library to be used properly upon release.
+
+------------------------------------------------------------------------------
+*/
+#ifndef _GSMAMR_DEC_H_
+#define _GSMAMR_DEC_H_
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "gsm_amr_typedefs.h"
+#include "pvamrnbdecoder_api.h"
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ----------------------------------------------------------------------------*/
+    /* Number of 13-bit linear PCM samples per 20 ms frame */
+    /* L_FRAME = (8 kHz) * (20 msec) = 160 samples         */
+#define L_FRAME     160
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    enum Frame_Type_3GPP
+    {
+        AMR_475 = 0,        /* 4.75 kbps    */
+        AMR_515,            /* 5.15 kbps    */
+        AMR_59,             /* 5.9 kbps     */
+        AMR_67,             /* 6.7 kbps     */
+        AMR_74,             /* 7.4 kbps     */
+        AMR_795,            /* 7.95 kbps    */
+        AMR_102,            /* 10.2 kbps    */
+        AMR_122,            /* 12.2 kbps    */
+        AMR_SID,            /* GSM AMR DTX  */
+        GSM_EFR_SID,        /* GSM EFR DTX  */
+        TDMA_EFR_SID,       /* TDMA EFR DTX */
+        PDC_EFR_SID,        /* PDC EFR DTX  */
+        FOR_FUTURE_USE1,    /* Unused 1     */
+        FOR_FUTURE_USE2,    /* Unused 2     */
+        FOR_FUTURE_USE3,    /* Unused 3     */
+        AMR_NO_DATA
+    };      /* No data      */
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ----------------------------------------------------------------------------*/
+    /*
+     * This function allocates memory for filter structure and initializes state
+     * memory used by the GSM AMR decoder. This function returns zero. It will
+     * return negative one if there is an error.
+     */
+    Word16 GSMInitDecode(void **state_data,
+                         Word8 *id);
+
+    /*
+     * AMRDecode steps into the part of the library that decodes the raw data
+     * speech bits for the decoding process. It returns the address offset of
+     * the next frame to be decoded.
+     */
+    Word16 AMRDecode(
+        void                      *state_data,
+        enum Frame_Type_3GPP      frame_type,
+        UWord8                    *speech_bits_ptr,
+        Word16                    *raw_pcm_buffer,
+        Word16                    input_format
+    );
+
+    /*
+     * This function resets the state memory used by the GSM AMR decoder. This
+     * function returns zero. It will return negative one if there is an error.
+     */
+    Word16 Speech_Decode_Frame_reset(void *state_data);
+
+    /*
+     * This function frees up the memory used for the state memory of the
+     * GSM AMR decoder.
+     */
+    void GSMDecodeFrameExit(void **state_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _GSMAMR_DEC_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.cpp
new file mode 100644 (file)
index 0000000..6463bec
--- /dev/null
@@ -0,0 +1,183 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Filename: if2_to_ets.cpp
+ Funtions: if2_to_ets
+
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "frame_type_3gpp.h"
+#include "if2_to_ets.h"
+#include "typedef.h"
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: if2_to_ets
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    frame_type_3gpp = decoder speech bit rate (enum Frame_Type_3GPP)
+    if2_input_ptr   = pointer to input encoded speech bits in IF2 format (Word8)
+    ets_output_ptr  = pointer to output encoded speech bits in ETS format (Word16)
+
+ Outputs:
+    ets_output_ptr  = pointer to encoded speech bits in the ETS format (Word16)
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs a transformation on the data buffers. It converts the
+ data format from IF2 to ETS. IF2 is the storage format where the frame type
+ is in the first four bits of the first byte. The upper four bits of that byte
+ contain the first four encoded speech bits for the frame. The following bytes
+ contain the rest of the encoded speech bits. The final byte has padded zeros
+ to make the frame byte aligned. ETS format has the encoded speech
+ bits each separate with only one bit stored in each word.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0 Release 4, June 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void if2_to_ets(
+    enum Frame_Type_3GPP frame_type_3gpp,
+    UWord8   *if2_input_ptr,
+    Word16   *ets_output_ptr,
+    CommonAmrTbls* common_amr_tbls)
+{
+
+    Word16 i;
+    Word16 j;
+    Word16 x = 0;
+    const Word16* numCompressedBytes_ptr = common_amr_tbls->numCompressedBytes_ptr;
+    const Word16* numOfBits_ptr = common_amr_tbls->numOfBits_ptr;
+    const Word16* const* reorderBits_ptr = common_amr_tbls->reorderBits_ptr;
+
+    /*
+     * The following section of code accesses bits in the IF2 method of
+     * bit ordering. Each bit is given its own location in the buffer pointed
+     * to by ets_output_ptr. The bits (for modes less than AMR_SID) are
+     * reordered using the tables in bitreorder.c before the data is stored
+     * into the buffer pointed to by ets_output_ptr.
+     */
+
+    if (frame_type_3gpp < AMR_SID)
+    {
+        for (j = 4; j < 8; j++)
+        {
+            ets_output_ptr[reorderBits_ptr[frame_type_3gpp][x++]] =
+                (if2_input_ptr[0] >> j) & 0x01;
+        }
+        for (i = 1; i < numCompressedBytes_ptr[frame_type_3gpp]; i++)
+        {
+            for (j = 0; j < 8; j++)
+            {
+                if (x >= numOfBits_ptr[frame_type_3gpp])
+                {
+                    break;
+                }
+                ets_output_ptr[reorderBits_ptr[frame_type_3gpp][x++]] =
+                    (if2_input_ptr[i] >> j) & 0x01;
+            }
+        }
+    }
+    else
+    {
+        for (j = 4; j < 8; j++)
+        {
+            ets_output_ptr[x++] =
+                (if2_input_ptr[0] >> j) & 0x01;
+        }
+        for (i = 1; i < numCompressedBytes_ptr[frame_type_3gpp]; i++)
+        {
+            for (j = 0; j < 8; j++)
+            {
+                ets_output_ptr[x++] =
+                    (if2_input_ptr[i] >> j) & 0x01;
+            }
+        }
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.h
new file mode 100644 (file)
index 0000000..4994991
--- /dev/null
@@ -0,0 +1,111 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: if2_to_ets.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the if2_to_ets function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef IF2_TO_ETS_H
+#define IF2_TO_ETS_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "frame_type_3gpp.h"
+#include "typedef.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void if2_to_ets(enum Frame_Type_3GPP frame_type_3gpp,
+    UWord8   *if2_input_ptr,
+    Word16   *ets_output_ptr,
+    CommonAmrTbls* common_amr_tbls);
+
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp
new file mode 100644 (file)
index 0000000..e50eb6c
--- /dev/null
@@ -0,0 +1,270 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: int_lsf.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "int_lsf.h"
+#include    "typedef.h"
+#include    "basic_op.h"
+#include    "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Int_lsf
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lsf_old = LSF vector at the 4th SF of past frame (Word16)
+    lsf_new = LSF vector at the 4th SF of present frame (Word16)
+    i_subfr = Current subframe (equal to 0,40,80 or 120) (Word16)
+    lsf_out = interpolated LSF parameters for current subframe (Word16)
+
+ Outputs:
+    lsf_out   = new interpolated LSF parameters for current subframe
+    pOverflow = pointer of type Flag * to overflow indicator.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function interpolates the LSFs for selected subframe.
+ The 20 ms speech frame is divided into 4 subframes. The LSFs are
+ interpolated at the 1st, 2nd and 3rd subframe and only forwarded
+ at the 4th subframe.
+
+                      |------|------|------|------|
+                         sf1    sf2    sf3    sf4
+                   F0                          F1
+
+                 sf1:   3/4 F0 + 1/4 F1         sf3:   1/4 F0 + 3/4 F1
+                 sf2:   1/2 F0 + 1/2 F1         sf4:       F1
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ int_lsf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Int_lsf(
+    Word16 lsf_old[], // i : LSF vector at the 4th SF of past frame
+    Word16 lsf_new[], // i : LSF vector at the 4th SF of present frame
+    Word16 i_subfr,   // i : Pointer to current sf (equal to 0,40,80 or 120)
+    Word16 lsf_out[]  // o : interpolated LSF parameters for current sf
+)
+{
+    Word16 i;
+
+    if ( i_subfr == 0 )
+    {
+       for (i = 0; i < M; i++) {
+          lsf_out[i] = add(sub(lsf_old[i], shr(lsf_old[i], 2)),
+                           shr(lsf_new[i], 2));
+       }
+    }
+    else if ( sub(i_subfr, 40) == 0 )
+    {
+       for (i = 0; i < M; i++) {
+          lsf_out[i] = add(shr(lsf_old[i],1), shr(lsf_new[i], 1) );
+       }
+    }
+    else if ( sub(i_subfr, 80) == 0 )
+    {
+       for (i = 0; i < M; i++) {
+          lsf_out[i] = add(shr(lsf_old[i], 2),
+                           sub(lsf_new[i], shr(lsf_new[i], 2)));
+       }
+    }
+    else if ( sub(i_subfr, 120) == 0 )
+    {
+       for (i = 0; i < M; i++) {
+          lsf_out[i] = lsf_new[i];
+       }
+    }
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Int_lsf(
+    Word16 lsf_old[], /* i : LSF vector at the 4th SF of past frame         */
+    Word16 lsf_new[], /* i : LSF vector at the 4th SF of present frame      */
+    Word16 i_subfr,   /* i : Current sf (equal to 0,40,80 or 120)           */
+    Word16 lsf_out[], /* o : interpolated LSF parameters for current sf     */
+    Flag  *pOverflow  /* o : flag set if overflow occurs                    */
+)
+{
+    register Word16 i;
+    register Word16 temp1;
+    register Word16 temp2;
+
+    if (i_subfr == 0)
+    {
+        for (i = M - 1; i >= 0; i--)
+        {
+            if (*(lsf_old + i) < 0)
+            {
+                temp1 = ~(~(*(lsf_old + i)) >> 2);
+            }
+            else
+            {
+                temp1 = *(lsf_old + i) >> 2;
+            }
+            if (*(lsf_new + i) < 0)
+            {
+                temp2 = ~(~(*(lsf_new + i)) >> 2);
+            }
+            else
+            {
+                temp2 = *(lsf_new + i) >> 2;
+            }
+            *(lsf_out + i) = add_16((Word16)(*(lsf_old + i) - temp1),
+                                    (Word16)temp2,
+                                    pOverflow);
+        }
+    }
+
+    else if (i_subfr == 40)
+    {
+        for (i = M - 1; i >= 0; i--)
+        {
+            if (*(lsf_old + i) < 0)
+            {
+                temp1 = ~(~(*(lsf_old + i)) >> 1);
+            }
+            else
+            {
+                temp1 = *(lsf_old + i) >> 1;
+            }
+            if (*(lsf_new + i) < 0)
+            {
+                temp2 = ~(~(*(lsf_new + i)) >> 1);
+            }
+            else
+            {
+                temp2 = *(lsf_new + i) >> 1;
+            }
+            *(lsf_out + i) = temp1 + temp2;
+        }
+    }
+
+    else if (i_subfr == 80)
+    {
+        for (i = M - 1; i >= 0; i--)
+        {
+            if (*(lsf_old + i) < 0)
+            {
+                temp1 = ~(~(*(lsf_old + i)) >> 2);
+            }
+            else
+            {
+                temp1 = *(lsf_old + i) >> 2;
+            }
+            if (*(lsf_new + i) < 0)
+            {
+                temp2 = ~(~(*(lsf_new + i)) >> 2);
+            }
+            else
+            {
+                temp2 = *(lsf_new + i) >> 2;
+            }
+            *(lsf_out + i) = add_16((Word16)temp1,
+                                    (Word16)(*(lsf_new + i) - temp2),
+                                    pOverflow);
+
+        }
+    }
+
+    else if (i_subfr == 120)
+    {
+        for (i = M - 1; i >= 0; i--)
+        {
+            *(lsf_out + i) = *(lsf_new + i);
+        }
+    }
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.cpp
new file mode 100644 (file)
index 0000000..2850d6e
--- /dev/null
@@ -0,0 +1,250 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: lsp_avg.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+    LSP averaging and history
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "lsp_avg.h"
+#include "basic_op.h"
+#include "oper_32b.h"
+#include "oscl_mem.h"
+#include "q_plsf_5_tbl.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lsp_avg_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to structure of type lsp_avgState
+
+ Outputs:
+    fields of the structure pointed to by state are initialized.
+
+ Returns:
+    return_value = 0, if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+lsp_avg.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int lsp_avg_reset (lsp_avgState *st)
+{
+  if (st == (lsp_avgState *) NULL){
+      // fprintf(stderr, "lsp_avg_reset: invalid parameter\n");
+      return -1;
+  }
+
+  Copy(mean_lsf, &st->lsp_meanSave[0], M);
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 lsp_avg_reset(lsp_avgState *st, const Word16* mean_lsf_5_ptr)
+{
+    if (st == (lsp_avgState *) NULL)
+    {
+        /* fprintf(stderr, "lsp_avg_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    oscl_memmove((void *)&st->lsp_meanSave[0], mean_lsf_5_ptr, M*sizeof(*mean_lsf_5_ptr));
+
+    return 0;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lsp_avg
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st  = pointer to structure of type lsp_avgState
+    lsp = pointer to Word16, which reflects the state of the state machine
+
+ Outputs:
+    st = pointer to structure of type lsp_avgState
+    pOverflow = pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+lsp_avg.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+void lsp_avg (
+    lsp_avgState *st,         // i/o : State struct                 Q15
+    Word16 *lsp               // i   : state of the state machine   Q15
+)
+{
+    Word16 i;
+    Word32 L_tmp;            // Q31
+
+    for (i = 0; i < M; i++) {
+
+       // mean = 0.84*mean
+       L_tmp = L_deposit_h(st->lsp_meanSave[i]);
+       L_tmp = L_msu(L_tmp, EXPCONST, st->lsp_meanSave[i]);
+
+       // Add 0.16 of newest LSPs to mean
+       L_tmp = L_mac(L_tmp, EXPCONST, lsp[i]);
+
+       // Save means
+       st->lsp_meanSave[i] = pv_round(L_tmp);   // Q15
+    }
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void lsp_avg(
+    lsp_avgState *st,         /* i/o : State struct                 Q15 */
+    Word16 *lsp,              /* i   : state of the state machine   Q15 */
+    Flag   *pOverflow         /* o   : Flag set when overflow occurs    */
+)
+{
+    Word16 i;
+    Word32 L_tmp;            /* Q31 */
+
+    for (i = 0; i < M; i++)
+    {
+
+        /* mean = 0.84*mean */
+        L_tmp = ((Word32)st->lsp_meanSave[i] << 16);
+        L_tmp = L_msu(L_tmp, EXPCONST, st->lsp_meanSave[i], pOverflow);
+
+        /* Add 0.16 of newest LSPs to mean */
+        L_tmp = L_mac(L_tmp, EXPCONST, lsp[i], pOverflow);
+
+        /* Save means */
+        st->lsp_meanSave[i] = pv_round(L_tmp, pOverflow);   /* Q15 */
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.h
new file mode 100644 (file)
index 0000000..4b45b96
--- /dev/null
@@ -0,0 +1,120 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: lsp_avg.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsp_avg.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef lsp_avg_h
+#define lsp_avg_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define EXPCONST          5243               /* 0.16 in Q15 */
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 lsp_meanSave[M];          /* Averaged LSPs saved for efficiency  */
+    } lsp_avgState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    Word16 lsp_avg_reset(
+        lsp_avgState *state,
+        const Word16* mean_lsf_5_ptr
+    );
+
+
+    void lsp_avg(
+        lsp_avgState *st,     /* i/o : State struct                 Q15 */
+        Word16 *lsp,          /* i   : LSP vector                   Q15 */
+        Flag   *pOverflow     /* o   : Flag set when overflow occurs    */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LSP_LSF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp
new file mode 100644 (file)
index 0000000..22fe3b5
--- /dev/null
@@ -0,0 +1,796 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ph_disp.cpp
+ Functions:
+            ph_disp_reset
+            ph_disp_lock
+            ph_disp_release
+            ph_disp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the function that performs adaptive phase dispersion of
+ the excitation signal. The phase dispersion initialization, reset, and
+ exit functions are included in this file, as well as, the phase dispersion
+ lock and release functions.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "ph_disp.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ph_disp_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a structure of type ph_dispState
+
+ Outputs:
+    Structure pointed to by state is initialized to zeros
+
+ Returns:
+    return_value = 0, if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function resets the variables used by the phase dispersion function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ph_disp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int ph_disp_reset (ph_dispState *state)
+{
+  Word16 i;
+
+   if (state == (ph_dispState *) NULL){
+      fprint(stderr, "ph_disp_reset: invalid parameter\n");
+      return -1;
+   }
+   for (i=0; i<PHDGAINMEMSIZE; i++)
+   {
+       state->gainMem[i] = 0;
+   }
+   state->prevState = 0;
+   state->prevCbGain = 0;
+   state->lockFull = 0;
+   state->onset = 0;          // assume no onset in start
+
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 ph_disp_reset(ph_dispState *state)
+{
+    register Word16 i;
+
+    if (state == (ph_dispState *) NULL)
+    {
+        /*  fprint(stderr, "ph_disp_reset: invalid parameter\n");  */
+        return(-1);
+    }
+    for (i = 0; i < PHDGAINMEMSIZE; i++)
+    {
+        state->gainMem[i] = 0;
+    }
+    state->prevState = 0;
+    state->prevCbGain = 0;
+    state->lockFull = 0;
+    state->onset = 0;          /* assume no onset in start */
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ph_disp_lock
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a structure of type ph_dispState
+
+ Outputs:
+    lockFull field of the structure pointed to by state is set to 1
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function sets the lockFull flag to indicate a lock condition.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ph_disp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void ph_disp_lock (ph_dispState *state)
+{
+  state->lockFull = 1;
+  return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void ph_disp_lock(ph_dispState *state)
+{
+    state->lockFull = 1;
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ph_disp_release
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a structure of type ph_dispState
+
+ Outputs:
+    lockFull field of the structure pointed to by state is set to 0
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function clears the lockFull flag to indicate an unlocked state.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ph_disp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void ph_disp_release (ph_dispState *state)
+{
+  state->lockFull = 0;
+  return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void ph_disp_release(ph_dispState *state)
+{
+    state->lockFull = 0;
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ph_disp
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a structure of type ph_dispState
+    mode = codec mode (enum Mode)
+    x = LTP excitation signal buffer (Word16)
+    cbGain = codebook gain (Word16)
+    ltpGain = LTP gain (Word16)
+    inno = innovation buffer (Word16)
+    pitch_fac = pitch factor used to scale the LTP excitation (Word16)
+    tmp_shift = shift factor applied to sum of scaled LTP excitation and
+                innovation before rounding (Word16)
+    pOverflow = pointer to overflow indicator (Flag)
+
+ Outputs:
+    structure pointed to by state contains the updated gainMem array,
+      prevState, prevCbGain, and onset fields
+    x buffer contains the new excitation signal
+    inno buffer contains the new innovation signal
+    pOverflow -> 1 if there is overflow
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs adaptive phase dispersion, i.e., forming of total
+ excitation for the synthesis part of the decoder.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ph_disp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void ph_disp (
+      ph_dispState *state, // i/o     : State struct
+      enum Mode mode,      // i       : codec mode
+      Word16 x[],          // i/o Q0  : in:  LTP excitation signal
+                           //           out: total excitation signal
+      Word16 cbGain,       // i   Q1  : Codebook gain
+      Word16 ltpGain,      // i   Q14 : LTP gain
+      Word16 inno[],       // i/o Q13 : Innovation vector (Q12 for 12.2)
+      Word16 pitch_fac,    // i   Q14 : pitch factor used to scale the
+                                        LTP excitation (Q13 for 12.2)
+      Word16 tmp_shift     // i   Q0  : shift factor applied to sum of
+                                        scaled LTP ex & innov. before
+                                        rounding
+)
+{
+   Word16 i, i1;
+   Word16 tmp1;
+   Word32 L_temp;
+   Word16 impNr;           // indicator for amount of disp./filter used
+
+   Word16 inno_sav[L_SUBFR];
+   Word16 ps_poss[L_SUBFR];
+   Word16 j, nze, nPulse, ppos;
+   const Word16 *ph_imp;   // Pointer to phase dispersion filter
+
+   // Update LTP gain memory
+   for (i = PHDGAINMEMSIZE-1; i > 0; i--)
+   {
+       state->gainMem[i] = state->gainMem[i-1];
+   }
+   state->gainMem[0] = ltpGain;
+
+   // basic adaption of phase dispersion
+   if (sub(ltpGain, PHDTHR2LTP) < 0) {    // if (ltpGain < 0.9)
+       if (sub(ltpGain, PHDTHR1LTP) > 0)
+       {  // if (ltpGain > 0.6
+          impNr = 1; // medium dispersion
+       }
+       else
+       {
+          impNr = 0; // maximum dispersion
+       }
+   }
+   else
+   {
+      impNr = 2; // no dispersion
+   }
+
+   // onset indicator
+   // onset = (cbGain  > onFact * cbGainMem[0])
+   tmp1 = pv_round(L_shl(L_mult(state->prevCbGain, ONFACTPLUS1), 2));
+   if (sub(cbGain, tmp1) > 0)
+   {
+       state->onset = ONLENGTH;
+   }
+   else
+   {
+       if (state->onset > 0)
+       {
+           state->onset = sub (state->onset, 1);
+       }
+   }
+
+   // if not onset, check ltpGain buffer and use max phase dispersion if
+      half or more of the ltpGain-parameters say so
+   if (state->onset == 0)
+   {
+       // Check LTP gain memory and set filter accordingly
+       i1 = 0;
+       for (i = 0; i < PHDGAINMEMSIZE; i++)
+       {
+           if (sub(state->gainMem[i], PHDTHR1LTP) < 0)
+           {
+               i1 = add (i1, 1);
+           }
+       }
+       if (sub(i1, 2) > 0)
+       {
+           impNr = 0;
+       }
+
+   }
+   // Restrict decrease in phase dispersion to one step if not onset
+   if ((sub(impNr, add(state->prevState, 1)) > 0) && (state->onset == 0))
+   {
+       impNr = sub (impNr, 1);
+   }
+   // if onset, use one step less phase dispersion
+   if((sub(impNr, 2) < 0) && (state->onset > 0))
+   {
+       impNr = add (impNr, 1);
+   }
+
+   // disable for very low levels
+   if(sub(cbGain, 10) < 0)
+   {
+       impNr = 2;
+   }
+
+   if(sub(state->lockFull, 1) == 0)
+   {
+       impNr = 0;
+   }
+
+   // update static memory
+   state->prevState = impNr;
+   state->prevCbGain = cbGain;
+
+   // do phase dispersion for all modes but 12.2 and 7.4;
+   // don't modify the innovation if impNr >=2 (= no phase disp)
+   if (sub(mode, MR122) != 0 &&
+       sub(mode, MR102) != 0 &&
+       sub(mode, MR74) != 0 &&
+       sub(impNr, 2) < 0)
+   {
+       // track pulse positions, save innovation,
+          and initialize new innovation
+       nze = 0;
+       for (i = 0; i < L_SUBFR; i++)
+       {
+           if (inno[i] != 0)
+           {
+               ps_poss[nze] = i;
+               nze = add (nze, 1);
+           }
+           inno_sav[i] = inno[i];
+           inno[i] = 0;
+       }
+       // Choose filter corresponding to codec mode and dispersion criterium
+       if (sub (mode, MR795) == 0)
+       {
+           if (impNr == 0)
+           {
+               ph_imp = ph_imp_low_MR795;
+           }
+           else
+           {
+               ph_imp = ph_imp_mid_MR795;
+           }
+       }
+       else
+       {
+           if (impNr == 0)
+           {
+               ph_imp = ph_imp_low;
+           }
+           else
+           {
+               ph_imp = ph_imp_mid;
+           }
+       }
+
+       // Do phase dispersion of innovation
+       for (nPulse = 0; nPulse < nze; nPulse++)
+       {
+           ppos = ps_poss[nPulse];
+
+           // circular convolution with impulse response
+           j = 0;
+           for (i = ppos; i < L_SUBFR; i++)
+           {
+               // inno[i1] += inno_sav[ppos] * ph_imp[i1-ppos]
+               tmp1 = mult(inno_sav[ppos], ph_imp[j++]);
+               inno[i] = add(inno[i], tmp1);
+           }
+
+           for (i = 0; i < ppos; i++)
+           {
+               // inno[i] += inno_sav[ppos] * ph_imp[L_SUBFR-ppos+i]
+               tmp1 = mult(inno_sav[ppos], ph_imp[j++]);
+               inno[i] = add(inno[i], tmp1);
+           }
+       }
+   }
+
+   // compute total excitation for synthesis part of decoder
+   // (using modified innovation if phase dispersion is active)
+   for (i = 0; i < L_SUBFR; i++)
+   {
+       // x[i] = gain_pit*x[i] + cbGain*code[i];
+       L_temp = L_mult (        x[i],    pitch_fac);
+                                                // 12.2: Q0 * Q13
+                                                //  7.4: Q0 * Q14
+       L_temp = L_mac  (L_temp, inno[i], cbGain);
+                                                // 12.2: Q12 * Q1
+                                                //  7.4: Q13 * Q1
+       L_temp = L_shl (L_temp, tmp_shift);                 // Q16
+       x[i] = pv_round (L_temp);
+   }
+
+   return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void ph_disp(
+    ph_dispState *state,    /* i/o     : State struct                       */
+    enum Mode mode,         /* i       : codec mode                         */
+    Word16 x[],             /* i/o Q0  : in:  LTP excitation signal         */
+    /*           out: total excitation signal       */
+    Word16 cbGain,          /* i   Q1  : Codebook gain                      */
+    Word16 ltpGain,         /* i   Q14 : LTP gain                           */
+    Word16 inno[],          /* i/o Q13 : Innovation vector (Q12 for 12.2)   */
+    Word16 pitch_fac,       /* i   Q14 : pitch factor used to scale the
+                                         LTP excitation (Q13 for 12.2)      */
+    Word16 tmp_shift,       /* i   Q0  : shift factor applied to sum of
+                                         scaled LTP ex & innov. before
+                                         rounding                           */
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs      */
+    Flag   *pOverflow       /* i/o     : oveflow indicator                  */
+)
+{
+    register Word16 i, i1;
+    register Word16 tmp1;
+    Word32 L_temp;
+    Word32 L_temp2;
+    Word16 impNr;           /* indicator for amount of disp./filter used */
+
+    Word16 inno_sav[L_SUBFR];
+    Word16 ps_poss[L_SUBFR];
+    register Word16 nze, nPulse;
+    Word16 ppos;
+    const Word16 *ph_imp;   /* Pointer to phase dispersion filter */
+
+    Word16 *p_inno;
+    Word16 *p_inno_sav;
+    Word16 *p_x;
+    const Word16 *p_ph_imp;
+    Word16 c_inno_sav;
+
+    const Word16* ph_imp_low_MR795_ptr = common_amr_tbls->ph_imp_low_MR795_ptr;
+    const Word16* ph_imp_mid_MR795_ptr = common_amr_tbls->ph_imp_mid_MR795_ptr;
+    const Word16* ph_imp_low_ptr = common_amr_tbls->ph_imp_low_ptr;
+    const Word16* ph_imp_mid_ptr = common_amr_tbls->ph_imp_mid_ptr;
+
+    /* Update LTP gain memory */
+    /* Unrolled FOR loop below since PHDGAINMEMSIZE is assumed to stay */
+    /* the same.                                                       */
+    /* for (i = PHDGAINMEMSIZE-1; i > 0; i--)                          */
+    /* {                                                               */
+    /*    state->gainMem[i] = state->gainMem[i-1];                     */
+    /* }                                                               */
+    state->gainMem[4] = state->gainMem[3];
+    state->gainMem[3] = state->gainMem[2];
+    state->gainMem[2] = state->gainMem[1];
+    state->gainMem[1] = state->gainMem[0];
+    state->gainMem[0] = ltpGain;
+
+    /* basic adaption of phase dispersion */
+
+    if (ltpGain < PHDTHR2LTP)    /* if (ltpGain < 0.9) */
+    {
+        if (ltpGain > PHDTHR1LTP)
+        {  /* if (ltpGain > 0.6 */
+            impNr = 1; /* medium dispersion */
+        }
+        else
+        {
+            impNr = 0; /* maximum dispersion */
+        }
+    }
+    else
+    {
+        impNr = 2; /* no dispersion */
+    }
+
+    /* onset indicator */
+    /* onset = (cbGain  > onFact * cbGainMem[0]) */
+
+    L_temp = ((Word32) state->prevCbGain * ONFACTPLUS1) << 1;
+
+    /* (L_temp << 2) calculation with saturation check */
+    if (L_temp > (Word32) 0X1fffffffL)
+    {
+        *pOverflow = 1;
+        L_temp = MAX_32;
+    }
+    else if (L_temp < (Word32) - 536870912)
+    {
+        *pOverflow = 1;
+        L_temp = MIN_32;
+    }
+    else
+    {
+        L_temp <<= 2;
+    }
+
+    tmp1 = pv_round(L_temp, pOverflow);
+
+    if (cbGain > tmp1)
+    {
+        state->onset = ONLENGTH;
+    }
+    else
+    {
+
+        if (state->onset > 0)
+        {
+            state->onset -= 1;
+        }
+    }
+
+    /* if not onset, check ltpGain buffer and use max phase dispersion if
+       half or more of the ltpGain-parameters say so */
+    if (state->onset == 0)
+    {
+        /* Check LTP gain memory and set filter accordingly */
+        i1 = 0;
+        for (i = 0; i < PHDGAINMEMSIZE; i++)
+        {
+            if (state->gainMem[i] < PHDTHR1LTP)
+            {
+                i1 += 1;
+            }
+        }
+
+        if (i1 > 2)
+        {
+            impNr = 0;
+        }
+    }
+    /* Restrict decrease in phase dispersion to one step if not onset */
+    if ((impNr > ((state->prevState) + 1)) && (state->onset == 0))
+    {
+        impNr -= 1;
+    }
+
+    /* if onset, use one step less phase dispersion */
+    if ((impNr < 2) && (state->onset > 0))
+    {
+        impNr += 1;
+    }
+
+    /* disable for very low levels */
+    if (cbGain < 10)
+    {
+        impNr = 2;
+    }
+
+    if (state->lockFull == 1)
+    {
+        impNr = 0;
+    }
+
+    /* update static memory */
+    state->prevState = impNr;
+    state->prevCbGain = cbGain;
+
+    /* do phase dispersion for all modes but 12.2 and 7.4;
+       don't modify the innovation if impNr >=2 (= no phase disp) */
+    if ((mode != MR122) && (mode != MR102) && (mode != MR74) && (impNr < 2))
+    {
+        /* track pulse positions, save innovation,
+           and initialize new innovation          */
+        nze = 0;
+        p_inno = &inno[0];
+        p_inno_sav = &inno_sav[0];
+
+        for (i = 0; i < L_SUBFR; i++)
+        {
+            if (*(p_inno) != 0)
+            {
+                ps_poss[nze] = i;
+                nze += 1;
+            }
+            *(p_inno_sav++) = *(p_inno);
+            *(p_inno++) = 0;
+        }
+
+        /* Choose filter corresponding to codec mode and dispersion criterium */
+        if (mode == MR795)
+        {
+            if (impNr == 0)
+            {
+                ph_imp = ph_imp_low_MR795_ptr;
+            }
+            else
+            {
+                ph_imp = ph_imp_mid_MR795_ptr;
+            }
+        }
+        else
+        {
+            if (impNr == 0)
+            {
+                ph_imp = ph_imp_low_ptr;
+            }
+            else
+            {
+                ph_imp = ph_imp_mid_ptr;
+            }
+        }
+
+        /* Do phase dispersion of innovation */
+        for (nPulse = 0; nPulse < nze; nPulse++)
+        {
+            ppos = ps_poss[nPulse];
+
+            /* circular convolution with impulse response */
+            c_inno_sav = inno_sav[ppos];
+            p_inno = &inno[ppos];
+            p_ph_imp = ph_imp;
+
+            for (i = ppos; i < L_SUBFR; i++)
+            {
+                /* inno[i1] += inno_sav[ppos] * ph_imp[i1-ppos] */
+                L_temp = ((Word32) c_inno_sav * *(p_ph_imp++)) >> 15;
+                tmp1 = (Word16) L_temp;
+                *(p_inno) = add_16(*(p_inno), tmp1, pOverflow);
+                p_inno += 1;
+            }
+
+            p_inno = &inno[0];
+
+            for (i = 0; i < ppos; i++)
+            {
+                /* inno[i] += inno_sav[ppos] * ph_imp[L_SUBFR-ppos+i] */
+                L_temp = ((Word32) c_inno_sav * *(p_ph_imp++)) >> 15;
+                tmp1 = (Word16) L_temp;
+                *(p_inno) = add_16(*(p_inno), tmp1, pOverflow);
+                p_inno += 1;
+            }
+        }
+    }
+
+    /* compute total excitation for synthesis part of decoder
+       (using modified innovation if phase dispersion is active) */
+    p_inno = &inno[0];
+    p_x = &x[0];
+
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        /* x[i] = gain_pit*x[i] + cbGain*code[i]; */
+        L_temp = L_mult(x[i], pitch_fac, pOverflow);
+        /* 12.2: Q0 * Q13 */
+        /*  7.4: Q0 * Q14 */
+        L_temp2 = ((Word32) * (p_inno++) * cbGain) << 1;
+        L_temp = L_add(L_temp, L_temp2, pOverflow);
+        /* 12.2: Q12 * Q1 */
+        /*  7.4: Q13 * Q1 */
+        L_temp = L_shl(L_temp, tmp_shift, pOverflow);                  /* Q16 */
+        *(p_x++) = pv_round(L_temp, pOverflow);
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.h
new file mode 100644 (file)
index 0000000..e48aea0
--- /dev/null
@@ -0,0 +1,173 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ph_disp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the Phase dispersion of excitation signal ph_disp() function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef PH_DISP_H
+#define PH_DISP_H "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "typedef.h"
+#include    "mode.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define PHDGAINMEMSIZE 5
+#define PHDTHR1LTP     9830  /* 0.6 in Q14 */
+#define PHDTHR2LTP     14746 /* 0.9 in Q14 */
+#define ONFACTPLUS1    16384 /* 2.0 in Q13   */
+#define ONLENGTH 2
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 gainMem[PHDGAINMEMSIZE];
+        Word16 prevState;
+        Word16 prevCbGain;
+        Word16 lockFull;
+        Word16 onset;
+    } ph_dispState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ;
+    ;  Function:   ph_disp_reset
+    ;  Purpose:    Initializes state memory
+    ;
+    ----------------------------------------------------------------------------*/
+    Word16 ph_disp_reset(ph_dispState *state);
+
+    /*----------------------------------------------------------------------------
+    ;
+    ;  Function:   ph_disp_exit
+    ;  Purpose:    The memory used for state memory is freed
+    ;
+    ----------------------------------------------------------------------------*/
+    void ph_disp_exit(ph_dispState **state);
+
+    /*----------------------------------------------------------------------------
+    ;
+    ;  Function:   ph_disp_lock
+    ;  Purpose:    mark phase dispersion as locked in state struct
+    ;
+    ----------------------------------------------------------------------------*/
+    void ph_disp_lock(ph_dispState *state);
+
+    /*----------------------------------------------------------------------------
+    ;
+    ;  Function:   ph_disp_release
+    ;  Purpose:    mark phase dispersion as unlocked in state struct
+    ;
+    ----------------------------------------------------------------------------*/
+
+    void ph_disp_release(ph_dispState *state);
+
+    /*----------------------------------------------------------------------------
+    ;
+    ;  Function:   ph_disp
+    ;  Purpose:    perform phase dispersion according to the specified codec
+    ;              mode and computes total excitation for synthesis part
+    ;              if decoder
+    ;
+    ----------------------------------------------------------------------------*/
+
+    void ph_disp(
+        ph_dispState *state,    /* i/o     : State struct                       */
+        enum Mode mode,         /* i       : codec mode                         */
+        Word16 x[],             /* i/o Q0  : in:  LTP excitation signal         */
+        /*           out: total excitation signal       */
+        Word16 cbGain,          /* i   Q1  : Codebook gain                      */
+        Word16 ltpGain,         /* i   Q14 : LTP gain                           */
+        Word16 inno[],          /* i/o Q13 : Innovation vector (Q12 for 12.2)   */
+        Word16 pitch_fac,       /* i   Q14 : pitch factor used to scale the
+                                         LTP excitation (Q13 for 12.2)      */
+        Word16 tmp_shift,       /* i   Q0  : shift factor applied to sum of
+                                         scaled LTP ex & innov. before
+                                         rounding                           */
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs      */
+        Flag   *pOverflow       /* i/o     : oveflow indicator                  */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PH_DISP_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.cpp
new file mode 100644 (file)
index 0000000..3e3f4e1
--- /dev/null
@@ -0,0 +1,316 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: post_pro.cpp
+ Functions:
+           Post_Process_reset
+           Post_Process
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the function that performs post-processing on the output
+ speech. Post-processing include filtering the output speech through a second
+ order high pass filter with cutoff frequency of 60 Hz, and up-scaling the
+ output speech by a factor of 2. In addition to the post-processing function
+ itself, a post-processing initialization function, post-processing reset
+ function, and post-processing exit function are also included in this file.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "post_pro.h"
+#include "typedef.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/* filter coefficients (fc = 60 Hz) */
+static const Word16 b[3] = {7699, -15398, 7699};
+static const Word16 a[3] = {8192, 15836, -7667};
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Post_Process_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a structure of type Post_ProcessState
+
+ Outputs:
+    structure pointed to by state will have all its fields initialized
+      to zero
+
+ Returns:
+    return_value = 0, if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function initializes state memory to zero.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ post_pro.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Post_Process_reset (Post_ProcessState *state)
+{
+  if (state == (Post_ProcessState *) NULL){
+      fprint(stderr, "Post_Process_reset: invalid parameter\n");
+      return -1;
+  }
+
+  state->y2_hi = 0;
+  state->y2_lo = 0;
+  state->y1_hi = 0;
+  state->y1_lo = 0;
+  state->x0 = 0;
+  state->x1 = 0;
+
+  return 0;
+}
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Post_Process_reset(Post_ProcessState *state)
+{
+    if (state == (Post_ProcessState *) NULL)
+    {
+        /*  fprint(stderr, "Post_Process_reset: invalid parameter\n");  */
+        return(-1);
+    }
+
+    state->y2_hi = 0;
+    state->y2_lo = 0;
+    state->y1_hi = 0;
+    state->y1_lo = 0;
+    state->x0 = 0;
+    state->x1 = 0;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Post_Process
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type Post_ProcessState
+    signal = buffer containing the input signal (Word16)
+    lg = length of the input signal (Word16)
+    pOverflow = pointer to overflow indicator of type Flag
+
+ Outputs:
+    structure pointed to by st contains new filter input and output values
+    signal buffer contains the HP filtered and up-scaled input signal
+    pOverflow points to 1 if overflow occurs in the math functions called
+              else it points to 0.
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    a = buffer containing filter coefficients
+    b = buffer containing filter coefficients
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs post-processing on the output speech signal. First,
+ the output speech goes through a second order high pass filter with a
+ cutoff frequency of 60 Hz. Then, the filtered output speech is multiplied
+ by a factor of 2. The algorithm implemented follows the following difference
+ equation:
+
+ y[i] = b[0]*x[i]*2 + b[1]*x[i-1]*2 + b[2]*x[i-2]*2 + a[1]*y[i-1] + a[2]*y[i-2];
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ post_pro.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Post_Process (
+    Post_ProcessState *st,  //i/o : post process state
+    Word16 signal[],        //i/o : signal
+    Word16 lg               //i   : length of signal
+    )
+{
+    Word16 i, x2;
+    Word32 L_tmp;
+
+    for (i = 0; i < lg; i++)
+    {
+        x2 = st->x1;
+        st->x1 = st->x0;
+        st->x0 = signal[i];
+
+        // y[i] = b[0]*x[i]*2 + b[1]*x[i-1]*2 + b140[2]*x[i-2]/2
+        //                    + a[1]*y[i-1] + a[2] * y[i-2];
+
+        L_tmp = Mpy_32_16 (st->y1_hi, st->y1_lo, a[1]);
+        L_tmp = L_add (L_tmp, Mpy_32_16 (st->y2_hi, st->y2_lo, a[2]));
+        L_tmp = L_mac (L_tmp, st->x0, b[0]);
+        L_tmp = L_mac (L_tmp, st->x1, b[1]);
+        L_tmp = L_mac (L_tmp, x2, b[2]);
+        L_tmp = L_shl (L_tmp, 2);
+
+        //Multiplication by two of output speech with saturation.
+        signal[i] = pv_round(L_shl(L_tmp, 1));
+
+        st->y2_hi = st->y1_hi;
+        st->y2_lo = st->y1_lo;
+        L_Extract (L_tmp, &st->y1_hi, &st->y1_lo);
+    }
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Post_Process(
+    Post_ProcessState *st,  /* i/o : post process state                   */
+    Word16 signal[],        /* i/o : signal                               */
+    Word16 lg,              /* i   : length of signal                     */
+    Flag   *pOverflow
+)
+{
+    Word16 i, x2;
+    Word32 L_tmp;
+
+    Word16 *p_signal;
+    Word16 c_a1 = a[1];
+    Word16 c_a2 = a[2];
+    Word16 c_b0 = b[0];
+    Word16 c_b1 = b[1];
+    Word16 c_b2 = b[2];
+
+    p_signal = &signal[0];
+
+    for (i = 0; i < lg; i++)
+    {
+        x2 = st->x1;
+        st->x1 = st->x0;
+        st->x0 = *(p_signal);
+
+        /*  y[i] = b[0]*x[i]*2 + b[1]*x[i-1]*2 + b140[2]*x[i-2]/2  */
+        /*                     + a[1]*y[i-1] + a[2] * y[i-2];      */
+
+        L_tmp = ((Word32) st->y1_hi) * c_a1;
+        L_tmp += (((Word32) st->y1_lo) * c_a1) >> 15;
+        L_tmp += ((Word32) st->y2_hi) * c_a2;
+        L_tmp += (((Word32) st->y2_lo) * c_a2) >> 15;
+        L_tmp += ((Word32) st->x0) * c_b0;
+        L_tmp += ((Word32) st->x1) * c_b1;
+        L_tmp += ((Word32) x2) * c_b2;
+
+        L_tmp = L_shl(L_tmp, 3, pOverflow);
+
+
+        /* Multiplication by two of output speech with saturation. */
+
+        *(p_signal++) = pv_round(L_shl(L_tmp, 1, pOverflow), pOverflow);
+
+        st->y2_hi = st->y1_hi;
+        st->y2_lo = st->y1_lo;
+
+        st->y1_hi = (Word16)(L_tmp >> 16);
+        st->y1_lo = (Word16)((L_tmp >> 1) - ((Word32) st->y1_hi << 15));
+
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.h
new file mode 100644 (file)
index 0000000..820b79a
--- /dev/null
@@ -0,0 +1,129 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: post_pro.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : post_pro.h
+      Purpose          : Postprocessing of output speech.
+
+                         - 2nd order high pass filtering with cut
+                           off frequency at 60 Hz.
+                         - Multiplication of output by two.
+------------------------------------------------------------------------------
+*/
+
+#ifndef _POST_PRO_H_
+#define _POST_PRO_H_
+#define post_pro_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 y2_hi;
+        Word16 y2_lo;
+        Word16 y1_hi;
+        Word16 y1_lo;
+        Word16 x0;
+        Word16 x1;
+    } Post_ProcessState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    Word16 Post_Process_reset(Post_ProcessState *st);
+    /* reset of Post processing state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+    void Post_Process_exit(Post_ProcessState **st);
+    /* de-initialize Post processing state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    void Post_Process(
+        Post_ProcessState *st,  /* i/o : post process state                   */
+        Word16 signal[],        /* i/o : signal                               */
+        Word16 lg,              /* i   : lenght of signal                     */
+        Flag *pOverflow
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _POST_PRO_H_ */
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.cpp
new file mode 100644 (file)
index 0000000..5f8d0e3
--- /dev/null
@@ -0,0 +1,222 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: preemph.cpp
+ Functions:
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ Purpose          : Preemphasis filtering
+ Description      : Filtering through 1 - g z^-1
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "preemph.h"
+#include "typedef.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:  preemphasis_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- double pointer to preemphasisState
+
+ Outputs:
+    st -- double ponter to preemphasisState
+
+ Returns:
+    -1 if an error occurs
+     0 if OK
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Initializes state memory to zero
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ preemph.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 preemphasis_reset(preemphasisState *state)
+{
+    if (state == (preemphasisState *) NULL)
+    {
+        /* fprintf(stderr, "preemphasis_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    state->mem_pre = 0;
+
+    return 0;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:  preemphasis
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- Pointer to preemphasisState -- preemphasis filter state
+    signal -- array of type Word16 -- input signal overwritten by the output
+    g -- Word16 -- preemphasis coefficient
+    L -- Word16 -- size of filtering
+
+ Outputs:
+    st -- Pointer to preemphasisState -- preemphasis filter state
+    signal -- array of type Word16 -- input signal overwritten by the output
+    pOverflow -- pointer to type Flag -- overflow indicator
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Filtering through 1 - g z^-1
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ preemph.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+
+void preemphasis(
+    preemphasisState *st, /* (i/o) : preemphasis filter state               */
+    Word16 *signal,       /* (i/o) : input signal overwritten by the output */
+    Word16 g,             /* (i)   : preemphasis coefficient                */
+    Word16 L,             /* (i)   : size of filtering                      */
+    Flag  *pOverflow      /* (o)   : overflow indicator                     */
+)
+{
+    Word16 *p1;
+    Word16 *p2;
+    Word16 temp;
+    Word16 temp2;
+    Word16 i;
+
+    p1 = signal + L - 1;
+    p2 = p1 - 1;
+    temp = *p1;
+
+    for (i = 0; i <= L - 2; i++)
+    {
+        temp2 = mult(g, *(p2--), pOverflow);
+        *p1 = sub(*p1, temp2, pOverflow);
+
+        p1--;
+    }
+
+    temp2 = mult(g, st->mem_pre, pOverflow);
+
+    *p1 = sub(*p1, temp2, pOverflow);
+
+    st->mem_pre = temp;
+
+    return;
+}
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.h
new file mode 100644 (file)
index 0000000..0798731
--- /dev/null
@@ -0,0 +1,124 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Filename: preemph.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, preemph.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef preemph_h
+#define preemph_h "$Id $"
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 mem_pre;          /* filter state */
+    } preemphasisState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    Word16 preemphasis_reset(preemphasisState *st);
+    /* reset of preemphasis filter (i.e. set state memory to zero)
+       returns 0 on success
+     */
+    void preemphasis_exit(preemphasisState **st);
+    /* de-initialize preemphasis filter (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    void preemphasis(
+        preemphasisState *st, /* (i/o): preemphasis filter state                */
+        Word16 *signal,    /* (i/o): input signal overwritten by the output     */
+        Word16 g,          /* (i)  : preemphasis coefficient                    */
+        Word16 L,          /* (i)  : size of filtering                          */
+        Flag   *pOverflow  /* (o)  : overflow indicator                         */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* preemph_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp
new file mode 100644 (file)
index 0000000..479ded7
--- /dev/null
@@ -0,0 +1,506 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pstfilt.cpp
+ Functions:
+            Post_Filter_reset
+            Post_Filter
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the function that performs adaptive post-filtering on the
+ synthesized speech. It also contains the functions that initialize, reset,
+ and exit the post-filtering function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "pstfilt.h"
+#include "typedef.h"
+#include "mode.h"
+#include "basicop_malloc.h"
+#include "basic_op.h"
+#include "weight_a.h"
+#include "residu.h"
+#include "syn_filt.h"
+#include "preemph.h"
+#include "cnst.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define L_H 22  /* size of truncated impulse response of A(z/g1)/A(z/g2) */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/* Spectral expansion factors */
+static const Word16 gamma3_MR122[M] =
+{
+    22938, 16057, 11240, 7868, 5508,
+    3856, 2699, 1889, 1322, 925
+};
+
+static const Word16 gamma3[M] =
+{
+    18022, 9912, 5451, 2998, 1649, 907, 499, 274, 151, 83
+};
+
+static const Word16 gamma4_MR122[M] =
+{
+    24576, 18432, 13824, 10368, 7776,
+    5832, 4374, 3281, 2461, 1846
+};
+
+static const Word16 gamma4[M] =
+{
+    22938, 16057, 11240, 7868, 5508, 3856, 2699, 1889, 1322, 925
+};
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Post_Filter_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to structure of type Post_FilterState
+
+ Outputs:
+    fields of the structure pointed to by state is initialized to zero
+
+ Returns:
+    return_value = 0, if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function initializes the state memory used by the Post_Filter function
+ to zero.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pstfilt.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Post_Filter_reset (Post_FilterState *state)
+{
+  if (state == (Post_FilterState *) NULL){
+      fprintf(stderr, "Post_Filter_reset: invalid parameter\n");
+      return -1;
+  }
+
+  Set_zero (state->mem_syn_pst, M);
+  Set_zero (state->res2, L_SUBFR);
+  Set_zero (state->synth_buf, L_FRAME + M);
+  agc_reset(state->agc_state);
+  preemphasis_reset(state->preemph_state);
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Post_Filter_reset(Post_FilterState *state)
+{
+    if (state == (Post_FilterState *) NULL)
+    {
+        /*fprintf(stderr, "Post_Filter_reset: invalid parameter\n");  */
+        return(-1);
+    }
+
+    oscl_memset(state->mem_syn_pst, 0, sizeof(Word16)*M);
+    oscl_memset(state->res2, 0, sizeof(Word16)*L_SUBFR);
+    oscl_memset(state->synth_buf, 0, sizeof(Word16)*(L_FRAME + M));
+    agc_reset(&(state->agc_state));
+    preemphasis_reset(&(state->preemph_state));
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Post_Filter
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type Post_FilterState
+    mode = AMR mode
+    syn = pointer to a buffer containing synthesized speech; upon
+          exiting this function, it will contain the post-filtered
+          synthesized speech
+    Az_4 = pointer to the interpolated LPC parameters for all subframes
+    pOverflow = pointer to overflow indicator of type Flag
+
+ Outputs:
+    fields of the structure pointed to by st contains the updated field
+      values
+    syn buffer contains the post-filtered synthesized speech
+    pOverflow = 1 if overflow occurrs in the math functions called else
+                it is zero.
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs the post-filtering on the synthesized speech. The
+ post-filtering process is described as follows:
+ (1) inverse filtering of syn[] through A(z/0.7) to get res2[]
+ (2) tilt compensation filtering; 1 - MU*k*z^-1
+ (3) synthesis filtering through 1/A(z/0.75)
+ (4) adaptive gain control
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pstfilt.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Post_Filter (
+    Post_FilterState *st, // i/o : post filter states
+    enum Mode mode,       // i   : AMR mode
+    Word16 *syn,          // i/o : synthesis speech (postfiltered is output)
+    Word16 *Az_4          // i   : interpolated LPC parameters in all subfr.
+)
+{
+     *-------------------------------------------------------------------*
+     *           Declaration of parameters                               *
+     *-------------------------------------------------------------------*
+
+    Word16 Ap3[MP1], Ap4[MP1];  // bandwidth expanded LP parameters
+    Word16 *Az;                 // pointer to Az_4:
+                                //  LPC parameters in each subframe
+    Word16 i_subfr;             // index for beginning of subframe
+    Word16 h[L_H];
+
+    Word16 i;
+    Word16 temp1, temp2;
+    Word32 L_tmp;
+    Word16 *syn_work = &st->synth_buf[M];
+
+
+     *-----------------------------------------------------*
+     * Post filtering                                      *
+     *-----------------------------------------------------*
+
+    Copy (syn, syn_work , L_FRAME);
+
+    Az = Az_4;
+
+    for (i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
+    {
+       // Find weighted filter coefficients Ap3[] and ap[4]
+
+       if (sub(mode, MR122) == 0 || sub(mode, MR102) == 0)
+       {
+          Weight_Ai (Az, gamma3_MR122, Ap3);
+          Weight_Ai (Az, gamma4_MR122, Ap4);
+       }
+       else
+       {
+          Weight_Ai (Az, gamma3, Ap3);
+          Weight_Ai (Az, gamma4, Ap4);
+       }
+
+       // filtering of synthesis speech by A(z/0.7) to find res2[]
+
+       Residu (Ap3, &syn_work[i_subfr], st->res2, L_SUBFR);
+
+       // tilt compensation filter
+
+       // impulse response of A(z/0.7)/A(z/0.75)
+
+       Copy (Ap3, h, M + 1);
+       Set_zero (&h[M + 1], L_H - M - 1);
+       Syn_filt (Ap4, h, h, L_H, &h[M + 1], 0);
+
+       // 1st correlation of h[]
+
+       L_tmp = L_mult (h[0], h[0]);
+       for (i = 1; i < L_H; i++)
+       {
+          L_tmp = L_mac (L_tmp, h[i], h[i]);
+       }
+       temp1 = extract_h (L_tmp);
+
+       L_tmp = L_mult (h[0], h[1]);
+       for (i = 1; i < L_H - 1; i++)
+       {
+          L_tmp = L_mac (L_tmp, h[i], h[i + 1]);
+       }
+       temp2 = extract_h (L_tmp);
+
+       if (temp2 <= 0)
+       {
+          temp2 = 0;
+       }
+       else
+       {
+          temp2 = mult (temp2, MU);
+          temp2 = div_s (temp2, temp1);
+       }
+
+       preemphasis (st->preemph_state, st->res2, temp2, L_SUBFR);
+
+       // filtering through  1/A(z/0.75)
+
+       Syn_filt (Ap4, st->res2, &syn[i_subfr], L_SUBFR, st->mem_syn_pst, 1);
+
+       // scale output to input
+
+       agc (st->agc_state, &syn_work[i_subfr], &syn[i_subfr],
+            AGC_FAC, L_SUBFR);
+
+       Az += MP1;
+    }
+
+    // update syn_work[] buffer
+
+    Copy (&syn_work[L_FRAME - M], &syn_work[-M], M);
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Post_Filter(
+    Post_FilterState *st, /* i/o : post filter states                        */
+    enum Mode mode,       /* i   : AMR mode                                  */
+    Word16 *syn,          /* i/o : synthesis speech (postfiltered is output) */
+    Word16 *Az_4,         /* i   : interpolated LPC parameters in all subfr. */
+    Flag   *pOverflow
+)
+{
+    Word16 Ap3[MP1];
+    Word16 Ap4[MP1];            /* bandwidth expanded LP parameters */
+    Word16 *Az;                 /* pointer to Az_4:                 */
+    /*  LPC parameters in each subframe */
+    register Word16 i_subfr;    /* index for beginning of subframe  */
+    Word16 h[L_H];
+
+    register Word16 i;
+    Word16 temp1;
+    Word16 temp2;
+    Word32 L_tmp;
+    Word32 L_tmp2;
+    Word16 *syn_work = &st->synth_buf[M];
+
+
+    /*-----------------------------------------------------*
+     * Post filtering                                      *
+     *-----------------------------------------------------*/
+
+    oscl_memmove((void *)syn_work , syn, L_FRAME*sizeof(*syn));
+
+    Az = Az_4;
+
+    for (i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
+    {
+        /* Find weighted filter coefficients Ap3[] and ap[4] */
+
+        if (mode == MR122 || mode == MR102)
+        {
+            Weight_Ai(Az, gamma3_MR122, Ap3);
+            Weight_Ai(Az, gamma4_MR122, Ap4);
+        }
+        else
+        {
+            Weight_Ai(Az, gamma3, Ap3);
+            Weight_Ai(Az, gamma4, Ap4);
+        }
+
+        /* filtering of synthesis speech by A(z/0.7) to find res2[] */
+
+        Residu(Ap3, &syn_work[i_subfr], st->res2, L_SUBFR);
+
+        /* tilt compensation filter */
+
+        /* impulse response of A(z/0.7)/A(z/0.75) */
+
+        oscl_memmove((void *)h, Ap3, (M + 1)*sizeof(*Ap3));
+        oscl_memset(&h[M + 1], 0, sizeof(Word16)*(L_H - M - 1));
+        Syn_filt(Ap4, h, h, L_H, &h[M + 1], 0);
+
+        /* 1st correlation of h[] */
+
+        L_tmp = 0;
+
+        for (i = L_H - 1; i >= 0; i--)
+        {
+            L_tmp2 = ((Word32) h[i]) * h[i];
+
+            if (L_tmp2 != (Word32) 0x40000000L)
+            {
+                L_tmp2 = L_tmp2 << 1;
+            }
+            else
+            {
+                *pOverflow = 1;
+                L_tmp2 = MAX_32;
+                break;
+            }
+
+            L_tmp = L_add(L_tmp, L_tmp2, pOverflow);
+        }
+        temp1 = (Word16)(L_tmp >> 16);
+
+        L_tmp = 0;
+
+        for (i = L_H - 2; i >= 0; i--)
+        {
+            L_tmp2 = ((Word32) h[i]) * h[i + 1];
+
+            if (L_tmp2 != (Word32) 0x40000000L)
+            {
+                L_tmp2 = L_tmp2 << 1;
+            }
+            else
+            {
+                *pOverflow = 1;
+                L_tmp2 = MAX_32;
+                break;
+            }
+
+            L_tmp = L_add(L_tmp, L_tmp2, pOverflow);
+        }
+        temp2 = (Word16)(L_tmp >> 16);
+
+        if (temp2 <= 0)
+        {
+            temp2 = 0;
+        }
+        else
+        {
+            L_tmp = (((Word32) temp2) * MU) >> 15;
+
+            /* Sign-extend product */
+            if (L_tmp & (Word32) 0x00010000L)
+            {
+                L_tmp = L_tmp | (Word32) 0xffff0000L;
+            }
+            temp2 = (Word16) L_tmp;
+
+            temp2 = div_s(temp2, temp1);
+        }
+
+        preemphasis(&(st->preemph_state), st->res2, temp2, L_SUBFR, pOverflow);
+
+        /* filtering through  1/A(z/0.75) */
+
+        Syn_filt(Ap4, st->res2, &syn[i_subfr], L_SUBFR, st->mem_syn_pst, 1);
+
+        /* scale output to input */
+
+        agc(&(st->agc_state), &syn_work[i_subfr], &syn[i_subfr],
+            AGC_FAC, L_SUBFR, pOverflow);
+
+        Az += MP1;
+    }
+
+    /* update syn_work[] buffer */
+
+    oscl_memmove((void *)&syn_work[-M], &syn_work[L_FRAME - M], M*sizeof(*syn_work));
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.h
new file mode 100644 (file)
index 0000000..bdee89c
--- /dev/null
@@ -0,0 +1,132 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pstfilt.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : pstfilt.h
+      Purpose          : Performs adaptive postfiltering on the synthesis
+                       : speech
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _PSTFILT_H_
+#define _PSTFILT_H_
+#define pstfilt_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "cnst.h"
+#include "preemph.h"
+#include "agc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 res2[L_SUBFR];
+        Word16 mem_syn_pst[M];
+        preemphasisState preemph_state;
+        agcState agc_state;
+        Word16 synth_buf[M + L_FRAME];
+    } Post_FilterState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    Word16 Post_Filter_reset(Post_FilterState *st);
+    /* reset post filter (i.e. set state memory to zero)
+       returns 0 on success
+     */
+
+    void Post_Filter(
+        Post_FilterState *st, /* i/o : post filter states                        */
+        enum Mode mode,       /* i   : AMR mode                                  */
+        Word16 *syn,          /* i/o : synthesis speech (postfiltered is output) */
+        Word16 *Az_4,         /* i   : interpolated LPC parameters in all subfr. */
+        Flag   *pOverflow
+    );
+    /* filters the signal syn using the parameters in Az_4 to calculate filter
+       coefficients.
+       The filter must be set up using Post_Filter_init prior to the first call
+       to Post_Filter. Post_FilterState is updated to mirror the current state
+       of the filter
+
+       return 0 on success
+     */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _PSTFILT_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder.cpp
new file mode 100644 (file)
index 0000000..95b0b47
--- /dev/null
@@ -0,0 +1,77 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+
+#include "PVGSMAMRDecoder.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF CPVGSMAMRDecoder::CPVGSMAMRDecoder()
+{
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF CPVGSMAMRDecoder::~CPVGSMAMRDecoder()
+{
+    delete iDecState;
+    iDecState = NULL;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF int32 CPVGSMAMRDecoder::InitDecoder(void)
+{
+    return GSMInitDecode(&iDecState, (int8*)"Decoder");
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF int32 CPVGSMAMRDecoder::DecodeFrame(Frame_Type_3GPP aType,
+        uint8* aCompressedBlock,
+        uint8* aAudioBuffer,
+        int32 aFormat)
+{
+    return AMRDecode(iDecState, aType, aCompressedBlock, (Word16*)aAudioBuffer, (Word16) aFormat);
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF int32 CPVGSMAMRDecoder::ResetDecoder(void)
+{
+    return Speech_Decode_Frame_reset(iDecState);
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF void CPVGSMAMRDecoder::TerminateDecoder(void)
+{
+    GSMDecodeFrameExit(&iDecState);
+    iDecState = NULL;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder.h
new file mode 100644 (file)
index 0000000..bfdc07d
--- /dev/null
@@ -0,0 +1,57 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+
+#ifndef __PVGSMAMRDECODER_H
+#define __PVGSMAMRDECODER_H
+
+#include "oscl_base.h"
+
+#include "gsmamr_dec.h"
+
+// PVGSMAMRDecoder
+class CPVGSMAMRDecoder
+{
+    public:
+        OSCL_IMPORT_REF CPVGSMAMRDecoder();
+        OSCL_IMPORT_REF ~CPVGSMAMRDecoder();
+
+        OSCL_IMPORT_REF int32 InitDecoder(void);
+        OSCL_IMPORT_REF int32 DecodeFrame(Frame_Type_3GPP aType,
+                                          uint8* aCompressedBlock,
+                                          uint8* aAudioBuffer,
+                                          int32 aFormat);
+        OSCL_IMPORT_REF int32 ResetDecoder(void);
+        OSCL_IMPORT_REF void TerminateDecoder(void);
+
+    private:
+        void* iDecState;
+};
+
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder_dpi.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder_dpi.h
new file mode 100644 (file)
index 0000000..09c778e
--- /dev/null
@@ -0,0 +1,59 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+
+#ifndef __PVGSMAMRDECODER_H
+#define __PVGSMAMRDECODER_H
+
+#include "oscl_base.h"
+
+#include "gsmamr_dec.h"
+#include "gsmamrdpidecoder.h"
+
+// PVGSMAMRDecoder
+class CPVGSMAMRDecoder
+{
+    public:
+        OSCL_IMPORT_REF CPVGSMAMRDecoder();
+        OSCL_IMPORT_REF ~CPVGSMAMRDecoder();
+
+        OSCL_IMPORT_REF int32 InitDecoder(void);
+        OSCL_IMPORT_REF int32 DecodeFrame(Frame_Type_3GPP aType,
+                                          uint8* aCompressedBlock,
+                                          uint8* aAudioBuffer,
+                                          int32 aFormat);
+        OSCL_IMPORT_REF int32 ResetDecoder(void);
+        OSCL_IMPORT_REF void TerminateDecoder(void);
+
+    private:
+        void* iDecState;
+        CPvGsmAmrDPIDecoder *iDecoder;
+};
+
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/qgain475_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/qgain475_tab.cpp
new file mode 100644 (file)
index 0000000..9aaafc2
--- /dev/null
@@ -0,0 +1,405 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+
+
+ Filename: qgain475_tab.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "qgain475_tab.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+
+    /* The table contains the following data:
+     *
+     *    g_pitch(0)        (Q14) // for sub-
+     *    g_fac(0)          (Q12) // frame 0 and 2
+     *    g_pitch(1)        (Q14) // for sub-
+     *    g_fac(2)          (Q12) // frame 1 and 3
+     *
+     */
+    const Word16 table_gain_MR475[MR475_VQ_SIZE*4] =
+    {
+        /*g_pit(0), g_fac(0),      g_pit(1), g_fac(1) */
+        812,          128,           542,      140,
+        2873,         1135,          2266,     3402,
+        2067,          563,         12677,      647,
+        4132,         1798,          5601,     5285,
+        7689,          374,          3735,      441,
+        10912,         2638,         11807,     2494,
+        20490,          797,          5218,      675,
+        6724,         8354,          5282,     1696,
+        1488,          428,          5882,      452,
+        5332,         4072,          3583,     1268,
+        2469,          901,         15894,     1005,
+        14982,         3271,         10331,     4858,
+        3635,         2021,          2596,      835,
+        12360,         4892,         12206,     1704,
+        13432,         1604,          9118,     2341,
+        3968,         1538,          5479,     9936,
+        3795,          417,          1359,      414,
+        3640,         1569,          7995,     3541,
+        11405,          645,          8552,      635,
+        4056,         1377,         16608,     6124,
+        11420,          700,          2007,      607,
+        12415,         1578,         11119,     4654,
+        13680,         1708,         11990,     1229,
+        7996,         7297,         13231,     5715,
+        2428,         1159,          2073,     1941,
+        6218,         6121,          3546,     1804,
+        8925,         1802,          8679,     1580,
+        13935,         3576,         13313,     6237,
+        6142,         1130,          5994,     1734,
+        14141,         4662,         11271,     3321,
+        12226,         1551,         13931,     3015,
+        5081,        10464,          9444,     6706,
+        1689,          683,          1436,     1306,
+        7212,         3933,          4082,     2713,
+        7793,          704,         15070,      802,
+        6299,         5212,          4337,     5357,
+        6676,          541,          6062,      626,
+        13651,         3700,         11498,     2408,
+        16156,          716,         12177,      751,
+        8065,        11489,          6314,     2256,
+        4466,          496,          7293,      523,
+        10213,         3833,          8394,     3037,
+        8403,          966,         14228,     1880,
+        8703,         5409,         16395,     4863,
+        7420,         1979,          6089,     1230,
+        9371,         4398,         14558,     3363,
+        13559,         2873,         13163,     1465,
+        5534,         1678,         13138,    14771,
+        7338,          600,          1318,      548,
+        4252,         3539,         10044,     2364,
+        10587,          622,         13088,      669,
+        14126,         3526,          5039,     9784,
+        15338,          619,          3115,      590,
+        16442,         3013,         15542,     4168,
+        15537,         1611,         15405,     1228,
+        16023,         9299,          7534,     4976,
+        1990,         1213,         11447,     1157,
+        12512,         5519,          9475,     2644,
+        7716,         2034,         13280,     2239,
+        16011,         5093,          8066,     6761,
+        10083,         1413,          5002,     2347,
+        12523,         5975,         15126,     2899,
+        18264,         2289,         15827,     2527,
+        16265,        10254,         14651,    11319,
+        1797,          337,          3115,      397,
+        3510,         2928,          4592,     2670,
+        7519,          628,         11415,      656,
+        5946,         2435,          6544,     7367,
+        8238,          829,          4000,      863,
+        10032,         2492,         16057,     3551,
+        18204,         1054,          6103,     1454,
+        5884,         7900,         18752,     3468,
+        1864,          544,          9198,      683,
+        11623,         4160,          4594,     1644,
+        3158,         1157,         15953,     2560,
+        12349,         3733,         17420,     5260,
+        6106,         2004,          2917,     1742,
+        16467,         5257,         16787,     1680,
+        17205,         1759,          4773,     3231,
+        7386,         6035,         14342,    10012,
+        4035,          442,          4194,      458,
+        9214,         2242,          7427,     4217,
+        12860,          801,         11186,      825,
+        12648,         2084,         12956,     6554,
+        9505,          996,          6629,      985,
+        10537,         2502,         15289,     5006,
+        12602,         2055,         15484,     1653,
+        16194,         6921,         14231,     5790,
+        2626,          828,          5615,     1686,
+        13663,         5778,          3668,     1554,
+        11313,         2633,          9770,     1459,
+        14003,         4733,         15897,     6291,
+        6278,         1870,          7910,     2285,
+        16978,         4571,         16576,     3849,
+        15248,         2311,         16023,     3244,
+        14459,        17808,         11847,     2763,
+        1981,         1407,          1400,      876,
+        4335,         3547,          4391,     4210,
+        5405,          680,         17461,      781,
+        6501,         5118,          8091,     7677,
+        7355,          794,          8333,     1182,
+        15041,         3160,         14928,     3039,
+        20421,          880,         14545,      852,
+        12337,        14708,          6904,     1920,
+        4225,          933,          8218,     1087,
+        10659,         4084,         10082,     4533,
+        2735,          840,         20657,     1081,
+        16711,         5966,         15873,     4578,
+        10871,         2574,          3773,     1166,
+        14519,         4044,         20699,     2627,
+        15219,         2734,         15274,     2186,
+        6257,         3226,         13125,    19480,
+        7196,          930,          2462,     1618,
+        4515,         3092,         13852,     4277,
+        10460,          833,         17339,      810,
+        16891,         2289,         15546,     8217,
+        13603,         1684,          3197,     1834,
+        15948,         2820,         15812,     5327,
+        17006,         2438,         16788,     1326,
+        15671,         8156,         11726,     8556,
+        3762,         2053,          9563,     1317,
+        13561,         6790,         12227,     1936,
+        8180,         3550,         13287,     1778,
+        16299,         6599,         16291,     7758,
+        8521,         2551,          7225,     2645,
+        18269,         7489,         16885,     2248,
+        17882,         2884,         17265,     3328,
+        9417,        20162,         11042,     8320,
+        1286,          620,          1431,      583,
+        5993,         2289,          3978,     3626,
+        5144,          752,         13409,      830,
+        5553,         2860,         11764,     5908,
+        10737,          560,          5446,      564,
+        13321,         3008,         11946,     3683,
+        19887,          798,          9825,      728,
+        13663,         8748,          7391,     3053,
+        2515,          778,          6050,      833,
+        6469,         5074,          8305,     2463,
+        6141,         1865,         15308,     1262,
+        14408,         4547,         13663,     4515,
+        3137,         2983,          2479,     1259,
+        15088,         4647,         15382,     2607,
+        14492,         2392,         12462,     2537,
+        7539,         2949,         12909,    12060,
+        5468,          684,          3141,      722,
+        5081,         1274,         12732,     4200,
+        15302,          681,          7819,      592,
+        6534,         2021,         16478,     8737,
+        13364,          882,          5397,      899,
+        14656,         2178,         14741,     4227,
+        14270,         1298,         13929,     2029,
+        15477,         7482,         15815,     4572,
+        2521,         2013,          5062,     1804,
+        5159,         6582,          7130,     3597,
+        10920,         1611,         11729,     1708,
+        16903,         3455,         16268,     6640,
+        9306,         1007,          9369,     2106,
+        19182,         5037,         12441,     4269,
+        15919,         1332,         15357,     3512,
+        11898,        14141,         16101,     6854,
+        2010,          737,          3779,      861,
+        11454,         2880,          3564,     3540,
+        9057,         1241,         12391,      896,
+        8546,         4629,         11561,     5776,
+        8129,          589,          8218,      588,
+        18728,         3755,         12973,     3149,
+        15729,          758,         16634,      754,
+        15222,        11138,         15871,     2208,
+        4673,          610,         10218,      678,
+        15257,         4146,          5729,     3327,
+        8377,         1670,         19862,     2321,
+        15450,         5511,         14054,     5481,
+        5728,         2888,          7580,     1346,
+        14384,         5325,         16236,     3950,
+        15118,         3744,         15306,     1435,
+        14597,         4070,         12301,    15696,
+        7617,         1699,          2170,      884,
+        4459,         4567,         18094,     3306,
+        12742,          815,         14926,      907,
+        15016,         4281,         15518,     8368,
+        17994,         1087,          2358,      865,
+        16281,         3787,         15679,     4596,
+        16356,         1534,         16584,     2210,
+        16833,         9697,         15929,     4513,
+        3277,         1085,          9643,     2187,
+        11973,         6068,          9199,     4462,
+        8955,         1629,         10289,     3062,
+        16481,         5155,         15466,     7066,
+        13678,         2543,          5273,     2277,
+        16746,         6213,         16655,     3408,
+        20304,         3363,         18688,     1985,
+        14172,        12867,         15154,    15703,
+        4473,         1020,          1681,      886,
+        4311,         4301,          8952,     3657,
+        5893,         1147,         11647,     1452,
+        15886,         2227,          4582,     6644,
+        6929,         1205,          6220,      799,
+        12415,         3409,         15968,     3877,
+        19859,         2109,          9689,     2141,
+        14742,         8830,         14480,     2599,
+        1817,         1238,          7771,      813,
+        19079,         4410,          5554,     2064,
+        3687,         2844,         17435,     2256,
+        16697,         4486,         16199,     5388,
+        8028,         2763,          3405,     2119,
+        17426,         5477,         13698,     2786,
+        19879,         2720,          9098,     3880,
+        18172,         4833,         17336,    12207,
+        5116,          996,          4935,      988,
+        9888,         3081,          6014,     5371,
+        15881,         1667,          8405,     1183,
+        15087,         2366,         19777,     7002,
+        11963,         1562,          7279,     1128,
+        16859,         1532,         15762,     5381,
+        14708,         2065,         20105,     2155,
+        17158,         8245,         17911,     6318,
+        5467,         1504,          4100,     2574,
+        17421,         6810,          5673,     2888,
+        16636,         3382,          8975,     1831,
+        20159,         4737,         19550,     7294,
+        6658,         2781,         11472,     3321,
+        19397,         5054,         18878,     4722,
+        16439,         2373,         20430,     4386,
+        11353,        26526,         11593,     3068,
+        2866,         1566,          5108,     1070,
+        9614,         4915,          4939,     3536,
+        7541,          878,         20717,      851,
+        6938,         4395,         16799,     7733,
+        10137,         1019,          9845,      964,
+        15494,         3955,         15459,     3430,
+        18863,          982,         20120,      963,
+        16876,        12887,         14334,     4200,
+        6599,         1220,          9222,      814,
+        16942,         5134,          5661,     4898,
+        5488,         1798,         20258,     3962,
+        17005,         6178,         17929,     5929,
+        9365,         3420,          7474,     1971,
+        19537,         5177,         19003,     3006,
+        16454,         3788,         16070,     2367,
+        8664,         2743,          9445,    26358,
+        10856,         1287,          3555,     1009,
+        5606,         3622,         19453,     5512,
+        12453,          797,         20634,      911,
+        15427,         3066,         17037,    10275,
+        18883,         2633,          3913,     1268,
+        19519,         3371,         18052,     5230,
+        19291,         1678,         19508,     3172,
+        18072,        10754,         16625,     6845,
+        3134,         2298,         10869,     2437,
+        15580,         6913,         12597,     3381,
+        11116,         3297,         16762,     2424,
+        18853,         6715,         17171,     9887,
+        12743,         2605,          8937,     3140,
+        19033,         7764,         18347,     3880,
+        20475,         3682,         19602,     3380,
+        13044,        19373,         10526,    23124
+    };
+
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] qua_gain.tab,  UMTS GSM AMR speech codec,
+                    R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.cpp
new file mode 100644 (file)
index 0000000..f597a23
--- /dev/null
@@ -0,0 +1,774 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: sp_dec.cpp
+ Functions: GSMInitDecode
+            Speech_Decode_Frame_reset
+            GSMDecodeFrameExit
+            GSMFrameDecode
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the functions that initialize, invoke, reset, and exit
+ the GSM AMR decoder.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "sp_dec.h"
+#include "typedef.h"
+#include "cnst.h"
+#include "dec_amr.h"
+#include "pstfilt.h"
+#include "mode.h"
+#include "post_pro.h"
+#include "oscl_mem.h"
+#include "bitno_tab.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Bin2int
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    no_of_bits = number of bits associated with value
+    bitstream = pointer to buffer where bits are read
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function    : Bin2int
+  Purpose     : Read "no_of_bits" bits from the array bitstream[]
+                and convert to integer.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ bits2prm.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static Word16 Bin2int ( // Reconstructed parameter
+    Word16 no_of_bits,  // input : number of bits associated with value
+    Word16 *bitstream   // output: address where bits are written
+)
+{
+    Word16 value, i, bit;
+
+    value = 0;
+    for (i = 0; i < no_of_bits; i++)
+    {
+        value = shl (value, 1);
+        bit = *bitstream++;
+        if (sub (bit, BIT_1) == 0)
+            value = add (value, 1);
+    }
+    return (value);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+static Word16 Bin2int(  /* Reconstructed parameter                      */
+    Word16 no_of_bits,  /* input : number of bits associated with value */
+    Word16 *bitstream   /* input: address where bits are read from      */
+)
+{
+    Word16 value;
+    Word16 i;
+    Word16 single_bit;
+
+    value = 0;
+    for (i = 0; i < no_of_bits; i++)
+    {
+        value <<= 1;
+        single_bit = *(bitstream++);
+        value |= single_bit;
+    }
+    return (value);
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: bits2prm
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode = AMR mode of type enum Mode
+    bits[] = pointer to serial bits of type Word16
+    prm[] = pointer to analysis parameters of type Word16
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function    : Bits2prm
+  Purpose     : Retrieves the vector of encoder parameters from
+                the received serial bits in a frame.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ bits2prm.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Bits2prm (
+    enum Mode mode,     // i : AMR mode
+    Word16 bits[],      // i : serial bits       (size <= MAX_SERIAL_SIZE)
+    Word16 prm[]        // o : analysis parameters  (size <= MAX_PRM_SIZE)
+)
+{
+    Word16 i;
+
+    for (i = 0; i < prmno[mode]; i++)
+    {
+        prm[i] = Bin2int (bitno[mode][i], bits);
+        bits += bitno[mode][i];
+        add(0,0);       // account for above pointer update
+    }
+
+   return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void Bits2prm(
+    enum Mode mode,     /* i : AMR mode                                    */
+    Word16 bits[],      /* i : serial bits       (size <= MAX_SERIAL_SIZE) */
+    Word16 prm[],        /* o : analysis parameters  (size <= MAX_PRM_SIZE) */
+    CommonAmrTbls* common_amr_tbls /* i : ptr to strcut of table ptrs        */
+)
+{
+    Word16 i;
+    const Word16* prmno_ptr = common_amr_tbls->prmno_ptr;
+    const Word16* const* bitno_ptr = common_amr_tbls->bitno_ptr;
+
+
+    for (i = 0; i < prmno_ptr[mode]; i++)
+    {
+        prm[i] = Bin2int(bitno_ptr[mode][i], bits);
+        bits += bitno_ptr[mode][i];
+    }
+
+    return;
+}
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: GSMInitDecode
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to an array of pointers to structures of type
+            Speech_Decode_FrameState
+    no_hp_post_MR122 = flag to turn off high-pass post filter for 12.2 kbps
+                       mode (Flag)
+    id = pointer to an array whose contents are of type char
+
+ Outputs:
+    decoder_amrState field of the structure pointed to by the pointer pointed
+       to by state is set to NULL
+    post_state field of the structure pointed to by the pointer pointed to
+      by state is set to NULL
+    postHP_state field of the structure pointed to by the pointer pointed to
+      by state is set to NULL
+    no_hp_post_MR122 field of the structure pointed to by the pointer pointed
+      to by state is set to the input no_hp_post_MR122
+
+ Returns:
+    return_value = set to zero, if initialization was successful; -1,
+                   otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function allocates memory for filter structure and initializes state
+ memory used by the GSM AMR decoder.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sp_dec.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ Note: Original function name of Speech_Decode_Frame_init was changed to
+       GSMInitDecode in the Code section.
+
+int Speech_Decode_Frame_init (Speech_Decode_FrameState **state,
+                              char *id)
+{
+  Speech_Decode_FrameState* s;
+
+  if (state == (Speech_Decode_FrameState **) NULL){
+      fprintf(stderr, "Speech_Decode_Frame_init: invalid parameter\n");
+      return -1;
+  }
+  *state = NULL;
+
+  // allocate memory
+  if ((s= (Speech_Decode_FrameState *)
+          malloc(sizeof(Speech_Decode_FrameState))) == NULL) {
+      fprintf(stderr, "Speech_Decode_Frame_init: can not malloc state "
+              "structure\n");
+      return -1;
+  }
+  s->decoder_amrState = NULL;
+  s->post_state = NULL;
+  s->postHP_state = NULL;
+
+  if (Decoder_amr_init(&s->decoder_amrState) ||
+      Post_Filter_init(&s->post_state) ||
+      Post_Process_init(&s->postHP_state) ) {
+      Speech_Decode_Frame_exit(&s);
+      return -1;
+  }
+
+  s->complexityCounter = getCounterId(id);
+
+  Speech_Decode_Frame_reset(s);
+  *state = s;
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 GSMInitDecode(void **state_data,
+                     Word8 * id)
+{
+    Speech_Decode_FrameState* s;
+    OSCL_UNUSED_ARG(id);
+
+    if (state_data == NULL)
+    {
+        /*  fprintf(stderr, "Speech_Decode_Frame_init:
+                             invalid parameter\n");  */
+        return (-1);
+    }
+    *state_data = NULL;
+
+    /* allocate memory */
+    if ((s = (Speech_Decode_FrameState *)
+             oscl_malloc(sizeof(Speech_Decode_FrameState))) == NULL)
+    {
+        /*  fprintf(stderr, "Speech_Decode_Frame_init: can not malloc state "
+            "structure\n");  */
+        return (-1);
+    }
+
+    if (Decoder_amr_init(&s->decoder_amrState)
+            || Post_Process_reset(&s->postHP_state))
+    {
+        Speech_Decode_FrameState *tmp = s;
+        /*
+         *  dereferencing type-punned pointer avoid
+         *  breaking strict-aliasing rules
+         */
+        void** tempVoid = (void**) tmp;
+        GSMDecodeFrameExit(tempVoid);
+        return (-1);
+    }
+
+
+    Speech_Decode_Frame_reset(s);
+    *state_data = (void *)s;
+
+    return (0);
+}
+
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Speech_Decode_Frame_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to structures of type Speech_Decode_FrameState
+
+ Outputs:
+    None
+
+ Returns:
+    return_value = set to zero if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function resets the state memory used by the GSM AMR decoder.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sp_dec.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Speech_Decode_Frame_reset (Speech_Decode_FrameState *state)
+{
+  if (state == (Speech_Decode_FrameState *) NULL){
+      fprintf(stderr, "Speech_Decode_Frame_reset: invalid parameter\n");
+      return -1;
+  }
+
+  Decoder_amr_reset(state->decoder_amrState, (enum Mode)0);
+  Post_Filter_reset(state->post_state);
+  Post_Process_reset(state->postHP_state);
+
+  state->prev_mode = (enum Mode)0;
+
+  setCounter(state->complexityCounter);
+  Init_WMOPS_counter();
+  setCounter(0); // set counter to global counter
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 Speech_Decode_Frame_reset(void *state_data)
+{
+
+    Speech_Decode_FrameState *state =
+        (Speech_Decode_FrameState *) state_data;
+
+    if (state_data ==  NULL)
+    {
+        /*  fprintf(stderr, "Speech_Decode_Frame_reset:
+                             invalid parameter\n");  */
+        return (-1);
+    }
+
+    Decoder_amr_reset(&(state->decoder_amrState), MR475);
+    Post_Filter_reset(&(state->post_state));
+    Post_Process_reset(&(state->postHP_state));
+
+    state->prev_mode = MR475;
+
+    return (0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: GSMDecodeFrameExit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to an array of pointers to structures of type
+            Speech_Decode_FrameState
+
+ Outputs:
+    state contents is set to NULL
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function frees up the memory used for the state memory of the GSM AMR
+ decoder.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sp_dec.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ Note: The original function name of Speech_Decode_Frame_exit was changed to
+       GSMDecodeFrameExit in the Code section.
+
+void Speech_Decode_Frame_exit (Speech_Decode_FrameState **state)
+{
+  if (state == NULL || *state == NULL)
+      return;
+
+  Decoder_amr_exit(&(*state)->decoder_amrState);
+  Post_Filter_exit(&(*state)->post_state);
+  Post_Process_exit(&(*state)->postHP_state);
+
+  setCounter((*state)->complexityCounter);
+  WMOPS_output(0);
+  setCounter(0); // set counter to global counter
+
+  // deallocate memory
+  free(*state);
+  *state = NULL;
+
+  return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void GSMDecodeFrameExit(void **state_data)
+{
+
+    Speech_Decode_FrameState **state =
+        (Speech_Decode_FrameState **) state_data;
+
+    if (state == NULL || *state == NULL)
+    {
+        return;
+    }
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: GSMFrameDecode
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to structures of type Speech_Decode_FrameState
+    mode = GSM AMR codec mode (enum Mode)
+    serial = pointer to the serial bit stream buffer (unsigned char)
+    frame_type = GSM AMR receive frame type (enum RXFrameType)
+    synth = pointer to the output synthesis speech buffer (Word16)
+
+ Outputs:
+    synth contents are truncated to 13 bits if NO13BIT is not defined,
+      otherwise, its contents are left at 16 bits
+
+ Returns:
+    return_value = set to zero (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function is the entry point to the GSM AMR decoder. The following
+ operations are performed on one received frame: First, the codec
+ parameters are parsed from the buffer pointed to by serial according to
+ frame_type. Then the AMR decoder is invoked via a call to Decoder_amr. Post
+ filtering of the decoded data is done via a call to Post_Filter function.
+ Lastly, the decoded data is post-processed via a call to Post_Process
+ function. If NO13BIT is not defined, the contents of the buffer pointed to
+ by synth is truncated to 13 bits. It remains unchanged otherwise.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sp_dec.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ Note: The original function name of Speech_Decode_Frame_exit was changed to
+       GSMFrameDecode in the Code section.
+
+int Speech_Decode_Frame (
+    Speech_Decode_FrameState *st, // io: post filter states
+    enum Mode mode,               // i : AMR mode
+    Word16 *serial,               // i : serial bit stream
+    enum RXFrameType frame_type,  // i : Frame type
+    Word16 *synth                 // o : synthesis speech (postfiltered
+                                  //     output)
+)
+{
+  Word16 parm[MAX_PRM_SIZE + 1];  // Synthesis parameters
+  Word16 Az_dec[AZ_SIZE];         // Decoded Az for post-filter
+                                  // in 4 subframes
+
+#if !defined(NO13BIT)
+  Word16 i;
+#endif
+
+  setCounter(st->complexityCounter);
+  Reset_WMOPS_counter ();          // reset WMOPS counter for the new frame
+
+  // Serial to parameters
+  if ((frame_type == RX_SID_BAD) ||
+      (frame_type == RX_SID_UPDATE)) {
+    // Override mode to MRDTX
+    Bits2prm (MRDTX, serial, parm);
+  } else {
+    Bits2prm (mode, serial, parm);
+  }
+
+  // Synthesis
+  Decoder_amr(st->decoder_amrState, mode, parm, frame_type,
+              synth, Az_dec);
+
+  Post_Filter(st->post_state, mode, synth, Az_dec);   // Post-filter
+
+  // post HP filter, and 15->16 bits
+  Post_Process(st->postHP_state, synth, L_FRAME);
+
+#if !defined(NO13BIT)
+  // Truncate to 13 bits
+  for (i = 0; i < L_FRAME; i++)
+  {
+     synth[i] = synth[i] & 0xfff8;
+  }
+#endif
+
+  setCounter(0); // set counter to global counter
+
+  return 0;
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void GSMFrameDecode(
+    Speech_Decode_FrameState *st, /* io: post filter states                */
+    enum Mode mode,               /* i : AMR mode                          */
+    Word16 *serial,               /* i : serial bit stream                 */
+    enum RXFrameType frame_type,  /* i : Frame type                        */
+    Word16 *synth)                /* o : synthesis speech (postfiltered    */
+/*     output)                           */
+
+{
+    Word16 parm[MAX_PRM_SIZE + 1];  /* Synthesis parameters                */
+    Word16 Az_dec[AZ_SIZE];         /* Decoded Az for post-filter          */
+    /* in 4 subframes                      */
+    Flag *pOverflow = &(st->decoder_amrState.overflow);  /* Overflow flag  */
+
+#if !defined(NO13BIT)
+    Word16 i;
+#endif
+
+    /* Serial to parameters   */
+    if ((frame_type == RX_SID_BAD) ||
+            (frame_type == RX_SID_UPDATE))
+    {
+        /* Override mode to MRDTX */
+        Bits2prm(MRDTX, serial, parm, &st->decoder_amrState.common_amr_tbls);
+    }
+    else
+    {
+        Bits2prm(mode, serial, parm, &st->decoder_amrState.common_amr_tbls);
+    }
+
+    /* Synthesis */
+    Decoder_amr(
+        &(st->decoder_amrState),
+        mode,
+        parm,
+        frame_type,
+        synth,
+        Az_dec);
+
+    /* Post-filter */
+    Post_Filter(
+        &(st->post_state),
+        mode,
+        synth,
+        Az_dec,
+        pOverflow);
+
+    /* post HP filter, and 15->16 bits */
+    Post_Process(
+        &(st->postHP_state),
+        synth,
+        L_FRAME,
+        pOverflow);
+
+#if !defined(NO13BIT)
+    /* Truncate to 13 bits */
+    for (i = 0; i < L_FRAME; i++)
+    {
+        synth[i] = synth[i] & 0xfff8;
+    }
+#endif
+
+    return;
+}
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.h
new file mode 100644 (file)
index 0000000..3150feb
--- /dev/null
@@ -0,0 +1,113 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+*****************************************************************************
+*
+*      GSM AMR speech codec   Version 2.0.0   February 8, 1999
+*
+*****************************************************************************
+*
+*      File             : sp_dec.h
+*      Purpose          : Decoding and post filtering of one speech frame.
+*
+
+ Description:  Replaced "int" and/or "char" with OSCL defined types.
+
+*****************************************************************************
+*/
+#ifndef sp_dec_h
+#define sp_dec_h "$Id $"
+
+/*
+*****************************************************************************
+*                         INCLUDE FILES
+*****************************************************************************
+*/
+#include "typedef.h"
+#include "cnst.h"
+#include "dec_amr.h"
+#include "pstfilt.h"
+#include "post_pro.h"
+#include "mode.h"
+
+/*
+*****************************************************************************
+*                         DEFINITION OF DATA TYPES
+*****************************************************************************
+*/
+typedef struct
+{
+    Decoder_amrState  decoder_amrState;
+    Post_FilterState  post_state;
+    Post_ProcessState postHP_state;
+    enum Mode prev_mode;
+} Speech_Decode_FrameState;
+
+/*
+*****************************************************************************
+*                         DECLARATION OF PROTOTYPES
+*****************************************************************************
+*/
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+    Word16 GSMInitDecode(void **state_data,
+    Word8 *id);
+    /* initialize one instance of the speech decoder
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to Speech_Decode_Frame in each call.
+       returns 0 on success
+     */
+
+    Word16 Speech_Decode_Frame_reset(void *state_data);
+    /* reset speech decoder (i.e. set state memory to zero)
+       returns 0 on success
+     */
+
+    void GSMDecodeFrameExit(void **state_data);
+    /* de-initialize speech decoder (i.e. free status struct)
+       stores NULL in *s
+     */
+
+    void GSMFrameDecode(
+        Speech_Decode_FrameState *st, /* io: post filter states                */
+        enum Mode mode,               /* i : AMR mode                          */
+        Word16 *serial,               /* i : serial bit stream                 */
+        enum RXFrameType frame_type,  /* i : Frame type                        */
+        Word16 *synth                 /* o : synthesis speech (postfiltered    */
+        /*     output)                           */
+    );
+    /*    return 0 on success
+     */
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/wmf_to_ets.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/wmf_to_ets.cpp
new file mode 100644 (file)
index 0000000..c60c2cb
--- /dev/null
@@ -0,0 +1,163 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: wmf_to_ets.cpp
+ Functions: wmf_to_ets
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "frame_type_3gpp.h"
+#include "wmf_to_ets.h"
+#include "typedef.h"
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: wmf_to_ets
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    frame_type_3gpp = decoder speech bit rate (enum Frame_Type_3GPP)
+    wmf_input_ptr   = pointer to input encoded speech bits in WMF (non-IF2) format
+                     (Word8)
+    ets_output_ptr  = pointer to output encoded speech bits in ETS format (Word16)
+
+ Outputs:
+    ets_output_ptr  = pointer to encoded speech bits in the ETS format (Word16)
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs a transformation on the data buffers. It converts the
+ data format from WMF (non-IF2) (Wireless Multi-media Forum) to ETS (European
+ Telecommunication Standard). WMF format has the encoded speech bits byte
+ aligned with MSB to LSB going left to right. ETS format has the encoded speech
+ bits each separate with only one bit stored in each word.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0 Release 4, June 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void wmf_to_ets(
+    enum Frame_Type_3GPP frame_type_3gpp,
+    UWord8   *wmf_input_ptr,
+    Word16   *ets_output_ptr,
+    CommonAmrTbls* common_amr_tbls)
+{
+
+    Word16 i;
+    const Word16* const* reorderBits_ptr = common_amr_tbls->reorderBits_ptr;
+    const Word16* numOfBits_ptr = common_amr_tbls->numOfBits_ptr;
+
+    /*
+     * The following section of code accesses bits in the WMF method of
+     * bit ordering. Each bit is given its own location in the buffer pointed
+     * to by ets_output_ptr. If the frame_type_3gpp is less than MRDTX then
+     * the elements are reordered within the buffer pointed to by ets_output_ptr.
+     */
+
+    if (frame_type_3gpp < AMR_SID)
+    {
+        /* The table numOfBits[] can be found in bitreorder.c. */
+        for (i = numOfBits_ptr[frame_type_3gpp] - 1; i >= 0; i--)
+        {
+            /* The table reorderBits[][] can be found in bitreorder.c. */
+            ets_output_ptr[reorderBits_ptr[frame_type_3gpp][i]] =
+                (wmf_input_ptr[i>>3] >> ((~i) & 0x7)) & 0x01;
+        }
+    }
+    else
+    {
+        /* The table numOfBits[] can be found in bitreorder.c. */
+        for (i = numOfBits_ptr[frame_type_3gpp] - 1; i >= 0; i--)
+        {
+            ets_output_ptr[i] = (wmf_input_ptr[i>>3] >> ((~i) & 0x7)) & 0x01;
+        }
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk
new file mode 100644 (file)
index 0000000..a40eaf3
--- /dev/null
@@ -0,0 +1,88 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+       src/amrencode.cpp \
+       src/autocorr.cpp \
+       src/c1035pf.cpp \
+       src/c2_11pf.cpp \
+       src/c2_9pf.cpp \
+       src/c3_14pf.cpp \
+       src/c4_17pf.cpp \
+       src/c8_31pf.cpp \
+       src/calc_cor.cpp \
+       src/calc_en.cpp \
+       src/cbsearch.cpp \
+       src/cl_ltp.cpp \
+       src/cod_amr.cpp \
+       src/convolve.cpp \
+       src/cor_h.cpp \
+       src/cor_h_x.cpp \
+       src/cor_h_x2.cpp \
+       src/corrwght_tab.cpp \
+       src/div_32.cpp \
+       src/dtx_enc.cpp \
+       src/enc_lag3.cpp \
+       src/enc_lag6.cpp \
+       src/enc_output_format_tab.cpp \
+       src/ets_to_if2.cpp \
+       src/ets_to_wmf.cpp \
+       src/g_adapt.cpp \
+       src/g_code.cpp \
+       src/g_pitch.cpp \
+       src/gain_q.cpp \
+       src/gsmamr_encoder_wrapper.cpp \
+       src/hp_max.cpp \
+       src/inter_36.cpp \
+       src/inter_36_tab.cpp \
+       src/l_abs.cpp \
+       src/l_comp.cpp \
+       src/l_extract.cpp \
+       src/l_negate.cpp \
+       src/lag_wind.cpp \
+       src/lag_wind_tab.cpp \
+       src/levinson.cpp \
+       src/lpc.cpp \
+       src/ol_ltp.cpp \
+       src/p_ol_wgh.cpp \
+       src/pitch_fr.cpp \
+       src/pitch_ol.cpp \
+       src/pre_big.cpp \
+       src/pre_proc.cpp \
+       src/prm2bits.cpp \
+       src/q_gain_c.cpp \
+       src/q_gain_p.cpp \
+       src/qgain475.cpp \
+       src/qgain795.cpp \
+       src/qua_gain.cpp \
+       src/s10_8pf.cpp \
+       src/set_sign.cpp \
+       src/sid_sync.cpp \
+       src/sp_enc.cpp \
+       src/spreproc.cpp \
+       src/spstproc.cpp \
+       src/ton_stab.cpp \
+       src/vad1.cpp
+
+
+LOCAL_MODULE := libpvencoder_gsmamr
+
+LOCAL_CFLAGS :=   $(PV_CFLAGS)
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := 
+
+LOCAL_SHARED_LIBRARIES := 
+
+LOCAL_C_INCLUDES := \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/enc/src \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/enc/include \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/include \
+       $(PV_INCLUDES)
+
+LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO)
+
+LOCAL_COPY_HEADERS := \
+       include/gsmamr_encoder_wrapper.h
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build/make/local.mk b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build/make/local.mk
new file mode 100644 (file)
index 0000000..01d55d8
--- /dev/null
@@ -0,0 +1,84 @@
+# Get the current local path as the first operation
+LOCAL_PATH := $(call get_makefile_dir)
+
+# Clear out the variables used in the local makefiles
+include $(MK)/clear.mk
+
+
+
+TARGET := pvencoder_gsmamr
+
+
+OPTIMIZE_FOR_PERFORMANCE_OVER_SIZE := true
+
+XINCDIRS +=  ../../../common/include
+
+SRCDIR := ../../src
+INCSRCDIR := ../../include
+
+SRCS := amrencode.cpp \
+       autocorr.cpp \
+       c1035pf.cpp \
+       c2_11pf.cpp \
+       c2_9pf.cpp \
+       c3_14pf.cpp \
+       c4_17pf.cpp \
+       c8_31pf.cpp \
+       calc_cor.cpp \
+       calc_en.cpp \
+       cbsearch.cpp \
+       cl_ltp.cpp \
+       cod_amr.cpp \
+       convolve.cpp \
+       cor_h.cpp \
+       cor_h_x.cpp \
+       cor_h_x2.cpp \
+       corrwght_tab.cpp \
+       div_32.cpp \
+       dtx_enc.cpp \
+       enc_lag3.cpp \
+       enc_lag6.cpp \
+       enc_output_format_tab.cpp \
+       ets_to_if2.cpp \
+       ets_to_wmf.cpp \
+       g_adapt.cpp \
+       g_code.cpp \
+       g_pitch.cpp \
+       gain_q.cpp \
+       gsmamr_encoder_wrapper.cpp \
+       hp_max.cpp \
+       inter_36.cpp \
+       inter_36_tab.cpp \
+       l_abs.cpp \
+       l_comp.cpp \
+       l_extract.cpp \
+       l_negate.cpp \
+       lag_wind.cpp \
+       lag_wind_tab.cpp \
+       levinson.cpp \
+       lpc.cpp \
+       ol_ltp.cpp \
+       p_ol_wgh.cpp \
+       pitch_fr.cpp \
+       pitch_ol.cpp \
+       pre_big.cpp \
+       pre_proc.cpp \
+       prm2bits.cpp \
+       q_gain_c.cpp \
+       q_gain_p.cpp \
+       qgain475.cpp \
+       qgain795.cpp \
+       qua_gain.cpp \
+       s10_8pf.cpp \
+       set_sign.cpp \
+       sid_sync.cpp \
+       sp_enc.cpp \
+       spreproc.cpp \
+       spstproc.cpp \
+       ton_stab.cpp \
+       vad1.cpp 
+
+HDRS := gsmamr_encoder_wrapper.h
+
+include $(MK)/library.mk
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/include/gsmamr_encoder_wrapper.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/include/gsmamr_encoder_wrapper.h
new file mode 100644 (file)
index 0000000..7b54d28
--- /dev/null
@@ -0,0 +1,323 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+#ifndef __GSMAMR_ENCODER_WRAPPER_H__
+#define __GSMAMR_ENCODER_WRAPPER_H__
+
+//----------------------------------------------------------------------------
+// INCLUDES
+//----------------------------------------------------------------------------
+#include "oscl_base.h"
+
+class TInputAudioStream
+{
+    public:
+        // Pointer to buffer containing the audio samples.
+        // The application is required to allocate this buffer.
+        uint8* iSampleBuffer;
+
+        // Number of samples in bytes contained in iSampleBuffer
+        int32 iSampleLength;
+
+        // Mode of operation (the same as bit rate)
+        // For example, "GSM_AMR_4_75" (for 4.75 kbps) for GSM-AMR
+        int32 iMode;
+
+        // Start time when samples were taken
+        uint64 iStartTime;
+
+        // End time when samples were taken
+        uint64 iStopTime;
+};
+
+
+class TOutputAudioStream
+{
+    public:
+        // Pointer to buffer containing encoded audio samples
+        uint8* iBitStreamBuffer;
+
+        // Number of sample frames encoded and are contained in the buffer
+        int32 iNumSampleFrames;
+
+        // Size in bytes of each encoded sample frame;
+        // This variable may point to an array if the sample frame sizes are
+        // variable. For example:
+        //    iSampleFrameSize[0] = 23   (frame size of frame #1)
+        //    iSampleFrameSize[1] = 12   (frame size of frame #2)
+        //    . . .
+        //    iSampleFrameSize[iNumSampleFrames] = 10 (frame size of last frame)
+        int32* iSampleFrameSize;
+
+        // Start time of the encoded samples contained in the bit stream buffer
+        uint32 iStartTime;
+
+        // Stop time of encoded samples contained in the bit stream buffer
+        uint32 iStopTime;
+};
+
+class TEncodeProperties
+{
+    public:
+        // /////////////////////////////////////////////
+        // Input stream properties (uncompressed audio)
+        // /////////////////////////////////////////////
+
+        enum EInterleaveMode
+        {
+            EINTERLEAVE_LR,        // interleaved left-right
+            EGROUPED_LR,           // non-interleaved left-right
+            ENUM_INTERLEAVE_MODES  // number of modes supported
+        };
+
+        // DESCRIPTION: Number of bits per sample. For example, set it to "16"
+        //              bits for PCM.
+        // USAGE:       The authoring application is required to fill this in.
+        //              The CAEI uses the value for encoding.
+        int32 iInBitsPerSample;
+
+        // DESCRIPTION: Sampling rate of the input samples in Hz.
+        //              For example, set it to "22050" Hz.
+        // USAGE:       The authoring application is required to fill this in.
+        //              If sampling rate is not known until CAEI is initialized,
+        //              use '0'. The CAEI uses the value for encoding.
+        uint32 iInSamplingRate;
+
+        // DESCRIPTION: Clock rate or time scale to be used for the input timestamps
+        //              (ticks per secs). For example, "22050" ticks/sec.
+        // USAGE:       The authoring application is required to fill this in.
+        //              If sampling rate is not known until CAEI is initialized,
+        //              use '0'. The CAEI uses the value for encoding.
+        uint32 iInClockRate;
+
+        // DESCRIPTION: Number of input channels:1=Mono,2=Stereo.(Mono uses 1 channel;
+        //              Stereo uses 2 channels).
+        // USAGE:       The authoring application is required to fill this in.
+        //              The CAEI uses the value for encoding.
+        uint8 iInNumChannels;
+
+        // DESCRIPTION: Whether to interleave or not the multi-channel input samples:
+        //              EINTERLEAVE_LR  = LRLRLRLRLR    (interleaved left-right)
+        //              EGROUPED_LR = LLLLLL...RRRRRR   (non-interleaved left-right)
+        // USAGE:       The authoring application is required to fill this in.
+        //              The CAEI uses the value for encoding.
+        EInterleaveMode iInInterleaveMode;
+
+        // DESCRIPTION: Desired Sampling rate for a given bitrate combination:
+        //              For example, set it to "16000" Hz if the encoding 16kbps
+        //              mono/stereo or 24 kbps stereo
+        // USAGE:       The authoring application is required to fill this in.
+        //              The CAEI uses the value for encoding.
+        uint32 iDesiredSamplingRate;
+
+    public:
+        // ////////////////////////////////////////////
+        // Output stream properties (compressed audio)
+        // ////////////////////////////////////////////
+
+        // DESCRIPTION: Mode of operation (the same as bit rate). For example,
+        //              "GSM_AMR_4_75" (for 4.75 kbps).
+        // USAGE:       The authoring application is required to fill this in.
+        //              The CAEI uses the value to configure the codec library.
+        int32 iMode;
+
+        // DESCRIPTION: Bit order format:
+        //              TRUE  = MSB..................LSB
+        //                       d7 d6 d5 d4 d3 d2 d1 d0
+        //              FALSE = MSB..................LSB
+        //                      d0 d1 d2 d3 d4 d5 d6 d7
+        // USAGE:       The authoring application is required to fill this in.
+        //              The CAEI will use the value to setup the codec library.
+        int32 iBitStreamFormat;
+
+        // DESCRIPTION: Audio object type for the output bitstream; only applies
+        //              to AAC codec
+        // USAGE:       The application is required to fill this in.
+        //              The CADI will use the value to setup the codec library.
+        int32 iAudioObjectType;
+
+        // DESCRIPTION: Final sampling frequency used when encoding in Hz.
+        //              For example, "44100" Hz.
+        // USAGE:       If the input sampling rate is not appropriate (e.g.,
+        //              the codec requires a different sampling frequency),
+        //              the CAEI will fill this in with the final sampling
+        //              rate. The CAEI will perform resampling if the
+        //              input sampling frequency is not the same as the output
+        //              sampling frequency.
+        uint32 iOutSamplingRate;
+
+        // DESCRIPTION: Number of output channels:1=Mono,2=Stereo. (Mono uses 1
+        //              channel; Stereo uses 2 channels).
+        // USAGE:       The CAEI will fill this in if it needs to convert
+        //              the input samples to what is required by the codec.
+        uint8 iOutNumChannels;
+
+        // DESCRIPTION: Clock rate or time scale used for the timestamps (ticks per secs)
+        //              For example, "8000" ticks/sec.
+        // USAGE:       The CAEI will fill this in if the input data will be
+        //              resampled.
+        uint32 iOutClockRate;
+};
+
+
+
+/**
+**   This class encodes audio samples using the GSM-AMR algorithm.
+**   This codec operates on a 20-msec frame duration corresponding to 160
+**   samples at the sampling frequency of 8000 samples/sec. The size of a frame
+**   is 320 bytes. For each 20-ms frame, a bit-rate of 4.75, 5.15, 5.90, 6.70,
+**   7.40, 7.95, 10.2, or 12.2 kbits/sec can be produced.
+**
+**   Sample usage:
+**   ------------
+**       // create a GSM-AMR encoder object
+**       CGsmAmrEncoder* myAppEncoder = OSCL_NEW(CGsmAmrEncoder, ());
+**       // set input parameters
+**       TEncodeProperties myProps;
+**       myProps.iInSamplingRate = 8000;
+**       myProps.iInBitsPerSample = 16;
+**       myProps.iOutBitRate = CGsmAmrEncoder::GSM_AMR_12_2;
+**       myAppEncoder->InitializeEncoder(myProps, 2000);
+**
+**       // encode a sample block
+**       myAppEncoder->Encode(myInput, myOutput);
+**
+//       // done encoding so cleanup
+**       myAppEncoder->CleanupEncoder();
+**       OSCL_DELETE(myAppEncoder);
+**
+*/
+
+class CPvGsmAmrEncoder
+{
+    public:
+        //! Constructor -- creates a GSM-AMR encoder object
+        OSCL_IMPORT_REF CPvGsmAmrEncoder();
+
+        //! Destructor -- destroys the GSM-AMR encoder object
+        OSCL_IMPORT_REF ~CPvGsmAmrEncoder();
+
+        /**
+        *  This function initializes the GSM-AMR encoder.
+        * @param "aMaxOutputBufferSize" "the maximum buffer size for the output buffer when Encode() gets called"
+        * @param "aProps" "TEncodeProperties based pointer for the input encoding setting. if aProps=NULL, then
+        *        default settings will be set"
+        * @return 0 for the correct operation, and -1 for the wrong operation
+        */
+        OSCL_IMPORT_REF int32 InitializeEncoder(int32 aMaxOutputBufferSize,
+                                                TEncodeProperties* aProps = NULL);
+
+        /**
+        *  This function initializes the GSM-AMR encoder.
+        * @param "aInStream" "TInputAudioStream based reference object that contains the input buffer and buffer size and timestamp info"
+        * @param "aOutStream" "TOutputAudioStream based reference object that contains the output buffer for compressed data
+        * @return 0 for the correct operation, and -1 for the wrong operation
+        */
+        OSCL_IMPORT_REF int32 Encode(TInputAudioStream& aInStream,
+                                     TOutputAudioStream& aOutStream);
+
+        /**
+        *  This function cleans up the encoder workspace when done encoding.
+        */
+        OSCL_IMPORT_REF int32 CleanupEncoder();
+
+        /**
+        *  This function reset the encoder workspace.
+        */
+        OSCL_IMPORT_REF int32 Reset();
+
+
+    public:
+        // GSM AMR modes
+        // ** values should be the same as the Mode enum specified by AMR library
+        enum GSM_AMR_MODES
+        {
+            GSM_AMR_4_75,
+            GSM_AMR_5_15,
+            GSM_AMR_5_90,
+            GSM_AMR_6_70,
+            GSM_AMR_7_40,
+            GSM_AMR_7_95,
+            GSM_AMR_10_2,
+            GSM_AMR_12_2,
+            GSM_AMR_DTX,
+            GSM_AMR_N_MODES      /* number of (SPC) modes */
+        };
+
+    private:
+
+        /**
+        *  This inline function checks whether the specified mode is valid or not.
+        * @param "aMode" "input the current mode to be used in encoding"
+        * @return true for the valid mode, and false for the wrong mode
+        */
+        inline bool IsModeValid(int32 aMode)
+        {
+            return((aMode < GSM_AMR_N_MODES) && (aMode >= 0));
+        }
+
+    private:
+
+        // GSM AMR encoder state variables
+        void* iEncState;
+        void* iSidState;
+
+        // contains the current mode of GSM AMR
+        GSM_AMR_MODES iGsmAmrMode;
+
+        // last mode used
+        int32 iLastModeUsed;
+
+        // number of samples per frame (granulity)
+        int32 iNumSamplesPerFrame;
+        // number of bytes per sample
+        int32 iBytesPerSample;
+
+        // maximum size allowed for output buffer
+        int32 iMaxOutputBufferSize;
+
+        // bit stream format
+        int32 iBitStreamFormat;
+
+};
+
+typedef enum
+{
+    GSMAMR_ENC_NO_ERROR                 = 0,
+    GSMAMR_ENC_NO_MEMORY_ERROR          = -1,
+    GSMAMR_ENC_CODEC_INIT_FAILURE       = -2,
+    GSMAMR_ENC_CODEC_NOT_INITIALIZED    = -3,
+    GSMAMR_ENC_INVALID_PARAM            = -4,
+    GSMAMR_ENC_INVALID_MODE             = -5,
+    GSMAMR_ENC_CODEC_ENCODE_FAILURE     = -6,
+    GSMAMR_ENC_MEMORY_OVERFLOW          = -7
+} GSMAMR_ENC_STATUS;
+
+#endif  // __GSMAMR_ENCODER_WRAPPER_H__
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.cpp
new file mode 100644 (file)
index 0000000..a58dd74
--- /dev/null
@@ -0,0 +1,811 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: amrencode.cpp
+ Functions: AMREncode
+            AMREncodeInit
+            AMREncodeReset
+            AMREncodeExit
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the functions required to initialize, reset, exit, and
+ invoke the ETS 3GPP GSM AMR encoder.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "cnst.h"
+#include "mode.h"
+#include "frame_type_3gpp.h"
+#include "typedef.h"
+
+#include "amrencode.h"
+#include "ets_to_if2.h"
+#include "ets_to_wmf.h"
+#include "sid_sync.h"
+#include "sp_enc.h"
+
+/*----------------------------------------------------------------------------
+; MACROS [optional]
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES [optional]
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: AMREncodeInit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pEncStructure = pointer containing the pointer to a structure used by
+                    the encoder (void)
+    pSidSyncStructure = pointer containing the pointer to a structure used for
+                        SID synchronization (void)
+    dtx_enable = flag to turn off or turn on DTX (Flag)
+
+ Outputs:
+    None
+
+ Returns:
+    init_status = 0, if initialization was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    speech_encoder_state = pointer to encoder frame structure
+                           (Speech_Encode_FrameState)
+    sid_state = pointer to SID sync structure (sid_syncState)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function initializes the GSM AMR Encoder library by calling
+ GSMInitEncode and sid_sync_init. If initialization was successful,
+ init_status is set to zero, otherwise, it is set to -1.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ // Initialize GSM AMR Encoder
+ CALL GSMInitEncode(state_data = &pEncStructure,
+                    dtx = dtx_enable,
+                    id = char_id            )
+   MODIFYING(nothing)
+   RETURNING(return_value = enc_init_status)
+
+ // Initialize SID synchronization
+ CALL sid_sync_init(state = &pSidSyncStructure)
+   MODIFYING(nothing)
+   RETURNING(return_value = sid_sync_init_status)
+
+ IF ((enc_init_status != 0) || (sid_sync_init != 0))
+ THEN
+     init_status = -1
+
+ ENDIF
+
+ MODIFY(nothing)
+ RETURN(init_status)
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 AMREncodeInit(
+    void **pEncStructure,
+    void **pSidSyncStructure,
+    Flag dtx_enable)
+{
+    Word16 enc_init_status = 0;
+    Word16 sid_sync_init_status = 0;
+    Word16 init_status = 0;
+
+    /* Initialize GSM AMR Encoder */
+#ifdef CONSOLE_ENCODER_REF
+    /* Change to original ETS input types */
+    Speech_Encode_FrameState **speech_encode_frame =
+        (Speech_Encode_FrameState **)(pEncStructure);
+
+    sid_syncState **sid_sync_state = (sid_syncState **)(pSidSyncStructure);
+
+    /* Use ETS version of sp_enc.c */
+    enc_init_status = Speech_Encode_Frame_init(speech_encode_frame,
+                      dtx_enable,
+                      (Word8*)"encoder");
+
+    /* Initialize SID synchronization */
+    sid_sync_init_status = sid_sync_init(sid_sync_state);
+
+#else
+    /* Use PV version of sp_enc.c */
+    enc_init_status = GSMInitEncode(pEncStructure,
+                                    dtx_enable,
+                                    (Word8*)"encoder");
+
+    /* Initialize SID synchronization */
+    sid_sync_init_status = sid_sync_init(pSidSyncStructure);
+
+
+#endif
+
+    if ((enc_init_status != 0) || (sid_sync_init_status != 0))
+    {
+        init_status = -1;
+    }
+
+    return(init_status);
+}
+
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: AMREncodeReset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pEncStructure = pointer to a structure used by the encoder (void)
+    pSidSyncStructure = pointer to a structure used for SID synchronization
+                        (void)
+
+ Outputs:
+    None
+
+ Returns:
+    reset_status = 0, if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    speech_encoder_state = pointer to encoder frame structure
+                           (Speech_Encode_FrameState)
+    sid_state = pointer to SID sync structure (sid_syncState)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function resets the state memory used by the Encoder and SID sync
+ function. If reset was successful, reset_status is set to zero, otherwise,
+ it is set to -1.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ // Reset GSM AMR Encoder
+ CALL Speech_Encode_Frame_reset(state_data = pEncStructure)
+   MODIFYING(nothing)
+   RETURNING(return_value = enc_reset_status)
+
+ // Reset SID synchronization
+ CALL sid_sync_reset(state = pSidSyncStructure)
+   MODIFYING(nothing)
+   RETURNING(return_value = sid_sync_reset_status)
+
+ IF ((enc_reset_status != 0) || (sid_sync_reset_status != 0))
+ THEN
+     reset_status = -1
+
+ ENDIF
+
+ MODIFY(nothing)
+ RETURN(reset_status)
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 AMREncodeReset(
+    void *pEncStructure,
+    void *pSidSyncStructure)
+{
+    Word16 enc_reset_status = 0;
+    Word16 sid_sync_reset_status = 0;
+    Word16 reset_status = 0;
+
+    /* Reset GSM AMR Encoder */
+    enc_reset_status = Speech_Encode_Frame_reset(pEncStructure);
+
+
+    /* Reset SID synchronization */
+    sid_sync_reset_status = sid_sync_reset(pSidSyncStructure);
+
+    if ((enc_reset_status != 0) || (sid_sync_reset_status != 0))
+    {
+        reset_status = -1;
+    }
+
+    return(reset_status);
+}
+
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: AMREncodeExit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pEncStructure = pointer containing the pointer to a structure used by
+                    the encoder (void)
+    pSidSyncStructure = pointer containing the pointer to a structure used for
+                        SID synchronization (void)
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    speech_encoder_state = pointer to encoder frame structure
+                           (Speech_Encode_FrameState)
+    sid_state = pointer to SID sync structure (sid_syncState)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function frees up the state memory used by the Encoder and SID
+ synchronization function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ // Exit GSM AMR Encoder
+ CALL GSMEncodeFrameExit(state_data = &pEncStructure)
+   MODIFYING(nothing)
+   RETURNING(nothing)
+
+ // Exit SID synchronization
+ CALL sid_sync_exit(state = &pSidSyncStructure)
+   MODIFYING(nothing)
+   RETURNING(nothing)
+
+ MODIFY(nothing)
+ RETURN(nothing)
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void AMREncodeExit(
+    void **pEncStructure,
+    void **pSidSyncStructure)
+{
+    /* Exit GSM AMR Encoder */
+
+#ifdef CONSOLE_ENCODER_REF
+    /* Change to original ETS input types */
+    Speech_Encode_FrameState ** speech_encode_frame =
+        (Speech_Encode_FrameState **)(pEncStructure);
+
+    sid_syncState ** sid_sync_state = (sid_syncState **)(pSidSyncStructure);
+
+    /* Use ETS version of sp_enc.c */
+    Speech_Encode_Frame_exit(speech_encode_frame);
+
+
+    /* Exit SID synchronization */
+    sid_sync_exit(sid_sync_state);
+
+#else
+
+    /* Use PV version of sp_enc.c */
+    GSMEncodeFrameExit(pEncStructure);
+
+    /* Exit SID synchronization */
+    sid_sync_exit(pSidSyncStructure);
+
+#endif
+
+    return;
+}
+
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: AMREncode
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pEncState = pointer to encoder state structure (void)
+    pSidSyncState = pointer to SID sync state structure (void)
+    mode = codec mode (enum Mode)
+    pEncInput = pointer to the input speech samples (Word16)
+    pEncOutput = pointer to the encoded bit stream (unsigned char)
+    p3gpp_frame_type = pointer to the 3GPP frame type (enum Frame_Type_3GPP)
+    output_format = output format type (Word16); valid values are AMR_WMF,
+                    AMR_IF2, and AMR_ETS
+
+ Outputs:
+    pEncOutput buffer contains to the newly encoded bit stream
+    p3gpp_frame_type store contains the new 3GPP frame type
+
+ Returns:
+    num_enc_bytes = number of encoded bytes for a particular
+                    mode or -1, if an error occurred (int)
+
+ Global Variables Used:
+    WmfEncBytesPerFrame = table containing the number of encoder frame
+                          data bytes per codec mode for WMF output
+                          format (const int)
+    If2EncBytesPerFrame = table containing the number of encoder frame
+                          data bytes per codec mode for IF2 output
+                          format (const int)
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function is the top-level entry point to the GSM AMR Encoder library.
+
+ The following describes the encoding process for WMF or IF2 formatted output
+ data. This functions calls GSMEncodeFrame to encode one frame's worth of
+ input speech samples, and returns the newly encoded bit stream in the buffer
+ pointed to by pEncOutput.Then the function sid_sync is called to determine
+ the transmit frame type. If the transmit frame type is TX_SPEECH_GOOD or
+ TX_SID_FIRST or TX_SID_UPDATE, p3gpp_frame_type will be set to the encoder
+ used mode. For SID frames, the SID type information and mode information are
+ added to the encoded parameter bitstream according to the SID frame format
+ described in [1]. If the transmit frame type is TX_NO_DATA, the store
+ pointed to by p3gpp_frame_type will be set to NO_DATA. Then the output
+ format type (output_format) will be checked to determine the format of the
+ encoded data.
+
+ If output_format is AMR_TX_WMF, the function ets_to_wmf will be called to
+ convert from ETS format (1 bit/word, where 1 word = 16 bits, information in
+ least significant bit) to WMF (aka, non-IF2). The WMF format stores the data
+ in octets. The least significant 4 bits of the first octet contains the 3GPP
+ frame type information and the most significant 4 bits are zeroed out. The
+ succeeding octets contain the packed encoded speech bits. The total number of
+ WMF bytes encoded is obtained from WmfEncBytesPerFrame table and returned via
+ num_enc_bytes.
+
+ If output_format is AMR_TX_IF2, the function if2_to_ets will be called to
+ convert from ETS format to IF2 [1]. The IF2 format stores the data in octets.
+ The least significant nibble of the first octet contains the 3GPP frame type
+ and the most significant nibble contains the first 4 encoded speech bits. The
+ suceeding octets contain the packed encoded speech bits. The total number of
+ IF2 bytes encoded is obtained from If2EncBytesPerFrame table and returned via
+ num_enc_bytes.
+
+ If output_format is AMR_TX_ETS, GSMFrameEncode is called to generate the
+ encoded speech parameters, then, sid_sync is called to determine the transmit
+ frame type. If the transmit frame type is not TX_NO_DATA, then the transmit
+ frame type information is saved in the first location of the ets_output_bfr,
+ followed by the encoded speech parameters. The codec mode information is
+ stored immediately after the MAX_SERIAL_SIZE encoded speech parameters. If
+ the transmit frame type is TX_NO_DATA, the transmit frame type, encoded
+ speech parameters, and codec mode are stored in the same order as before
+ in ets_output_bfr. However, for the no data case, the codec mode is set to
+ -1.
+
+ After all the required information is generated, the 16-bit data generated
+ by the Encoder (in ets_output_bfr) is copied to the buffer pointed to by
+ pEncOutput in the little endian configuration, i.e., least significant byte,
+ followed by most significant byte. The num_enc_bytes is set to
+ 2*(MAX_SERIAL_SIZE+2).
+
+ If output_format is invalid, this function flags the error and sets
+ num_enc_bytes to -1.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] "AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0
+     Release 4, June 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ IF ((output_format == AMR_TX_WMF) | (output_format == AMR_TX_IF2))
+ THEN
+     // Encode one speech frame (20 ms)
+     CALL GSMEncodeFrame( state_data = pEncState,
+                          mode = mode,
+                          new_speech = pEncInput,
+                          serial = &ets_output_bfr[0],
+                          usedMode = &usedMode )
+       MODIFYING(nothing)
+       RETURNING(return_value = 0)
+
+     // Determine transmit frame type
+     CALL sid_sync(st = pSidSyncState,
+                   mode = usedMode
+                   tx_frame_type = &tx_frame_type)
+       MODIFYING(nothing)
+       RETURNING(nothing)
+
+     IF (tx_frame_type != TX_NO_DATA)
+     THEN
+         // There is data to transmit
+         *p3gpp_frame_type = (enum Frame_Type_3GPP) usedMode
+
+         // Add SID type and mode info for SID frames
+         IF (*p3gpp_frame_type == AMR_SID)
+         THEN
+             // Add SID type to encoder output buffer
+             IF (tx_frame_type == TX_SID_FIRST)
+             THEN
+                 ets_output_bfr[AMRSID_TXTYPE_BIT_OFFSET] &= 0x7f
+
+             ELSEIF (tx_frame_type == TX_SID_UPDATE )
+             THEN
+                 ets_output_bfr[AMRSID_TXTYPE_BIT_OFFSET] |= 0x80
+
+             ENDIF
+
+             // Add mode information bits
+             FOR i = 0 TO NUM_AMRSID_TXMODE_BITS-1
+
+                 ets_output_bfr[AMRSID_TXMODE_BIT_OFFSET+i] = (mode>>i)&&0x0001
+
+             ENDFOR
+
+         ENDIF
+
+     ELSE
+         // There is no data to transmit
+         *p3gpp_frame_type = NO_DATA
+
+     ENDIF
+
+     // Determine the output format to use
+     IF (output_format == AMR_TX_WMF)
+     THEN
+         // Change output data format to WMF
+         CALL ets_to_wmf( frame_type_3gpp = *p3gpp_frame_type,
+                          ets_input_ptr = &ets_output_bfr[0],
+                          wmf_output_ptr = pEncOutput         )
+           MODIFYING(nothing)
+           RETURNING(nothing)
+
+         // Set up the number of encoded WMF bytes
+         num_enc_bytes = WmfEncBytesPerFrame[(int) *p3gpp_frame_type]
+
+     ELSEIF (output_format == AMR_TX_IF2)
+     THEN
+         // Change output data format to IF2
+         CALL ets_to_if2( frame_type_3gpp = *p3gpp_frame_type,
+                          ets_input_ptr = &ets_output_bfr[0],
+                          if2_output_ptr = pEncOutput         )
+           MODIFYING(nothing)
+           RETURNING(nothing)
+
+         // Set up the number of encoded IF2 bytes
+         num_enc_bytes = If2EncBytesPerFrame[(int) *p3gpp_frame_type]
+
+     ENDIF
+
+ ELSEIF (output_format = AMR_TX_ETS)
+ THEN
+     // Encode one speech frame (20 ms)
+     CALL GSMEncodeFrame( state_data = pEncState,
+                          mode = mode,
+                          new_speech = pEncInput,
+                          serial = &ets_output_bfr[1],
+                          usedMode = &usedMode )
+       MODIFYING(nothing)
+       RETURNING(return_value = 0)
+
+     // Save used mode
+     *p3gpp_frame_type = (enum Frame_Type_3GPP) usedMode
+
+     // Determine transmit frame type
+     CALL sid_sync(st = pSidSyncState,
+                   mode = usedMode
+                   tx_frame_type = &tx_frame_type)
+       MODIFYING(nothing)
+       RETURNING(nothing)
+
+     // Put TX frame type in output buffer
+     ets_output_bfr[0] = tx_frame_type
+
+     // Put mode information after the encoded speech parameters
+     IF (tx_frame_type != TX_NO_DATA)
+     THEN
+         ets_output_bfr[MAX_SERIAL_SIZE+1] = mode
+
+     ELSE
+         ets_output_bfr[MAX_SERIAL_SIZE+1] = -1
+
+     ENDIF
+
+     // Copy output of encoder to pEncOutput buffer
+     ets_output_ptr = (unsigned char *) &ets_output_bfr[0]
+
+     // Copy 16-bit data in 8-bit chunks using Little Endian configuration
+     FOR i = 0 TO (2*(MAX_SERIAL_SIZE+6))-1
+
+         *(pEncOutput+i) = *ets_output_ptr
+         ets_output_ptr = ets_output_ptr + 1
+
+     ENDFOR
+
+     // Set up number of encoded bytes
+     num_enc_bytes = 2*(MAX_SERIAL_SIZE+6)
+
+ ELSE
+     // Invalid output_format, set up error code
+     num_enc_bytes = -1
+
+ ENDIF
+
+ MODIFY (nothing)
+ RETURN (num_enc_bytes)
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 AMREncode(
+    void *pEncState,
+    void *pSidSyncState,
+    enum Mode mode,
+    Word16 *pEncInput,
+    UWord8 *pEncOutput,
+    enum Frame_Type_3GPP *p3gpp_frame_type,
+    Word16 output_format
+)
+{
+    Word16 ets_output_bfr[MAX_SERIAL_SIZE+2];
+    UWord8 *ets_output_ptr;
+    Word16 num_enc_bytes = -1;
+    Word16 i;
+    enum TXFrameType tx_frame_type;
+    enum Mode usedMode = MR475;
+
+    /* Encode WMF or IF2 frames */
+    if ((output_format == AMR_TX_WMF) | (output_format == AMR_TX_IF2)
+            | (output_format == AMR_TX_IETF))
+    {
+        /* Encode one speech frame (20 ms) */
+
+#ifndef CONSOLE_ENCODER_REF
+
+        /* Use PV version of sp_enc.c */
+        GSMEncodeFrame(pEncState, mode, pEncInput, ets_output_bfr, &usedMode);
+
+#else
+        /* Use ETS version of sp_enc.c */
+        Speech_Encode_Frame(pEncState, mode, pEncInput, ets_output_bfr, &usedMode);
+
+#endif
+
+        /* Determine transmit frame type */
+        sid_sync(pSidSyncState, usedMode, &tx_frame_type);
+
+        if (tx_frame_type != TX_NO_DATA)
+        {
+            /* There is data to transmit */
+            *p3gpp_frame_type = (enum Frame_Type_3GPP) usedMode;
+
+            /* Add SID type and mode info for SID frames */
+            if (*p3gpp_frame_type == AMR_SID)
+            {
+                /* Add SID type to encoder output buffer */
+                if (tx_frame_type == TX_SID_FIRST)
+                {
+                    ets_output_bfr[AMRSID_TXTYPE_BIT_OFFSET] &= 0x0000;
+                }
+                else if (tx_frame_type == TX_SID_UPDATE)
+                {
+                    ets_output_bfr[AMRSID_TXTYPE_BIT_OFFSET] |= 0x0001;
+                }
+
+                /* Add mode information bits */
+                for (i = 0; i < NUM_AMRSID_TXMODE_BITS; i++)
+                {
+                    ets_output_bfr[AMRSID_TXMODE_BIT_OFFSET+i] =
+                        (mode >> i) & 0x0001;
+                }
+            }
+        }
+        else
+        {
+            /* This is no data to transmit */
+            *p3gpp_frame_type = (enum Frame_Type_3GPP)AMR_NO_DATA;
+        }
+
+        /* At this point, output format is ETS */
+        /* Determine the output format to use */
+        if (output_format == AMR_TX_IETF)
+        {
+            /* Change output data format to WMF */
+            ets_to_ietf(*p3gpp_frame_type, ets_output_bfr, pEncOutput, &(((Speech_Encode_FrameState*)pEncState)->cod_amr_state->common_amr_tbls));
+
+            /* Set up the number of encoded WMF bytes */
+            num_enc_bytes = WmfEncBytesPerFrame[(Word16) *p3gpp_frame_type];
+
+        }
+        else if (output_format == AMR_TX_WMF)
+        {
+            /* Change output data format to WMF */
+            ets_to_wmf(*p3gpp_frame_type, ets_output_bfr, pEncOutput, &(((Speech_Encode_FrameState*)pEncState)->cod_amr_state->common_amr_tbls));
+
+            /* Set up the number of encoded WMF bytes */
+            num_enc_bytes = WmfEncBytesPerFrame[(Word16) *p3gpp_frame_type];
+
+        }
+        else if (output_format == AMR_TX_IF2)
+        {
+            /* Change output data format to IF2 */
+            ets_to_if2(*p3gpp_frame_type, ets_output_bfr, pEncOutput, &(((Speech_Encode_FrameState*)pEncState)->cod_amr_state->common_amr_tbls));
+
+            /* Set up the number of encoded IF2 bytes */
+            num_enc_bytes = If2EncBytesPerFrame[(Word16) *p3gpp_frame_type];
+
+        }
+    }
+
+    /* Encode ETS frames */
+    else if (output_format == AMR_TX_ETS)
+    {
+        /* Encode one speech frame (20 ms) */
+
+#ifndef CONSOLE_ENCODER_REF
+
+        /* Use PV version of sp_enc.c */
+        GSMEncodeFrame(pEncState, mode, pEncInput, &ets_output_bfr[1], &usedMode);
+
+#else
+        /* Use ETS version of sp_enc.c */
+        Speech_Encode_Frame(pEncState, mode, pEncInput, &ets_output_bfr[1], &usedMode);
+
+#endif
+
+        /* Save used mode */
+        *p3gpp_frame_type = (enum Frame_Type_3GPP) usedMode;
+
+        /* Determine transmit frame type */
+        sid_sync(pSidSyncState, usedMode, &tx_frame_type);
+
+        /* Put TX frame type in output buffer */
+        ets_output_bfr[0] = tx_frame_type;
+
+        /* Put mode information after the encoded speech parameters */
+        if (tx_frame_type != TX_NO_DATA)
+        {
+            ets_output_bfr[1+MAX_SERIAL_SIZE] = (Word16) mode;
+        }
+        else
+        {
+            ets_output_bfr[1+MAX_SERIAL_SIZE] = -1;
+        }
+
+        /* Copy output of encoder to pEncOutput buffer */
+        ets_output_ptr = (UWord8 *) & ets_output_bfr[0];
+
+        /* Copy 16-bit data in 8-bit chunks  */
+        /* using Little Endian configuration */
+        for (i = 0; i < 2*(MAX_SERIAL_SIZE + 2); i++)
+        {
+            *(pEncOutput + i) = *ets_output_ptr;
+            ets_output_ptr += 1;
+        }
+
+        /* Set up the number of encoded bytes */
+        num_enc_bytes = 2 * (MAX_SERIAL_SIZE + 2);
+
+    }
+
+    /* Invalid frame format */
+    else
+    {
+        /* Invalid output format, set up error code */
+        num_enc_bytes = -1;
+    }
+
+    return(num_enc_bytes);
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.h
new file mode 100644 (file)
index 0000000..1f1dc90
--- /dev/null
@@ -0,0 +1,133 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: amrencode.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the function prototype of AMREncode.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _AMRENCODE_H_
+#define _AMRENCODE_H_
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "frame_type_3gpp.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+#define NUM_AMRSID_TXMODE_BITS     3
+#define AMRSID_TXMODE_BIT_OFFSET   36
+#define AMRSID_TXTYPE_BIT_OFFSET   35
+
+    /* Output format types */
+
+#define AMR_TX_WMF  0
+#define AMR_TX_IF2  1
+#define AMR_TX_ETS  2
+#define AMR_TX_IETF 3
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+    extern const Word16 WmfEncBytesPerFrame[];
+    extern const Word16 If2EncBytesPerFrame[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    Word16 AMREncodeInit(
+        void **pEncStructure,
+        void **pSidSyncStructure,
+        Flag dtx_enable);
+
+    Word16 AMREncodeReset(
+        void *pEncStructure,
+        void *pSidSyncStructure);
+
+    void AMREncodeExit(
+        void **pEncStructure,
+        void **pSidSyncStructure);
+
+    Word16 AMREncode(
+        void *pEncState,
+        void *pSidSyncState,
+        enum Mode mode,
+        Word16 *pEncInput,
+        UWord8 *pEncOutput,
+        enum Frame_Type_3GPP *p3gpp_frame_type,
+        Word16 output_format
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _AMRENCODE_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp
new file mode 100644 (file)
index 0000000..033c93a
--- /dev/null
@@ -0,0 +1,377 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: autocorr.cpp
+
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "autocorr.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "oper_32b.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Autocorr
+----------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    x = buffer of input signals of type Word16
+    m = LPC order of type Word16
+    wind = buffer of window signals of type Word16
+    r_h = buffer containing the high word of the autocorrelation values
+          of type Word16
+    r_l = buffer containing the low word of the autocorrelation values
+          of type Word16
+
+    pOverflow = pointer to variable of type Flag *, which indicates if
+                overflow occurs.
+
+ Outputs:
+    r_h buffer contains the high word of the new autocorrelation values
+    r_l buffer contains the low word of the new autocorrelation values
+    pOverflow -> 1 if overflow occurs.
+
+ Returns:
+    norm = normalized autocorrelation at lag zero of type Word16
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function windows the input signal with the provided window
+ then calculates the autocorrelation values for lags of 0,1,...m,
+ where m is the passed in LPC order.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ autocorr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 Autocorr (
+    Word16 x[],            // (i)    : Input signal (L_WINDOW)
+    Word16 m,              // (i)    : LPC order
+    Word16 r_h[],          // (o)    : Autocorrelations  (msb)
+    Word16 r_l[],          // (o)    : Autocorrelations  (lsb)
+    const Word16 wind[]    // (i)    : window for LPC analysis (L_WINDOW)
+)
+{
+    Word16 i, j, norm;
+    Word16 y[L_WINDOW];
+    Word32 sum;
+    Word16 overfl, overfl_shft;
+
+    // Windowing of signal
+
+    for (i = 0; i < L_WINDOW; i++)
+    {
+        y[i] = mult_r (x[i], wind[i]);
+    }
+
+    // Compute r[0] and test for overflow
+
+    overfl_shft = 0;
+
+    do
+    {
+        overfl = 0;
+        sum = 0L;
+
+        for (i = 0; i < L_WINDOW; i++)
+        {
+            sum = L_mac (sum, y[i], y[i]);
+        }
+
+        // If overflow divide y[] by 4
+
+        if (L_sub (sum, MAX_32) == 0L)
+        {
+            overfl_shft = add (overfl_shft, 4);
+            overfl = 1; // Set the overflow flag
+
+            for (i = 0; i < L_WINDOW; i++)
+            {
+                y[i] = shr (y[i], 2);
+            }
+        }
+    }
+    while (overfl != 0);
+
+    sum = L_add (sum, 1L);             // Avoid the case of all zeros
+
+    // Normalization of r[0]
+
+    norm = norm_l (sum);
+    sum = L_shl (sum, norm);
+    L_Extract (sum, &r_h[0], &r_l[0]); // Put in DPF format (see oper_32b)
+
+    // r[1] to r[m]
+
+    for (i = 1; i <= m; i++)
+    {
+        sum = 0;
+
+        for (j = 0; j < L_WINDOW - i; j++)
+        {
+            sum = L_mac (sum, y[j], y[j + i]);
+        }
+
+        sum = L_shl (sum, norm);
+        L_Extract (sum, &r_h[i], &r_l[i]);
+    }
+
+    norm = sub (norm, overfl_shft);
+
+    return norm;
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Autocorr(
+    Word16 x[],            /* (i)    : Input signal (L_WINDOW)            */
+    Word16 m,              /* (i)    : LPC order                          */
+    Word16 r_h[],          /* (o)    : Autocorrelations  (msb)            */
+    Word16 r_l[],          /* (o)    : Autocorrelations  (lsb)            */
+    const Word16 wind[],   /* (i)    : window for LPC analysis (L_WINDOW) */
+    Flag  *pOverflow       /* (o)    : indicates overflow                 */
+)
+{
+    register Word16 i;
+    register Word16 j;
+    register Word16 norm;
+
+    Word16 y[L_WINDOW];
+    Word32 sum;
+    Word16 overfl_shft;
+
+
+    /* Added for optimization  */
+
+
+    Word16 temp;
+    Word16 *p_x;
+    Word16 *p_y;
+    Word16 *p_y_1;
+    Word16 *p_y_ref;
+    Word16 *p_rh;
+    Word16 *p_rl;
+    const Word16 *p_wind;
+    p_y = y;
+    p_x = x;
+    p_wind = wind;
+    /*
+     *  Windowing of the signal
+     */
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    sum = 0L;
+    j = 0;
+
+    for (i = L_WINDOW; i != 0; i--)
+    {
+        temp = (Word16)((amrnb_fxp_mac_16_by_16bb((Word32) * (p_x++), (Word32) * (p_wind++), 0x04000)) >> 15);
+        *(p_y++) = temp;
+
+        sum += ((Word32)temp * temp) << 1;
+        if (sum < 0)
+        {
+            /*
+             * if oveflow exist, then stop accumulation
+             */
+            j = 1;
+            break;
+        }
+
+    }
+    /*
+     * if oveflow existed, complete  windowing operation
+     * without computing energy
+     */
+
+    if (j)
+    {
+        p_y = &y[L_WINDOW-i];
+        p_x = &x[L_WINDOW-i];
+        p_wind = &wind[L_WINDOW-i];
+
+        for (; i != 0; i--)
+        {
+            temp = (Word16)((amrnb_fxp_mac_16_by_16bb((Word32) * (p_x++), (Word32) * (p_wind++), 0x04000)) >> 15);
+            *(p_y++) = temp;
+        }
+    }
+
+
+    /*
+     *  Compute r[0] and test for overflow
+     */
+
+    overfl_shft = 0;
+
+    /*
+     * scale down by 1/4 only when needed
+     */
+    while (j == 1)
+    {
+        /* If overflow divide y[] by 4          */
+        /* FYI: For better resolution, we could */
+        /*      divide y[] by 2                 */
+        overfl_shft += 4;
+        p_y   = &y[0];
+        sum = 0L;
+
+        for (i = (L_WINDOW >> 1); i != 0 ; i--)
+        {
+            temp = *p_y >> 2;
+            *(p_y++) = temp;
+            sum += ((Word32)temp * temp) << 1;
+            temp = *p_y >> 2;
+            *(p_y++) = temp;
+            sum += ((Word32)temp * temp) << 1;
+        }
+        if (sum > 0)
+        {
+            j = 0;
+        }
+
+    }
+
+    sum += 1L;              /* Avoid the case of all zeros */
+
+    /* Normalization of r[0] */
+
+    norm = norm_l(sum);
+
+    sum <<= norm;
+
+    /* Put in DPF format (see oper_32b) */
+    r_h[0] = (Word16)(sum >> 16);
+    r_l[0] = (Word16)((sum >> 1) - ((Word32)(r_h[0]) << 15));
+
+    /* r[1] to r[m] */
+
+    p_y_ref = &y[L_WINDOW - 1 ];
+    p_rh = &r_h[m];
+    p_rl = &r_l[m];
+
+    for (i = m; i > 0; i--)
+    {
+        sum  = 0;
+
+        p_y   = &y[L_WINDOW - i - 1];
+        p_y_1 = p_y_ref;
+
+        for (j = (L_WINDOW - i - 1) >> 1; j != 0; j--)
+        {
+            sum = amrnb_fxp_mac_16_by_16bb((Word32) * (p_y--), (Word32) * (p_y_1--), sum);
+            sum = amrnb_fxp_mac_16_by_16bb((Word32) * (p_y--), (Word32) * (p_y_1--), sum);
+        }
+
+        sum = amrnb_fxp_mac_16_by_16bb((Word32) * (p_y--), (Word32) * (p_y_1--), sum);
+
+        if (((L_WINDOW - i - 1) & 1))
+        {
+            sum = amrnb_fxp_mac_16_by_16bb((Word32) * (p_y--), (Word32) * (p_y_1--), sum);
+        }
+
+        sum  <<= (norm + 1);
+
+        *(p_rh)   = (Word16)(sum >> 16);
+        *(p_rl--) = (Word16)((sum >> 1) - ((Word32) * (p_rh--) << 15));
+
+    }
+
+    norm -= overfl_shft;
+
+    return (norm);
+
+} /* Autocorr */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.h
new file mode 100644 (file)
index 0000000..c7f2786
--- /dev/null
@@ -0,0 +1,109 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: autocorr.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the autocorr function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef autocorr_h
+#define autocorr_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 Autocorr(
+        Word16 x[],            /* (i)    : Input signal (L_WINDOW)            */
+        Word16 m,              /* (i)    : LPC order                          */
+        Word16 r_h[],          /* (o)    : Autocorrelations  (msb)            */
+        Word16 r_l[],          /* (o)    : Autocorrelations  (lsb)            */
+        const Word16 wind[],   /* (i)    : window for LPC analysis (L_WINDOW) */
+        Flag  *pOverflow       /* (o)    : indicates overflow                 */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _AUTO_CORR_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.cpp
new file mode 100644 (file)
index 0000000..e3e428d
--- /dev/null
@@ -0,0 +1,602 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c1035pf.cpp
+ Functions: q_p
+            build_code
+            code_10i40_35bits
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the function that searches a 35 bit algebraic codebook
+ containing 10 pulses in a frame of 40 samples.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "c1035pf.h"
+#include "cnst.h"
+#include "basic_op.h"
+#include "inv_sqrt.h"
+#include "set_sign.h"
+#include "cor_h.h"
+#include "cor_h_x.h"
+#include "s10_8pf.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+#define NB_PULSE  10
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: q_p
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pShift_reg = pointer to Old CN generator shift register state (Word32)
+    no_bits = Number of bits (Word16)
+
+ Outputs:
+    pShift_reg -> Updated CN generator shift register state
+
+ Returns:
+    noise_bits = Generated random integer value (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This is a local function that determnes the index of the pulses by looking up
+ the gray encoder table
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ c1035pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void q_p (
+    Word16 *ind,        // Pulse position
+    Word16 n            // Pulse number
+)
+{
+    Word16 tmp;
+
+    tmp = *ind;
+
+    if (sub (n, 5) < 0)
+    {
+        *ind = (tmp & 0x8) | gray[tmp & 0x7];
+    }
+    else
+    {
+        *ind = gray[tmp & 0x7];
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void q_p(
+    Word16 *pInd,       /* Pulse position */
+    Word16 n,            /* Pulse number   */
+    const Word16* gray_ptr
+)
+{
+    Word16 tmp;
+
+    tmp = *pInd;
+
+    if (n < 5)
+    {
+        *pInd = (tmp & 0x8) | gray_ptr[tmp & 0x7];
+    }
+    else
+    {
+        *pInd = gray_ptr[tmp & 0x7];
+    }
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: build_code
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pSeed = pointer to the Old CN generator shift register state (Word32)
+    n_param = Number of parameters to randomize (Word16)
+    param_size_table = table holding paameter sizes (Word16)
+    param[] = array to hold CN generated paramters (Word16)
+    pOverflow = pointer to overflow flag (Flag)
+
+ Outputs:
+    param[] = CN generated parameters (Word16)
+    pSeed = Updated CN generator shift register state (Word16)
+    pOverflow -> 1 if overflow occured
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function builds the codeword, the filtered codeword and index of the
+ codevector, based on the signs and positions of 10 pulses.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ c1035pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+static void build_code (
+    Word16 codvec[],    // (i)  : position of pulses
+    Word16 sign[],      // (i)  : sign of d[n]
+    Word16 cod[],       // (o)  : innovative code vector
+    Word16 h[],         // (i)  : impulse response of weighted synthesis filter
+    Word16 y[],         // (o)  : filtered innovative code
+    Word16 indx[]       // (o)  : index of 10 pulses (sign+position)
+)
+{
+    Word16 i, j, k, track, index, _sign[NB_PULSE];
+    Word16 *p0, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9;
+    Word32 s;
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        cod[i] = 0;
+    }
+    for (i = 0; i < NB_TRACK; i++)
+    {
+        indx[i] = -1;
+    }
+
+    for (k = 0; k < NB_PULSE; k++)
+    {
+        // read pulse position
+        i = codvec[k];
+        // read sign
+        j = sign[i];
+
+        index = mult (i, 6554);                  // index = pos/5
+        // track = pos%5
+        track = sub (i, extract_l (L_shr (L_mult (index, 5), 1)));
+
+        if (j > 0)
+        {
+            cod[i] = add (cod[i], 4096);
+            _sign[k] = 8192;
+
+        }
+        else
+        {
+            cod[i] = sub (cod[i], 4096);
+            _sign[k] = -8192;
+            index = add (index, 8);
+        }
+
+        if (indx[track] < 0)
+        {
+            indx[track] = index;
+        }
+        else
+        {
+            if (((index ^ indx[track]) & 8) == 0)
+            {
+                // sign of 1st pulse == sign of 2nd pulse
+
+                if (sub (indx[track], index) <= 0)
+                {
+                    indx[track + 5] = index;
+                }
+                else
+                {
+                    indx[track + 5] = indx[track];
+                    indx[track] = index;
+                }
+            }
+            else
+            {
+                // sign of 1st pulse != sign of 2nd pulse
+
+                if (sub ((Word16)(indx[track] & 7), (Word16)(index & 7)) <= 0)
+                {
+                    indx[track + 5] = indx[track];
+                    indx[track] = index;
+                }
+                else
+                {
+                    indx[track + 5] = index;
+                }
+            }
+        }
+    }
+
+    p0 = h - codvec[0];
+    p1 = h - codvec[1];
+    p2 = h - codvec[2];
+    p3 = h - codvec[3];
+    p4 = h - codvec[4];
+    p5 = h - codvec[5];
+    p6 = h - codvec[6];
+    p7 = h - codvec[7];
+    p8 = h - codvec[8];
+    p9 = h - codvec[9];
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        s = 0;
+        s = L_mac (s, *p0++, _sign[0]);
+        s = L_mac (s, *p1++, _sign[1]);
+        s = L_mac (s, *p2++, _sign[2]);
+        s = L_mac (s, *p3++, _sign[3]);
+        s = L_mac (s, *p4++, _sign[4]);
+        s = L_mac (s, *p5++, _sign[5]);
+        s = L_mac (s, *p6++, _sign[6]);
+        s = L_mac (s, *p7++, _sign[7]);
+        s = L_mac (s, *p8++, _sign[8]);
+        s = L_mac (s, *p9++, _sign[9]);
+        y[i] = pv_round (s);
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+static void build_code(
+    Word16 codvec[],    /* (i)  : position of pulses                        */
+    Word16 sign[],      /* (i)  : sign of d[n]                              */
+    Word16 cod[],       /* (o)  : innovative code vector                    */
+    Word16 h[],         /* (i)  : impulse response of weighted synthesis filter*/
+    Word16 y[],         /* (o)  : filtered innovative code                  */
+    Word16 indx[],      /* (o)  : index of 10 pulses (sign+position)        */
+    Flag   *pOverflow   /* i/o  : overflow Flag                             */
+)
+{
+    Word16 i, k, track, index, _sign[NB_PULSE];
+    Word16 *p0, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9;
+    Word32 s;
+    Word16 temp;
+    Word16 *p__sign;
+    Word16 *p_y;
+    Word16 *p_codvec;
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    oscl_memset(cod, 0, L_CODE*sizeof(*cod));
+    oscl_memset(indx, 0xFF, NB_TRACK*sizeof(*indx));
+
+    p__sign = _sign;
+
+    p0 = &codvec[0];
+
+    for (k = 0; k < NB_PULSE; k++)
+    {
+        /* read pulse position */
+        i = *(p0++);
+        /* read sign           */
+
+        index = ((Word32)i * 6554) >> 15;       /* index = pos/5    */
+
+        /* track = pos%5 */
+        /* track = sub (i, extract_l (L_shr (L_mult (index, 5), 1))); */
+        track = i - (index + (index << 2));
+
+        if (sign[i] > 0)
+        {
+            cod[i] +=  4096;
+            *(p__sign++) = 8192;
+
+        }
+        else
+        {
+            cod[i] -=  4096;
+            *(p__sign++) = -8192;
+            /* index = add (index, 8); */
+            index += 8;
+        }
+
+        p1 = &indx[track];
+
+        temp = *p1;
+
+        if (temp < 0)
+        {
+            *p1 = index;
+        }
+        else
+        {
+            if (((index ^ temp) & 8) == 0)
+            {
+                /* sign of 1st pulse == sign of 2nd pulse */
+
+                /* if (sub (indx[track], index) <= 0) */
+                if (temp <= index)
+                {
+                    *(p1 + 5) = index;
+                }
+                else
+                {
+                    *(p1 + 5) = temp;
+                    *p1 = index;
+                }
+            }
+            else
+            {
+                /* sign of 1st pulse != sign of 2nd pulse */
+
+                /* if (sub ((Word16)(indx[track] & 7), (Word16)(index & 7)) <= 0) */
+                if ((temp & 7) <= (index & 7))
+                {
+                    *(p1 + 5) = temp;
+                    *p1 = index;
+                }
+                else
+                {
+                    *(p1 + 5) = index;
+                }
+            }
+        }
+    }
+
+    p_codvec = &codvec[0];
+
+    p0 = h - *(p_codvec++);
+    p1 = h - *(p_codvec++);
+    p2 = h - *(p_codvec++);
+    p3 = h - *(p_codvec++);
+    p4 = h - *(p_codvec++);
+    p5 = h - *(p_codvec++);
+    p6 = h - *(p_codvec++);
+    p7 = h - *(p_codvec++);
+    p8 = h - *(p_codvec++);
+    p9 = h - *(p_codvec++);
+
+    p_y = y;
+
+    for (i = L_CODE; i != 0; i--)
+    {
+        p__sign = _sign;
+
+        s  = (*p0++ * *(p__sign++)) >> 7;
+        s += (*p1++ * *(p__sign++)) >> 7;
+        s += (*p2++ * *(p__sign++)) >> 7;
+        s += (*p3++ * *(p__sign++)) >> 7;
+        s += (*p4++ * *(p__sign++)) >> 7;
+        s += (*p5++ * *(p__sign++)) >> 7;
+        s += (*p6++ * *(p__sign++)) >> 7;
+        s += (*p7++ * *(p__sign++)) >> 7;
+        s += (*p8++ * *(p__sign++)) >> 7;
+        s += (*p9++ * *(p__sign++)) >> 7;
+
+        *(p_y++) = (s + 0x080) >> 8;
+    }
+
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: code_10i40_35bits
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pSeed = pointer to the Old CN generator shift register state (Word32)
+    n_param = Number of parameters to randomize (Word16)
+    param_size_table = table holding paameter sizes (Word16)
+    param[] = array to hold CN generated paramters (Word16)
+    pOverflow = pointer to overflow flag (Flag)
+
+ Outputs:
+    param[] = CN generated parameters (Word16)
+    pSeed = Updated CN generator shift register state (Word16)
+    pOverflow -> 1 if overflow occured
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function searches a 35 bit algebraic codebook containing 10 pulses in a
+ frame of 40 samples.
+
+ The code contains 10 nonzero pulses: i0...i9.
+ All pulses can have two possible amplitudes: +1 or -1.
+ The 40 positions in a subframe are divided into 5 tracks of
+ interleaved positions. Each track contains two pulses.
+ The pulses can have the following possible positions:
+
+    i0, i5 :  0, 5, 10, 15, 20, 25, 30, 35.
+    i1, i6 :  1, 6, 11, 16, 21, 26, 31, 36.
+    i2, i7 :  2, 7, 12, 17, 22, 27, 32, 37.
+    i3, i8 :  3, 8, 13, 18, 23, 28, 33, 38.
+    i4, i9 :  4, 9, 14, 19, 24, 29, 34, 39.
+
+ Each pair of pulses require 1 bit for their signs and 6 bits for their
+ positions (3 bits + 3 bits). This results in a 35 bit codebook.
+ The function determines the optimal pulse signs and positions, builds
+ the codevector, and computes the filtered codevector.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ c1035pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+void code_10i40_35bits (
+    Word16 x[],   // (i)   : target vector
+    Word16 cn[],  // (i)   : residual after long term prediction
+    Word16 h[],   // (i)   : impulse response of weighted synthesis filter
+                           // h[-L_subfr..-1] must be set to zero
+    Word16 cod[], // (o)   : algebraic (fixed) codebook excitation
+    Word16 y[],   // (o)   : filtered fixed codebook excitation
+    Word16 indx[] // (o)   : index of 10 pulses (sign + position)
+)
+{
+    Word16 ipos[NB_PULSE], pos_max[NB_TRACK], codvec[NB_PULSE];
+    Word16 dn[L_CODE], sign[L_CODE];
+    Word16 rr[L_CODE][L_CODE], i;
+
+    cor_h_x (h, x, dn, 2);
+    set_sign12k2 (dn, cn, sign, pos_max, NB_TRACK, ipos, STEP);
+    cor_h (h, sign, rr);
+
+    search_10and8i40 (NB_PULSE, STEP, NB_TRACK,
+                      dn, rr, ipos, pos_max, codvec);
+
+    build_code (codvec, sign, cod, h, y, indx);
+    for (i = 0; i < 10; i++)
+    {
+        q_p (&indx[i], i);
+    }
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void code_10i40_35bits(
+    Word16 x[],     /* (i)   : target vector                                */
+    Word16 cn[],    /* (i)   : residual after long term prediction          */
+    Word16 h[],     /* (i)   : impulse response of weighted synthesis filter
+                             h[-L_subfr..-1] must be set to zero            */
+    Word16 cod[],   /* (o)   : algebraic (fixed) codebook excitation        */
+    Word16 y[],     /* (o)   : filtered fixed codebook excitation           */
+    Word16 indx[],  /* (o)   : index of 10 pulses (sign + position)         */
+    const Word16* gray_ptr, /* (i) : ptr to read-only table                 */
+    Flag *pOverflow /* (i/o) : overflow Flag                                */
+)
+{
+    Word16 ipos[NB_PULSE], pos_max[NB_TRACK], codvec[NB_PULSE];
+    Word16 dn[L_CODE], sign[L_CODE];
+    Word16 rr[L_CODE][L_CODE], i;
+
+    cor_h_x(h, x, dn, 2, pOverflow);
+    set_sign12k2(dn, cn, sign, pos_max, NB_TRACK, ipos, STEP, pOverflow);
+    cor_h(h, sign, rr, pOverflow);
+
+    search_10and8i40(NB_PULSE, STEP, NB_TRACK,
+                     dn, rr, ipos, pos_max, codvec, pOverflow);
+
+    build_code(codvec, sign, cod, h, y, indx, pOverflow);
+    for (i = 0; i < 10; i++)
+    {
+        q_p(&indx[i], i, gray_ptr);
+    }
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.h
new file mode 100644 (file)
index 0000000..4bd970a
--- /dev/null
@@ -0,0 +1,112 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c1035pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the prototype declaration for code_10i40_35bits function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef C1035PF_H
+#define C1035PF_H "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void code_10i40_35bits(
+        Word16 x[],     /* (i)   : target vector                                */
+        Word16 cn[],    /* (i)   : residual after long term prediction          */
+        Word16 h[],     /* (i)   : impulse response of weighted synthesis filter
+                             h[-L_subfr..-1] must be set to zero            */
+        Word16 cod[],   /* (o)   : algebraic (fixed) codebook excitation        */
+        Word16 y[],     /* (o)   : filtered fixed codebook excitation           */
+        Word16 indx[],  /* (o)   : index of 10 pulses (sign + position)         */
+        const Word16* gray_ptr, /* (i) : ptr to read-only table                 */
+        Flag *pOverflow /* (i/o) : overflow Flag                                */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _C1035PF_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.cpp
new file mode 100644 (file)
index 0000000..95f8d5f
--- /dev/null
@@ -0,0 +1,771 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c2_11pf.cpp
+ Functions:
+            code_2i40_11bits
+            search_2i40
+            build_code
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ *************************************************************************
+ *
+ *  FUNCTION:  code_2i40_11bits()
+ *
+ *  PURPOSE:  Searches a 11 bit algebraic codebook containing 2 pulses
+ *            in a frame of 40 samples.
+ *
+ *  DESCRIPTION:
+ *    The code length is 40, containing 2 nonzero pulses: i0...i1.
+ *    All pulses can have two possible amplitudes: +1 or -1.
+ *    Pulse i0 can have 2x8=16 possible positions, pulse i1 can have
+ *    4x8=32 positions.
+ *
+ *       i0 :  1, 6, 11, 16, 21, 26, 31, 36.
+ *             3, 8, 13, 18, 23, 28, 33, 38.
+ *       i1 :  0, 5, 10, 15, 20, 25, 30, 35.
+ *             1, 6, 11, 16, 21, 26, 31, 36.
+ *             2, 7, 12, 17, 22, 27, 32, 37.
+ *             4, 9, 14, 19, 24, 29, 34, 39.
+ *
+ *************************************************************************
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "c2_11pf.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "inv_sqrt.h"
+#include "cnst.h"
+#include "cor_h.h"
+#include "set_sign.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NB_PULSE  2
+
+#define _1_2    (Word16)(32768L/2)
+#define _1_4    (Word16)(32768L/4)
+#define _1_8    (Word16)(32768L/8)
+#define _1_16   (Word16)(32768L/16)
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+static void search_2i40(
+    Word16 dn[],        /* i : correlation between target and h[]            */
+    Word16 rr[][L_CODE],/* i : matrix of autocorrelation                     */
+    Word16 codvec[],    /* o : algebraic codebook vector                     */
+    Flag   * pOverflow
+);
+
+static Word16 build_code(
+    Word16 codvec[],    /* i : algebraic codebook vector                     */
+    Word16 dn_sign[],   /* i : sign of dn[]                                  */
+    Word16 cod[],       /* o : algebraic (fixed) codebook excitation         */
+    Word16 h[],         /* i : impulse response of weighted synthesis filter */
+    Word16 y[],         /* o : filtered fixed codebook excitation            */
+    Word16 sign[],      /* o : sign of 2 pulses                              */
+    Flag   * pOverflow
+);
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+const Word16 startPos1[2] = {1, 3};
+const Word16 startPos2[4] = {0, 1, 2, 4};
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: code_2i40_11bits
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    x,  target vector, array of type Word16
+    h,  impulse response of weighted synthesis filter, array of type Word16
+    T0, Pitch lag, variable of type Word16
+    pitch_sharp, Last quantized pitch gain, variable of type Word16
+
+ Outputs:
+    code[], Innovative codebook, array of type Word16
+    y[],    filtered fixed codebook excitation, array of type Word16
+    sign,   Signs of 2 pulses, pointer of type Word16 *
+    pOverflow  Flag set when overflow occurs, pointer of type Flag *
+
+ Returns:
+    index
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+     Searches a 11 bit algebraic codebook containing 2 pulses
+     in a frame of 40 samples.
+
+     The code length is 40, containing 2 nonzero pulses: i0...i1.
+     All pulses can have two possible amplitudes: +1 or -1.
+     Pulse i0 can have 2x8=16 possible positions, pulse i1 can have
+     4x8=32 positions.
+
+        i0 :  1, 6, 11, 16, 21, 26, 31, 36.
+              3, 8, 13, 18, 23, 28, 33, 38.
+        i1 :  0, 5, 10, 15, 20, 25, 30, 35.
+              1, 6, 11, 16, 21, 26, 31, 36.
+              2, 7, 12, 17, 22, 27, 32, 37.
+              4, 9, 14, 19, 24, 29, 34, 39.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ c2_11pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 code_2i40_11bits(
+    Word16 x[],         /* i : target vector                                 */
+    Word16 h[],         /* i : impulse response of weighted synthesis filter */
+    /*     h[-L_subfr..-1] must be set to zero.          */
+    Word16 T0,          /* i : Pitch lag                                     */
+    Word16 pitch_sharp, /* i : Last quantized pitch gain                     */
+    Word16 code[],      /* o : Innovative codebook                           */
+    Word16 y[],         /* o : filtered fixed codebook excitation            */
+    Word16 * sign,      /* o : Signs of 2 pulses                             */
+    Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+)
+{
+    Word16 codvec[NB_PULSE];
+    Word16 dn[L_CODE];
+    Word16 dn2[L_CODE];
+    Word16 dn_sign[L_CODE];
+
+    Word16 rr[L_CODE][L_CODE];
+
+    Word16 i;
+    Word16 index;
+    Word16 sharp;
+    Word16 tempWord;
+
+    sharp = pitch_sharp << 1;
+
+    if (T0 < L_CODE)
+    {
+        for (i = T0; i < L_CODE; i++)
+        {
+            tempWord =
+                mult(
+                    h[i - T0],
+                    sharp,
+                    pOverflow);
+
+            h[i] =
+                add_16(
+                    h[i],
+                    tempWord,
+                    pOverflow);
+        }
+
+    }
+
+    cor_h_x(
+        h,
+        x,
+        dn,
+        1,
+        pOverflow);
+
+    set_sign(
+        dn,
+        dn_sign,
+        dn2,
+        8); /* dn2[] not used in this codebook search */
+
+    cor_h(
+        h,
+        dn_sign,
+        rr,
+        pOverflow);
+
+    search_2i40(
+        dn,
+        rr,
+        codvec,
+        pOverflow);
+
+    /* function result */
+
+    index =
+        build_code(
+            codvec,
+            dn_sign,
+            code,
+            h,
+            y,
+            sign,
+            pOverflow);
+
+    /*
+    * Compute innovation vector gain.
+    * Include fixed-gain pitch contribution into code[].
+    */
+
+    if (T0 < L_CODE)
+    {
+        for (i = T0; i < L_CODE; i++)
+        {
+            tempWord =
+                mult(
+                    code[i - T0],
+                    sharp,
+                    pOverflow);
+
+            code[i] =
+                add_16(
+                    code[i],
+                    tempWord,
+                    pOverflow);
+        }
+    }
+
+    return index;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: search_2i40
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    dn, correlation between target and h[], array of type Word16
+    rr, matrix of autocorrelation, double-array of type Word16
+
+ Outputs:
+    codvec[],  algebraic codebook vector, array of type Word16
+    pOverflow, Flag set when overflow occurs, pointer of type Flag *
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Search the best codevector; determine positions of the 2 pulses
+ in the 40-sample frame.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ c2_11pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void search_2i40(
+    Word16 dn[],         /* i : correlation between target and h[] */
+    Word16 rr[][L_CODE], /* i : matrix of autocorrelation          */
+    Word16 codvec[],     /* o : algebraic codebook vector          */
+    Flag   * pOverflow   /* o : Flag set when overflow occurs      */
+)
+{
+    Word16 i0;
+    Word16 i1;
+    Word16 ix = 0; /* initialization only needed to keep gcc silent */
+    Word16 track1;
+    Word16 track2;
+    Word16 ipos[NB_PULSE];
+
+    Word16 psk;
+    Word16 ps0;
+    Word16 ps1;
+    Word16 sq;
+    Word16 sq1;
+
+    Word16 alpk;
+    Word16 alp;
+    Word16 alp_16;
+
+    Word32 s;
+    Word32 alp0;
+    Word32 alp1;
+
+    Word16 i;
+    Word16 *p_codvec = &codvec[0];
+
+    psk = -1;
+    alpk = 1;
+
+    for (i = 0; i < NB_PULSE; i++)
+    {
+        *(p_codvec++) = i;
+    }
+
+    /*------------------------------------------------------------------*
+    * main loop: try 2x4  tracks.                                      *
+    *------------------------------------------------------------------*/
+
+    for (track1 = 0; track1 < 2; track1++)
+    {
+        for (track2 = 0; track2 < 4; track2++)
+        {
+            /* fix starting position */
+            ipos[0] = startPos1[track1];
+            ipos[1] = startPos2[track2];
+
+            /*----------------------------------------------------------------*
+            * i0 loop: try 8 positions.                                      *
+            *----------------------------------------------------------------*/
+            for (i0 = ipos[0]; i0 < L_CODE; i0 += STEP)
+            {
+                ps0 = dn[i0];
+
+                /* alp0 = L_mult(rr[i0][i0], _1_4, pOverflow); */
+                alp0 = (Word32) rr[i0][i0] << 14;
+
+                /*-------------------------------------------------------------*
+                * i1 loop: 8 positions.                                       *
+                *-------------------------------------------------------------*/
+
+                sq = -1;
+                alp = 1;
+                ix = ipos[1];
+
+                /*---------------------------------------------------------------*
+                * These index have low complexity address computation because   *
+                * they are, in fact, pointers with fixed increment. For example,*
+                * "rr[i0][i2]" is a pointer initialized to "&rr[i0][ipos[2]]"   *
+                * and incremented by "STEP".                                    *
+                *---------------------------------------------------------------*/
+
+                for (i1 = ipos[1]; i1 < L_CODE; i1 += STEP)
+                {
+                    /* idx increment = STEP */
+                    ps1 = add_16(ps0, dn[i1], pOverflow);
+
+                    /* alp1 = alp0 + rr[i0][i1] + 1/2*rr[i1][i1]; */
+
+                    /* idx incr = STEP */
+                    /* alp1 = L_mac(alp0, rr[i1][i1], _1_4, pOverflow); */
+                    alp1 = alp0 + ((Word32) rr[i1][i1] << 14);
+
+                    /* idx incr = STEP */
+                    /* alp1 = L_mac(alp1, rr[i0][i1], _1_2, pOverflow); */
+                    alp1 += (Word32) rr[i0][i1] << 15;
+
+                    /* sq1 = mult(ps1, ps1, pOverflow); */
+                    sq1 = (Word16)(((Word32) ps1 * ps1) >> 15);
+
+                    /* alp_16 = pv_round(alp1, pOverflow); */
+                    alp_16 = (Word16)((alp1 + (Word32) 0x00008000L) >> 16);
+
+                    /* s = L_mult(alp, sq1, pOverflow); */
+                    s = ((Word32) alp * sq1) << 1;
+
+                    /* s =L_msu(s, sq, alp_16, pOverflow); */
+                    s -= (((Word32) sq * alp_16) << 1);
+
+                    if (s > 0)
+                    {
+                        sq = sq1;
+                        alp = alp_16;
+                        ix = i1;
+                    }
+
+                } /* for (i1 = ipos[1]; i1 < L_CODE; i1 += STEP) */
+
+                /* memorize codevector if this one is better than the last one. */
+
+                /* s = L_mult(alpk, sq, pOverflow); */
+                s = ((Word32) alpk * sq) << 1;
+
+                /* s = L_msu(s, psk, alp, pOverflow); */
+                s -= (((Word32) psk * alp) << 1);
+
+                if (s > 0)
+                {
+                    psk = sq;
+                    alpk = alp;
+                    p_codvec = &codvec[0];
+
+                    *(p_codvec++) = i0;
+                    *(p_codvec) = ix;
+                }
+
+            } /* for (i0 = ipos[0]; i0 < L_CODE; i0 += STEP) */
+
+        } /* for (track2 = 0; track2 < 4; track2++) */
+
+    } /* for (track1 = 0; track1 < 2; track1++) */
+
+    return;
+
+} /* search_2i40 */
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: build_code
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    codvec,  position of pulses, array of type Word16
+    dn_sign, sign of pulses, array of type Word16
+    h,       impulse response of weighted synthesis filter, Word16 array
+
+ Outputs:
+
+    cod,       innovative code vector, array of type Word16
+    y[],       filtered innovative code, array of type Word16
+    sign[],    sign of 2 pulses, array of type Word16
+    pOverflow, Flag set when overflow occurs, pointer of type Flag *
+
+ Returns:
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Builds the codeword, the filtered codeword and index of the
+ codevector, based on the signs and positions of 2 pulses.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ c2_11pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+static Word16 build_code(
+    Word16 codvec[],    /* i : position of pulses                            */
+    Word16 dn_sign[],   /* i : sign of pulses                                */
+    Word16 cod[],       /* o : innovative code vector                        */
+    Word16 h[],         /* i : impulse response of weighted synthesis filter */
+    Word16 y[],         /* o : filtered innovative code                      */
+    Word16 sign[],      /* o : sign of 2 pulses                              */
+    Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+)
+{
+    Word16 i;
+    Word16 j;
+    Word16 k;
+    Word16 track;
+    Word16 index;
+    Word16 _sign[NB_PULSE];
+    Word16 indx;
+    Word16 rsign;
+    Word16 tempWord;
+
+    Word16 *p0;
+    Word16 *p1;
+
+    Word32 s;
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        cod[i] = 0;
+    }
+
+    indx = 0;
+    rsign = 0;
+
+    for (k = 0; k < NB_PULSE; k++)
+    {
+        i = codvec[k];      /* read pulse position */
+        j = dn_sign[i];     /* read sign           */
+
+        /* index = pos/5 */
+        /* index = mult(i, 6554, pOverflow); */
+        index = (Word16)(((Word32) i * 6554) >> 15);
+
+        /* track = pos%5 */
+        /* tempWord =
+            L_mult(
+            index,
+            5,
+            pOverflow); */
+        tempWord = (index << 3) + (index << 1);
+
+        /* tempWord =
+            L_shr(
+            tempWord,
+            1,
+            pOverflow); */
+        tempWord >>= 1;
+
+
+        /* track =
+            sub(
+            i,
+            tempWord,
+            pOverflow); */
+        track = i - tempWord;
+
+        tempWord = track;
+
+        if (tempWord == 0)
+        {
+            track = 1;
+
+            /* index =
+                shl(
+                index,
+                6,
+                pOverflow); */
+            index <<= 6;
+        }
+        else if (track == 1)
+        {
+            tempWord = k;
+
+            if (tempWord == 0)
+            {
+                track = 0;
+                /* index =
+                    shl(
+                    index,
+                    1,
+                    pOverflow); */
+                index <<= 1;
+            }
+            else
+            {
+                track = 1;
+
+                /* tempWord =
+                    shl(
+                    index,
+                    6,
+                    pOverflow); */
+                tempWord = index << 6;
+
+                /* index =
+                    add(
+                    tempWord,
+                    16,
+                    pOverflow); */
+                index = tempWord + 16;
+            }
+        }
+        else if (track == 2)
+        {
+            track = 1;
+
+            /* tempWord =
+                shl(
+                index,
+                6,
+                pOverflow); */
+            tempWord = index << 6;
+
+            /* index =
+                add(
+                tempWord,
+                32,
+                pOverflow); */
+            index = tempWord + 32;
+        }
+        else if (track == 3)
+        {
+            track = 0;
+
+            /* tempWord =
+                shl(
+                index,
+                1,
+                pOverflow); */
+            tempWord = index << 1;
+
+            /* index =
+                add(
+                tempWord,
+                1,
+                pOverflow); */
+            index = tempWord + 1;
+        }
+        else if (track == 4)
+        {
+            track = 1;
+
+            /* tempWord =
+                shl(
+                index,
+                6,
+                pOverflow); */
+            tempWord = index << 6;
+
+            /* index =
+                add(
+                tempWord,
+                48,
+                pOverflow); */
+            index = tempWord + 48;
+        }
+
+        if (j > 0)
+        {
+            cod[i] = 8191;
+            _sign[k] = 32767;
+
+            tempWord =
+                shl(
+                    1,
+                    track,
+                    pOverflow);
+
+            rsign =
+                add_16(
+                    rsign,
+                    tempWord,
+                    pOverflow);
+        }
+        else
+        {
+            cod[i] = -8192;
+            _sign[k] = (Word16) - 32768L;
+        }
+
+        indx =
+            add_16(
+                indx,
+                index,
+                pOverflow);
+    }
+    *sign = rsign;
+
+    p0 = h - codvec[0];
+    p1 = h - codvec[1];
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        s = 0;
+
+        s =
+            L_mac(
+                s,
+                *p0++,
+                _sign[0],
+                pOverflow);
+
+        s =
+            L_mac(
+                s,
+                *p1++,
+                _sign[1],
+                pOverflow);
+
+        y[i] =
+            pv_round(
+                s,
+                pOverflow);
+    }
+
+    return indx;
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.h
new file mode 100644 (file)
index 0000000..391f640
--- /dev/null
@@ -0,0 +1,112 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c2_11pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the c2_11pf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef c2_11pf_h
+#define c2_11pf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 code_2i40_11bits(
+        Word16 x[], /* i : target vector                                 */
+        Word16 h[], /* i : impulse response of weighted synthesis filter */
+        /*     h[-L_subfr..-1] must be set to zero.          */
+        Word16 T0,  /* i : Pitch lag                                     */
+        Word16 pitch_sharp, /* i : Last quantized pitch gain             */
+        Word16 code[],      /* o : Innovative codebook                   */
+        Word16 y[],         /* o : filtered fixed codebook excitation    */
+        Word16 * sign,      /* o : Signs of 2 pulses                     */
+        Flag   * pOverflow
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _c2_11PF_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp
new file mode 100644 (file)
index 0000000..052a53f
--- /dev/null
@@ -0,0 +1,1108 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c2_9pf.cpp
+ Functions: code_2i40_9bits
+           search_2i40
+           Test_search_2i40
+           build_code
+           Test_build_code
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the functions that search a 9 bit algebraic codebook
+ containing 2 pulses in a frame of 40 samples.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "c2_9pf.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "inv_sqrt.h"
+#include "cnst.h"
+#include "cor_h.h"
+#include "cor_h_x.h"
+#include "set_sign.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+#define NB_PULSE  2
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    static void search_2i40(
+        Word16 subNr,       /* i : subframe number                               */
+        Word16 dn[],        /* i : correlation between target and h[]            */
+        Word16 rr[][L_CODE],/* i : matrix of autocorrelation                     */
+        const Word16* startPos_ptr, /* i: ptr to read only table                 */
+        Word16 codvec[],    /* o : algebraic codebook vector                     */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+    );
+
+    static Word16 build_code(
+        Word16 subNr,       /* i : subframe number                               */
+        Word16 codvec[],    /* i : algebraic codebook vector                     */
+        Word16 dn_sign[],   /* i : sign of dn[]                                  */
+        Word16 cod[],       /* o : algebraic (fixed) codebook excitation         */
+        Word16 h[],         /* i : impulse response of weighted synthesis filter */
+        Word16 y[],         /* o : filtered fixed codebook excitation            */
+        Word16 sign[],      /* o : sign of 2 pulses                              */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    const Word16 trackTable[4*5] =
+    {
+        0, 1, 0, 1, -1, /* subframe 1; track to code;
+                         * -1 do not code this position
+                         */
+        0, -1, 1, 0, 1, /* subframe 2 */
+        0, 1, 0, -1, 1, /* subframe 3 */
+        0, 1, -1, 0, 1
+    };/* subframe 4 */
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: code_2i40_9bits
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        subNr = subframe number (Word16)
+        x  = target buffer (Word16)
+        h  = buffer containing the impulse response of the
+             weighted synthesis filter; h[-L_subfr .. -1] must be
+             set to zero (Word16)
+        T0 = pitch lag (Word16)
+        pitch_sharp = last quantized pitch gain (Word16)
+        code = buffer containing the innovative codebook (Word16)
+        y = buffer containing the filtered fixed codebook excitation (Word16)
+        sign = pointer to the signs of 2 pulses (Word16)
+
+     Outputs:
+        code buffer contains the new innovation vector gains
+
+     Returns:
+        index = code index (Word16)
+
+     Global Variables Used:
+        Overflow = overflow flag (Flag)
+
+     Local Variables Needed:
+        None
+
+    ------------------------------------------------------------------------------
+     FUNCTION DESCRIPTION
+
+     This function searches a 9 bit algebraic codebook containing 2 pulses in a
+     frame of 40 samples.
+
+     The code length is 40, containing 2 nonzero pulses: i0...i1. All pulses can
+     have two possible amplitudes: +1 or -1. Pulse i0 can have 8 possible positions,
+     pulse i1 can have 8 positions. Also coded is which track pair should be used,
+     i.e. first or second pair. Where each pair contains 2 tracks.
+
+        First subframe:
+        first   i0 :  0, 5, 10, 15, 20, 25, 30, 35.
+            i1 :  2, 7, 12, 17, 22, 27, 32, 37.
+        second  i0 :  1, 6, 11, 16, 21, 26, 31, 36.
+                    i1 :  3, 8, 13, 18, 23, 28, 33, 38.
+
+        Second subframe:
+        first   i0 :  0, 5, 10, 15, 20, 25, 30, 35.
+                    i1 :  3, 8, 13, 18, 23, 28, 33, 38.
+        second  i0 :  2, 7, 12, 17, 22, 27, 32, 37.
+                    i1 :  4, 9, 14, 19, 24, 29, 34, 39.
+
+        Third subframe:
+        first   i0 :  0, 5, 10, 15, 20, 25, 30, 35.
+                    i1 :  2, 7, 12, 17, 22, 27, 32, 37.
+        second  i0 :  1, 6, 11, 16, 21, 26, 31, 36.
+                    i1 :  4, 9, 14, 19, 24, 29, 34, 39.
+
+        Fourth subframe:
+        first   i0 :  0, 5, 10, 15, 20, 25, 30, 35.
+                    i1 :  3, 8, 13, 18, 23, 28, 33, 38.
+        second  i0 :  1, 6, 11, 16, 21, 26, 31, 36.
+                    i1 :  4, 9, 14, 19, 24, 29, 34, 39.
+
+    ------------------------------------------------------------------------------
+     REQUIREMENTS
+
+     None
+
+    ------------------------------------------------------------------------------
+     REFERENCES
+
+     [1] c2_9pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+    ------------------------------------------------------------------------------
+     PSEUDO-CODE
+
+    Word16 code_2i40_9bits(
+        Word16 subNr,       // i : subframe number
+        Word16 x[],         // i : target vector
+        Word16 h[],         // i : impulse response of weighted synthesis filter
+                            //     h[-L_subfr..-1] must be set to zero.
+        Word16 T0,          // i : Pitch lag
+        Word16 pitch_sharp, // i : Last quantized pitch gain
+        Word16 code[],      // o : Innovative codebook
+        Word16 y[],         // o : filtered fixed codebook excitation
+        Word16 * sign       // o : Signs of 2 pulses
+    )
+    {
+        Word16 codvec[NB_PULSE];
+        Word16 dn[L_CODE], dn2[L_CODE], dn_sign[L_CODE];
+        Word16 rr[L_CODE][L_CODE];
+        Word16 i, index, sharp;
+
+        sharp = shl(pitch_sharp, 1);
+        if (sub(T0, L_CODE) < 0)
+           for (i = T0; i < L_CODE; i++) {
+              h[i] = add(h[i], mult(h[i - T0], sharp));
+           }
+        cor_h_x(h, x, dn, 1);
+        set_sign(dn, dn_sign, dn2, 8); // dn2[] not used in this codebook search
+        cor_h(h, dn_sign, rr);
+        search_2i40(subNr, dn, rr, codvec);
+        index = build_code(subNr, codvec, dn_sign, code, h, y, sign);
+
+       *-----------------------------------------------------------------*
+       * Compute innovation vector gain.                                 *
+       * Include fixed-gain pitch contribution into code[].              *
+       *-----------------------------------------------------------------*
+
+        if (sub(T0, L_CODE) < 0)
+           for (i = T0; i < L_CODE; i++) {
+              code[i] = add(code[i], mult(code[i - T0], sharp));
+           }
+        return index;
+    }
+
+    ------------------------------------------------------------------------------
+     CAUTION [optional]
+     [State any special notes, constraints or cautions for users of this function]
+
+    ------------------------------------------------------------------------------
+    */
+
+    Word16 code_2i40_9bits(
+        Word16 subNr,       /* i : subframe number                          */
+        Word16 x[],         /* i : target vector                            */
+        Word16 h[],         /* i : impulse response of weighted synthesis   */
+        /*     filter h[-L_subfr..-1] must be set to 0. */
+        Word16 T0,          /* i : Pitch lag                                */
+        Word16 pitch_sharp, /* i : Last quantized pitch gain                */
+        Word16 code[],      /* o : Innovative codebook                      */
+        Word16 y[],         /* o : filtered fixed codebook excitation       */
+        Word16 * sign,      /* o : Signs of 2 pulses                        */
+        const Word16* startPos_ptr, /* ptr to read-only table              */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs            */
+    )
+    {
+        Word16 codvec[NB_PULSE];
+        Word16 dn[L_CODE];
+        Word16 dn2[L_CODE];
+        Word16 dn_sign[L_CODE];
+        Word16 rr[L_CODE][L_CODE];
+
+        register Word16 i;
+
+        Word16 index;
+        Word16 sharp;
+        Word16 temp;
+        Word32 L_temp;
+
+        L_temp = ((Word32) pitch_sharp) << 1;
+
+        /* Check for overflow condition */
+        if (L_temp != (Word32)((Word16) L_temp))
+        {
+            *(pOverflow) = 1;
+            sharp = (pitch_sharp > 0) ? MAX_16 : MIN_16;
+        }
+        else
+        {
+            sharp = (Word16) L_temp;
+        }
+
+        if (T0 < L_CODE)
+        {
+            for (i = T0; i < L_CODE; i++)
+            {
+                temp =
+                    mult(
+                        *(h + i - T0),
+                        sharp,
+                        pOverflow);
+
+                *(h + i) =
+                    add_16(
+                        *(h + i),
+                        temp,
+                        pOverflow);
+            }
+        }
+
+        cor_h_x(
+            h,
+            x,
+            dn,
+            1,
+            pOverflow);
+
+        /* dn2[] not used in this codebook search */
+
+        set_sign(
+            dn,
+            dn_sign,
+            dn2,
+            8);
+
+        cor_h(
+            h,
+            dn_sign,
+            rr,
+            pOverflow);
+
+        search_2i40(
+            subNr,
+            dn,
+            rr,
+            startPos_ptr,
+            codvec,
+            pOverflow);
+
+        index =
+            build_code(
+                subNr,
+                codvec,
+                dn_sign,
+                code,
+                h,
+                y,
+                sign,
+                pOverflow);
+
+        /*-----------------------------------------------------------------*
+         * Compute innovation vector gain.                                 *
+         * Include fixed-gain pitch contribution into code[].              *
+         *-----------------------------------------------------------------*/
+
+        if (T0 < L_CODE)
+        {
+            for (i = T0; i < L_CODE; i++)
+            {
+                temp =
+                    mult(
+                        *(code + i - T0),
+                        sharp,
+                        pOverflow);
+
+                *(code + i) =
+                    add_16(
+                        *(code + i),
+                        temp,
+                        pOverflow);
+            }
+        }
+
+        return(index);
+    }
+
+    /****************************************************************************/
+
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: search_2i40
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        subNr = subframe number (Word16)
+        dn = vector containing the correlation between target and the impulse
+             response of the weighted synthesis filter (Word16)
+        rr = autocorrelation matrix (Word16)
+        codvec = algebraic codebook vector (Word16)
+
+     Outputs:
+        codvec contains the newly calculated codevectors
+
+     Returns:
+        None
+
+     Global Variables Used:
+        None
+
+     Local Variables Needed:
+        startPos = table containing the start positions used by fixed codebook
+                   routines (const Word16)
+
+    ------------------------------------------------------------------------------
+     FUNCTION DESCRIPTION
+
+     This function searches the best codevector and determines the positions of
+     the 2 pulses in the 40-sample frame.
+
+    ------------------------------------------------------------------------------
+     REQUIREMENTS
+
+     None
+
+    ------------------------------------------------------------------------------
+     REFERENCES
+
+     [1] c2_9pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+    ------------------------------------------------------------------------------
+     PSEUDO-CODE
+
+    static void search_2i40(
+        Word16 subNr,        // i : subframe number
+        Word16 dn[],         // i : correlation between target and h[]
+        Word16 rr[][L_CODE], // i : matrix of autocorrelation
+        Word16 codvec[]      // o : algebraic codebook vector
+    )
+    {
+        Word16 i0, i1;
+        Word16 ix = 0; // initialization only needed to keep gcc silent
+        Word16  track1, ipos[NB_PULSE];
+        Word16 psk, ps0, ps1, sq, sq1;
+        Word16 alpk, alp, alp_16;
+        Word32 s, alp0, alp1;
+        Word16 i;
+
+        psk = -1;
+        alpk = 1;
+        for (i = 0; i < NB_PULSE; i++)
+        {
+           codvec[i] = i;
+        }
+
+        for (track1 = 0; track1 < 2; track1++) {
+           // fix starting position
+
+           ipos[0] = startPos[subNr*2+8*track1];
+           ipos[1] = startPos[subNr*2+1+8*track1];
+
+
+               *----------------------------------------------------------------*
+               * i0 loop: try 8 positions.                                      *
+               *----------------------------------------------------------------*
+
+              for (i0 = ipos[0]; i0 < L_CODE; i0 += STEP) {
+
+                 ps0 = dn[i0];
+                 alp0 = L_mult(rr[i0][i0], _1_4);
+
+               *----------------------------------------------------------------*
+               * i1 loop: 8 positions.                                          *
+               *----------------------------------------------------------------*
+
+                 sq = -1;
+                 alp = 1;
+                 ix = ipos[1];
+
+            *-------------------------------------------------------------------*
+            *  These index have low complexity address computation because      *
+            *  they are, in fact, pointers with fixed increment.  For example,  *
+            *  "rr[i0][i2]" is a pointer initialized to "&rr[i0][ipos[2]]"      *
+            *  and incremented by "STEP".                                       *
+            *-------------------------------------------------------------------*
+
+                 for (i1 = ipos[1]; i1 < L_CODE; i1 += STEP) {
+                    ps1 = add(ps0, dn[i1]);   // idx increment = STEP
+
+                    // alp1 = alp0 + rr[i0][i1] + 1/2*rr[i1][i1];
+
+                    alp1 = L_mac(alp0, rr[i1][i1], _1_4); // idx incr = STEP
+                    alp1 = L_mac(alp1, rr[i0][i1], _1_2); // idx incr = STEP
+
+                    sq1 = mult(ps1, ps1);
+
+                    alp_16 = pv_round(alp1);
+
+                    s = L_msu(L_mult(alp, sq1), sq, alp_16);
+
+                    if (s > 0) {
+                       sq = sq1;
+                       alp = alp_16;
+                       ix = i1;
+                    }
+                 }
+
+               *----------------------------------------------------------------*
+               * memorise codevector if this one is better than the last one.   *
+               *----------------------------------------------------------------*
+
+                 s = L_msu(L_mult(alpk, sq), psk, alp);
+
+                 if (s > 0) {
+                    psk = sq;
+                    alpk = alp;
+                    codvec[0] = i0;
+                    codvec[1] = ix;
+                 }
+              }
+        }
+
+        return;
+    }
+
+    ------------------------------------------------------------------------------
+     CAUTION [optional]
+     [State any special notes, constraints or cautions for users of this function]
+
+    ------------------------------------------------------------------------------
+    */
+
+    static void search_2i40(
+        Word16 subNr,        /* i : subframe number                    */
+        Word16 dn[],         /* i : correlation between target and h[] */
+        Word16 rr[][L_CODE], /* i : matrix of autocorrelation          */
+        const Word16* startPos_ptr, /* i: ptr to read only table       */
+        Word16 codvec[],     /* o : algebraic codebook vector          */
+        Flag   * pOverflow   /* o : Flag set when overflow occurs      */
+    )
+    {
+        register Word16 i0;
+        register Word16 i1;
+        Word16 ix = 0; /* initialization only needed to keep gcc silent */
+        register Word16  track1;
+        Word16 ipos[NB_PULSE];
+        Word16 psk;
+        Word16 ps0;
+        Word16 ps1;
+        Word16 sq;
+        Word16 sq1;
+        Word16 alpk;
+        Word16 alp;
+        Word16 alp_16;
+        Word32 s;
+        Word32 alp0;
+        Word32 alp1;
+        register Word16 i;
+        Word32 L_temp;
+        Word16 *p_codvec = &codvec[0];
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        psk = -1;
+        alpk = 1;
+
+        /* Unrolled the following FOR loop to save MIPS */
+        /* for (i = 0; i < NB_PULSE; i++)           */
+        /* {                            */
+        /*  *(codvec + i) = i;          */
+        /* }                        */
+
+        *(p_codvec++) = 0;
+        *(p_codvec) = 1;
+
+        for (track1 = 0; track1 < 2; track1++)
+        {
+            /* fix starting position */
+
+            i = (subNr << 1) + (track1 << 3);
+            *ipos = *(startPos_ptr + i);
+            *(ipos + 1) = *(startPos_ptr + i + 1);
+
+
+            /*----------------------------------------------------------*
+             * i0 loop: try 8 positions.                                *
+             *----------------------------------------------------------*/
+
+            for (i0 = *ipos; i0 < L_CODE; i0 += STEP)
+            {
+                ps0 = *(dn + i0);
+
+                /* Left shift by 1 converts integer product to */
+                /* fractional product.                 */
+                alp0 = (Word32) rr[i0][i0] << 14;
+
+                /*--------------------------------------------------*
+                 * i1 loop: 8 positions.                            *
+                 *--------------------------------------------------*/
+
+                sq = -1;
+                alp = 1;
+                ix = *(ipos + 1);
+
+                /*--------------------------------------------------*
+                 * These index have low complexity address          *
+                 * computation because they are, in fact, pointers  *
+                 * with fixed increment. For example, "rr[i0][i2]"  *
+                 * is a pointer initialized to "&rr[i0][ipos[2]]"   *
+                *  and incremented by "STEP".                       *
+                *---------------------------------------------------*/
+
+                for (i1 = *(ipos + 1); i1 < L_CODE; i1 += STEP)
+                {
+                    /* idx increment = STEP */
+                    /* ps1 = add(ps0, *(dn + i1), pOverflow); */
+                    ps1 = ps0 + dn[i1];
+
+                    /* alp1 = alp0+rr[i0][i1]+1/2*rr[i1][i1]; */
+
+                    /* idx incr = STEP */
+                    /* Extra left shift by 1 converts integer  */
+                    /* product to fractional product     */
+                    /* alp1 = L_add(alp0, s, pOverflow); */
+                    alp1 = alp0 + ((Word32) rr[i1][i1] << 14);
+
+                    /* idx incr = STEP */
+                    /* Extra left shift by 1 converts integer  */
+                    /* product to fractional product     */
+                    /* alp1 = L_add(alp1, s, pOverflow); */
+                    alp1 += (Word32) rr[i0][i1] << 15;
+
+                    /* sq1 = mult(ps1, ps1, pOverflow); */
+                    sq1 = (Word16)(((Word32) ps1 * ps1) >> 15);
+
+                    /* alp_16 = pv_round(alp1, pOverflow); */
+                    alp_16 = (Word16)((alp1 + (Word32) 0x00008000L) >> 16);
+
+                    /* L_temp = L_mult(alp, sq1, pOverflow); */
+                    L_temp = ((Word32) alp * sq1) << 1;
+
+                    /* s = L_msu(L_temp, sq, alp_16, pOverflow); */
+                    s = L_temp - (((Word32) sq * alp_16) << 1);
+
+                    if (s > 0)
+                    {
+                        sq = sq1;
+                        alp = alp_16;
+                        ix = i1;
+                    }
+                }
+
+                /* memorize codevector if this one is better than the last one. */
+
+                /* L_temp = L_mult(alpk, sq, pOverflow); */
+                L_temp = ((Word32) alpk * sq) << 1;
+
+                /* s = L_msu(L_temp, psk, alp, pOverflow); */
+                s = L_temp - (((Word32) psk * alp) << 1);
+
+                if (s > 0)
+                {
+                    psk = sq;
+                    alpk = alp;
+                    p_codvec = &codvec[0];
+                    *(p_codvec++) = i0;
+                    *(p_codvec) = ix;
+                }
+            }
+        }
+
+        return;
+    }
+
+    /****************************************************************************/
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: Test_search_2i40
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        subNr = subframe number (Word16)
+        dn = vector containing the correlation between target and the impulse
+             response of the weighted synthesis filter (Word16)
+        rr = autocorrelation matrix (Word16)
+        codvec = algebraic codebook vector (Word16)
+
+     Outputs:
+        codvec contains the newly calculated codevectors
+
+     Returns:
+        None
+
+     Global Variables Used:
+        None
+
+     Local Variables Needed:
+        startPos = table containing the start positions used by fixed codebook
+                   routines (const Word16)
+
+    ------------------------------------------------------------------------------
+     FUNCTION DESCRIPTION
+
+     This function provides external access to the local function search_2i40.
+
+    ------------------------------------------------------------------------------
+     REQUIREMENTS
+
+     None
+
+    ------------------------------------------------------------------------------
+     REFERENCES
+
+     [1] c2_9pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+    ------------------------------------------------------------------------------
+     PSEUDO-CODE
+
+     CALL search_2i40 ( subNr = subNr
+                dn = dn
+                rr = rr
+                codvec = codvec )
+       MODIFYING(nothing)
+       RETURNING(nothing)
+
+    ------------------------------------------------------------------------------
+     CAUTION [optional]
+     [State any special notes, constraints or cautions for users of this function]
+
+    ------------------------------------------------------------------------------
+    */
+
+    void Test_search_2i40(
+        Word16 subNr,        /* i : subframe number                    */
+        Word16 dn[],         /* i : correlation between target and h[] */
+        Word16 rr[][L_CODE], /* i : matrix of autocorrelation          */
+        const Word16* startPos_ptr, /* i : ptr to read-only table      */
+        Word16 codvec[],     /* o : algebraic codebook vector          */
+        Flag   * pOverflow   /* o : Flag set when overflow occurs      */
+    )
+    {
+        /*----------------------------------------------------------------------------
+         CALL search_2i40 ( subNr = subNr
+                    dn = dn
+                    rr = rr
+                    codvec = codvec )
+           MODIFYING(nothing)
+           RETURNING(nothing)
+        ----------------------------------------------------------------------------*/
+        search_2i40(
+            subNr,
+            dn,
+            rr,
+            startPos_ptr,
+            codvec,
+            pOverflow);
+
+        return;
+    }
+
+    /****************************************************************************/
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: build_code
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        subNr = subframe number (Word16)
+        codvec = vector containing the position of pulses (Word16)
+        dn_sign = vector containing the sign of pulses (Word16)
+        cod = innovative code vector (Word16)
+        h = vector containing the impulse response of the weighted
+            synthesis filter (Word16)
+        y = vector containing the filtered innovative code (Word16)
+        sign = vector containing the sign of 2 pulses (Word16)
+
+     Outputs:
+        cod vector contains the new innovative code
+        y vector contains the new filtered innovative code
+        sign vector contains the sign of 2 pulses
+
+     Returns:
+        indx = codebook index (Word16)
+
+     Global Variables Used:
+        None
+
+     Local Variables Needed:
+        trackTable = table used for tracking codewords (Word16)
+
+    ------------------------------------------------------------------------------
+     FUNCTION DESCRIPTION
+
+     This function builds the codeword, the filtered codeword and index of the
+     codevector, based on the signs and positions of 2 pulses.
+
+    ------------------------------------------------------------------------------
+     REQUIREMENTS
+
+     None
+
+    ------------------------------------------------------------------------------
+     REFERENCES
+
+     [1] c2_9pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+    ------------------------------------------------------------------------------
+     PSEUDO-CODE
+
+    static Word16 build_code(
+        Word16 subNr,     // i : subframe number
+        Word16 codvec[],  // i : position of pulses
+        Word16 dn_sign[], // i : sign of pulses
+        Word16 cod[],     // o : innovative code vector
+        Word16 h[],       // i : impulse response of weighted synthesis filter
+        Word16 y[],       // o : filtered innovative code
+        Word16 sign[]     // o : sign of 2 pulses
+    )
+    {
+        Word16 i, j, k, track, first, index, _sign[NB_PULSE], indx, rsign;
+        Word16 *p0, *p1, *pt;
+        Word32 s;
+        static Word16 trackTable[4*5] = {
+           0, 1, 0, 1, -1, // subframe 1; track to code; -1 do not code this position
+           0, -1, 1, 0, 1, // subframe 2
+           0, 1, 0, -1, 1, // subframe 3
+           0, 1, -1, 0, 1};// subframe 4
+
+        pt = &trackTable[add(subNr, shl(subNr, 2))];
+
+        for (i = 0; i < L_CODE; i++) {
+            cod[i] = 0;
+        }
+
+        indx = 0;
+        rsign = 0;
+        for (k = 0; k < NB_PULSE; k++) {
+           i = codvec[k];    // read pulse position
+           j = dn_sign[i];   // read sign
+
+           index = mult(i, 6554);    // index = pos/5
+                                     // track = pos%5
+           track = sub(i, extract_l(L_shr(L_mult(index, 5), 1)));
+
+           first = pt[track];
+
+           if (first == 0) {
+              if (k == 0) {
+                 track = 0;
+              } else {
+                 track = 1;
+                 index = shl(index, 3);
+              }
+           } else {
+              if (k == 0) {
+                 track = 0;
+                 index = add(index, 64);  // table bit is MSB
+              } else {
+                 track = 1;
+                 index = shl(index, 3);
+              }
+           }
+
+           if (j > 0) {
+              cod[i] = 8191;
+              _sign[k] = 32767;
+              rsign = add(rsign, shl(1, track));
+           } else {
+              cod[i] = -8192;
+              _sign[k] = (Word16) - 32768L;
+            }
+
+           indx = add(indx, index);
+        }
+        *sign = rsign;
+
+        p0 = h - codvec[0];
+        p1 = h - codvec[1];
+
+        for (i = 0; i < L_CODE; i++) {
+           s = 0;
+           s = L_mac(s, *p0++, _sign[0]);
+           s = L_mac(s, *p1++, _sign[1]);
+           y[i] = pv_round(s);
+        }
+
+        return indx;
+    }
+
+    ------------------------------------------------------------------------------
+     CAUTION [optional]
+     [State any special notes, constraints or cautions for users of this function]
+
+    ------------------------------------------------------------------------------
+    */
+
+    static Word16 build_code(
+        Word16 subNr,     /* i : subframe number                            */
+        Word16 codvec[],  /* i : position of pulses                         */
+        Word16 dn_sign[], /* i : sign of pulses                             */
+        Word16 cod[],     /* o : innovative code vector                     */
+        Word16 h[],       /* i : impulse response of weighted synthesis     */
+        /*     filter                                     */
+        Word16 y[],       /* o : filtered innovative code                   */
+        Word16 sign[],    /* o : sign of 2 pulses                           */
+        Flag  *pOverflow  /* o : Flag set when overflow occurs              */
+    )
+    {
+        register Word16 i;
+        register Word16 j;
+        register Word16 k;
+        register Word16 track;
+        register Word16 first;
+        register Word16 index;
+        register Word16 rsign;
+        Word16 indx;
+        Word16 _sign[NB_PULSE];
+        Word16 *p0;
+        Word16 *p1;
+
+        const Word16 *pt;
+
+        Word32 s;
+
+        pt = trackTable + subNr + (subNr << 2);
+
+        for (i = 0; i < L_CODE; i++)
+        {
+            *(cod + i) = 0;
+        }
+
+        indx = 0;
+        rsign = 0;
+
+        for (k = 0; k < NB_PULSE; k++)
+        {
+            i = *(codvec + k);  /* read pulse position */
+            j = *(dn_sign + i); /* read sign           */
+
+            s = ((Word32)(i * 6554)) >> 15;
+            index = (Word16) s; /* index = pos/5 */
+
+            track = i - (5 * index);    /* track = pos%5 */
+
+            first = *(pt + track);
+
+
+            if (k == 0)
+            {
+                track = 0;
+
+                if (first != 0)
+                {
+                    index += 64;  /* table bit is MSB */
+                }
+            }
+            else
+            {
+                track = 1;
+                index <<= 3;
+            }
+
+            if (j > 0)
+            {
+                *(cod + i) = 8191;
+                *(_sign + k) = 32767;
+                rsign += (1 << track);
+            }
+            else
+            {
+                *(cod + i) = ~(8192) + 1;
+                *(_sign + k) = (Word16)(~(32768) + 1);
+            }
+
+            indx += index;
+        }
+
+        *sign = rsign;
+
+        p0 = h - *codvec;
+        p1 = h - *(codvec + 1);
+
+        for (i = 0; i < L_CODE; i++)
+        {
+            s = 0;
+            s =
+                L_mult(
+                    *p0++,
+                    *_sign,
+                    pOverflow);
+
+            s =
+                L_mac(
+                    s,
+                    *p1++,
+                    *(_sign + 1),
+                    pOverflow);
+
+            *(y + i) =
+                pv_round(
+                    s,
+                    pOverflow);
+        }
+
+        return(indx);
+    }
+
+    /****************************************************************************/
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: Test_build_code
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        subNr = subframe number (Word16)
+        codvec = vector containing the position of pulses (Word16)
+        dn_sign = vector containing the sign of pulses (Word16)
+        cod = innovative code vector (Word16)
+        h = vector containing the impulse response of the weighted
+            synthesis filter (Word16)
+        y = vector containing the filtered innovative code (Word16)
+        sign = vector containing the sign of 2 pulses (Word16)
+
+     Outputs:
+        cod vector contains the new innovative code
+        y vector contains the new filtered innovative code
+        sign vector contains the sign of 2 pulses
+
+     Returns:
+        indx = codebook index (Word16)
+
+     Global Variables Used:
+        None
+
+     Local Variables Needed:
+        trackTable = table used for tracking codewords (Word16)
+
+    ------------------------------------------------------------------------------
+     FUNCTION DESCRIPTION
+
+     This function provides external access to the local function build_code.
+
+    ------------------------------------------------------------------------------
+     REQUIREMENTS
+
+     None
+
+    ------------------------------------------------------------------------------
+     REFERENCES
+
+     [1] c2_9pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+    ------------------------------------------------------------------------------
+     PSEUDO-CODE
+
+     CALL build_code ( subNr = subNr
+               codvec = codvec
+               dn_sign = dn_sign
+               cod = cod
+               h = h
+               y = y
+               sign = sign )
+       MODIFYING(nothing)
+       RETURNING(indx)
+
+    ------------------------------------------------------------------------------
+     CAUTION [optional]
+     [State any special notes, constraints or cautions for users of this function]
+
+    ------------------------------------------------------------------------------
+    */
+
+    Word16 Test_build_code(
+        Word16 subNr,      /* i : subframe number                            */
+        Word16 codvec[],   /* i : position of pulses                         */
+        Word16 dn_sign[],  /* i : sign of pulses                             */
+        Word16 cod[],      /* o : innovative code vector                     */
+        Word16 h[],        /* i : impulse response of weighted synthesis     */
+        /*     filter                                     */
+        Word16 y[],        /* o : filtered innovative code                   */
+        Word16 sign[],     /* o : sign of 2 pulses                           */
+        Flag   * pOverflow /* o : Flag set when overflow occurs              */
+    )
+    {
+        Word16  test_index;
+
+        /*----------------------------------------------------------------------------
+         CALL build_code ( subNr = subNr
+                   codvec = codvec
+                   dn_sign = dn_sign
+                   cod = cod
+                   h = h
+                   y = y
+                   sign = sign )
+           MODIFYING(nothing)
+           RETURNING(indx)
+        ----------------------------------------------------------------------------*/
+        test_index =
+            build_code(
+                subNr,
+                codvec,
+                dn_sign,
+                cod,
+                h,
+                y,
+                sign,
+                pOverflow);
+
+        return(test_index);
+    }
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.h
new file mode 100644 (file)
index 0000000..0009352
--- /dev/null
@@ -0,0 +1,117 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c2_9pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the c2_9pf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef c2_9pf_h
+#define c2_9pf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 code_2i40_9bits(
+        Word16 subNr,       /* i : subframe number                               */
+        Word16 x[],         /* i : target vector                                 */
+        Word16 h[],         /* i : impulse response of weighted synthesis filter */
+        /*     h[-L_subfr..-1] must be set to zero.          */
+        Word16 T0,          /* i : Pitch lag                                     */
+        Word16 pitch_sharp, /* i : Last quantized pitch gain                     */
+        Word16 code[],      /* o : Innovative codebook                           */
+        Word16 y[],         /* o : filtered fixed codebook excitation            */
+        Word16 * sign,      /* o : Signs of 2 pulses                             */
+        const Word16* startPos_ptr, /* ptr to read-only table                    */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _c2_9PF_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.cpp
new file mode 100644 (file)
index 0000000..0b8a596
--- /dev/null
@@ -0,0 +1,748 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c3_14pf.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "c3_14pf.h"
+#include "typedef.h"
+#include "inv_sqrt.h"
+#include "cnst.h"
+#include "cor_h.h"
+#include "set_sign.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+#define NB_PULSE  3
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+static void search_3i40(
+    Word16 dn[],        /* i : correlation between target and h[]            */
+    Word16 dn2[],       /* i : maximum of corr. in each track.               */
+    Word16 rr[][L_CODE],/* i : matrix of autocorrelation                     */
+    Word16 codvec[],    /* o : algebraic codebook vector                     */
+    Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+);
+
+static Word16 build_code(
+    Word16 codvec[],    /* i : algebraic codebook vector                     */
+    Word16 dn_sign[],   /* i : sign of dn[]                                  */
+    Word16 cod[],       /* o : algebraic (fixed) codebook excitation         */
+    Word16 h[],         /* i : impulse response of weighted synthesis filter */
+    Word16 y[],         /* o : filtered fixed codebook excitation            */
+    Word16 sign[],      /* o : sign of 3 pulses                              */
+    Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+);
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: code_3i40_14bits
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    x[]   Array of type Word16 -- target vector
+    h[]   Array of type Word16 -- impulse response of weighted synthesis filter
+                                  h[-L_subfr..-1] must be set to zero.
+
+    T0           Array of type Word16 -- Pitch lag
+    pitch_sharp, Array of type Word16 --  Last quantized pitch gain
+
+ Outputs:
+    code[]  Array of type Word16 -- Innovative codebook
+    y[]     Array of type Word16 -- filtered fixed codebook excitation
+    * sign  Pointer of type Word16 -- Pointer to the signs of 3 pulses
+    pOverflow    Pointer to Flag      -- set when overflow occurs
+
+ Returns:
+    index
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE:  Searches a 14 bit algebraic codebook containing 3 pulses
+           in a frame of 40 samples.
+
+ DESCRIPTION:
+    The code length is 40, containing 3 nonzero pulses: i0...i2.
+    All pulses can have two possible amplitudes: +1 or -1.
+    Pulse i0 can have 8 possible positions, pulses i1 and i2 can have
+    2x8=16 positions.
+
+        i0 :  0, 5, 10, 15, 20, 25, 30, 35.
+        i1 :  1, 6, 11, 16, 21, 26, 31, 36.
+              3, 8, 13, 18, 23, 28, 33, 38.
+        i2 :  2, 7, 12, 17, 22, 27, 32, 37.
+              4, 9, 14, 19, 24, 29, 34, 39.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] c3_14pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 code_3i40_14bits(
+    Word16 x[],         /* i : target vector                                 */
+    Word16 h[],         /* i : impulse response of weighted synthesis filter */
+    /*     h[-L_subfr..-1] must be set to zero.          */
+    Word16 T0,          /* i : Pitch lag                                     */
+    Word16 pitch_sharp, /* i : Last quantized pitch gain                     */
+    Word16 code[],      /* o : Innovative codebook                           */
+    Word16 y[],         /* o : filtered fixed codebook excitation            */
+    Word16 * sign,      /* o : Signs of 3 pulses                             */
+    Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+)
+{
+    Word16 codvec[NB_PULSE];
+    Word16 dn[L_CODE];
+    Word16 dn2[L_CODE];
+    Word16 dn_sign[L_CODE];
+    Word16 rr[L_CODE][L_CODE];
+    Word16 i;
+    Word16 index;
+    Word16 sharp;
+    Word16 tempWord;
+
+    /* sharp = shl(pitch_sharp, 1, pOverflow); */
+    sharp = pitch_sharp << 1;
+
+    if (T0 < L_CODE)
+    {
+        for (i = T0; i < L_CODE; i++)
+        {
+            tempWord =
+                mult(
+                    h[i - T0],
+                    sharp,
+                    pOverflow);
+
+            h[i] =
+                add_16(
+                    h[i],
+                    tempWord,
+                    pOverflow);
+        }
+    }
+
+    cor_h_x(
+        h,
+        x,
+        dn,
+        1,
+        pOverflow);
+
+    set_sign(
+        dn,
+        dn_sign,
+        dn2,
+        6);
+
+    cor_h(
+        h,
+        dn_sign,
+        rr,
+        pOverflow);
+
+    search_3i40(
+        dn,
+        dn2,
+        rr,
+        codvec,
+        pOverflow);
+
+    /* function result */
+    index =
+        build_code(
+            codvec,
+            dn_sign,
+            code,
+            h,
+            y,
+            sign,
+            pOverflow);
+
+    /*-----------------------------------------------------------------*
+    * Compute innovation vector gain.                                 *
+    * Include fixed-gain pitch contribution into code[].              *
+    *-----------------------------------------------------------------*/
+
+    if (T0 < L_CODE)
+    {
+        for (i = T0; i < L_CODE; i++)
+        {
+            tempWord =
+                mult(
+                    code[i - T0],
+                    sharp,
+                    pOverflow);
+
+            code[i] =
+                add_16(
+                    code[i],
+                    tempWord,
+                    pOverflow);
+        }
+    }
+    return index;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: search_3i40
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    dn[]         Array of type Word16 -- correlation between target and h[]
+    dn2[]        Array of type Word16 -- maximum of corr. in each track.
+    rr[][L_CODE] Double Array of type Word16 -- autocorrelation matrix
+
+ Outputs:
+    codvec[]     Array of type Word16 -- algebraic codebook vector
+    pOverflow    Pointer to Flag      -- set when overflow occurs
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE: Search the best codevector; determine positions of the 3 pulses
+          in the 40-sample frame.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] c3_14pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+static void search_3i40(
+    Word16 dn[],         /* i : correlation between target and h[] */
+    Word16 dn2[],        /* i : maximum of corr. in each track.    */
+    Word16 rr[][L_CODE], /* i : matrix of autocorrelation          */
+    Word16 codvec[],     /* o : algebraic codebook vector          */
+    Flag   * pOverflow   /* o : Flag set when overflow occurs      */
+)
+{
+    Word16 i0;
+    Word16 i1;
+    Word16 i2;
+
+    Word16 ix = 0; /* initialization only needed to keep gcc silent */
+    Word16 ps = 0; /* initialization only needed to keep gcc silent */
+
+    Word16 i;
+    Word16 pos;
+    Word16 track1;
+    Word16 track2;
+    Word16 ipos[NB_PULSE];
+
+    Word16 psk;
+    Word16 ps0;
+    Word16 ps1;
+    Word16 sq;
+    Word16 sq1;
+    Word16 alpk;
+    Word16 alp;
+    Word16 alp_16;
+
+    Word16 *p_codvec = &codvec[0];
+
+    Word32 s;
+    Word32 alp0;
+    Word32 alp1;
+
+    psk = -1;
+    alpk = 1;
+
+    for (i = 0; i < NB_PULSE; i++)
+    {
+        *(p_codvec++) = i;
+    }
+
+    for (track1 = 1; track1 < 4; track1 += 2)
+    {
+        for (track2 = 2; track2 < 5; track2 += 2)
+        {
+            /* fix starting position */
+
+            ipos[0] = 0;
+            ipos[1] = track1;
+            ipos[2] = track2;
+
+            /*------------------------------------------------------------------*
+             * main loop: try 3 tracks.                                         *
+             *------------------------------------------------------------------*/
+
+            for (i = 0; i < NB_PULSE; i++)
+            {
+                /*----------------------------------------------------------------*
+                 * i0 loop: try 8 positions.                                      *
+                 *----------------------------------------------------------------*/
+
+                /* account for ptr. init. (rr[io]) */
+                for (i0 = ipos[0]; i0 < L_CODE; i0 += STEP)
+                {
+                    if (dn2[i0] >= 0)
+                    {
+                        ps0 = dn[i0];
+
+                        /* alp0 = L_mult(rr[i0][i0],_1_4, pOverflow); */
+                        alp0 = (Word32) rr[i0][i0] << 14;
+
+                        /*----------------------------------------------------------------*
+                         * i1 loop: 8 positions.                                          *
+                         *----------------------------------------------------------------*/
+
+                        sq = -1;
+                        alp = 1;
+                        ps = 0;
+                        ix = ipos[1];
+
+                        /* initialize 4 index for next loop. */
+                        /*-------------------------------------------------------------------*
+                         *  These index have low complexity address computation because      *
+                         *  they are, in fact, pointers with fixed increment.  For example,  *
+                         *  "rr[i0][i2]" is a pointer initialized to "&rr[i0][ipos[2]]"      *
+                         *  and incremented by "STEP".                                       *
+                         *-------------------------------------------------------------------*/
+
+                        for (i1 = ipos[1]; i1 < L_CODE; i1 += STEP)
+                        {
+                            /* idx increment = STEP */
+                            /* ps1 = add(ps0, dn[i1], pOverflow); */
+                            ps1 = ps0 + dn[i1];
+
+                            /* alp1 = alp0 + rr[i0][i1] + 1/2*rr[i1][i1]; */
+
+                            /* idx incr = STEP */
+                            /* alp1 = L_mac(alp0, rr[i1][i1], _1_4, pOverflow); */
+                            alp1 = alp0 + ((Word32) rr[i1][i1] << 14);
+
+                            /* idx incr = STEP */
+                            /* alp1 = L_mac(alp1, rr[i0][i1], _1_2, pOverflow); */
+                            alp1 += (Word32) rr[i0][i1] << 15;
+
+                            /* sq1 = mult(ps1, ps1, pOverflow); */
+                            sq1 = (Word16)(((Word32) ps1 * ps1) >> 15);
+
+                            /* alp_16 = pv_round(alp1, pOverflow); */
+                            alp_16 = (Word16)((alp1 + (Word32) 0x00008000L) >> 16);
+
+                            /* s = L_mult(alp, sq1, pOverflow); */
+                            s = ((Word32) alp * sq1) << 1;
+
+                            /* s = L_msu(s, sq, alp_16, pOverflow); */
+                            s -= (((Word32) sq * alp_16) << 1);
+
+                            if (s > 0)
+                            {
+                                sq = sq1;
+                                ps = ps1;
+                                alp = alp_16;
+                                ix = i1;
+                            }
+                        }
+                        i1 = ix;
+
+                        /*----------------------------------------------------------------*
+                         * i2 loop: 8 positions.                                          *
+                         *----------------------------------------------------------------*/
+
+                        ps0 = ps;
+
+                        /* alp0 = L_mult(alp, _1_4, pOverflow); */
+                        alp0 = (Word32) alp << 14;
+
+                        sq = -1;
+                        alp = 1;
+                        ps = 0;
+                        ix = ipos[2];
+
+                        /* initialize 4 index for next loop (see i1 loop) */
+
+                        for (i2 = ipos[2]; i2 < L_CODE; i2 += STEP)
+                        {
+                            /* index increment = STEP */
+                            /* ps1 = add(ps0, dn[i2], pOverflow); */
+                            ps1 = ps0 + dn[i2];
+
+                            /* alp1 = alp0 + rr[i0][i2] + rr[i1][i2] + 1/2*rr[i2][i2]; */
+
+                            /* idx incr = STEP */
+                            /* alp1 = L_mac(alp0, rr[i2][i2], _1_16, pOverflow); */
+                            alp1 = alp0 + ((Word32) rr[i2][i2] << 12);
+
+                            /* idx incr = STEP */
+                            /* alp1 = L_mac(alp1, rr[i1][i2], _1_8, pOverflow); */
+                            alp1 += (Word32) rr[i1][i2] << 13;
+
+                            /* idx incr = STEP */
+                            /* alp1 = L_mac(alp1,rr[i0][i2], _1_8, pOverflow); */
+                            alp1 += (Word32) rr[i0][i2] << 13;
+
+                            /* sq1 = mult(ps1, ps1, pOverflow); */
+                            sq1 = (Word16)(((Word32) ps1 * ps1) >> 15);
+
+                            /* alp_16 = pv_round(alp1, pOverflow); */
+                            alp_16 = (Word16)((alp1 + (Word32) 0x00008000L) >> 16);
+
+                            /* s = L_mult(alp, sq1, pOverflow); */
+                            s = ((Word32) alp * sq1) << 1;
+
+                            /* s = L_msu(s, sq, alp_16, pOverflow); */
+                            s -= (((Word32) sq * alp_16) << 1);
+
+                            if (s > 0)
+                            {
+                                sq = sq1;
+                                ps = ps1;
+                                alp = alp_16;
+                                ix = i2;
+                            }
+                        }
+                        i2 = ix;
+
+                        /* memorize codevector if this one
+                         * is better than the last one.
+                         */
+
+                        s = L_mult(alpk, sq, pOverflow);
+                        //s = ((Word32) alpk * sq) << 1;
+
+                        s = L_msu(s, psk, alp, pOverflow);
+                        //s -= (((Word32) psk * alp) << 1);
+
+                        if (s > 0)
+                        {
+                            psk = sq;
+                            alpk = alp;
+                            p_codvec = &codvec[0];
+
+                            *(p_codvec++) = i0;
+                            *(p_codvec++) = i1;
+                            *(p_codvec) = i2;
+                        }
+                    }
+                }
+                /*----------------------------------------------------------------*
+                 * Cyclic permutation of i0, i1 and i2.                           *
+                 *----------------------------------------------------------------*/
+
+                pos = ipos[2];
+                ipos[2] = ipos[1];
+                ipos[1] = ipos[0];
+                ipos[0] = pos;
+            }
+        }
+    }
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:  build_code()
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    codvec[]   Array of type Word16 -- position of pulses
+    dn_sign[]  Array of type Word16 -- sign of pulses
+    h[]        Array of type Word16 -- impulse response of
+                                       weighted synthesis filter
+
+ Outputs:
+    cod[]  Array of type Word16 -- innovative code vector
+    y[]    Array of type Word16 -- filtered innovative code
+    sign[] Array of type Word16 -- sign of 3 pulses
+    pOverflow  Pointer to Flag  -- set when overflow occurs
+
+ Returns:
+    indx
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE: Builds the codeword, the filtered codeword and index of the
+          codevector, based on the signs and positions of 3 pulses.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] c3_14pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16
+build_code(
+    Word16 codvec[],  /* i : position of pulses                            */
+    Word16 dn_sign[], /* i : sign of pulses                                */
+    Word16 cod[],     /* o : innovative code vector                        */
+    Word16 h[],       /* i : impulse response of weighted synthesis filter */
+    Word16 y[],       /* o : filtered innovative code                      */
+    Word16 sign[],    /* o : sign of 3 pulses                              */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs                 */
+)
+{
+    Word16 i;
+    Word16 j;
+    Word16 k;
+    Word16 track;
+    Word16 index;
+    Word16 _sign[NB_PULSE];
+    Word16 indx;
+    Word16 rsign;
+
+    Word16 *p0;
+    Word16 *p1;
+    Word16 *p2;
+
+    Word32 s;
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        cod[i] = 0;
+    }
+
+    indx = 0;
+    rsign = 0;
+
+    for (k = 0; k < NB_PULSE; k++)
+    {
+        i = codvec[k];  /* read pulse position */
+        j = dn_sign[i];  /* read sign           */
+
+        /* index = pos/5 */
+        /* index = mult(i, 6554, pOverflow); */
+        index = (Word16)(((Word32) i * 6554) >> 15);
+
+        /* track = pos%5 */
+        /* s = L_mult(index, 5, pOverflow); */
+        s = ((Word32) index * 5) << 1;
+
+        /* s = L_shr(s, 1, pOverflow); */
+        s >>= 1;
+
+        /* track = sub(i, (Word16) s, pOverflow); */
+        track = i - (Word16) s;
+
+        if (track == 1)
+        {
+            /* index = shl(index, 4, pOverflow); */
+            index <<= 4;
+        }
+        else if (track == 2)
+        {
+            track = 2;
+
+            /* index = shl(index, 8, pOverflow); */
+            index <<= 8;
+        }
+        else if (track == 3)
+        {
+            track = 1;
+
+            /* index = shl(index, 4, pOverflow); */
+            index <<= 4;
+
+            /* index = add(index, 8, pOverflow); */
+            index += 8;
+        }
+        else if (track == 4)
+        {
+            track = 2;
+
+            /* index = shl(index, 8, pOverflow); */
+            index <<= 8;
+
+            /* index = add(index, 128, pOverflow); */
+            index += 128;
+        }
+
+        if (j > 0)
+        {
+            cod[i] = 8191;
+            _sign[k] = 32767;
+
+            /* track = shl(1, track, pOverflow); */
+            track = 1 << track;
+
+            /* rsign = add(rsign, track, pOverflow); */
+            rsign += track;
+        }
+        else
+        {
+            cod[i] = -8192;
+            _sign[k] = (Word16) - 32768L;
+        }
+
+        /* indx = add(indx, index, pOverflow); */
+        indx += index;
+    }
+    *sign = rsign;
+
+    p0 = h - codvec[0];
+    p1 = h - codvec[1];
+    p2 = h - codvec[2];
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        s = 0;
+        s =
+            L_mac(
+                s,
+                *p0++,
+                _sign[0],
+                pOverflow);
+
+        s =
+            L_mac(
+                s,
+                *p1++,
+                _sign[1],
+                pOverflow);
+
+        s =
+            L_mac(
+                s,
+                *p2++,
+                _sign[2],
+                pOverflow);
+
+        y[i] =
+            pv_round(
+                s,
+                pOverflow);
+    }
+
+    return indx;
+}
+
+
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.h
new file mode 100644 (file)
index 0000000..85cf47b
--- /dev/null
@@ -0,0 +1,114 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c3_14pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by c3_14pf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef c3_14pf_h
+#define c3_14pf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    Word16 code_3i40_14bits(
+        Word16 x[], /* (i)   : target vector                                 */
+        Word16 h[], /* (i)   : impulse response of weighted synthesis filter */
+        /*         h[-L_subfr..-1] must be set to zero.          */
+        Word16 T0,  /* (i)   : Pitch lag                                     */
+        Word16 pitch_sharp, /* (i)   : Last quantized pitch gain             */
+        Word16 code[],      /* (o)   : Innovative codebook                   */
+        Word16 y[],         /* (o)   : filtered fixed codebook excitation    */
+        Word16 * sign,      /* (o)   : Signs of 3 pulses                     */
+        Flag   *pOverflow
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _c3_14PF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.cpp
new file mode 100644 (file)
index 0000000..e511092
--- /dev/null
@@ -0,0 +1,823 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c4_17pf.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ Purpose          : Searches a 17 bit algebraic codebook containing 4 pulses
+                    in a frame of 40 samples
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "c4_17pf.h"
+#include "typedef.h"
+#include "inv_sqrt.h"
+#include "cnst.h"
+#include "cor_h.h"
+#include "set_sign.h"
+#include "basic_op.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+#define NB_PULSE  4
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    static void search_4i40(
+        Word16 dn[],        /* i : correlation between target and h[]            */
+        Word16 dn2[],       /* i : maximum of corr. in each track.               */
+        Word16 rr[][L_CODE],/* i : matrix of autocorrelation                     */
+        Word16 codvec[],    /* o : algebraic codebook vector                     */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+    );
+
+    static Word16 build_code(
+        Word16 codvec[],    /* i : algebraic codebook vector                     */
+        Word16 dn_sign[],   /* i : sign of dn[]                                  */
+        Word16 cod[],       /* o : algebraic (fixed) codebook excitation         */
+        Word16 h[],         /* i : impulse response of weighted synthesis filter */
+        Word16 y[],         /* o : filtered fixed codebook excitation            */
+        Word16 sign[],      /* o : index of 4 pulses (position+sign+ampl)*4      */
+        const Word16* gray_ptr,   /* i : ptr to read-only table                        */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME:  code_4i40_17bits()
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        x[]   Array of type Word16 -- target vector
+        h[]   Array of type Word16 -- impulse response of weighted synthesis filter
+                                      h[-L_subfr..-1] must be set to zero.
+
+        T0           Array of type Word16 -- Pitch lag
+        pitch_sharp, Array of type Word16 --  Last quantized pitch gain
+
+     Outputs:
+        code[]  Array of type Word16 -- Innovative codebook
+        y[]     Array of type Word16 -- filtered fixed codebook excitation
+        * sign  Pointer of type Word16 -- Pointer to the signs of 4 pulses
+        pOverflow    Pointer to Flag      -- set when overflow occurs
+
+     Returns:
+        index
+
+     Global Variables Used:
+        None
+
+     Local Variables Needed:
+
+    ------------------------------------------------------------------------------
+     FUNCTION DESCRIPTION
+
+     PURPOSE:  Searches a 17 bit algebraic codebook containing 4 pulses
+               in a frame of 40 samples.
+
+     DESCRIPTION:
+       The code length is 40, containing 4 nonzero pulses: i0...i3.
+       All pulses can have two possible amplitudes: +1 or -1.
+       Pulse i0 to i2 can have 8 possible positions, pulse i3 can have
+       2x8=16 positions.
+
+          i0 :  0, 5, 10, 15, 20, 25, 30, 35.
+          i1 :  1, 6, 11, 16, 21, 26, 31, 36.
+          i2 :  2, 7, 12, 17, 22, 27, 32, 37.
+          i3 :  3, 8, 13, 18, 23, 28, 33, 38.
+                4, 9, 14, 19, 24, 29, 34, 39.
+
+    ------------------------------------------------------------------------------
+     REQUIREMENTS
+
+     None
+
+    ------------------------------------------------------------------------------
+     REFERENCES
+
+     [1] c3_14pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+    ------------------------------------------------------------------------------
+     PSEUDO-CODE
+
+    ------------------------------------------------------------------------------
+     CAUTION [optional]
+     [State any special notes, constraints or cautions for users of this function]
+
+    ------------------------------------------------------------------------------
+    */
+
+    Word16 code_4i40_17bits(
+        Word16 x[],         /* i : target vector                                 */
+        Word16 h[],         /* i : impulse response of weighted synthesis filter */
+        /*     h[-L_subfr..-1] must be set to zero.          */
+        Word16 T0,          /* i : Pitch lag                                     */
+        Word16 pitch_sharp, /* i : Last quantized pitch gain                     */
+        Word16 code[],      /* o : Innovative codebook                           */
+        Word16 y[],         /* o : filtered fixed codebook excitation            */
+        Word16 * sign,      /* o : Signs of 4 pulses                             */
+        const Word16* gray_ptr,   /* i : ptr to read-only table                  */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
+    )
+    {
+        Word16 codvec[NB_PULSE];
+        Word16 dn[L_CODE];
+        Word16 dn2[L_CODE];
+        Word16 dn_sign[L_CODE];
+
+        Word16 rr[L_CODE][L_CODE];
+        Word16 i;
+        Word16 index;
+        Word16 sharp;
+        Word16 tempWord;
+
+        sharp = pitch_sharp << 1;
+
+        if (T0 < L_CODE)
+        {
+            for (i = T0; i < L_CODE; i++)
+            {
+                tempWord =
+                    mult(
+                        h[i - T0],
+                        sharp,
+                        pOverflow);
+
+                h[i] =
+                    add_16(
+                        h[i],
+                        tempWord,
+                        pOverflow);
+            }
+        }
+
+        cor_h_x(
+            h,
+            x,
+            dn,
+            1,
+            pOverflow);
+
+        set_sign(
+            dn,
+            dn_sign,
+            dn2,
+            4);
+
+        cor_h(
+            h,
+            dn_sign,
+            rr,
+            pOverflow);
+
+        search_4i40(
+            dn,
+            dn2,
+            rr,
+            codvec,
+            pOverflow);
+
+        /* function result */
+        index =
+            build_code(
+                codvec,
+                dn_sign,
+                code,
+                h,
+                y,
+                sign,
+                gray_ptr,
+                pOverflow);
+
+        /*-----------------------------------------------------------------*
+        * Compute innovation vector gain.                                 *
+        * Include fixed-gain pitch contribution into code[].              *
+        *-----------------------------------------------------------------*/
+
+        tempWord = T0 - L_CODE;
+
+        if (tempWord < 0)
+        {
+            for (i = T0; i < L_CODE; i++)
+            {
+                tempWord =
+                    mult(
+                        code[i - T0],
+                        sharp,
+                        pOverflow);
+
+                code[i] =
+                    add_16(
+                        code[i],
+                        tempWord,
+                        pOverflow);
+            }
+        }
+
+        return index;
+    }
+    /****************************************************************************/
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME: search_4i40()
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        dn[]         Array of type Word16 -- correlation between target and h[]
+        dn2[]        Array of type Word16 -- maximum of corr. in each track.
+        rr[][L_CODE] Double Array of type Word16 -- autocorrelation matrix
+
+     Outputs:
+        codvec[]     Array of type Word16 -- algebraic codebook vector
+        pOverflow    Pointer to Flag      -- set when overflow occurs
+
+     Returns:
+
+
+     Global Variables Used:
+        None
+
+     Local Variables Needed:
+
+
+    ------------------------------------------------------------------------------
+     FUNCTION DESCRIPTION
+
+     PURPOSE: Search the best codevector; determine positions of the 4 pulses
+              in the 40-sample frame.
+
+    ------------------------------------------------------------------------------
+     REQUIREMENTS
+
+     None
+
+    ------------------------------------------------------------------------------
+     REFERENCES
+
+     [1] c4_17pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+    ------------------------------------------------------------------------------
+     PSEUDO-CODE
+
+    ------------------------------------------------------------------------------
+     CAUTION [optional]
+     [State any special notes, constraints or cautions for users of this function]
+
+    ------------------------------------------------------------------------------
+    */
+    static void search_4i40(
+        Word16 dn[],         /* i : correlation between target and h[]  */
+        Word16 dn2[],        /* i : maximum of corr. in each track.     */
+        Word16 rr[][L_CODE], /* i : matrix of autocorrelation           */
+        Word16 codvec[],     /* o : algebraic codebook vector           */
+        Flag   * pOverflow   /* o : Flag set when overflow occurs       */
+    )
+    {
+        Word16 i0;
+        Word16 i1;
+        Word16 i2;
+        Word16 i3;
+
+        Word16 ix = 0; /* initialization only needed to keep gcc silent */
+        Word16 ps = 0; /* initialization only needed to keep gcc silent */
+
+        Word16 i;
+        Word16 pos;
+        Word16 track;
+        Word16 ipos[NB_PULSE];
+
+        Word16 psk;
+        Word16 ps0;
+        Word16 ps1;
+        Word16 sq;
+        Word16 sq1;
+
+        Word16 alpk;
+        Word16 alp;
+        Word16 alp_16;
+        Word16 *p_codvec = &codvec[0];
+
+        Word32 s;
+        Word32 alp0;
+        Word32 alp1;
+
+        OSCL_UNUSED_ARG(pOverflow);
+
+        /* Default value */
+        psk = -1;
+        alpk = 1;
+        for (i = 0; i < NB_PULSE; i++)
+        {
+            *(p_codvec++) = i;
+        }
+
+        for (track = 3; track < 5; track++)
+        {
+            /* fix starting position */
+
+            ipos[0] = 0;
+            ipos[1] = 1;
+            ipos[2] = 2;
+            ipos[3] = track;
+
+            /*------------------------------------------------------------------*
+             * main loop: try 4 tracks.                                         *
+             *------------------------------------------------------------------*/
+
+            for (i = 0; i < NB_PULSE; i++)
+            {
+                /*----------------------------------------------------------------*
+                 * i0 loop: try 4 positions (use position with max of corr.).     *
+                 *----------------------------------------------------------------*/
+
+                for (i0 = ipos[0]; i0 < L_CODE; i0 += STEP)
+                {
+                    if (dn2[i0] >= 0)
+                    {
+                        ps0 = dn[i0];
+
+                        alp0 = (Word32) rr[i0][i0] << 14;
+
+                        /*----------------------------------------------------------------*
+                         * i1 loop: 8 positions.                                          *
+                         *----------------------------------------------------------------*/
+
+                        sq = -1;
+                        alp = 1;
+                        ps = 0;
+                        ix = ipos[1];
+
+                        /* initialize 4 index for next loop. */
+                        /*-------------------------------------------------------------------*
+                         *  These index have low complexity address computation because      *
+                         *  they are, in fact, pointers with fixed increment.  For example,  *
+                         *  "rr[i0][i3]" is a pointer initialized to "&rr[i0][ipos[3]]"      *
+                         *  and incremented by "STEP".                                       *
+                         *-------------------------------------------------------------------*/
+
+                        for (i1 = ipos[1]; i1 < L_CODE; i1 += STEP)
+                        {
+                            /* idx increment = STEP */
+                            /* ps1 = add(ps0, dn[i1], pOverflow); */
+                            ps1 = ps0 + dn[i1];
+
+                            /* alp1 = alp0 + rr[i0][i1] + 1/2*rr[i1][i1]; */
+
+                            /* alp1 = L_mac(alp0, rr[i1][i1], _1_4, pOverflow); */
+                            alp1 = alp0 + ((Word32) rr[i1][i1] << 14);
+
+                            /* alp1 = L_mac(alp1, rr[i0][i1], _1_2, pOverflow); */
+                            alp1 += (Word32) rr[i0][i1] << 15;
+
+                            /* sq1 = mult(ps1, ps1, pOverflow); */
+                            sq1 = (Word16)(((Word32) ps1 * ps1) >> 15);
+
+                            /* alp_16 = pv_round(alp1, pOverflow); */
+                            alp_16 = (Word16)((alp1 + (Word32) 0x00008000L) >> 16);
+
+                            /* s = L_mult(alp, sq1, pOverflow); */
+                            s = ((Word32) alp * sq1) << 1;
+
+                            /* s = L_msu(s, sq, alp_16, pOverflow); */
+                            s -= (((Word32) sq * alp_16) << 1);
+
+                            if (s > 0)
+                            {
+                                sq = sq1;
+                                ps = ps1;
+                                alp = alp_16;
+                                ix = i1;
+                            }
+                        }
+                        i1 = ix;
+
+                        /*----------------------------------------------------------------*
+                         * i2 loop: 8 positions.                                          *
+                         *----------------------------------------------------------------*/
+
+                        ps0 = ps;
+
+                        /* alp0 = L_mult(alp, _1_4, pOverflow); */
+                        alp0 = (Word32) alp << 14;
+
+                        sq = -1;
+                        alp = 1;
+                        ps = 0;
+                        ix = ipos[2];
+
+                        /* initialize 4 index for next loop (see i1 loop) */
+
+                        for (i2 = ipos[2]; i2 < L_CODE; i2 += STEP)
+                        {
+                            /* index increment = STEP */
+                            /* ps1 = add(ps0, dn[i2], pOverflow); */
+                            ps1 = ps0 + dn[i2];
+
+                            /* alp1 = alp0 + rr[i0][i2] + rr[i1][i2] + 1/2*rr[i2][i2]; */
+
+                            /* idx incr = STEP */
+                            /* alp1 = L_mac(alp0, rr[i2][i2], _1_16, pOverflow); */
+                            alp1 = alp0 + ((Word32) rr[i2][i2] << 12);
+
+                            /* idx incr = STEP */
+                            /* alp1 = L_mac(alp1, rr[i1][i2], _1_8, pOverflow); */
+                            alp1 += (Word32) rr[i1][i2] << 13;
+
+                            /* idx incr = STEP */
+                            /* alp1 = L_mac(alp1,rr[i0][i2], _1_8, pOverflow); */
+                            alp1 += (Word32) rr[i0][i2] << 13;
+
+                            /* sq1 = mult(ps1, ps1, pOverflow); */
+                            sq1 = (Word16)(((Word32) ps1 * ps1) >> 15);
+
+                            /* alp_16 = pv_round(alp1, pOverflow); */
+                            alp_16 = (Word16)((alp1 + (Word32) 0x00008000L) >> 16);
+
+                            /* s = L_mult(alp, sq1, pOverflow); */
+                            s = ((Word32) alp * sq1) << 1;
+
+                            /* s = L_msu(s, sq, alp_16, pOverflow); */
+                            s -= (((Word32) sq * alp_16) << 1);
+
+                            if (s > 0)
+                            {
+                                sq = sq1;
+                                ps = ps1;
+                                alp = alp_16;
+                                ix = i2;
+                            }
+                        }
+                        i2 = ix;
+
+                        /*----------------------------------------------------------------*
+                         * i3 loop: 8 positions.                                          *
+                         *----------------------------------------------------------------*/
+
+                        ps0 = ps;
+                        alp0 = ((Word32)alp << 16);
+
+                        sq = -1;
+                        alp = 1;
+                        ps = 0;
+                        ix = ipos[3];
+
+                        /* initialize 5 index for next loop (see i1 loop) */
+
+                        for (i3 = ipos[3]; i3 < L_CODE; i3 += STEP)
+                        {
+                            /* ps1 = add(ps0, dn[i3], pOverflow); */
+                            ps1 = ps0 + dn[i3]; /* index increment = STEP */
+
+                            /* alp1 = alp0 + rr[i0][i3] + rr[i1][i3] + rr[i2][i3] + 1/2*rr[i3][i3]; */
+
+                            /* alp1 = L_mac(alp0, rr[i3][i3], _1_16, pOverflow); */
+                            alp1 = alp0 + ((Word32) rr[i3][i3] << 12); /* idx incr = STEP */
+
+                            /* alp1 = L_mac(alp1, rr[i2][i3], _1_8, pOverflow); */
+                            alp1 += (Word32) rr[i2][i3] << 13;  /* idx incr = STEP */
+
+                            /* alp1 = L_mac(alp1, rr[i1][i3], _1_8, pOverflow); */
+                            alp1 += (Word32) rr[i1][i3] << 13;  /* idx incr = STEP */
+
+                            /* alp1 = L_mac(alp1, rr[i0][i3], _1_8, pOverflow); */
+                            alp1 += (Word32) rr[i0][i3] << 13;  /* idx incr = STEP */
+
+                            /* sq1 = mult(ps1, ps1, pOverflow); */
+                            sq1 = (Word16)(((Word32) ps1 * ps1) >> 15);
+
+                            /* alp_16 = pv_round(alp1, pOverflow); */
+                            alp_16 = (Word16)((alp1 + (Word32) 0x00008000L) >> 16);
+
+                            /* s = L_mult(alp, sq1, pOverflow); */
+                            s = ((Word32) alp * sq1) << 1;
+
+                            /* s = L_msu(s, sq, alp_16, pOverflow); */
+                            s -= (((Word32) sq * alp_16) << 1);
+
+                            if (s > 0)
+                            {
+                                sq = sq1;
+                                ps = ps1;
+                                alp = alp_16;
+                                ix = i3;
+                            }
+                        }
+
+
+                        /*----------------------------------------------------------------*
+                         * memorise codevector if this one is better than the last one.   *
+                         *----------------------------------------------------------------*/
+
+                        /* s = L_mult(alpk, sq, pOverflow); */
+                        s = ((Word32) alpk * sq) << 1;
+
+                        /* s = L_msu(s, psk, alp, pOverflow); */
+                        s -= (((Word32) psk * alp) << 1);
+
+                        if (s > 0)
+                        {
+                            psk = sq;
+                            alpk = alp;
+                            p_codvec = &codvec[0];
+
+                            *(p_codvec++) = i0;
+                            *(p_codvec++) = i1;
+                            *(p_codvec++) = i2;
+                            *(p_codvec) = ix;
+                        }
+                    }
+                }
+
+                /*----------------------------------------------------------------*
+                 * Cyclic permutation of i0,i1,i2 and i3.                         *
+                 *----------------------------------------------------------------*/
+
+                pos = ipos[3];
+                ipos[3] = ipos[2];
+                ipos[2] = ipos[1];
+                ipos[1] = ipos[0];
+                ipos[0] = pos;
+            }
+        }
+
+        return;
+    }
+
+
+
+
+    /****************************************************************************/
+
+    /*
+    ------------------------------------------------------------------------------
+     FUNCTION NAME:  build_code()
+    ------------------------------------------------------------------------------
+     INPUT AND OUTPUT DEFINITIONS
+
+     Inputs:
+        codvec[]   Array of type Word16 -- position of pulses
+        dn_sign[]  Array of type Word16 -- sign of pulses
+        h[]        Array of type Word16 -- impulse response of
+                                           weighted synthesis filter
+
+     Outputs:
+        cod[]  Array of type Word16 -- innovative code vector
+        y[]    Array of type Word16 -- filtered innovative code
+        sign[] Array of type Word16 -- index of 4 pulses (sign + position)
+        pOverflow  Pointer to Flag  -- set when overflow occurs
+
+     Returns:
+        indx
+
+     Global Variables Used:
+        None
+
+     Local Variables Needed:
+
+    ------------------------------------------------------------------------------
+     FUNCTION DESCRIPTION
+
+     PURPOSE: Builds the codeword, the filtered codeword and index of the
+              codevector, based on the signs and positions of 4 pulses.
+
+    ------------------------------------------------------------------------------
+     REQUIREMENTS
+
+     None
+
+    ------------------------------------------------------------------------------
+     REFERENCES
+
+     [1] c4_17pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+    ------------------------------------------------------------------------------
+     PSEUDO-CODE
+
+    ------------------------------------------------------------------------------
+     CAUTION [optional]
+     [State any special notes, constraints or cautions for users of this function]
+
+    ------------------------------------------------------------------------------
+    */
+
+    static Word16
+    build_code(
+        Word16 codvec[],  /* i : position of pulses                            */
+        Word16 dn_sign[], /* i : sign of pulses                                */
+        Word16 cod[],     /* o : innovative code vector                        */
+        Word16 h[],       /* i : impulse response of weighted synthesis filter */
+        Word16 y[],       /* o : filtered innovative code                      */
+        Word16 sign[],    /* o : index of 4 pulses (sign+position)             */
+        const Word16* gray_ptr, /* i : ptr to read-only table                  */
+        Flag   * pOverflow  /* o : Flag set when overflow occurs               */
+    )
+    {
+        Word16 i;
+        Word16 j;
+        Word16 k;
+        Word16 track;
+        Word16 index;
+        Word16 _sign[NB_PULSE];
+        Word16 indx;
+        Word16 rsign;
+
+        Word16 *p0;
+        Word16 *p1;
+        Word16 *p2;
+        Word16 *p3;
+        Word16 *p_cod = &cod[0];
+
+        Word32 s;
+
+        for (i = 0; i < L_CODE; i++)
+        {
+            *(p_cod++) = 0;
+        }
+
+        indx = 0;
+        rsign = 0;
+
+        for (k = 0; k < NB_PULSE; k++)
+        {
+            i = codvec[k]; /* read pulse position */
+            j = dn_sign[i]; /* read sign          */
+
+            /* index = pos/5 */
+            /* index = mult(i, 6554, pOverflow); */
+            index = (Word16)(((Word32) i * 6554) >> 15);
+
+            /* track = pos%5 */
+            /* s = L_mult(index, 5, pOverflow); */
+            s = ((Word32) index * 5) << 1;
+
+            /* s = L_shr(s, 1, pOverflow); */
+            s >>= 1;
+
+            /* track = sub(i, (Word16) s, pOverflow); */
+            track = i - (Word16) s;
+
+            index = gray_ptr[index];
+
+            if (track == 1)
+            {
+                /* index = shl(index, 3, pOverflow); */
+                index <<= 3;
+            }
+            else if (track == 2)
+            {
+                /* index = shl(index, 6, pOverflow); */
+                index <<= 6;
+            }
+            else if (track == 3)
+            {
+                /* index = shl(index, 10, pOverflow); */
+                index <<= 10;
+            }
+            else if (track == 4)
+            {
+                track = 3;
+
+                /* index = shl(index, 10, pOverflow); */
+                index <<= 10;
+
+                /* index = add(index, 512, pOverflow); */
+                index += 512;
+            }
+
+            if (j > 0)
+            {
+                cod[i] = 8191;
+                _sign[k] = 32767;
+
+                /* track = shl(1, track, pOverflow); */
+                track = 1 << track;
+
+                /* rsign = add(rsign, track, pOverflow); */
+                rsign += track;
+            }
+            else
+            {
+                cod[i] = -8192;
+                _sign[k] = (Word16) - 32768L;
+            }
+
+            /* indx = add(indx, index, pOverflow); */
+            indx += index;
+        }
+        *sign = rsign;
+
+        p0 = h - codvec[0];
+        p1 = h - codvec[1];
+        p2 = h - codvec[2];
+        p3 = h - codvec[3];
+
+        for (i = 0; i < L_CODE; i++)
+        {
+            s = 0;
+            s =
+                L_mac(
+                    s,
+                    *p0++,
+                    _sign[0],
+                    pOverflow);
+
+            s =
+                L_mac(
+                    s,
+                    *p1++,
+                    _sign[1],
+                    pOverflow);
+
+            s =
+                L_mac(
+                    s,
+                    *p2++,
+                    _sign[2],
+                    pOverflow);
+
+            s =
+                L_mac(
+                    s,
+                    *p3++,
+                    _sign[3],
+                    pOverflow);
+
+            y[i] =
+                pv_round(
+                    s,
+                    pOverflow);
+
+        } /* for (i = 0; i < L_CODE; i++) */
+
+        return indx;
+
+    } /* build_code */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.h
new file mode 100644 (file)
index 0000000..5237595
--- /dev/null
@@ -0,0 +1,115 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c4_17pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the c4_17pf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef c4_17pf_h
+#define c4_17pf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 code_4i40_17bits(
+        Word16 x[], /* (i)   : target vector                                 */
+        Word16 h[], /* (i)   : impulse response of weighted synthesis filter */
+        /*         h[-L_subfr..-1] must be set to zero.          */
+        Word16 T0,  /* (i)   : Pitch lag                                     */
+        Word16 pitch_sharp, /* (i)   : Last quantized pitch gain             */
+        Word16 code[],      /* (o)   : Innovative codebook                   */
+        Word16 y[],         /* (o)   : filtered fixed codebook excitation    */
+        Word16 * sign,      /* (o)   : Signs of 4 pulses                     */
+        const Word16* gray_ptr,   /* i : ptr to read-only table                  */
+        Flag   * pOverflow  /* (o)   : Flag set when overflow occurs         */
+    );
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _c4_17PF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.cpp
new file mode 100644 (file)
index 0000000..9245ce4
--- /dev/null
@@ -0,0 +1,745 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c8_31pf.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ Purpose          : Searches a 31 bit algebraic codebook containing
+                  : 8 pulses in a frame of 40 samples.
+                  : in the same manner as GSM-EFR
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "c8_31pf.h"
+#include "typedef.h"
+#include "cnst.h"
+#include "inv_sqrt.h"
+#include "cor_h.h"
+#include "cor_h_x2.h"
+#include "set_sign.h"
+#include "s10_8pf.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NB_PULSE 8
+
+/* define values/representation for output codevector and sign */
+#define POS_CODE  8191
+#define NEG_CODE  8191
+#define POS_SIGN  32767
+#define NEG_SIGN  (Word16) (-32768L)
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    codvec[]   Array of type Word16 -- position of pulses
+    sign[]     Array of type Word16 -- sign of pulses
+    h[]        Array of type Word16 -- impulse response of
+                                       weighted synthesis filter
+ Outputs:
+    cod[]       Array of type Word16 -- innovative code vector
+    y[]         Array of type Word16 -- filtered innovative code
+    sign_indx[] Array of type Word16 -- signs of 4 pulses (signs only)
+    pos_indx[]  Array of type Word16 --
+                             position index of 8 pulses(position only)
+
+    pOverflow  Pointer to Flag  -- set when overflow occurs
+
+ Returns:
+    indx
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] c8_31pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*************************************************************************
+ *
+ *  FUNCTION:  build_code()
+ *
+ *  PURPOSE: Builds the codeword, the filtered codeword and a
+ *   linear uncombined version of  the index of the
+ *           codevector, based on the signs and positions of 8  pulses.
+ *
+ *************************************************************************/
+
+static void build_code(
+    Word16 codvec[],    /* i : position of pulses                           */
+    Word16 sign[],      /* i : sign of d[n]                                 */
+    Word16 cod[],       /* o : innovative code vector                       */
+    Word16 h[],         /* i : impulse response of weighted synthesis filter*/
+    Word16 y[],         /* o : filtered innovative code                     */
+    Word16 sign_indx[], /* o : signs of 4  pulses (signs only)              */
+    Word16 pos_indx[],  /* o : position index of 8 pulses(position only)    */
+    Flag   * pOverflow  /* o : Flag set when overflow occurs                */
+)
+{
+    Word16 i;
+    Word16 j;
+    Word16 k;
+    Word16 track;
+    Word16 sign_index;
+    Word16 pos_index;
+    Word16 _sign[NB_PULSE];
+
+    Word16 *p0;
+    Word16 *p1;
+    Word16 *p2;
+    Word16 *p3;
+    Word16 *p4;
+    Word16 *p5;
+    Word16 *p6;
+    Word16 *p7;
+
+    Word16 *p_cod = &cod[0];
+    Word16 *p_codvec = &codvec[0];
+
+    Word32 s;
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        *(p_cod++) = 0;
+    }
+
+    for (i = 0; i < NB_TRACK_MR102; i++)
+    {
+        pos_indx[i] = -1;
+        sign_indx[i] = -1;
+    }
+
+    for (k = 0; k < NB_PULSE; k++)
+    {
+        /* read pulse position */
+        i = codvec[k];
+        /* read sign           */
+        j = sign[i];
+
+        pos_index = i >> 2; /* index = pos/4 */
+
+        track = i & 3;     /* track = pos%4 */
+
+        if (j > 0)
+        {
+            cod[i] = (Word16)((Word32) cod[i] + POS_CODE);
+
+            _sign[k] = POS_SIGN;
+            sign_index = 0;  /* bit=0 -> positive pulse */
+        }
+        else
+        {
+            cod[i] = (Word16)((Word32) cod[i] - NEG_CODE);
+
+            _sign[k] = NEG_SIGN;
+            sign_index = 1; /* bit=1 => negative pulse */
+            /* index = add (index, 8); 1 = negative  old code */
+        }
+
+        if (pos_indx[track] < 0)
+        {   /* first set first NB_TRACK pulses  */
+            pos_indx[track] = pos_index;
+            sign_indx[track] = sign_index;
+        }
+        else
+        {   /* 2nd row of pulses , test if positions needs to be switched */
+            if (((sign_index ^ sign_indx[track]) & 1) == 0)
+            {
+                /* sign of 1st pulse == sign of 2nd pulse */
+
+                if (pos_indx[track] <= pos_index)
+                {   /* no swap */
+                    pos_indx[track + NB_TRACK_MR102] = pos_index;
+                }
+                else
+                {   /* swap*/
+                    pos_indx[track + NB_TRACK_MR102] = pos_indx[track];
+
+                    pos_indx[track] = pos_index;
+                    sign_indx[track] = sign_index;
+                }
+            }
+            else
+            {
+                /* sign of 1st pulse != sign of 2nd pulse */
+
+                if (pos_indx[track] <= pos_index)
+                {  /*swap*/
+                    pos_indx[track + NB_TRACK_MR102] = pos_indx[track];
+
+                    pos_indx[track] = pos_index;
+                    sign_indx[track] = sign_index;
+                }
+                else
+                {   /*no swap */
+                    pos_indx[track + NB_TRACK_MR102] = pos_index;
+                }
+            }
+        }
+    }
+
+    p0 = h - *(p_codvec++);
+    p1 = h - *(p_codvec++);
+    p2 = h - *(p_codvec++);
+    p3 = h - *(p_codvec++);
+    p4 = h - *(p_codvec++);
+    p5 = h - *(p_codvec++);
+    p6 = h - *(p_codvec++);
+    p7 = h - *(p_codvec);
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        s = 0;
+
+        s =
+            L_mac(
+                s,
+                *p0++,
+                _sign[0],
+                pOverflow);
+        s =
+            L_mac(
+                s,
+                *p1++,
+                _sign[1],
+                pOverflow);
+        s =
+            L_mac(
+                s,
+                *p2++,
+                _sign[2],
+                pOverflow);
+        s =
+            L_mac(
+                s,
+                *p3++,
+                _sign[3],
+                pOverflow);
+        s =
+            L_mac(
+                s,
+                *p4++,
+                _sign[4],
+                pOverflow);
+        s =
+            L_mac(
+                s,
+                *p5++,
+                _sign[5],
+                pOverflow);
+        s =
+            L_mac(
+                s,
+                *p6++,
+                _sign[6],
+                pOverflow);
+        s =
+            L_mac(
+                s,
+                *p7++,
+                _sign[7],
+                pOverflow);
+
+        y[i] =
+            pv_round(
+                s,
+                pOverflow);
+
+    } /* for (i = 0; i < L_CODE; i++) */
+
+} /* build_code */
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: compress_code()
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+
+ Outputs:
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ FUNCTION:
+
+ PURPOSE: compression of three indeces [0..9] to one 10 bit index
+          minimizing the phase shift of a bit error.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] c8_31pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 compress10(
+    Word16 pos_indxA,  /* i : signs of 4 pulses (signs only)             */
+    Word16 pos_indxB,  /* i : position index of 8 pulses (pos only)      */
+    Word16 pos_indxC,  /* i : position and sign of 8 pulses (compressed) */
+    Flag  *pOverflow)  /* o : Flag set when overflow occurs              */
+{
+    Word16 indx;
+    Word16 ia;
+    Word16 ib;
+    Word16 ic;
+
+    Word32 tempWord32;
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    ia = pos_indxA >> 1;
+
+    ib = pos_indxB >> 1;
+
+    tempWord32 = ((Word32) ib * 5) << 1;
+
+    tempWord32 = tempWord32 >> 1;
+
+    ib = (Word16) tempWord32;
+
+    ic = pos_indxC >> 1;
+
+    tempWord32 = ((Word32) ic * 25) << 1;
+
+    tempWord32 = tempWord32 >> 1;
+
+    ic = (Word16) tempWord32;
+
+    ib += ic;
+
+    ib += ia;
+
+    indx = ib << 3;
+
+    ia = pos_indxA & 1;
+
+    ib = ((Word16)(pos_indxB & 1)) << 1;
+
+    ic = ((Word16)(pos_indxC & 1)) << 2;
+
+    ib += ic;
+
+    ib += ia;
+
+    indx += ib;
+
+    return indx;
+
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: compress_code()
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    sign_indx   Array of type Word16 -- signs of 4 pulses (signs only)
+    pos_indx    Array of type Word16 -- position index of 8 pulses
+                                            (position only)
+
+ Outputs:
+    indx         Array of type Word16 -- position and sign of 8 pulses
+                                            (compressed)
+    pOverflow    Pointer to Flag      -- set when overflow occurs
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE: compression of the linear codewords to 4+three indeces
+          one bit from each pulse is made robust to errors by
+          minimizing the phase shift of a bit error.
+          4 signs (one for each track)
+          i0,i4,i1 => one index (7+3) bits, 3   LSBs more robust
+          i2,i6,i5 => one index (7+3) bits, 3   LSBs more robust
+          i3,i7    => one index (5+2) bits, 2-3 LSbs more robust
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] c3_14pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void compress_code(
+    Word16 sign_indx[], /* i : signs of 4 pulses (signs only)             */
+    Word16 pos_indx[],  /* i : position index of 8 pulses (position only) */
+    Word16 indx[],      /* o : position and sign of 8 pulses (compressed) */
+    Flag  *pOverflow)   /* o : Flag set when overflow occurs              */
+{
+    Word16 i;
+    Word16 ia;
+    Word16 ib;
+    Word16 ic;
+
+    Word16 *p_indx = &indx[0];
+    Word16 *p_sign_indx = &sign_indx[0];
+
+    Word32 tempWord32;
+
+    for (i = 0; i < NB_TRACK_MR102; i++)
+    {
+        *(p_indx++) = *(p_sign_indx++);
+    }
+
+    /* First index
+      indx[NB_TRACK] = (ia/2+(ib/2)*5 +(ic/2)*25)*8 + ia%2 + (ib%2)*2 + (ic%2)*4; */
+
+    indx[NB_TRACK_MR102] =
+        compress10(
+            pos_indx[0],
+            pos_indx[4],
+            pos_indx[1],
+            pOverflow);
+
+    /* Second index
+      indx[NB_TRACK+1] = (ia/2+(ib/2)*5 +(ic/2)*25)*8 + ia%2 + (ib%2)*2 + (ic%2)*4; */
+
+    indx[NB_TRACK_MR102+1] =
+        compress10(
+            pos_indx[2],
+            pos_indx[6],
+            pos_indx[5],
+            pOverflow);
+
+    /*
+      Third index
+      if ((ib/2)%2 == 1)
+        indx[NB_TRACK+2] = ((((4-ia/2) + (ib/2)*5)*32+12)/25)*4 + ia%2 + (ib%2)*2;
+      else
+        indx[NB_TRACK+2] = ((((ia/2) +   (ib/2)*5)*32+12)/25)*4 + ia%2 + (ib%2)*2;
+        */
+
+    ib = pos_indx[7] >> 1;
+
+    ib &= 1;
+
+    ia = pos_indx[3] >> 1;
+
+    if (ib == 1)
+    {
+        ia = 4 - ia;
+    }
+
+    ib = pos_indx[7] >> 1;
+
+    tempWord32 = ((Word32) ib * 5) << 1;
+
+    tempWord32 = tempWord32 >> 1;
+
+    ib = (Word16) tempWord32;
+
+    ib += ia;
+
+    ib <<= 5;
+
+    ib += 12;
+
+    ic = (Word16)(((Word32) ib * 1311) >> 15);
+
+    ic <<= 2;
+
+    ia = pos_indx[3] & 1;
+
+    ib = ((Word16)(pos_indx[7] & 1)) << 1;
+
+    ib += ic;
+
+    ib += ia;
+
+    indx[NB_TRACK_MR102+2] = ib;
+
+} /* compress_code */
+
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: code_8i40_31bits()
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    x   Array of type Word16 -- target vector
+    cn  Array of type Word16 -- residual after long term prediction
+    h   Array of type Word16 -- impulse response of weighted synthesis filter
+
+
+ Outputs:
+    cod Array of type Word16 -- algebraic (fixed) codebook excitation
+    y   Array of type Word16 -- filtered fixed codebook excitation
+    indx Array of type Word16 -- index of 8 pulses (signs+positions)
+    pOverflow    Pointer to Flag      -- set when overflow occurs
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ FUNCTION:
+
+ PURPOSE:  Searches a 31 bit algebraic codebook containing 8 pulses
+           in a frame of 40 samples.
+
+ DESCRIPTION:
+   The code contains 8 nonzero pulses: i0...i7.
+   All pulses can have two possible amplitudes: +1 or -1.
+   The 40 positions in a subframe are divided into 4 tracks of
+   interleaved positions. Each track contains two pulses.
+   The pulses can have the following possible positions:
+
+      i0, i4 :  0, 4, 8,  12, 16, 20, 24, 28, 32, 36
+      i1, i5 :  1, 5, 9,  13, 17, 21, 25, 29, 33, 37
+      i2, i6 :  2, 6, 10, 14, 18, 22, 26, 30, 34, 38
+      i3, i7 :  3, 7, 11, 15, 19, 23, 27, 31, 35, 39
+
+   Each pair of pulses require 1 bit for their signs. The positions
+   are encoded together 3,3 and 2 resulting in
+   (7+3) + (7+3) + (5+2) bits for their
+   positions. This results in a 31 (4 sign and 27 pos) bit codebook.
+   The function determines the optimal pulse signs and positions, builds
+   the codevector, and computes the filtered codevector.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] c8_31pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void code_8i40_31bits(
+    Word16 x[],        /* i : target vector                                  */
+    Word16 cn[],       /* i : residual after long term prediction            */
+    Word16 h[],        /* i : impulse response of weighted synthesis
+                             filter                                         */
+    Word16 cod[],      /* o : algebraic (fixed) codebook excitation          */
+    Word16 y[],        /* o : filtered fixed codebook excitation             */
+    Word16 indx[],     /* o : 7 Word16, index of 8 pulses (signs+positions)  */
+    Flag  *pOverflow   /* o : Flag set when overflow occurs                  */
+)
+{
+    Word16 ipos[NB_PULSE];
+    Word16 pos_max[NB_TRACK_MR102];
+    Word16 codvec[NB_PULSE];
+
+    Word16 dn[L_CODE];
+    Word16 sign[L_CODE];
+
+    Word16 rr[L_CODE][L_CODE];
+    Word16 linear_signs[NB_TRACK_MR102];
+    Word16 linear_codewords[NB_PULSE];
+
+    cor_h_x2(
+        h,
+        x,
+        dn,
+        2,
+        NB_TRACK_MR102,
+        STEP_MR102,
+        pOverflow);
+
+    /* 2 = use GSMEFR scaling */
+
+    set_sign12k2(
+        dn,
+        cn,
+        sign,
+        pos_max,
+        NB_TRACK_MR102,
+        ipos,
+        STEP_MR102,
+        pOverflow);
+
+    /* same setsign alg as GSM-EFR new constants though*/
+
+    cor_h(
+        h,
+        sign,
+        rr,
+        pOverflow);
+
+    search_10and8i40(
+        NB_PULSE,
+        STEP_MR102,
+        NB_TRACK_MR102,
+        dn,
+        rr,
+        ipos,
+        pos_max,
+        codvec,
+        pOverflow);
+
+    build_code(
+        codvec,
+        sign,
+        cod,
+        h,
+        y,
+        linear_signs,
+        linear_codewords,
+        pOverflow);
+
+    compress_code(
+        linear_signs,
+        linear_codewords,
+        indx,
+        pOverflow);
+
+} /* code_8i40_31bits */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.h
new file mode 100644 (file)
index 0000000..2dbf63e
--- /dev/null
@@ -0,0 +1,113 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: c8_31pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the c8_31pf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef c8_31pf_h
+#define c8_31pf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void code_8i40_31bits(
+        Word16 x[],        /* i : target vector                                  */
+        Word16 cn[],       /* i : residual after long term prediction            */
+        Word16 h[],        /* i : impulse response of weighted synthesis
+                              filter                                         */
+        Word16 cod[],      /* o : algebraic (fixed) codebook excitation          */
+        Word16 y[],        /* o : filtered fixed codebook excitation             */
+        Word16 indx[],     /* o : 7 Word16, index of 8 pulses (signs+positions)  */
+        Flag   * pOverflow /* o : Flag set when overflow occurs                  */
+    );
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _c8_31PF_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.cpp
new file mode 100644 (file)
index 0000000..b6a4132
--- /dev/null
@@ -0,0 +1,220 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: calc_cor.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "calc_cor.h"
+#include "basic_op.h"
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: comp_corr
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    scal_sig = array of input samples. (Word16)
+    L_frame = length of frame used to compute pitch(Word16)
+    lag_max = maximum lag (Word16)
+    lag_min = minimum lag (Word16)
+    corr = pointer to array of correlations corresponding to the selected
+        lags. (Word32)
+
+ Outputs:
+    corr = pointer to array of correlations corresponding to the selected
+        lags. (Word32)
+
+ Returns:
+    none
+
+ Global Variables Used:
+    none
+
+ Local Variables Needed:
+    none
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates all correlations of scal_sig[] in a given delay
+ range.
+
+ The correlation is given by
+
+         cor[t] = <scal_sig[n],scal_sig[n-t]>,  t=lag_min,...,lag_max
+
+ The function outputs all of the correlations
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ none
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] calc_cor.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void comp_corr (
+    Word16 scal_sig[],  // i   : scaled signal.
+    Word16 L_frame,     // i   : length of frame to compute pitch
+    Word16 lag_max,     // i   : maximum lag
+    Word16 lag_min,     // i   : minimum lag
+    Word32 corr[])      // o   : correlation of selected lag
+{
+    Word16 i, j;
+    Word16 *p, *p1;
+    Word32 t0;
+
+    for (i = lag_max; i >= lag_min; i--)
+    {
+       p = scal_sig;
+       p1 = &scal_sig[-i];
+       t0 = 0;
+
+       for (j = 0; j < L_frame; j++, p++, p1++)
+       {
+          t0 = L_mac (t0, *p, *p1);
+       }
+       corr[-i] = t0;
+    }
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void comp_corr(
+    Word16 scal_sig[],  /* i   : scaled signal.                     */
+    Word16 L_frame,     /* i   : length of frame to compute pitch   */
+    Word16 lag_max,     /* i   : maximum lag                        */
+    Word16 lag_min,     /* i   : minimum lag                        */
+    Word32 corr[])      /* o   : correlation of selected lag        */
+{
+
+
+
+
+    /*---------------------------------------------------
+    ; lag_max and lag_min are typically negative numbers
+    -----------------------------------------------------*/
+
+
+    /* PIT_MIN_MR122 18        Minimum pitch lag (MR122 mode)           */
+    /* PIT_MIN       20        Minimum pitch lag (all other modes)      */
+    /* PIT_MAX       143       Maximum pitch lag                        */
+
+
+    Word16 i;
+    Word16 j;
+    Word16 *p;
+    Word16 *p1;
+    Word16 *p2;
+    Word16 *p_scal_sig;
+    Word32 t1;
+    Word32 t2;
+    Word32 t3;
+    Word32 t4;
+
+    corr = corr - lag_max ;
+    p_scal_sig = &scal_sig[-lag_max];
+
+    for (i = ((lag_max - lag_min) >> 2) + 1; i > 0; i--)
+    {
+        t1 = 0;
+        t2 = 0;
+        t3 = 0;
+        t4 = 0;
+        p  = &scal_sig[0];
+        p1 = p_scal_sig++;
+        p_scal_sig++;
+        p2 = p_scal_sig++;
+        p_scal_sig++;
+        for (j = (L_frame >> 1); j != 0; j--)
+        {
+            t1 = amrnb_fxp_mac_16_by_16bb((Word32) * (p), (Word32) * (p1++), t1);
+            t2 = amrnb_fxp_mac_16_by_16bb((Word32) * (p), (Word32) * (p1), t2);
+            t3 = amrnb_fxp_mac_16_by_16bb((Word32) * (p), (Word32) * (p2++), t3);
+            t4 = amrnb_fxp_mac_16_by_16bb((Word32) * (p++), (Word32) * (p2), t4);
+
+            t1 = amrnb_fxp_mac_16_by_16bb((Word32) * (p), (Word32) * (p1++), t1);
+            t2 = amrnb_fxp_mac_16_by_16bb((Word32) * (p), (Word32) * (p1), t2);
+            t3 = amrnb_fxp_mac_16_by_16bb((Word32) * (p), (Word32) * (p2++), t3);
+            t4 = amrnb_fxp_mac_16_by_16bb((Word32) * (p++), (Word32) * (p2), t4);
+        }
+
+        *(corr++) = t1 << 1;
+        *(corr++) = t2 << 1;
+        *(corr++) = t3 << 1;
+        *(corr++) = t4 << 1;
+
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.h
new file mode 100644 (file)
index 0000000..d4a694b
--- /dev/null
@@ -0,0 +1,87 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : calc_cor.h
+*      Purpose          : Calculate all correlations for prior the OL LTP
+*
+********************************************************************************
+*/
+#ifndef calc_cor_h
+#define calc_cor_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         DECLARATION OF PROTOTYPES
+    ********************************************************************************
+    */
+    /*************************************************************************
+     *
+     *  FUNCTION: comp_corr
+     *
+     *  PURPOSE: Calculate all correlations of scal_sig[] in a given delay
+     *           range.
+     *
+     *  DESCRIPTION:
+     *      The correlation is given by
+     *           cor[t] = <scal_sig[n], scal_sig[n-t]>,  t=lag_min,...,lag_max
+     *      The functions outputs all correlations in the given range
+     *
+     *************************************************************************/
+    void comp_corr(Word16 scal_sig[],   /* i   : scaled signal.                     */
+    Word16 L_frame,     /* i   : length of frame to compute pitch   */
+    Word16 lag_max,     /* i   : maximum lag                        */
+    Word16 lag_min,     /* i   : minimum lag                        */
+    Word32 corr[]       /* o   : correlation of selected lag        */
+                  );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.cpp
new file mode 100644 (file)
index 0000000..539df11
--- /dev/null
@@ -0,0 +1,777 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: calc_en.cpp
+ Funtions: calc_unfilt_energies
+           calc_filt_energies
+           calc_target_energy
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the functions that calculate the energy coefficients
+ for unfiltered and filtered excitation signals, the LTP coding gain, and
+ the target energy.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "calc_en.h"
+#include "typedef.h"
+#include "basicop_malloc.h"
+#include "l_comp.h"
+#include "cnst.h"
+#include "log2.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: calc_unfilt_energies
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    res      = LP residual, buffer type Word16
+    exc      = LTP excitation (unfiltered), buffer type Word16
+    code     = CB innovation (unfiltered), buffer type Word16
+    gain_pit = pitch gain,  type Word16
+    L_subfr  = Subframe length, type Word16
+    frac_en  = energy coefficients (4), fraction part, buffer type Word16
+    exp_en   = energy coefficients (4), exponent part, buffer type Word16
+    ltpg     = LTP coding gain (log2()), pointer to type Word16
+    pOverflow= pointer to value indicating existence of overflow (Flag)
+
+ Outputs:
+    frac_en buffer containing new fractional parts of energy coefficients
+    exp_en buffer containing new exponential parts of energy coefficients
+    ltpg points to new LTP coding gain
+    pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates several energy coefficients for unfiltered
+ excitation signals and the LTP coding gain
+
+    frac_en[0]*2^exp_en[0] = <res res>    LP residual energy
+    frac_en[1]*2^exp_en[1] = <exc exc>    LTP residual energy
+    frac_en[2]*2^exp_en[2] = <exc code>   LTP/CB innovation dot product
+    frac_en[3]*2^exp_en[3] = <lres lres>  LTP residual energy
+    (lres = res - gain_pit*exc)
+    ltpg = log2(LP_res_en / LTP_res_en)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+  None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ calc_en.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void
+calc_unfilt_energies(
+    Word16 res[],     // i  : LP residual,                               Q0
+    Word16 exc[],     // i  : LTP excitation (unfiltered),               Q0
+    Word16 code[],    // i  : CB innovation (unfiltered),                Q13
+    Word16 gain_pit,  // i  : pitch gain,                                Q14
+    Word16 L_subfr,   // i  : Subframe length
+
+    Word16 frac_en[], // o  : energy coefficients (4), fraction part,    Q15
+    Word16 exp_en[],  // o  : energy coefficients (4), exponent part,    Q0
+    Word16 *ltpg      // o  : LTP coding gain (log2()),                  Q13
+)
+{
+    Word32 s, L_temp;
+    Word16 i, exp, tmp;
+    Word16 ltp_res_en, pred_gain;
+    Word16 ltpg_exp, ltpg_frac;
+
+    // Compute residual energy
+    s = L_mac((Word32) 0, res[0], res[0]);
+    for (i = 1; i < L_subfr; i++)
+        s = L_mac(s, res[i], res[i]);
+
+    // ResEn := 0 if ResEn < 200.0 (= 400 Q1)
+    if (L_sub (s, 400L) < 0)
+    {
+        frac_en[0] = 0;
+        exp_en[0] = -15;
+    }
+    else
+    {
+        exp = norm_l(s);
+        frac_en[0] = extract_h(L_shl(s, exp));
+        exp_en[0] = sub(15, exp);
+    }
+
+    // Compute ltp excitation energy
+    s = L_mac((Word32) 0, exc[0], exc[0]);
+    for (i = 1; i < L_subfr; i++)
+        s = L_mac(s, exc[i], exc[i]);
+
+    exp = norm_l(s);
+    frac_en[1] = extract_h(L_shl(s, exp));
+    exp_en[1] = sub(15, exp);
+
+    // Compute scalar product <exc[],code[]>
+    s = L_mac((Word32) 0, exc[0], code[0]);
+    for (i = 1; i < L_subfr; i++)
+        s = L_mac(s, exc[i], code[i]);
+
+    exp = norm_l(s);
+    frac_en[2] = extract_h(L_shl(s, exp));
+    exp_en[2] = sub(16-14, exp);
+
+    // Compute energy of LTP residual
+    s = 0L;
+    for (i = 0; i < L_subfr; i++)
+    {
+        L_temp = L_mult(exc[i], gain_pit);
+        L_temp = L_shl(L_temp, 1);
+        tmp = sub(res[i], pv_round(L_temp)); // LTP residual, Q0
+        s = L_mac (s, tmp, tmp);
+    }
+
+    exp = norm_l(s);
+    ltp_res_en = extract_h (L_shl (s, exp));
+    exp = sub (15, exp);
+
+    frac_en[3] = ltp_res_en;
+    exp_en[3] = exp;
+
+    // calculate LTP coding gain, i.e. energy reduction LP res -> LTP res
+    if (ltp_res_en > 0 && frac_en[0] != 0)
+    {
+        // gain = ResEn / LTPResEn
+        pred_gain = div_s (shr (frac_en[0], 1), ltp_res_en);
+        exp = sub (exp, exp_en[0]);
+
+        // L_temp = ltpGain * 2^(30 + exp)
+        L_temp = L_deposit_h (pred_gain);
+        // L_temp = ltpGain * 2^27
+        L_temp = L_shr (L_temp, add (exp, 3));
+
+        // Log2 = log2() + 27
+        Log2(L_temp, &ltpg_exp, &ltpg_frac);
+
+        // ltpg = log2(LtpGain) * 2^13 --> range: +- 4 = +- 12 dB
+        L_temp = L_Comp (sub (ltpg_exp, 27), ltpg_frac);
+        *ltpg = pv_round (L_shl (L_temp, 13)); // Q13
+    }
+    else
+    {
+        *ltpg = 0;
+    }
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void calc_unfilt_energies(
+    Word16 res[],     /* i  : LP residual,                               Q0  */
+    Word16 exc[],     /* i  : LTP excitation (unfiltered),               Q0  */
+    Word16 code[],    /* i  : CB innovation (unfiltered),                Q13 */
+    Word16 gain_pit,  /* i  : pitch gain,                                Q14 */
+    Word16 L_subfr,   /* i  : Subframe length                                */
+
+    Word16 frac_en[], /* o  : energy coefficients (4), fraction part,    Q15 */
+    Word16 exp_en[],  /* o  : energy coefficients (4), exponent part,    Q0  */
+    Word16 *ltpg,     /* o  : LTP coding gain (log2()),                  Q13 */
+    Flag   *pOverflow
+)
+{
+    Word32 s1;      /* Intermediate energy accumulator */
+    Word32 s2;      /* Intermediate energy accumulator */
+    Word32 s3;      /* Intermediate energy accumulator */
+    Word32 s4;      /* Intermediate energy accumulator */
+    Word32 L_temp;      /* temporal 32 bits storage */
+
+    Word16 i;       /* index used in all loops */
+    Word16 exp;     /* nunmber of '0's or '1's before MSB != 0 */
+    Word16 tmp1;        /* temporal storage */
+    Word16 tmp2;        /* temporal storage */
+    Word16 ltp_res_en;
+    Word16 pred_gain;   /* predictor gain */
+    Word16 ltpg_exp;    /* LTP gain (exponent) */
+    Word16 ltpg_frac;   /* LTP gain (mantissa or fractional part) */
+
+    s1 = 0;
+    s2 = 0;
+    s3 = 0;
+    s4 = 0;
+
+    /*----------------------------------------------------------------------------
+    NOTE: Overflow is expected as a result of multiply and accumulated without
+        scale down the inputs. This modification is not made at this point
+        to have bit exact results with the pre-optimization code. (JT 6/20/00)
+
+    ----------------------------------------------------------------------------*/
+
+    for (i = 0; i < L_subfr; i++)
+    {
+        tmp1 = res[i];              /* avoid multiple accesses to memory */
+        tmp2 = exc[i];
+
+        s1 = amrnb_fxp_mac_16_by_16bb((Word32) tmp1, (Word32) tmp1, s1);   /* Compute residual energy */
+        s2 = amrnb_fxp_mac_16_by_16bb((Word32) tmp2, (Word32) tmp2, s2);   /* Compute ltp excitation energy */
+        s3 = amrnb_fxp_mac_16_by_16bb((Word32) tmp2, (Word32) code[i], s3);/* Compute scalar product */
+        /* <exc[],code[]>         */
+
+        L_temp = L_mult(tmp2, gain_pit, pOverflow);
+        L_temp = L_shl(L_temp, 1, pOverflow);
+        tmp2   = sub(tmp1, pv_round(L_temp, pOverflow), pOverflow);
+        /* LTP residual, Q0 */
+        s4     = L_mac(s4, tmp2, tmp2, pOverflow);
+        /* Compute energy of LTP residual */
+    }
+    s1 = s1 << 1;
+    s2 = s2 << 1;
+    s3 = s3 << 1;
+
+    if (s1 & MIN_32)
+    {
+        s1 = MAX_32;
+        *pOverflow = 1;
+    }
+
+    /* ResEn := 0 if ResEn < 200.0 (= 400 Q1) */
+    if (s1 < 400L)
+    {
+        frac_en[0] = 0;
+        exp_en[0] = -15;
+    }
+    else
+    {
+        exp = norm_l(s1);
+        frac_en[0] = (Word16)(L_shl(s1, exp, pOverflow) >> 16);
+        exp_en[0] = (15 - exp);
+    }
+
+    if (s2 & MIN_32)
+    {
+        s2 = MAX_32;
+        *pOverflow = 1;
+    }
+
+    exp = norm_l(s2);
+    frac_en[1] = (Word16)(L_shl(s2, exp, pOverflow) >> 16);
+    exp_en[1] = 15 - exp;
+
+    /*  s3 is not always sum of squares */
+    exp = norm_l(s3);
+    frac_en[2] = (Word16)(L_shl(s3, exp, pOverflow) >> 16);
+    exp_en[2]  = 2 - exp;
+
+    exp = norm_l(s4);
+    ltp_res_en = (Word16)(L_shl(s4, exp, pOverflow) >> 16);
+    exp = 15 - exp;
+
+    frac_en[3] = ltp_res_en;
+    exp_en[3] = exp;
+
+    /* calculate LTP coding gain, i.e. energy reduction LP res -> LTP res */
+
+    if (ltp_res_en > 0 && frac_en[0] != 0)
+    {
+        /* gain = ResEn / LTPResEn */
+        pred_gain = div_s(shr(frac_en[0], 1, pOverflow), ltp_res_en);
+        exp = sub(exp, exp_en[0], pOverflow);
+
+        /* L_temp = ltpGain * 2^(30 + exp) */
+        L_temp = (Word32) pred_gain << 16;
+        /* L_temp = ltpGain * 2^27 */
+        L_temp = L_shr(L_temp, (Word16)(exp + 3), pOverflow);
+
+        /* Log2 = log2() + 27 */
+        Log2(L_temp, &ltpg_exp, &ltpg_frac, pOverflow);
+
+        /* ltpg = log2(LtpGain) * 2^13 --> range: +- 4 = +- 12 dB */
+        L_temp = L_Comp((ltpg_exp - 27), ltpg_frac, pOverflow);
+        *ltpg = pv_round(L_shl(L_temp, 13, pOverflow), pOverflow);   /* Q13 */
+    }
+    else
+    {
+        *ltpg = 0;
+    }
+
+    return;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: calc_filt_energies
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode = coder mode, type Mode
+    xn = LTP target vector, buffer type Word16
+    xn2 = CB target vector,  buffer type Word16
+    y1 = Adaptive codebook,  buffer type Word16
+    Y2 = Filtered innovative vector,  buffer type Word16
+    g_coeff = Correlations <xn y1> <y1 y1>
+    computed in G_pitch()  buffer type Word16
+    frac_coeff = energy coefficients (5), fraction part, buffer type Word16
+    exp_coeff = energy coefficients (5), exponent part, buffer type Word16
+    cod_gain_frac = optimum codebook gain (fraction part), pointer type Word16
+    cod_gain_exp = optimum codebook gain (exponent part), pointer type Word16
+    pOverflow    = pointer to overflow indicator (Flag)
+
+ Outputs:
+    frac_coeff contains new fraction part energy coefficients
+    exp_coeff contains new exponent part energy coefficients
+    cod_gain_frac points to the new optimum codebook gain (fraction part)
+    cod_gain_exp points to the new optimum codebook gain (exponent part)
+    pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates several energy coefficients for filtered
+ excitation signals
+
+ Compute coefficients need for the quantization and the optimum
+ codebook gain gcu (for MR475 only).
+
+    coeff[0] =    y1 y1
+    coeff[1] = -2 xn y1
+    coeff[2] =    y2 y2
+    coeff[3] = -2 xn y2
+    coeff[4] =  2 y1 y2
+
+    gcu = <xn2, y2> / <y2, y2> (0 if <xn2, y2> <= 0)
+
+ Product <y1 y1> and <xn y1> have been computed in G_pitch() and
+ are in vector g_coeff[].
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ calc_en.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void
+calc_filt_energies(
+    enum Mode mode,     // i  : coder mode
+    Word16 xn[],        // i  : LTP target vector,                       Q0
+    Word16 xn2[],       // i  : CB target vector,                        Q0
+    Word16 y1[],        // i  : Adaptive codebook,                       Q0
+    Word16 Y2[],        // i  : Filtered innovative vector,              Q12
+    Word16 g_coeff[],   // i  : Correlations <xn y1> <y1 y1>
+                        //      computed in G_pitch()
+
+    Word16 frac_coeff[],// o  : energy coefficients (5), fraction part,  Q15
+    Word16 exp_coeff[], // o  : energy coefficients (5), exponent part,  Q0
+    Word16 *cod_gain_frac,// o: optimum codebook gain (fraction part),   Q15
+    Word16 *cod_gain_exp  // o: optimum codebook gain (exponent part),   Q0
+)
+{
+    Word32 s, ener_init;
+    Word16 i, exp, frac;
+    Word16 y2[L_SUBFR];
+
+    if (sub(mode, MR795) == 0 || sub(mode, MR475) == 0)
+    {
+        ener_init = 0L;
+    }
+    else
+    {
+        ener_init = 1L;
+    }
+
+    for (i = 0; i < L_SUBFR; i++) {
+        y2[i] = shr(Y2[i], 3);
+    }
+
+    frac_coeff[0] = g_coeff[0];
+    exp_coeff[0] = g_coeff[1];
+    frac_coeff[1] = negate(g_coeff[2]); // coeff[1] = -2 xn y1
+    exp_coeff[1] = add(g_coeff[3], 1);
+
+
+    // Compute scalar product <y2[],y2[]>
+
+    s = L_mac(ener_init, y2[0], y2[0]);
+    for (i = 1; i < L_SUBFR; i++)
+        s = L_mac(s, y2[i], y2[i]);
+
+    exp = norm_l(s);
+    frac_coeff[2] = extract_h(L_shl(s, exp));
+    exp_coeff[2] = sub(15 - 18, exp);
+
+    // Compute scalar product -2*<xn[],y2[]>
+
+    s = L_mac(ener_init, xn[0], y2[0]);
+    for (i = 1; i < L_SUBFR; i++)
+        s = L_mac(s, xn[i], y2[i]);
+
+    exp = norm_l(s);
+    frac_coeff[3] = negate(extract_h(L_shl(s, exp)));
+    exp_coeff[3] = sub(15 - 9 + 1, exp);
+
+
+    // Compute scalar product 2*<y1[],y2[]>
+
+    s = L_mac(ener_init, y1[0], y2[0]);
+    for (i = 1; i < L_SUBFR; i++)
+        s = L_mac(s, y1[i], y2[i]);
+
+    exp = norm_l(s);
+    frac_coeff[4] = extract_h(L_shl(s, exp));
+    exp_coeff[4] = sub(15 - 9 + 1, exp);
+
+    if (sub(mode, MR475) == 0 || sub(mode, MR795) == 0)
+    {
+        // Compute scalar product <xn2[],y2[]>
+
+        s = L_mac(ener_init, xn2[0], y2[0]);
+        for (i = 1; i < L_SUBFR; i++)
+            s = L_mac(s, xn2[i], y2[i]);
+
+        exp = norm_l(s);
+        frac = extract_h(L_shl(s, exp));
+        exp = sub(15 - 9, exp);
+
+
+        if (frac <= 0)
+        {
+            *cod_gain_frac = 0;
+            *cod_gain_exp = 0;
+        }
+        else
+        {
+            //
+              gcu = <xn2, y2> / c[2]
+                  = (frac>>1)/frac[2]             * 2^(exp+1-exp[2])
+                  = div_s(frac>>1, frac[2])*2^-15 * 2^(exp+1-exp[2])
+                  = div_s * 2^(exp-exp[2]-14)
+
+            *cod_gain_frac = div_s (shr (frac,1), frac_coeff[2]);
+            *cod_gain_exp = sub (sub (exp, exp_coeff[2]), 14);
+
+        }
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void calc_filt_energies(
+    enum Mode mode,     /* i  : coder mode                                   */
+    Word16 xn[],        /* i  : LTP target vector,                       Q0  */
+    Word16 xn2[],       /* i  : CB target vector,                        Q0  */
+    Word16 y1[],        /* i  : Adaptive codebook,                       Q0  */
+    Word16 Y2[],        /* i  : Filtered innovative vector,              Q12 */
+    Word16 g_coeff[],   /* i  : Correlations <xn y1> <y1 y1>                 */
+    /*      computed in G_pitch()                        */
+    Word16 frac_coeff[], /* o  : energy coefficients (5), fraction part, Q15 */
+    Word16 exp_coeff[], /* o  : energy coefficients (5), exponent part,  Q0  */
+    Word16 *cod_gain_frac, /* o  : optimum codebook gain (fraction part),Q15 */
+    Word16 *cod_gain_exp, /* o  : optimum codebook gain (exponent part), Q0  */
+    Flag   *pOverflow
+)
+{
+    Word32 s1;      /* Intermediate energy accumulator  */
+    Word32 s2;      /* Intermediate energy accumulator  */
+    Word32 s3;      /* Intermediate energy accumulator  */
+
+    Word16 i;       /* index used in all loops  */
+    Word16 exp;     /* number of '0's or '1's before MSB != 0   */
+    Word16 frac;        /* fractional part  */
+    Word16 tmp;     /* temporal storage */
+    Word16 scaled_y2[L_SUBFR];
+
+
+    frac_coeff[0] = g_coeff[0];
+    exp_coeff[0]  = g_coeff[1];
+    frac_coeff[1] = negate(g_coeff[2]);    /* coeff[1] = -2 xn y1 */
+    exp_coeff[1]  = g_coeff[3] + 1;
+
+    if ((mode == MR795) || (mode == MR475))
+    {
+        s1 = 0L;
+        s2 = 0L;
+        s3 = 0L;
+    }
+    else
+    {
+        s1 = 1L;
+        s2 = 1L;
+        s3 = 1L;
+    }
+
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        /* avoid multiple accesses to memory  */
+        tmp   = (Y2[i] >> 3);
+        scaled_y2[i] = tmp;
+
+        /* Compute scalar product <scaled_y2[],scaled_y2[]> */
+        s1 = L_mac(s1, tmp, tmp, pOverflow);
+
+        /* Compute scalar product -2*<xn[],scaled_y2[]> */
+        s2 = L_mac(s2, xn[i], tmp, pOverflow);
+
+        /* Compute scalar product 2*<y1[],scaled_y2[]> */
+        s3 = L_mac(s3, y1[i], tmp, pOverflow);
+    }
+
+    exp = norm_l(s1);
+    frac_coeff[2] = (Word16)(L_shl(s1, exp, pOverflow) >> 16);
+    exp_coeff[2] = (-3 - exp);
+
+    exp = norm_l(s2);
+    frac_coeff[3] = negate((Word16)(L_shl(s2, exp, pOverflow) >> 16));
+    exp_coeff[3] = (7 - exp);
+
+    exp = norm_l(s3);
+    frac_coeff[4] = (Word16)(L_shl(s3, exp, pOverflow) >> 16);
+    exp_coeff[4] = (7 - exp);
+
+
+    if ((mode == MR795) || (mode == MR475))
+    {
+        /* Compute scalar product <xn2[],scaled_y2[]> */
+        s1 = 0L;
+
+        for (i = 0; i < L_SUBFR; i++)
+        {
+            s1 = amrnb_fxp_mac_16_by_16bb((Word32) xn2[i], (Word32)scaled_y2[i], s1);
+        }
+
+        s1 = s1 << 1;
+
+        exp = norm_l(s1);
+        frac = (Word16)(L_shl(s1, exp, pOverflow) >> 16);
+        exp = (6 - exp);
+
+        if (frac <= 0)
+        {
+            *cod_gain_frac = 0;
+            *cod_gain_exp = 0;
+        }
+        else
+        {
+            /*
+            gcu = <xn2, scaled_y2> / c[2]
+                = (frac>>1)/frac[2]             * 2^(exp+1-exp[2])
+                = div_s(frac>>1, frac[2])*2^-15 * 2^(exp+1-exp[2])
+                = div_s * 2^(exp-exp[2]-14)
+            */
+            *cod_gain_frac = div_s(shr(frac, 1, pOverflow), frac_coeff[2]);
+            *cod_gain_exp = ((exp - exp_coeff[2]) - 14);
+        }
+    }
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: calc_target_energy
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    xn =  LTP target vector, buffer to type Word16  Q0
+    en_exp = optimum codebook gain (exponent part) pointer to type Word16
+    en_frac = optimum codebook gain (fraction part) pointer to type Word16
+    pOverflow = pointer to overflow indicator (Flag)
+
+ Outputs:
+    en_exp points to new optimum codebook gain (exponent part)
+    en_frac points to new optimum codebook gain (fraction part)
+    pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates the target energy using the formula,
+ en = <xn, xn>
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ calc_en.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void
+calc_target_energy(
+    Word16 xn[],     // i: LTP target vector,                       Q0
+    Word16 *en_exp,  // o: optimum codebook gain (exponent part),   Q0
+    Word16 *en_frac  // o: optimum codebook gain (fraction part),   Q15
+)
+{
+    Word32 s;
+    Word16 i, exp;
+
+    // Compute scalar product <xn[], xn[]>
+    s = L_mac(0L, xn[0], xn[0]);
+    for (i = 1; i < L_SUBFR; i++)
+        s = L_mac(s, xn[i], xn[i]);
+
+    // s = SUM 2*xn(i) * xn(i) = <xn xn> * 2
+    exp = norm_l(s);
+    *en_frac = extract_h(L_shl(s, exp));
+    *en_exp = sub(16, exp);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void calc_target_energy(
+    Word16 xn[],     /* i: LTP target vector,                       Q0  */
+    Word16 *en_exp,  /* o: optimum codebook gain (exponent part),   Q0  */
+    Word16 *en_frac, /* o: optimum codebook gain (fraction part),   Q15 */
+    Flag   *pOverflow
+)
+{
+    Word32 s;       /* Intermediate energy accumulator  */
+    Word16 i;       /* index used in all loops  */
+    Word16 exp;
+
+    /* Compute scalar product <xn[], xn[]> */
+    s = 0;
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        s = amrnb_fxp_mac_16_by_16bb((Word32) xn[i], (Word32) xn[i], s);
+    }
+
+    if (s < 0)
+    {
+        *pOverflow = 1;
+        s = MAX_32;
+    }
+
+    /* s = SUM 2*xn(i) * xn(i) = <xn xn> * 2 */
+    exp = norm_l(s);
+    *en_frac = (Word16)(L_shl(s, exp, pOverflow) >> 16);
+    *en_exp = (16 - exp);
+
+    return;
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.h
new file mode 100644 (file)
index 0000000..e74253b
--- /dev/null
@@ -0,0 +1,183 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: calc_en.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : calc_en.h
+      Purpose          : calculation of energy coefficients for quantizers
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _CALC_EN_H_
+#define _CALC_EN_H_
+#define calc_en_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    /*
+     * FUNCTION: calc_unfilt_energies
+     *
+     * PURPOSE:  calculation of several energy coefficients for unfiltered
+     *           excitation signals and the LTP coding gain
+     *
+     *       frac_en[0]*2^exp_en[0] = <res res>   // LP residual energy
+     *       frac_en[1]*2^exp_en[1] = <exc exc>   // LTP residual energy
+     *       frac_en[2]*2^exp_en[2] = <exc code>  // LTP/CB innovation dot product
+     *       frac_en[3]*2^exp_en[3] = <lres lres> // LTP residual energy
+     *                                            // (lres = res - gain_pit*exc)
+     *       ltpg = log2(LP_res_en / LTP_res_en)
+     */
+    void
+    calc_unfilt_energies(
+        Word16 res[],     /* i  : LP residual,                               Q0  */
+        Word16 exc[],     /* i  : LTP excitation (unfiltered),               Q0  */
+        Word16 code[],    /* i  : CB innovation (unfiltered),                Q13 */
+        Word16 gain_pit,  /* i  : pitch gain,                                Q14 */
+        Word16 L_subfr,   /* i  : Subframe length                                */
+
+        Word16 frac_en[], /* o  : energy coefficients (3), fraction part,    Q15 */
+        Word16 exp_en[],  /* o  : energy coefficients (3), exponent part,    Q0  */
+        Word16 *ltpg,     /* o  : LTP coding gain (log2()),                  Q13 */
+        Flag   *pOverflow
+    );
+
+    /*
+     * FUNCTION: calc_filt_energies
+     *
+     * PURPOSE:  calculation of several energy coefficients for filtered
+     *           excitation signals
+     *
+     *     Compute coefficients need for the quantization and the optimum
+     *     codebook gain gcu (for MR475 only).
+     *
+     *      coeff[0] =    y1 y1
+     *      coeff[1] = -2 xn y1
+     *      coeff[2] =    y2 y2
+     *      coeff[3] = -2 xn y2
+     *      coeff[4] =  2 y1 y2
+     *
+     *
+     *      gcu = <xn2, y2> / <y2, y2> (0 if <xn2, y2> <= 0)
+     *
+     *     Product <y1 y1> and <xn y1> have been computed in G_pitch() and
+     *     are in vector g_coeff[].
+     */
+    void
+    calc_filt_energies(
+        enum Mode mode,     /* i  : coder mode                                   */
+        Word16 xn[],        /* i  : LTP target vector,                       Q0  */
+        Word16 xn2[],       /* i  : CB target vector,                        Q0  */
+        Word16 y1[],        /* i  : Adaptive codebook,                       Q0  */
+        Word16 Y2[],        /* i  : Filtered innovative vector,              Q12 */
+        Word16 g_coeff[],   /* i  : Correlations <xn y1> <y1 y1>                 */
+        /*      computed in G_pitch()                        */
+
+        Word16 frac_coeff[],/* o  : energy coefficients (5), fraction part,  Q15 */
+        Word16 exp_coeff[], /* o  : energy coefficients (5), exponent part,  Q0  */
+        Word16 *cod_gain_frac,/* o: optimum codebook gain (fraction part),   Q15 */
+        Word16 *cod_gain_exp, /* o: optimum codebook gain (exponent part),   Q0  */
+        Flag   *pOverflow
+    );
+
+    /*
+     * FUNCTION: calc_target_energy
+     *
+     * PURPOSE:  calculation of target energy
+     *
+     *      en = <xn, xn>
+     */
+    void
+    calc_target_energy(
+        Word16 xn[],     /* i: LTP target vector,                       Q0  */
+        Word16 *en_exp,  /* o: optimum codebook gain (exponent part),   Q0  */
+        Word16 *en_frac,  /* o: optimum codebook gain (fraction part),   Q15 */
+        Flag   *pOverflow
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _CALC_EN_H_ */
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.cpp
new file mode 100644 (file)
index 0000000..a566ea0
--- /dev/null
@@ -0,0 +1,360 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: cbsearch.cpp
+ Functions: D_plsf_3
+
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    x[] -- array of type Word16 -- target vector, Q0
+    h[] -- array of type Word16 -- impulse response of weighted synthesis
+                                   filter h[-L_subfr..-1] must be set to
+                                   zero. Q12
+    T0  -- Word16 -- Pitch lag
+    pitch_sharp -- Word16 -- Last quantized pitch gain, Q14
+    gain_pit --  Word16 gain_pit -- Pitch gain, Q14
+    res2[] -- array of type Word16 -- Long term prediction residual, Q0
+    mode -- enum Mode --  coder mode
+    subNr -- Word16 -- subframe number
+
+ Outputs:
+    code[] -- array of type Word16 -- Innovative codebook, Q13
+    y[] -- array of type Word16 -- filtered fixed codebook excitation
+                                   Q12
+
+    anap -- Double pointer to Word16 -- Signs of the pulses
+
+
+    pOverflow -- pointer to Flag -- Flag set when overflow occurs
+
+ Returns:
+    Zero
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Purpose          : Inovative codebook search (find index and gain)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cbsearch.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "cbsearch.h"
+
+#include "typedef.h"
+#include "c2_9pf.h"
+#include "c2_11pf.h"
+#include "c3_14pf.h"
+#include "c4_17pf.h"
+#include "c8_31pf.h"
+#include "c1035pf.h"
+#include "mode.h"
+#include "basic_op.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void cbsearch(Word16 x[],        /* i : target vector, Q0                     */
+              Word16 h[],        /* i : impulse response of weighted synthesis*/
+              /*     filter h[-L_subfr..-1] must be set to */
+              /*     zero. Q12                             */
+              Word16 T0,         /* i : Pitch lag                             */
+              Word16 pitch_sharp,/* i : Last quantized pitch gain, Q14        */
+              Word16 gain_pit,   /* i : Pitch gain, Q14                       */
+              Word16 res2[],     /* i : Long term prediction residual, Q0     */
+              Word16 code[],     /* o : Innovative codebook, Q13              */
+              Word16 y[],        /* o : filtered fixed codebook excitation    */
+              /*     Q12                                   */
+              Word16 **anap,     /* o : Signs of the pulses                   */
+              enum Mode mode,    /* i : coder mode                            */
+              Word16 subNr,      /* i : subframe number                       */
+              CommonAmrTbls* common_amr_tbls, /* ptr to struct of tables    */
+              Flag  *pOverflow)  /* o : Flag set when overflow occurs         */
+{
+    Word16 index;
+    Word16 i;
+    Word16 temp;
+    Word16 pit_sharpTmp;
+
+    /* For MR74, the pre and post CB pitch sharpening is included in the
+     * codebook search routine, while for MR122 is it not.
+     */
+
+    if ((mode == MR475) || (mode == MR515))
+    {
+        /* MR475, MR515 */
+        *(*anap)++ =
+            code_2i40_9bits(
+                subNr,
+                x,
+                h,
+                T0,
+                pitch_sharp,
+                code,
+                y,
+                &index,
+                common_amr_tbls->startPos_ptr,
+                pOverflow);
+
+        *(*anap)++ = index;    /* sign index */
+    }
+    else if (mode == MR59)
+    {   /* MR59 */
+        *(*anap)++ =
+            code_2i40_11bits(
+                x,
+                h,
+                T0,
+                pitch_sharp,
+                code,
+                y,
+                &index,
+                pOverflow);
+
+        *(*anap)++ = index;    /* sign index */
+    }
+    else if (mode == MR67)
+    {   /* MR67 */
+        *(*anap)++ =
+            code_3i40_14bits(
+                x,
+                h,
+                T0,
+                pitch_sharp,
+                code,
+                y,
+                &index,
+                pOverflow);
+
+        *(*anap)++ = index;    /* sign index */
+    }
+    else if ((mode == MR74) || (mode == MR795))
+    {   /* MR74, MR795 */
+        *(*anap)++ =
+            code_4i40_17bits(
+                x,
+                h,
+                T0,
+                pitch_sharp,
+                code,
+                y,
+                &index,
+                common_amr_tbls->gray_ptr,
+                pOverflow);
+
+        *(*anap)++ = index;    /* sign index */
+    }
+    else if (mode == MR102)
+    {   /* MR102 */
+        /*-------------------------------------------------------------*
+         * - include pitch contribution into impulse resp. h1[]        *
+         *-------------------------------------------------------------*/
+        /* pit_sharpTmp = pit_sharp;                     */
+        /* if (pit_sharpTmp > 1.0) pit_sharpTmp = 1.0;   */
+
+        pit_sharpTmp =
+            shl(
+                pitch_sharp,
+                1,
+                pOverflow);
+
+        for (i = T0; i < L_SUBFR; i++)
+        {
+            temp =
+                mult(
+                    h[i - T0],
+                    pit_sharpTmp,
+                    pOverflow);
+
+            h[i] =
+                add_16(
+                    h[i],
+                    temp,
+                    pOverflow);
+        }
+
+        /*--------------------------------------------------------------*
+         * - Innovative codebook search (find index and gain)           *
+         *--------------------------------------------------------------*/
+        code_8i40_31bits(
+            x,
+            res2,
+            h,
+            code,
+            y,
+            *anap,
+            pOverflow);
+
+        *anap += 7;
+
+        /*-------------------------------------------------------*
+         * - Add the pitch contribution to code[].               *
+         *-------------------------------------------------------*/
+        for (i = T0; i < L_SUBFR; i++)
+        {
+            temp =
+                mult(
+                    code[i - T0],
+                    pit_sharpTmp,
+                    pOverflow);
+
+            code[i] =
+                add_16(
+                    code[i],
+                    temp,
+                    pOverflow);
+        }
+    }
+    else
+    {  /* MR122 */
+        /*-------------------------------------------------------------*
+         * - include pitch contribution into impulse resp. h1[]        *
+         *-------------------------------------------------------------*/
+
+        /* pit_sharpTmp = gain_pit;                      */
+        /* if (pit_sharpTmp > 1.0) pit_sharpTmp = 1.0;   */
+
+        pit_sharpTmp = shl(gain_pit, 1, pOverflow);
+
+        for (i = T0; i < L_SUBFR; i++)
+        {
+            temp = ((Word32)h[i - T0] * pit_sharpTmp) >> 15;
+            /*
+                     mult(
+                            h[i - T0],
+                            ,
+                            pOverflow);
+            */
+            h[i] =
+                add_16(
+                    h[i],
+                    temp,
+                    pOverflow);
+        }
+        /*--------------------------------------------------------------*
+         * - Innovative codebook search (find index and gain)           *
+         *--------------------------------------------------------------*/
+
+        code_10i40_35bits(
+            x,
+            res2,
+            h,
+            code,
+            y,
+            *anap,
+            common_amr_tbls->gray_ptr,
+            pOverflow);
+
+        *anap += 10;
+
+        /*-------------------------------------------------------*
+         * - Add the pitch contribution to code[].               *
+         *-------------------------------------------------------*/
+        for (i = T0; i < L_SUBFR; i++)
+        {
+            temp =
+                mult(
+                    code[i - T0],
+                    pit_sharpTmp,
+                    pOverflow);
+
+            code[i] =
+                add_16(
+                    code[i],
+                    temp,
+                    pOverflow);
+        }
+    }
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.h
new file mode 100644 (file)
index 0000000..caad735
--- /dev/null
@@ -0,0 +1,124 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: cbsearch.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the cbsearch.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef cbsearch_h
+#define cbsearch_h "$Id $"
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void cbsearch(Word16 x[],     /* i : target vector, Q0                      */
+    Word16 h[],     /* i : impulse response of weighted synthesis */
+    /*     filter h[-L_subfr..-1] must be set to  */
+    /*    zero. Q12                               */
+    Word16 T0,      /* i : Pitch lag                              */
+    Word16 pitch_sharp, /* i : Last quantized pitch gain, Q14     */
+    Word16 gain_pit,/* i : Pitch gain, Q14                        */
+    Word16 res2[],  /* i : Long term prediction residual, Q0      */
+    Word16 code[],  /* o : Innovative codebook, Q13               */
+    Word16 y[],     /* o : filtered fixed codebook excitation, Q12 */
+    Word16 **anap,  /* o : Signs of the pulses                    */
+    enum Mode mode, /* i : coder mode                             */
+    Word16 subNr,   /* i : subframe number                        */
+    CommonAmrTbls* common_amr_tbls, /* ptr to struct of tables    */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs        */
+                 );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CBSEARCH_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp
new file mode 100644 (file)
index 0000000..50eb6b9
--- /dev/null
@@ -0,0 +1,671 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: cl_ltp.cpp
+ Funtions: cl_ltp_init
+           cl_ltp_reset
+           cl_ltp_exit
+           cl_ltp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains functions that perform closed-loop fractional pitch
+ search.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "cl_ltp.h"
+#include "basicop_malloc.h"
+#include "cnst.h"
+#include "convolve.h"
+#include "g_pitch.h"
+#include "pred_lt.h"
+#include "pitch_fr.h"
+#include "enc_lag3.h"
+#include "enc_lag6.h"
+#include "q_gain_p.h"
+#include "ton_stab.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cl_ltp_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = Pointer to a pointer to a clLtpState structure
+
+ Outputs:
+    state points to the newly created clLtpState structure.
+
+ Returns:
+    This function returns 0 upon success and -1 upon failure.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Allocates state memory and initializes state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cl_ltp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int cl_ltp_init (clLtpState **state)
+{
+    clLtpState* s;
+
+    if (state == (clLtpState **) NULL){
+        fprintf(stderr, "cl_ltp_init: invalid parameter\n");
+        return -1;
+    }
+    *state = NULL;
+
+    // allocate memory
+    if ((s= (clLtpState *) malloc(sizeof(clLtpState))) == NULL){
+        fprintf(stderr, "cl_ltp_init: can not malloc state structure\n");
+        return -1;
+  }
+
+    // init the sub state
+    if (Pitch_fr_init(&s->pitchSt)) {
+        cl_ltp_exit(&s);
+        return -1;
+    }
+
+    cl_ltp_reset(s);
+
+    *state = s;
+
+    return 0;
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 cl_ltp_init(clLtpState **state)
+{
+    clLtpState* s;
+
+    if (state == (clLtpState **) NULL)
+    {
+        /*fprint(stderr, "cl_ltp_init: invalid parameter\n");*/
+        return(-1);
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (clLtpState *) oscl_malloc(sizeof(clLtpState))) == NULL)
+    {
+        /*fprint(stderr, "cl_ltp_init: can not malloc state structure\n");*/
+        return(-1);
+    }
+
+    /* init the sub state */
+    if (Pitch_fr_init(&s->pitchSt))
+    {
+        cl_ltp_exit(&s);
+        return(-1);
+    }
+
+    cl_ltp_reset(s);
+
+    *state = s;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cl_ltp_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to the clLtpState structure to be reset
+
+ Outputs:
+    The state structure pointed to by clLtpState *state is reset.
+
+ Returns:
+    The function returns int 0 if successful, -1 otherwise.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Initializes state memory to zero.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cl_ltp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+ ------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int cl_ltp_reset (clLtpState *state)
+{
+    if (state == (clLtpState *) NULL){
+        fprintf(stderr, "cl_ltp_reset: invalid parameter\n");
+        return -1;
+    }
+
+    // Reset pitch search states
+    Pitch_fr_reset (state->pitchSt);
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 cl_ltp_reset(clLtpState *state)
+{
+    if (state == (clLtpState *) NULL)
+    {
+        /*fprint(stderr, "cl_ltp_reset: invalid parameter\n");  */
+        return(-1);
+    }
+
+    /* Reset pitch search states */
+    Pitch_fr_reset(state->pitchSt);
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cl_ltp_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    clLtpState **state = Reference to the state object to be freed.
+
+ Outputs:
+    The memory used by the structure which is pointed to by 'state'
+      is freed.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ The memory used for state memory is freed
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cl_ltp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void cl_ltp_exit (clLtpState **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    // dealloc members
+    Pitch_fr_exit(&(*state)->pitchSt);
+
+    // deallocate memory
+    free(*state);
+    *state = NULL;
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void cl_ltp_exit(clLtpState **state)
+{
+    if (state == NULL || *state == NULL)
+    {
+        return;
+    }
+
+    /* dealloc members */
+    Pitch_fr_exit(&(*state)->pitchSt);
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cl_ltp
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    clSt = pointer to the clLtpState struct
+    tonSt = pointer to the tonStabState structure
+    mode = codec mode value, of type enum Mode
+    frameOffset = offset to subframe (Word16)
+    T_op = pointer to buffer of open loop pitch lags (Word16)
+    h1 = pointer to impulse response vector (Word16)
+    exc = pointer to excitation vector (Word16)
+    res2 = pointer to long term prediction residual (Word16)
+    xn = pointer to target vector for pitch search (Word16)
+    lsp_flag = LSP resonance flag (Word16)
+
+ Outputs:
+    clSt = pointer to the clLtpState struct
+    tonSt = pointer to the tonStabState structure
+    exc = pointer to excitation vector (Word16)
+    res2 = pointer to long term prediction residual (Word16)
+    xn2 = pointer to target vector for codebook search (Word16)
+    yl = pointer to buffer of filtered adaptive excitation (Word16)
+    T0 = pointer to pitch delay (integer part) (Word16)
+    T0_frac = pointer to pitch delay (fractional part) (Word16)
+    gain_pit = pointer to pitch gain (Word16)
+    g_coeff = pointer to array of correlations between xn, y1, & y2 (Word16)
+    anap = pointer to pointer to analysis parameters (Word16)
+    gp_limit = pointer to the pitch gain limit (Word16)
+    pOverflow = pointer to overflow indicator (Flag)
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs closed-loop fractional pitch search.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cl_ltp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE FOR cl_ltp
+
+int cl_ltp (
+    clLtpState *clSt,    // i/o : State struct
+    tonStabState *tonSt, // i/o : State struct
+    enum Mode mode,      // i   : coder mode
+    Word16 frameOffset,  // i   : Offset to subframe
+    Word16 T_op[],       // i   : Open loop pitch lags
+    Word16 *h1,          // i   : Impulse response vector               Q12
+    Word16 *exc,         // i/o : Excitation vector                      Q0
+    Word16 res2[],       // i/o : Long term prediction residual          Q0
+    Word16 xn[],         // i   : Target vector for pitch search         Q0
+    Word16 lsp_flag,     // i   : LSP resonance flag
+    Word16 xn2[],        // o   : Target vector for codebook search      Q0
+    Word16 y1[],         // o   : Filtered adaptive excitation           Q0
+    Word16 *T0,          // o   : Pitch delay (integer part)
+    Word16 *T0_frac,     // o   : Pitch delay (fractional part)
+    Word16 *gain_pit,    // o   : Pitch gain                            Q14
+    Word16 g_coeff[],    // o   : Correlations between xn, y1, & y2
+    Word16 **anap,       // o   : Analysis parameters
+    Word16 *gp_limit     // o   : pitch gain limit
+)
+{
+    Word16 i;
+    Word16 index;
+    Word32 L_temp;     // temporarily variable
+    Word16 resu3;      // flag for upsample resolution
+    Word16 gpc_flag;
+
+    *----------------------------------------------------------------------*
+    *                 Closed-loop fractional pitch search                  *
+    *----------------------------------------------------------------------*
+   *T0 = Pitch_fr(clSt->pitchSt,
+                  mode, T_op, exc, xn, h1,
+                  L_SUBFR, frameOffset,
+                  T0_frac, &resu3, &index);
+
+   *(*anap)++ = index;
+
+    *-----------------------------------------------------------------*
+    *   - find unity gain pitch excitation (adapitve codebook entry)  *
+    *     with fractional interpolation.                              *
+    *   - find filtered pitch exc. y1[]=exc[] convolve with h1[])     *
+    *   - compute pitch gain and limit between 0 and 1.2              *
+    *   - update target vector for codebook search                    *
+    *   - find LTP residual.                                          *
+    *-----------------------------------------------------------------*
+
+   Pred_lt_3or6(exc, *T0, *T0_frac, L_SUBFR, resu3);
+
+   Convolve(exc, h1, y1, L_SUBFR);
+
+   // gain_pit is Q14 for all modes
+   *gain_pit = G_pitch(mode, xn, y1, g_coeff, L_SUBFR);
+
+
+   // check if the pitch gain should be limit due to resonance in LPC filter
+   gpc_flag = 0;
+   *gp_limit = MAX_16;
+   if ((lsp_flag != 0) &&
+       (sub(*gain_pit, GP_CLIP) > 0))
+   {
+       gpc_flag = check_gp_clipping(tonSt, *gain_pit);
+   }
+
+   // special for the MR475, MR515 mode; limit the gain to 0.85 to
+   // cope with bit errors in the decoder in a better way.
+   if ((sub (mode, MR475) == 0) || (sub (mode, MR515) == 0)) {
+      if ( sub (*gain_pit, 13926) > 0) {
+         *gain_pit = 13926;   // 0.85 in Q14
+      }
+
+      if (gpc_flag != 0) {
+          *gp_limit = GP_CLIP;
+      }
+   }
+   else
+   {
+       if (gpc_flag != 0)
+       {
+           *gp_limit = GP_CLIP;
+           *gain_pit = GP_CLIP;
+       }
+       // For MR122, gain_pit is quantized here and not in gainQuant
+       if (sub(mode, MR122)==0)
+       {
+           *(*anap)++ = q_gain_pitch(MR122, *gp_limit, gain_pit,
+                                     NULL, NULL);
+       }
+   }
+
+   // update target vector und evaluate LTP residual
+   for (i = 0; i < L_SUBFR; i++) {
+       L_temp = L_mult(y1[i], *gain_pit);
+       L_temp = L_shl(L_temp, 1);
+       xn2[i] = sub(xn[i], extract_h(L_temp));
+
+       L_temp = L_mult(exc[i], *gain_pit);
+       L_temp = L_shl(L_temp, 1);
+       res2[i] = sub(res2[i], extract_h(L_temp));
+   }
+
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void cl_ltp(
+    clLtpState *clSt,    /* i/o : State struct                              */
+    tonStabState *tonSt, /* i/o : State struct                              */
+    enum Mode mode,      /* i   : coder mode                                */
+    Word16 frameOffset,  /* i   : Offset to subframe                        */
+    Word16 T_op[],       /* i   : Open loop pitch lags                      */
+    Word16 *h1,          /* i   : Impulse response vector               Q12 */
+    Word16 *exc,         /* i/o : Excitation vector                      Q0 */
+    Word16 res2[],       /* i/o : Long term prediction residual          Q0 */
+    Word16 xn[],         /* i   : Target vector for pitch search         Q0 */
+    Word16 lsp_flag,     /* i   : LSP resonance flag                        */
+    Word16 xn2[],        /* o   : Target vector for codebook search      Q0 */
+    Word16 yl[],         /* o   : Filtered adaptive excitation           Q0 */
+    Word16 *T0,          /* o   : Pitch delay (integer part)                */
+    Word16 *T0_frac,     /* o   : Pitch delay (fractional part)             */
+    Word16 *gain_pit,    /* o   : Pitch gain                            Q14 */
+    Word16 g_coeff[],    /* o   : Correlations between xn, y1, & y2         */
+    Word16 **anap,       /* o   : Analysis parameters                       */
+    Word16 *gp_limit,    /* o   : pitch gain limit                          */
+    const Word16* qua_gain_pitch_ptr, /* i : ptr to read-only table         */
+    Flag   *pOverflow    /* o   : overflow indicator                        */
+)
+{
+    register Word16 i;
+    Word16 index;
+    Word32 L_temp;     /* temporarily variable */
+    Word16 resu3;      /* flag for upsample resolution */
+    Word16 gpc_flag;
+
+    Word16 temp;
+    Word16 *p_exc;
+    Word16 *p_xn;
+    Word16 *p_xn2;
+    Word16 *p_yl;
+
+    /*----------------------------------------------------------------------*
+     *                 Closed-loop fractional pitch search                  *
+     *----------------------------------------------------------------------*/
+    *T0 =
+        Pitch_fr(
+            clSt->pitchSt,
+            mode,
+            T_op,
+            exc,
+            xn,
+            h1,
+            L_SUBFR,
+            frameOffset,
+            T0_frac,
+            &resu3,
+            &index,
+            pOverflow);
+
+    *(*anap)++ = index;
+
+    /*-----------------------------------------------------------------*
+     *   - find unity gain pitch excitation (adapitve codebook entry)  *
+     *     with fractional interpolation.                              *
+     *   - find filtered pitch exc. y1[]=exc[] convolve with h1[])     *
+     *   - compute pitch gain and limit between 0 and 1.2              *
+     *   - update target vector for codebook search                    *
+     *   - find LTP residual.                                          *
+     *-----------------------------------------------------------------*/
+
+    Pred_lt_3or6(
+        exc,
+        *T0,
+        *T0_frac,
+        L_SUBFR,
+        resu3,
+        pOverflow);
+
+    Convolve(exc, h1, yl, L_SUBFR);
+
+    /* gain_pit is Q14 for all modes */
+    *gain_pit =
+        G_pitch(
+            mode,
+            xn,
+            yl,
+            g_coeff,
+            L_SUBFR,
+            pOverflow);
+
+
+    /* check if the pitch gain should be limit due to resonance in LPC filter */
+    gpc_flag = 0;
+    *gp_limit = MAX_16;
+
+    if ((lsp_flag != 0) && ((Word32)(*gain_pit) > GP_CLIP))
+    {
+        gpc_flag = check_gp_clipping(tonSt, *gain_pit, pOverflow);
+    }
+
+    /* special for the MR475, MR515 mode; limit the gain to 0.85 to */
+    /* cope with bit errors in the decoder in a better way.         */
+
+    if ((mode == MR475) || (mode == MR515))
+    {
+        *gain_pit = ((Word32) * gain_pit > 13926) ? 13926 : *gain_pit;
+
+        if (gpc_flag != 0)
+        {
+            *gp_limit = GP_CLIP;
+        }
+    }
+    else
+    {
+        if (gpc_flag != 0)
+        {
+            *gp_limit = GP_CLIP;
+            *gain_pit = GP_CLIP;
+        }
+        /* For MR122, gain_pit is quantized here and not in gainQuant */
+        if (mode == MR122)
+        {
+            *(*anap)++ =
+                q_gain_pitch(
+                    MR122,
+                    *gp_limit,
+                    gain_pit,
+                    NULL,
+                    NULL,
+                    qua_gain_pitch_ptr,
+                    pOverflow);
+        }
+    }
+
+
+    p_exc  = &exc[0];
+    p_xn   =  &xn[0];
+    p_xn2  = &xn2[0];
+    p_yl   =  &yl[0];
+
+    temp = *gain_pit;
+
+    /* update target vector und evaluate LTP residual */
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        L_temp = ((Word32) * (p_yl++) * temp) >> 14;
+        *(p_xn2++) = *(p_xn++) - (Word16)L_temp;
+
+        L_temp   = ((Word32) * (p_exc++) * temp) >> 14;
+        res2[i] -= (Word16)L_temp;
+    }
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.h
new file mode 100644 (file)
index 0000000..22da3fb
--- /dev/null
@@ -0,0 +1,150 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: cl_ltp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the cl_ltp.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef cl_ltp_h
+#define cl_ltp_h "$Id $"
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "pitch_fr.h"
+#include "ton_stab.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /* state variable */
+    typedef struct
+    {
+        Pitch_frState *pitchSt;
+    } clLtpState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 cl_ltp_init(clLtpState **st);
+    /* initialize one instance of the pre processing state.
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to cl_ltp in each call.
+       returns 0 on success
+     */
+
+    Word16 cl_ltp_reset(clLtpState *st);
+    /* reset of pre processing state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+    void cl_ltp_exit(clLtpState **st);
+    /* de-initialize pre processing state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    void cl_ltp(
+        clLtpState *clSt,    /* i/o : State struct                              */
+        tonStabState *tonSt, /* i/o : State struct                              */
+        enum Mode mode,      /* i   : coder mode                                */
+        Word16 frameOffset,  /* i   : Offset to subframe                        */
+        Word16 T_op[],       /* i   : Open loop pitch lags                      */
+        Word16 *h1,          /* i   : Impulse response vector               Q12 */
+        Word16 *exc,         /* i/o : Excitation vector                      Q0 */
+        Word16 res2[],       /* i/o : Long term prediction residual          Q0 */
+        Word16 xn[],         /* i   : Target vector for pitch search         Q0 */
+        Word16 lsp_flag,     /* i   : LSP resonance flag                        */
+        Word16 xn2[],        /* o   : Target vector for codebook search      Q0 */
+        Word16 y1[],         /* o   : Filtered adaptive excitation           Q0 */
+        Word16 *T0,          /* o   : Pitch delay (integer part)                */
+        Word16 *T0_frac,     /* o   : Pitch delay (fractional part)             */
+        Word16 *gain_pit,    /* o   : Pitch gain                            Q14 */
+        Word16 g_coeff[],    /* o   : Correlations between xn, y1, & y2         */
+        Word16 **anap,       /* o   : Analysis parameters                       */
+        Word16 *gp_limit,    /* o   : pitch gain limit                          */
+        const Word16* qua_gain_pitch_ptr, /* i : ptr to read-only table         */
+        Flag   *pOverflow    /* o   : overflow indicator                        */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CL_LTP_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.cpp
new file mode 100644 (file)
index 0000000..f1c101c
--- /dev/null
@@ -0,0 +1,1502 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: cod_amr.cpp
+ Functions: cod_amr_init
+           cod_amr_reset
+           cod_amr_exit
+           cod_amr_first
+           cod_amr
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ These functions comprise the main encoder routine operating on a frame basis.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "cod_amr.h"
+#include "typedef.h"
+#include "cnst.h"
+#include "qua_gain.h"
+#include "lpc.h"
+#include "lsp.h"
+#include "pre_big.h"
+#include "ol_ltp.h"
+#include "p_ol_wgh.h"
+#include "spreproc.h"
+#include "cl_ltp.h"
+#include "pred_lt.h"
+#include "spstproc.h"
+#include "cbsearch.h"
+#include "gain_q.h"
+#include "convolve.h"
+#include "ton_stab.h"
+#include "vad.h"
+#include "dtx_enc.h"
+#include "oscl_mem.h"
+
+#ifdef VAD2
+#include "vad2.h"
+#endif
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/* Spectral expansion factors */
+
+static const Word16 gamma1[M] =
+{
+    30802, 28954, 27217, 25584, 24049,
+    22606, 21250, 19975, 18777, 17650
+};
+
+/* gamma1 differs for the 12k2 coder */
+static const Word16 gamma1_12k2[M] =
+{
+    29491, 26542, 23888, 21499, 19349,
+    17414, 15672, 14105, 12694, 11425
+};
+
+static const Word16 gamma2[M] =
+{
+    19661, 11797, 7078, 4247, 2548,
+    1529, 917, 550, 330, 198
+};
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cod_amr_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a pointer to a structure of type cod_amrState
+
+ Outputs:
+    Structure pointed to by the pointer pointed to by state is
+      initialized to its reset value
+    state points to the allocated memory
+
+ Returns:
+    Returns 0 if memory was successfully initialized,
+        otherwise returns -1.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function allocates memory and initializes state variables.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cod_amr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int cod_amr_init (cod_amrState **state, Flag dtx)
+{
+  cod_amrState* s;
+
+  if (state == (cod_amrState **) NULL){
+      fprintf(stderr, "cod_amr_init: invalid parameter\n");
+      return -1;
+  }
+  *state = NULL;
+
+  // allocate memory
+  if ((s= (cod_amrState *) malloc(sizeof(cod_amrState))) == NULL){
+      fprintf(stderr, "cod_amr_init: can not malloc state structure\n");
+      return -1;
+  }
+
+  s->lpcSt = NULL;
+  s->lspSt = NULL;
+  s->clLtpSt = NULL;
+  s->gainQuantSt = NULL;
+  s->pitchOLWghtSt = NULL;
+  s->tonStabSt = NULL;
+  s->vadSt = NULL;
+  s->dtx_encSt = NULL;
+  s->dtx = dtx;
+
+  // Init sub states
+  if (cl_ltp_init(&s->clLtpSt) ||
+      lsp_init(&s->lspSt) ||
+      gainQuant_init(&s->gainQuantSt) ||
+      p_ol_wgh_init(&s->pitchOLWghtSt) ||
+      ton_stab_init(&s->tonStabSt) ||
+#ifndef VAD2
+      vad1_init(&s->vadSt) ||
+#else
+      vad2_init(&s->vadSt) ||
+#endif
+      dtx_enc_init(&s->dtx_encSt) ||
+      lpc_init(&s->lpcSt)) {
+     cod_amr_exit(&s);
+     return -1;
+  }
+
+  cod_amr_reset(s);
+
+  *state = s;
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 cod_amr_init(cod_amrState **state, Flag dtx)
+{
+    cod_amrState* s;
+
+    if (state == (cod_amrState **) NULL)
+    {
+        /* fprint(stderr, "cod_amr_init: invalid parameter\n");  */
+        return(-1);
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (cod_amrState *) oscl_malloc(sizeof(cod_amrState))) == NULL)
+    {
+        /* fprint(stderr, "cod_amr_init:
+                           can not malloc state structure\n");  */
+        return(-1);
+    }
+
+    get_const_tbls(&s->common_amr_tbls);
+
+    s->lpcSt = NULL;
+    s->lspSt = NULL;
+    s->clLtpSt = NULL;
+    s->gainQuantSt = NULL;
+    s->pitchOLWghtSt = NULL;
+    s->tonStabSt = NULL;
+    s->vadSt = NULL;
+    s->dtx_encSt = NULL;
+    s->dtx = dtx;
+
+    /* Initialize overflow Flag */
+
+    s->overflow = 0;
+
+
+    /* Init sub states */
+    if (cl_ltp_init(&s->clLtpSt) ||
+            lsp_init(&s->lspSt) ||
+            gainQuant_init(&s->gainQuantSt) ||
+            p_ol_wgh_init(&s->pitchOLWghtSt) ||
+            ton_stab_init(&s->tonStabSt) ||
+#ifndef VAD2
+            vad1_init(&s->vadSt) ||
+#else
+            vad2_init(&s->vadSt) ||
+#endif
+            dtx_enc_init(&s->dtx_encSt, s->common_amr_tbls.lsp_init_data_ptr) ||
+            lpc_init(&s->lpcSt))
+    {
+        cod_amr_exit(&s);
+        return(-1);
+    }
+
+    cod_amr_reset(s);
+
+    *state = s;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cod_amr_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a structure of type cod_amrState
+
+ Outputs:
+    Structure pointed to by state is initialized to initial values.
+
+ Returns:
+    Returns 0 if memory was successfully initialized,
+        otherwise returns -1.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function resets the state memory for cod_amr.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cod_amr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int cod_amr_reset (cod_amrState *st)
+{
+   Word16 i;
+
+   if (st == (cod_amrState *) NULL){
+      fprintf(stderr, "cod_amr_reset: invalid parameter\n");
+      return -1;
+   }
+
+    *-----------------------------------------------------------------------*
+    *          Initialize pointers to speech vector.                        *
+    *-----------------------------------------------------------------------*
+
+   st->new_speech = st->old_speech + L_TOTAL - L_FRAME;   // New speech
+
+   st->speech = st->new_speech - L_NEXT;                  // Present frame
+
+   st->p_window = st->old_speech + L_TOTAL - L_WINDOW;    // For LPC window
+   st->p_window_12k2 = st->p_window - L_NEXT; // EFR LPC window: no lookahead
+
+   // Initialize static pointers
+
+   st->wsp = st->old_wsp + PIT_MAX;
+   st->exc = st->old_exc + PIT_MAX + L_INTERPOL;
+   st->zero = st->ai_zero + MP1;
+   st->error = st->mem_err + M;
+   st->h1 = &st->hvec[L_SUBFR];
+
+   // Static vectors to zero
+
+   Set_zero(st->old_speech, L_TOTAL);
+   Set_zero(st->old_exc,    PIT_MAX + L_INTERPOL);
+   Set_zero(st->old_wsp,    PIT_MAX);
+   Set_zero(st->mem_syn,    M);
+   Set_zero(st->mem_w,      M);
+   Set_zero(st->mem_w0,     M);
+   Set_zero(st->mem_err,    M);
+   Set_zero(st->zero,       L_SUBFR);
+   Set_zero(st->hvec,       L_SUBFR);    // set to zero "h1[-L_SUBFR..-1]"
+
+   // OL LTP states
+   for (i = 0; i < 5; i++)
+   {
+      st->old_lags[i] = 40;
+   }
+
+   // Reset lpc states
+   lpc_reset(st->lpcSt);
+
+   // Reset lsp states
+   lsp_reset(st->lspSt);
+
+   // Reset clLtp states
+   cl_ltp_reset(st->clLtpSt);
+
+   gainQuant_reset(st->gainQuantSt);
+
+   p_ol_wgh_reset(st->pitchOLWghtSt);
+
+   ton_stab_reset(st->tonStabSt);
+
+#ifndef VAD2
+   vad1_reset(st->vadSt);
+#else
+   vad2_reset(st->vadSt);
+#endif
+
+   dtx_enc_reset(st->dtx_encSt);
+
+   st->sharp = SHARPMIN;
+
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 cod_amr_reset(cod_amrState *st)
+{
+    Word16 i;
+
+    if (st == (cod_amrState *) NULL)
+    {
+        /* fprint(stderr, "cod_amr_reset: invalid parameter\n");  */
+        return(-1);
+    }
+
+    /*-----------------------------------------------------------------------*
+     *          Initialize pointers to speech vector.                        *
+     *-----------------------------------------------------------------------*/
+
+    st->new_speech = st->old_speech + L_TOTAL - L_FRAME;   /* New speech     */
+
+    st->speech = st->new_speech - L_NEXT;                  /* Present frame  */
+
+    st->p_window = st->old_speech + L_TOTAL - L_WINDOW;    /* For LPC window */
+    st->p_window_12k2 = st->p_window - L_NEXT; /* EFR LPC window: no lookahead */
+
+    /* Initialize static pointers */
+
+    st->wsp = st->old_wsp + PIT_MAX;
+    st->exc = st->old_exc + PIT_MAX + L_INTERPOL;
+    st->zero = st->ai_zero + MP1;
+    st->error = st->mem_err + M;
+    st->h1 = &st->hvec[L_SUBFR];
+
+    /* Initialize overflow Flag */
+
+    st->overflow = 0;
+
+    /* Static vectors to zero */
+    oscl_memset(st->old_speech, 0, sizeof(Word16)*L_TOTAL);
+    oscl_memset(st->old_exc, 0,    sizeof(Word16)*(PIT_MAX + L_INTERPOL));
+    oscl_memset(st->old_wsp, 0,    sizeof(Word16)*PIT_MAX);
+    oscl_memset(st->mem_syn, 0,    sizeof(Word16)*M);
+    oscl_memset(st->mem_w,   0,    sizeof(Word16)*M);
+    oscl_memset(st->mem_w0,  0,    sizeof(Word16)*M);
+    oscl_memset(st->mem_err, 0,    sizeof(Word16)*M);
+    oscl_memset(st->zero, 0,       sizeof(Word16)*L_SUBFR);
+    oscl_memset(st->hvec, 0,       sizeof(Word16)*L_SUBFR);    /* set to zero "h1[-L_SUBFR..-1]" */
+
+    /* OL LTP states */
+    for (i = 0; i < 5; i++)
+    {
+        st->old_lags[i] = 40;
+    }
+
+    /* Reset lpc states */
+    lpc_reset(st->lpcSt);
+
+    /* Reset lsp states */
+    lsp_reset(st->lspSt);
+
+    /* Reset clLtp states */
+    cl_ltp_reset(st->clLtpSt);
+
+    gainQuant_reset(st->gainQuantSt);
+
+    p_ol_wgh_reset(st->pitchOLWghtSt);
+
+    ton_stab_reset(st->tonStabSt);
+
+#ifndef VAD2
+    vad1_reset(st->vadSt);
+#else
+    vad2_reset(st->vadSt);
+#endif
+
+    dtx_enc_reset(st->dtx_encSt, st->common_amr_tbls.lsp_init_data_ptr);
+
+    st->sharp = SHARPMIN;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cod_amr_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a pointer to a structure of type cod_amrState
+
+ Outputs:
+    state points to a NULL address
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function frees the memory used for state memory.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cod_amr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void cod_amr_exit (cod_amrState **state)
+{
+   if (state == NULL || *state == NULL)
+      return;
+
+   // dealloc members
+   lpc_exit(&(*state)->lpcSt);
+   lsp_exit(&(*state)->lspSt);
+   gainQuant_exit(&(*state)->gainQuantSt);
+   cl_ltp_exit(&(*state)->clLtpSt);
+   p_ol_wgh_exit(&(*state)->pitchOLWghtSt);
+   ton_stab_exit(&(*state)->tonStabSt);
+#ifndef VAD2
+   vad1_exit(&(*state)->vadSt);
+#else
+   vad2_exit(&(*state)->vadSt);
+#endif
+   dtx_enc_exit(&(*state)->dtx_encSt);
+
+   // deallocate memory
+   free(*state);
+   *state = NULL;
+
+   return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void cod_amr_exit(cod_amrState **state)
+{
+    if (state == NULL || *state == NULL)
+    {
+        return;
+    }
+
+    /* dealloc members */
+    lpc_exit(&(*state)->lpcSt);
+    lsp_exit(&(*state)->lspSt);
+    gainQuant_exit(&(*state)->gainQuantSt);
+    cl_ltp_exit(&(*state)->clLtpSt);
+    p_ol_wgh_exit(&(*state)->pitchOLWghtSt);
+    ton_stab_exit(&(*state)->tonStabSt);
+#ifndef VAD2
+    vad1_exit(&(*state)->vadSt);
+#else
+    vad2_exit(&(*state)->vadSt);
+#endif
+    dtx_enc_exit(&(*state)->dtx_encSt);
+
+    /* deallocate memory */
+    oscl_free(*state); // BX
+    *state = NULL;
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cod_amr_first
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type cod_amrState
+    new_speech = pointer to buffer of length L_FRAME that contains
+                 the speech input (Word16)
+
+ Outputs:
+    The structure of type cod_amrState pointed to by st is updated.
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function copes with look-ahead and calls cod_amr.
+ No input argument are passed to this function. However, before
+ calling this function, 40 new speech data should be copied to the
+ vector new_speech[]. This is a global pointer which is declared in
+ this file (it points to the end of speech buffer minus 200).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cod_amr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int cod_amr_first(cod_amrState *st,     // i/o : State struct
+                  Word16 new_speech[])  // i   : speech input (L_FRAME)
+{
+   Copy(new_speech,&st->new_speech[-L_NEXT], L_NEXT);
+   //   Copy(new_speech,st->new_speech,L_FRAME);
+
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 cod_amr_first(cod_amrState *st,     /* i/o : State struct           */
+                     Word16 new_speech[])  /* i   : speech input (L_FRAME) */
+{
+
+    oscl_memcpy(&st->new_speech[-L_NEXT], new_speech, L_NEXT*sizeof(Word16));
+
+    /*   Copy(new_speech,st->new_speech,L_FRAME); */
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cod_amr
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type cod_amrState
+    mode = AMR mode of type enum Mode
+    new_speech = pointer to buffer of length L_FRAME that contains
+             the speech input of type Word16
+    ana = pointer to the analysis parameters of type Word16
+    usedMode = pointer to the used mode of type enum Mode
+    synth = pointer to a buffer containing the local synthesis speech of
+        type Word16
+
+ Outputs:
+    The structure of type cod_amrState pointed to by st is updated.
+    The analysis parameter buffer pointed to by ana is updated.
+    The value pointed to by usedMode is updated.
+    The local synthesis speech buffer pointed to by synth is updated.
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function is the main encoder routine. It is called every 20 ms speech
+ frame, operating on the newly read 160 speech samples. It performs the
+ principle encoding functions to produce the set of encoded parameters
+ which include the LSP, adaptive codebook, and fixed codebook
+ quantization indices (addresses and gains).
+
+ Before calling this function, 160 new speech data should be copied to the
+ vector new_speech[]. This is a global pointer which is declared in
+ this file (it points to the end of speech buffer minus 160).
+
+ The outputs of the function are:
+     ana[]:     vector of analysis parameters.
+     synth[]:   Local synthesis speech (for debugging purposes)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cod_amr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int cod_amr(
+    cod_amrState *st,          // i/o : State struct
+    enum Mode mode,            // i   : AMR mode
+    Word16 new_speech[],       // i   : speech input (L_FRAME)
+    Word16 ana[],              // o   : Analysis parameters
+    enum Mode *usedMode,       // o   : used mode
+    Word16 synth[]             // o   : Local synthesis
+)
+{
+   // LPC coefficients
+   Word16 A_t[(MP1) * 4];      // A(z) unquantized for the 4 subframes
+   Word16 Aq_t[(MP1) * 4];     // A(z)   quantized for the 4 subframes
+   Word16 *A, *Aq;             // Pointer on A_t and Aq_t
+   Word16 lsp_new[M];
+
+   // Other vectors
+   Word16 xn[L_SUBFR];         // Target vector for pitch search
+   Word16 xn2[L_SUBFR];        // Target vector for codebook search
+   Word16 code[L_SUBFR];       // Fixed codebook excitation
+   Word16 y1[L_SUBFR];         // Filtered adaptive excitation
+   Word16 y2[L_SUBFR];         // Filtered fixed codebook excitation
+   Word16 gCoeff[6];           // Correlations between xn, y1, & y2:
+   Word16 res[L_SUBFR];        // Short term (LPC) prediction residual
+   Word16 res2[L_SUBFR];       // Long term (LTP) prediction residual
+
+   // Vector and scalars needed for the MR475
+   Word16 xn_sf0[L_SUBFR];     // Target vector for pitch search
+   Word16 y2_sf0[L_SUBFR];     // Filtered codebook innovation
+   Word16 code_sf0[L_SUBFR];   // Fixed codebook excitation
+   Word16 h1_sf0[L_SUBFR];     // The impulse response of sf0
+   Word16 mem_syn_save[M];     // Filter memory
+   Word16 mem_w0_save[M];      // Filter memory
+   Word16 mem_err_save[M];     // Filter memory
+   Word16 sharp_save;          // Sharpening
+   Word16 evenSubfr;           // Even subframe indicator
+   Word16 T0_sf0 = 0;          // Integer pitch lag of sf0
+   Word16 T0_frac_sf0 = 0;     // Fractional pitch lag of sf0
+   Word16 i_subfr_sf0 = 0;     // Position in exc[] for sf0
+   Word16 gain_pit_sf0;        // Quantized pitch gain for sf0
+   Word16 gain_code_sf0;       // Quantized codebook gain for sf0
+
+   // Scalars
+   Word16 i_subfr, subfrNr;
+   Word16 T_op[L_FRAME/L_FRAME_BY2];
+   Word16 T0, T0_frac;
+   Word16 gain_pit, gain_code;
+
+   // Flags
+   Word16 lsp_flag = 0;        // indicates resonance in LPC filter
+   Word16 gp_limit;            // pitch gain limit value
+   Word16 vad_flag;            // VAD decision flag
+   Word16 compute_sid_flag;    // SID analysis  flag
+
+   Copy(new_speech, st->new_speech, L_FRAME);
+
+   *usedMode = mode;
+
+   // DTX processing
+   if (st->dtx)
+   {  // no test() call since this if is only in simulation env
+      // Find VAD decision
+
+#ifdef  VAD2
+      vad_flag = vad2 (st->new_speech,    st->vadSt);
+      vad_flag = vad2 (st->new_speech+80, st->vadSt) || vad_flag;
+#else
+      vad_flag = vad1(st->vadSt, st->new_speech);
+#endif
+
+      // NB! usedMode may change here
+      compute_sid_flag = tx_dtx_handler(st->dtx_encSt,
+                                        vad_flag,
+                                        usedMode);
+   }
+   else
+   {
+      compute_sid_flag = 0;
+   }
+
+    *------------------------------------------------------------------------*
+    *  - Perform LPC analysis:                                               *
+    *       * autocorrelation + lag windowing                                *
+    *       * Levinson-durbin algorithm to find a[]                          *
+    *       * convert a[] to lsp[]                                           *
+    *       * quantize and code the LSPs                                     *
+    *       * find the interpolated LSPs and convert to a[] for all          *
+    *         subframes (both quantized and unquantized)                     *
+    *------------------------------------------------------------------------*
+
+   // LP analysis
+   lpc(st->lpcSt, mode, st->p_window, st->p_window_12k2, A_t);
+
+
+   // From A(z) to lsp. LSP quantization and interpolation
+   lsp(st->lspSt, mode, *usedMode, A_t, Aq_t, lsp_new, &ana);
+
+
+   // Buffer lsp's and energy
+   dtx_buffer(st->dtx_encSt,
+          lsp_new,
+          st->new_speech);
+
+   // Check if in DTX mode
+   if (sub(*usedMode, MRDTX) == 0)
+   {
+      dtx_enc(st->dtx_encSt,
+              compute_sid_flag,
+              st->lspSt->qSt,
+              st->gainQuantSt->gc_predSt,
+              &ana);
+
+      Set_zero(st->old_exc,    PIT_MAX + L_INTERPOL);
+      Set_zero(st->mem_w0,     M);
+      Set_zero(st->mem_err,    M);
+      Set_zero(st->zero,       L_SUBFR);
+      Set_zero(st->hvec,       L_SUBFR);    // set to zero "h1[-L_SUBFR..-1]"
+      // Reset lsp states
+      lsp_reset(st->lspSt);
+      Copy(lsp_new, st->lspSt->lsp_old, M);
+      Copy(lsp_new, st->lspSt->lsp_old_q, M);
+
+      // Reset clLtp states
+      cl_ltp_reset(st->clLtpSt);
+      st->sharp = SHARPMIN;
+   }
+   else
+   {
+       // check resonance in the filter
+      lsp_flag = check_lsp(st->tonStabSt, st->lspSt->lsp_old);
+   }
+
+    *----------------------------------------------------------------------*
+    * - Find the weighted input speech w_sp[] for the whole speech frame   *
+    * - Find the open-loop pitch delay for first 2 subframes               *
+    * - Set the range for searching closed-loop pitch in 1st subframe      *
+    * - Find the open-loop pitch delay for last 2 subframes                *
+    *----------------------------------------------------------------------*
+
+#ifdef VAD2
+   if (st->dtx)
+   {  // no test() call since this if is only in simulation env
+       st->vadSt->L_Rmax = 0;
+       st->vadSt->L_R0 = 0;
+   }
+#endif
+   for(subfrNr = 0, i_subfr = 0;
+       subfrNr < L_FRAME/L_FRAME_BY2;
+       subfrNr++, i_subfr += L_FRAME_BY2)
+   {
+      // Pre-processing on 80 samples
+      pre_big(mode, gamma1, gamma1_12k2, gamma2, A_t, i_subfr, st->speech,
+              st->mem_w, st->wsp);
+
+      if ((sub(mode, MR475) != 0) && (sub(mode, MR515) != 0))
+      {
+         // Find open loop pitch lag for two subframes
+         ol_ltp(st->pitchOLWghtSt, st->vadSt, mode, &st->wsp[i_subfr],
+                &T_op[subfrNr], st->old_lags, st->ol_gain_flg, subfrNr,
+                st->dtx);
+      }
+   }
+
+   if ((sub(mode, MR475) == 0) || (sub(mode, MR515) == 0))
+   {
+      // Find open loop pitch lag for ONE FRAME ONLY
+      // search on 160 samples
+
+      ol_ltp(st->pitchOLWghtSt, st->vadSt, mode, &st->wsp[0], &T_op[0],
+             st->old_lags, st->ol_gain_flg, 1, st->dtx);
+      T_op[1] = T_op[0];
+   }
+
+#ifdef VAD2
+   if (st->dtx)
+   {  // no test() call since this if is only in simulation env
+      LTP_flag_update(st->vadSt, mode);
+   }
+#endif
+
+#ifndef VAD2
+   // run VAD pitch detection
+   if (st->dtx)
+   {  // no test() call since this if is only in simulation env
+      vad_pitch_detection(st->vadSt, T_op);
+   }
+#endif
+
+   if (sub(*usedMode, MRDTX) == 0)
+   {
+      goto the_end;
+   }
+
+    *------------------------------------------------------------------------*
+    *          Loop for every subframe in the analysis frame                 *
+    *------------------------------------------------------------------------*
+    *  To find the pitch and innovation parameters. The subframe size is     *
+    *  L_SUBFR and the loop is repeated L_FRAME/L_SUBFR times.               *
+    *     - find the weighted LPC coefficients                               *
+    *     - find the LPC residual signal res[]                               *
+    *     - compute the target signal for pitch search                       *
+    *     - compute impulse response of weighted synthesis filter (h1[])     *
+    *     - find the closed-loop pitch parameters                            *
+    *     - encode the pitch dealy                                           *
+    *     - update the impulse response h1[] by including fixed-gain pitch   *
+    *     - find target vector for codebook search                           *
+    *     - codebook search                                                  *
+    *     - encode codebook address                                          *
+    *     - VQ of pitch and codebook gains                                   *
+    *     - find synthesis speech                                            *
+    *     - update states of weighting filter                                *
+    *------------------------------------------------------------------------*
+
+   A = A_t;      // pointer to interpolated LPC parameters
+   Aq = Aq_t;    // pointer to interpolated quantized LPC parameters
+
+   evenSubfr = 0;
+   subfrNr = -1;
+   for (i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
+   {
+      subfrNr = add(subfrNr, 1);
+      evenSubfr = sub(1, evenSubfr);
+
+      // Save states for the MR475 mode
+      if ((evenSubfr != 0) && (sub(*usedMode, MR475) == 0))
+      {
+         Copy(st->mem_syn, mem_syn_save, M);
+         Copy(st->mem_w0, mem_w0_save, M);
+         Copy(st->mem_err, mem_err_save, M);
+         sharp_save = st->sharp;
+      }
+
+       *-----------------------------------------------------------------*
+       * - Preprocessing of subframe                                     *
+       *-----------------------------------------------------------------*
+      if (sub(*usedMode, MR475) != 0)
+      {
+         subframePreProc(*usedMode, gamma1, gamma1_12k2,
+                         gamma2, A, Aq, &st->speech[i_subfr],
+                         st->mem_err, st->mem_w0, st->zero,
+                         st->ai_zero, &st->exc[i_subfr],
+                         st->h1, xn, res, st->error);
+      }
+      else
+      { // MR475
+         subframePreProc(*usedMode, gamma1, gamma1_12k2,
+                         gamma2, A, Aq, &st->speech[i_subfr],
+                         st->mem_err, mem_w0_save, st->zero,
+                         st->ai_zero, &st->exc[i_subfr],
+                         st->h1, xn, res, st->error);
+
+         // save impulse response (modified in cbsearch)
+         if (evenSubfr != 0)
+         {
+             Copy (st->h1, h1_sf0, L_SUBFR);
+         }
+      }
+
+      // copy the LP residual (res2 is modified in the CL LTP search)
+      Copy (res, res2, L_SUBFR);
+
+
+       *-----------------------------------------------------------------*
+       * - Closed-loop LTP search                                        *
+       *-----------------------------------------------------------------*
+      cl_ltp(st->clLtpSt, st->tonStabSt, *usedMode, i_subfr, T_op, st->h1,
+             &st->exc[i_subfr], res2, xn, lsp_flag, xn2, y1,
+             &T0, &T0_frac, &gain_pit, gCoeff, &ana,
+             &gp_limit);
+
+      // update LTP lag history
+      if ((subfrNr == 0) && (st->ol_gain_flg[0] > 0))
+      {
+         st->old_lags[1] = T0;
+      }
+
+      if ((sub(subfrNr, 3) == 0) && (st->ol_gain_flg[1] > 0))
+      {
+         st->old_lags[0] = T0;
+      }
+
+
+       *-----------------------------------------------------------------*
+       * - Inovative codebook search (find index and gain)               *
+       *-----------------------------------------------------------------*
+      cbsearch(xn2, st->h1, T0, st->sharp, gain_pit, res2,
+               code, y2, &ana, *usedMode, subfrNr);
+
+       *------------------------------------------------------*
+       * - Quantization of gains.                             *
+       *------------------------------------------------------*
+      gainQuant(st->gainQuantSt, *usedMode, res, &st->exc[i_subfr], code,
+                xn, xn2,  y1, y2, gCoeff, evenSubfr, gp_limit,
+                &gain_pit_sf0, &gain_code_sf0,
+                &gain_pit, &gain_code, &ana);
+
+      // update gain history
+      update_gp_clipping(st->tonStabSt, gain_pit);
+
+      if (sub(*usedMode, MR475) != 0)
+      {
+         // Subframe Post Porcessing
+         subframePostProc(st->speech, *usedMode, i_subfr, gain_pit,
+                          gain_code, Aq, synth, xn, code, y1, y2, st->mem_syn,
+                          st->mem_err, st->mem_w0, st->exc, &st->sharp);
+      }
+      else
+      {
+         if (evenSubfr != 0)
+         {
+            i_subfr_sf0 = i_subfr;
+            Copy(xn, xn_sf0, L_SUBFR);
+            Copy(y2, y2_sf0, L_SUBFR);
+            Copy(code, code_sf0, L_SUBFR);
+            T0_sf0 = T0;
+            T0_frac_sf0 = T0_frac;
+
+            // Subframe Post Porcessing
+            subframePostProc(st->speech, *usedMode, i_subfr, gain_pit,
+                             gain_code, Aq, synth, xn, code, y1, y2,
+                             mem_syn_save, st->mem_err, mem_w0_save,
+                             st->exc, &st->sharp);
+            st->sharp = sharp_save;
+         }
+         else
+         {
+            // update both subframes for the MR475
+
+            // Restore states for the MR475 mode
+            Copy(mem_err_save, st->mem_err, M);
+
+            // re-build excitation for sf 0
+            Pred_lt_3or6(&st->exc[i_subfr_sf0], T0_sf0, T0_frac_sf0,
+                         L_SUBFR, 1);
+            Convolve(&st->exc[i_subfr_sf0], h1_sf0, y1, L_SUBFR);
+
+            Aq -= MP1;
+            subframePostProc(st->speech, *usedMode, i_subfr_sf0,
+                             gain_pit_sf0, gain_code_sf0, Aq,
+                             synth, xn_sf0, code_sf0, y1, y2_sf0,
+                             st->mem_syn, st->mem_err, st->mem_w0, st->exc,
+                             &sharp_save); // overwrites sharp_save
+            Aq += MP1;
+
+            // re-run pre-processing to get xn right (needed by postproc)
+            // (this also reconstructs the unsharpened h1 for sf 1)
+            subframePreProc(*usedMode, gamma1, gamma1_12k2,
+                            gamma2, A, Aq, &st->speech[i_subfr],
+                            st->mem_err, st->mem_w0, st->zero,
+                            st->ai_zero, &st->exc[i_subfr],
+                            st->h1, xn, res, st->error);
+
+            // re-build excitation sf 1 (changed if lag < L_SUBFR)
+            Pred_lt_3or6(&st->exc[i_subfr], T0, T0_frac, L_SUBFR, 1);
+            Convolve(&st->exc[i_subfr], st->h1, y1, L_SUBFR);
+
+            subframePostProc(st->speech, *usedMode, i_subfr, gain_pit,
+                             gain_code, Aq, synth, xn, code, y1, y2,
+                             st->mem_syn, st->mem_err, st->mem_w0,
+                             st->exc, &st->sharp);
+         }
+      }
+
+
+      A += MP1;    // interpolated LPC parameters for next subframe
+      Aq += MP1;
+   }
+
+   Copy(&st->old_exc[L_FRAME], &st->old_exc[0], PIT_MAX + L_INTERPOL);
+
+the_end:
+
+    *--------------------------------------------------*
+    * Update signal for next frame.                    *
+    *--------------------------------------------------*
+   Copy(&st->old_wsp[L_FRAME], &st->old_wsp[0], PIT_MAX);
+
+   Copy(&st->old_speech[L_FRAME], &st->old_speech[0], L_TOTAL - L_FRAME);
+
+   return 0;
+}
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 cod_amr(
+    cod_amrState *st,          /* i/o : State struct                   */
+    enum Mode mode,            /* i   : AMR mode                       */
+    Word16 new_speech[],       /* i   : speech input (L_FRAME)         */
+    Word16 ana[],              /* o   : Analysis parameters            */
+    enum Mode *usedMode,       /* o   : used mode                      */
+    Word16 synth[]            /* o   : Local synthesis                */
+)
+{
+    /* LPC coefficients */
+    Word16 A_t[(MP1) * 4];      /* A(z) unquantized for the 4 subframes */
+    Word16 Aq_t[(MP1) * 4];     /* A(z)   quantized for the 4 subframes */
+    Word16 *A, *Aq;             /* Pointer on A_t and Aq_t              */
+    Word16 lsp_new[M];
+
+    /* Other vectors */
+    Word16 xn[L_SUBFR];         /* Target vector for pitch search       */
+    Word16 xn2[L_SUBFR];        /* Target vector for codebook search    */
+    Word16 code[L_SUBFR];       /* Fixed codebook excitation            */
+    Word16 y1[L_SUBFR];         /* Filtered adaptive excitation         */
+    Word16 y2[L_SUBFR];         /* Filtered fixed codebook excitation   */
+    Word16 gCoeff[6];           /* Correlations between xn, y1, & y2:   */
+    Word16 res[L_SUBFR];        /* Short term (LPC) prediction residual */
+    Word16 res2[L_SUBFR];       /* Long term (LTP) prediction residual  */
+
+    /* Vector and scalars needed for the MR475 */
+    Word16 xn_sf0[L_SUBFR];     /* Target vector for pitch search       */
+    Word16 y2_sf0[L_SUBFR];     /* Filtered codebook innovation         */
+    Word16 code_sf0[L_SUBFR];   /* Fixed codebook excitation            */
+    Word16 h1_sf0[L_SUBFR];     /* The impulse response of sf0          */
+    Word16 mem_syn_save[M];     /* Filter memory                        */
+    Word16 mem_w0_save[M];      /* Filter memory                        */
+    Word16 mem_err_save[M];     /* Filter memory                        */
+    Word16 sharp_save;          /* Sharpening                           */
+    Word16 evenSubfr;           /* Even subframe indicator              */
+    Word16 T0_sf0 = 0;          /* Integer pitch lag of sf0             */
+    Word16 T0_frac_sf0 = 0;     /* Fractional pitch lag of sf0          */
+    Word16 i_subfr_sf0 = 0;     /* Position in exc[] for sf0            */
+    Word16 gain_pit_sf0;        /* Quantized pitch gain for sf0         */
+    Word16 gain_code_sf0;       /* Quantized codebook gain for sf0      */
+
+    /* Scalars */
+    Word16 i_subfr, subfrNr;
+    Word16 T_op[L_FRAME/L_FRAME_BY2];
+    Word16 T0, T0_frac;
+    Word16 gain_pit, gain_code;
+
+    /* Flags */
+    Word16 lsp_flag = 0;        /* indicates resonance in LPC filter    */
+    Word16 gp_limit;            /* pitch gain limit value               */
+    Word16 vad_flag;            /* VAD decision flag                    */
+    Word16 compute_sid_flag;    /* SID analysis  flag                   */
+    Flag   *pOverflow = &(st->overflow);     /* Overflow flag            */
+
+
+    oscl_memcpy(st->new_speech, new_speech, L_FRAME*sizeof(Word16));
+
+    *usedMode = mode;
+
+    /* DTX processing */
+    if (st->dtx)
+    {
+        /* Find VAD decision */
+#ifdef  VAD2
+        vad_flag = vad2(st->new_speech,    st->vadSt, pOverflow);
+        vad_flag = vad2(st->new_speech + 80, st->vadSt, pOverflow) || vad_flag;
+#else
+        vad_flag = vad1(st->vadSt, st->new_speech, pOverflow);
+#endif
+
+        /* NB! usedMode may change here */
+        compute_sid_flag = tx_dtx_handler(st->dtx_encSt,
+                                          vad_flag,
+                                          usedMode, pOverflow);
+    }
+    else
+    {
+        compute_sid_flag = 0;
+    }
+
+    /*------------------------------------------------------------------------*
+    *  - Perform LPC analysis:                                               *
+    *       * autocorrelation + lag windowing                                *
+    *       * Levinson-durbin algorithm to find a[]                          *
+    *       * convert a[] to lsp[]                                           *
+    *       * quantize and code the LSPs                                     *
+    *       * find the interpolated LSPs and convert to a[] for all          *
+    *         subframes (both quantized and unquantized)                     *
+    *------------------------------------------------------------------------*/
+
+    /* LP analysis */
+    lpc(st->lpcSt, mode, st->p_window, st->p_window_12k2, A_t, &(st->common_amr_tbls), pOverflow);
+
+    /* From A(z) to lsp. LSP quantization and interpolation */
+    lsp(st->lspSt, mode, *usedMode, A_t, Aq_t, lsp_new, &ana, pOverflow);
+
+    /* Buffer lsp's and energy */
+    dtx_buffer(st->dtx_encSt,
+               lsp_new,
+               st->new_speech, pOverflow);
+
+    /* Check if in DTX mode */
+
+    if (*usedMode == MRDTX)
+    {
+        dtx_enc(st->dtx_encSt,
+                compute_sid_flag,
+                st->lspSt->qSt,
+                &(st->gainQuantSt->gc_predSt),
+                &ana, pOverflow);
+
+        oscl_memset(st->old_exc, 0,   sizeof(Word16)*(PIT_MAX + L_INTERPOL));
+        oscl_memset(st->mem_w0,  0,   sizeof(Word16)*M);
+        oscl_memset(st->mem_err, 0,   sizeof(Word16)*M);
+        oscl_memset(st->zero,    0,   sizeof(Word16)*L_SUBFR);
+        oscl_memset(st->hvec,    0,   sizeof(Word16)*L_SUBFR);    /* set to zero "h1[-L_SUBFR..-1]" */
+        /* Reset lsp states */
+        lsp_reset(st->lspSt);
+
+        oscl_memcpy(st->lspSt->lsp_old,   lsp_new, M*sizeof(Word16));
+        oscl_memcpy(st->lspSt->lsp_old_q, lsp_new, M*sizeof(Word16));
+
+        /* Reset clLtp states */
+        cl_ltp_reset(st->clLtpSt);
+        st->sharp = SHARPMIN;
+    }
+    else
+    {
+        /* check resonance in the filter */
+        lsp_flag = check_lsp(st->tonStabSt, st->lspSt->lsp_old, pOverflow);
+    }
+
+    /*----------------------------------------------------------------------*
+    * - Find the weighted input speech w_sp[] for the whole speech frame   *
+    * - Find the open-loop pitch delay for first 2 subframes               *
+    * - Set the range for searching closed-loop pitch in 1st subframe      *
+    * - Find the open-loop pitch delay for last 2 subframes                *
+    *----------------------------------------------------------------------*/
+
+#ifdef VAD2
+    if (st->dtx)
+    {
+        st->vadSt->L_Rmax = 0;
+        st->vadSt->L_R0 = 0;
+    }
+#endif
+
+    for (subfrNr = 0, i_subfr = 0;
+            subfrNr < L_FRAME / L_FRAME_BY2;
+            subfrNr++, i_subfr += L_FRAME_BY2)
+    {
+        /* Pre-processing on 80 samples */
+        pre_big(mode, gamma1, gamma1_12k2, gamma2, A_t, i_subfr, st->speech,
+                st->mem_w, st->wsp, pOverflow);
+
+
+        if ((mode != MR475) && (mode != MR515))
+        {
+            /* Find open loop pitch lag for two subframes */
+            ol_ltp(st->pitchOLWghtSt, st->vadSt, mode, &st->wsp[i_subfr],
+                   &T_op[subfrNr], st->old_lags, st->ol_gain_flg, subfrNr,
+                   st->dtx, pOverflow);
+        }
+    }
+
+    if ((mode == MR475) || (mode == MR515))
+    {
+        /* Find open loop pitch lag for ONE FRAME ONLY */
+        /* search on 160 samples */
+
+        ol_ltp(st->pitchOLWghtSt, st->vadSt, mode, &st->wsp[0], &T_op[0],
+               st->old_lags, st->ol_gain_flg, 1, st->dtx, pOverflow);
+        T_op[1] = T_op[0];
+    }
+
+#ifdef VAD2
+    if (st->dtx)
+    {
+        LTP_flag_update(st->vadSt, (Word16) mode, pOverflow);
+    }
+#endif
+
+#ifndef VAD2
+    /* run VAD pitch detection */
+    if (st->dtx)
+    {
+        vad_pitch_detection(st->vadSt, T_op, pOverflow);
+    }
+#endif
+
+    if (*usedMode == MRDTX)
+    {
+        goto the_end;
+    }
+
+    /*------------------------------------------------------------------------*
+    *          Loop for every subframe in the analysis frame                 *
+    *------------------------------------------------------------------------*
+    *  To find the pitch and innovation parameters. The subframe size is     *
+    *  L_SUBFR and the loop is repeated L_FRAME/L_SUBFR times.               *
+    *     - find the weighted LPC coefficients                               *
+    *     - find the LPC residual signal res[]                               *
+    *     - compute the target signal for pitch search                       *
+    *     - compute impulse response of weighted synthesis filter (h1[])     *
+    *     - find the closed-loop pitch parameters                            *
+    *     - encode the pitch dealy                                           *
+    *     - update the impulse response h1[] by including fixed-gain pitch   *
+    *     - find target vector for codebook search                           *
+    *     - codebook search                                                  *
+    *     - encode codebook address                                          *
+    *     - VQ of pitch and codebook gains                                   *
+    *     - find synthesis speech                                            *
+    *     - update states of weighting filter                                *
+    *------------------------------------------------------------------------*/
+
+    A = A_t;      /* pointer to interpolated LPC parameters */
+    Aq = Aq_t;    /* pointer to interpolated quantized LPC parameters */
+
+    evenSubfr = 0;
+    subfrNr = -1;
+    for (i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
+    {
+        subfrNr++;
+        evenSubfr = 1 - evenSubfr;
+
+        /* Save states for the MR475 mode */
+
+        if ((evenSubfr != 0) && (*usedMode == MR475))
+        {
+            oscl_memcpy(mem_syn_save, st->mem_syn, M*sizeof(Word16));
+            oscl_memcpy(mem_w0_save, st->mem_w0, M*sizeof(Word16));
+            oscl_memcpy(mem_err_save, st->mem_err, M*sizeof(Word16));
+
+            sharp_save = st->sharp;
+        }
+
+        /*-----------------------------------------------------------------*
+        * - Preprocessing of subframe                                     *
+        *-----------------------------------------------------------------*/
+
+        if (*usedMode != MR475)
+        {
+            subframePreProc(*usedMode, gamma1, gamma1_12k2,
+                            gamma2, A, Aq, &st->speech[i_subfr],
+                            st->mem_err, st->mem_w0, st->zero,
+                            st->ai_zero, &st->exc[i_subfr],
+                            st->h1, xn, res, st->error);
+        }
+        else
+        { /* MR475 */
+            subframePreProc(*usedMode, gamma1, gamma1_12k2,
+                            gamma2, A, Aq, &st->speech[i_subfr],
+                            st->mem_err, mem_w0_save, st->zero,
+                            st->ai_zero, &st->exc[i_subfr],
+                            st->h1, xn, res, st->error);
+
+            /* save impulse response (modified in cbsearch) */
+
+            if (evenSubfr != 0)
+            {
+                oscl_memcpy(h1_sf0, st->h1, L_SUBFR*sizeof(Word16));
+
+            }
+        }
+
+        /* copy the LP residual (res2 is modified in the CL LTP search)    */
+        oscl_memcpy(res2, res, L_SUBFR*sizeof(Word16));
+
+        /*-----------------------------------------------------------------*
+        * - Closed-loop LTP search                                        *
+        *-----------------------------------------------------------------*/
+        cl_ltp(st->clLtpSt, st->tonStabSt, *usedMode, i_subfr, T_op, st->h1,
+               &st->exc[i_subfr], res2, xn, lsp_flag, xn2, y1,
+               &T0, &T0_frac, &gain_pit, gCoeff, &ana,
+               &gp_limit, st->common_amr_tbls.qua_gain_pitch_ptr, pOverflow);
+
+        /* update LTP lag history */
+
+        if ((subfrNr == 0) && (st->ol_gain_flg[0] > 0))
+        {
+            st->old_lags[1] = T0;
+        }
+
+
+        if ((subfrNr == 3) && (st->ol_gain_flg[1] > 0))
+        {
+            st->old_lags[0] = T0;
+        }
+
+        /*-----------------------------------------------------------------*
+        * - Inovative codebook search (find index and gain)               *
+        *-----------------------------------------------------------------*/
+        cbsearch(xn2, st->h1, T0, st->sharp, gain_pit, res2,
+                 code, y2, &ana, *usedMode, subfrNr, &(st->common_amr_tbls), pOverflow);
+
+        /*------------------------------------------------------*
+        * - Quantization of gains.                             *
+        *------------------------------------------------------*/
+        gainQuant(st->gainQuantSt, *usedMode, res, &st->exc[i_subfr], code,
+                  xn, xn2,  y1, y2, gCoeff, evenSubfr, gp_limit,
+                  &gain_pit_sf0, &gain_code_sf0,
+                  &gain_pit, &gain_code, &ana, &(st->common_amr_tbls), pOverflow);
+
+        /* update gain history */
+        update_gp_clipping(st->tonStabSt, gain_pit, pOverflow);
+
+
+        if (*usedMode != MR475)
+        {
+            /* Subframe Post Porcessing */
+            subframePostProc(st->speech, *usedMode, i_subfr, gain_pit,
+                             gain_code, Aq, synth, xn, code, y1, y2, st->mem_syn,
+                             st->mem_err, st->mem_w0, st->exc, &st->sharp, pOverflow);
+        }
+        else
+        {
+
+            if (evenSubfr != 0)
+            {
+                i_subfr_sf0 = i_subfr;
+
+                oscl_memcpy(xn_sf0, xn, L_SUBFR*sizeof(Word16));
+                oscl_memcpy(y2_sf0, y2, L_SUBFR*sizeof(Word16));
+                oscl_memcpy(code_sf0, code, L_SUBFR*sizeof(Word16));
+
+                T0_sf0 = T0;
+                T0_frac_sf0 = T0_frac;
+
+                /* Subframe Post Porcessing */
+                subframePostProc(st->speech, *usedMode, i_subfr, gain_pit,
+                                 gain_code, Aq, synth, xn, code, y1, y2,
+                                 mem_syn_save, st->mem_err, mem_w0_save,
+                                 st->exc, &st->sharp, pOverflow);
+                st->sharp = sharp_save;
+            }
+            else
+            {
+                /* update both subframes for the MR475 */
+
+                /* Restore states for the MR475 mode */
+                oscl_memcpy(st->mem_err, mem_err_save, M*sizeof(Word16));
+
+
+                /* re-build excitation for sf 0 */
+                Pred_lt_3or6(&st->exc[i_subfr_sf0], T0_sf0, T0_frac_sf0,
+                             L_SUBFR, 1, pOverflow);
+                Convolve(&st->exc[i_subfr_sf0], h1_sf0, y1, L_SUBFR);
+
+                Aq -= MP1;
+                subframePostProc(st->speech, *usedMode, i_subfr_sf0,
+                                 gain_pit_sf0, gain_code_sf0, Aq,
+                                 synth, xn_sf0, code_sf0, y1, y2_sf0,
+                                 st->mem_syn, st->mem_err, st->mem_w0, st->exc,
+                                 &sharp_save, pOverflow); /* overwrites sharp_save */
+                Aq += MP1;
+
+                /* re-run pre-processing to get xn right (needed by postproc) */
+                /* (this also reconstructs the unsharpened h1 for sf 1)       */
+                subframePreProc(*usedMode, gamma1, gamma1_12k2,
+                                gamma2, A, Aq, &st->speech[i_subfr],
+                                st->mem_err, st->mem_w0, st->zero,
+                                st->ai_zero, &st->exc[i_subfr],
+                                st->h1, xn, res, st->error);
+
+                /* re-build excitation sf 1 (changed if lag < L_SUBFR) */
+                Pred_lt_3or6(&st->exc[i_subfr], T0, T0_frac, L_SUBFR, 1, pOverflow);
+                Convolve(&st->exc[i_subfr], st->h1, y1, L_SUBFR);
+
+                subframePostProc(st->speech, *usedMode, i_subfr, gain_pit,
+                                 gain_code, Aq, synth, xn, code, y1, y2,
+                                 st->mem_syn, st->mem_err, st->mem_w0,
+                                 st->exc, &st->sharp, pOverflow);
+            }
+        }
+
+        A += MP1;    /* interpolated LPC parameters for next subframe */
+        Aq += MP1;
+    }
+
+    oscl_memcpy(&st->old_exc[0], &st->old_exc[L_FRAME], (PIT_MAX + L_INTERPOL)*sizeof(Word16));
+
+the_end:
+
+    /*--------------------------------------------------*
+    * Update signal for next frame.                    *
+    *--------------------------------------------------*/
+
+    oscl_memcpy(&st->old_wsp[0], &st->old_wsp[L_FRAME], PIT_MAX*sizeof(Word16));
+    oscl_memcpy(&st->old_speech[0], &st->old_speech[L_FRAME], (L_TOTAL - L_FRAME)*sizeof(Word16));
+
+    return(0);
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.h
new file mode 100644 (file)
index 0000000..4eb6015
--- /dev/null
@@ -0,0 +1,264 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: cod_amr.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+       File             : cod_amr.h
+       Purpose          : Main encoder routine operating on a frame basis.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef cod_amr_h
+#define cod_amr_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "mode.h"
+#include "lpc.h"
+#include "lsp.h"
+#include "cl_ltp.h"
+#include "gain_q.h"
+#include "p_ol_wgh.h"
+#include "ton_stab.h"
+#include "vad.h"
+#include "dtx_enc.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    /*-----------------------------------------------------------*
+     *    Coder constant parameters (defined in "cnst.h")        *
+     *-----------------------------------------------------------*
+     *   L_WINDOW    : LPC analysis window size.                 *
+     *   L_NEXT      : Samples of next frame needed for autocor. *
+     *   L_FRAME     : Frame size.                               *
+     *   L_FRAME_BY2 : Half the frame size.                      *
+     *   L_SUBFR     : Sub-frame size.                           *
+     *   M           : LPC order.                                *
+     *   MP1         : LPC order+1                               *
+     *   L_TOTAL7k4  : Total size of speech buffer.              *
+     *   PIT_MIN7k4  : Minimum pitch lag.                        *
+     *   PIT_MAX     : Maximum pitch lag.                        *
+     *   L_INTERPOL  : Length of filter for interpolation        *
+     *-----------------------------------------------------------*/
+    typedef struct
+    {
+        /* Speech vector */
+        Word16 old_speech[L_TOTAL];
+        Word16 *speech, *p_window, *p_window_12k2;
+        Word16 *new_speech;             /* Global variable */
+
+        /* Weight speech vector */
+        Word16 old_wsp[L_FRAME + PIT_MAX];
+        Word16 *wsp;
+
+        /* OL LTP states */
+        Word16 old_lags[5];
+        Word16 ol_gain_flg[2];
+
+        /* Excitation vector */
+        Word16 old_exc[L_FRAME + PIT_MAX + L_INTERPOL];
+        Word16 *exc;
+
+        /* Zero vector */
+        Word16 ai_zero[L_SUBFR + MP1];
+        Word16 *zero;
+
+        /* Impulse response vector */
+        Word16 *h1;
+        Word16 hvec[L_SUBFR * 2];
+
+        /* Substates */
+        lpcState   *lpcSt;
+        lspState   *lspSt;
+        clLtpState *clLtpSt;
+        gainQuantState  *gainQuantSt;
+        pitchOLWghtState *pitchOLWghtSt;
+        tonStabState *tonStabSt;
+        vadState *vadSt;
+        Flag dtx;
+        dtx_encState *dtx_encSt;
+
+        /* Filter's memory */
+        Word16 mem_syn[M], mem_w0[M], mem_w[M];
+        Word16 mem_err[M + L_SUBFR], *error;
+
+        Word16 sharp;
+
+        /* tables from amr common lib */
+        CommonAmrTbls common_amr_tbls;
+
+        /* Overflow flag */
+        Flag   overflow;
+
+    } cod_amrState;
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    /*
+    **************************************************************************
+    *
+    *  Function    : cod_amr_init
+    *  Purpose     : Allocates memory and initializes state variables
+    *  Description : Stores pointer to filter status struct in *st. This
+    *                pointer has to be passed to cod_amr in each call.
+    *                 - initilize pointers to speech buffer
+    *                 - initialize static  pointers
+    *                 - set static vectors to zero
+    *  Returns     : 0 on success
+    *
+    **************************************************************************
+    */
+    Word16 cod_amr_init(cod_amrState **st, Flag dtx);
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : cod_amr_reset
+    *  Purpose     : Resets state memory
+    *  Returns     : 0 on success
+    *
+    **************************************************************************
+    */
+    Word16 cod_amr_reset(cod_amrState *st);
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : cod_amr_exit
+    *  Purpose     : The memory used for state memory is freed
+    *  Description : Stores NULL in *st
+    *
+    **************************************************************************
+    */
+    void cod_amr_exit(cod_amrState **st);
+
+    /***************************************************************************
+     *   FUNCTION:   cod_amr_first
+     *
+     *   PURPOSE:  Copes with look-ahead.
+     *
+     *   INPUTS:
+     *       No input argument are passed to this function. However, before
+     *       calling this function, 40 new speech data should be copied to the
+     *       vector new_speech[]. This is a global pointer which is declared in
+     *       this file (it points to the end of speech buffer minus 200).
+     *
+     ***************************************************************************/
+
+    Word16 cod_amr_first(cod_amrState *st,     /* i/o : State struct            */
+                         Word16 new_speech[]   /* i   : speech input (L_FRAME)  */
+                        );
+
+    /***************************************************************************
+     *   FUNCTION:   cod_amr
+     *
+     *   PURPOSE:  Main encoder routine.
+     *
+     *   DESCRIPTION: This function is called every 20 ms speech frame,
+     *       operating on the newly read 160 speech samples. It performs the
+     *       principle encoding functions to produce the set of encoded parameters
+     *       which include the LSP, adaptive codebook, and fixed codebook
+     *       quantization indices (addresses and gains).
+     *
+     *   INPUTS:
+     *       No input argument are passed to this function. However, before
+     *       calling this function, 160 new speech data should be copied to the
+     *       vector new_speech[]. This is a global pointer which is declared in
+     *       this file (it points to the end of speech buffer minus 160).
+     *
+     *   OUTPUTS:
+     *
+     *       ana[]:     vector of analysis parameters.
+     *       synth[]:   Local synthesis speech (for debugging purposes)
+     *
+     ***************************************************************************/
+
+    Word16 cod_amr(cod_amrState *st,         /* i/o : State struct                 */
+                   enum Mode mode,           /* i   : AMR mode                     */
+                   Word16 new_speech[],      /* i   : speech input (L_FRAME)       */
+                   Word16 ana[],             /* o   : Analysis parameters          */
+                   enum Mode *usedMode,      /* o   : used mode                    */
+                   Word16 synth[]            /* o   : Local synthesis              */
+                  );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _cod_amr_h_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp
new file mode 100644 (file)
index 0000000..e1471d6
--- /dev/null
@@ -0,0 +1,188 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: convolve.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "convolve.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Convolve
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    x = pointer to input vector of L elements of type Word16
+    h = pointer to the filter's impulse response vector of L elements
+        of type Word16
+    y = pointer to the output vector of L elements of type Word16 used for
+        storing the convolution of x and h;
+    L = Length of the convolution; type definition is Word16
+
+ Outputs:
+    y buffer contains the new convolution output
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Perform the convolution between two vectors x[] and h[] and write the result
+ in the vector y[]. All vectors are of length L and only the first L samples
+ of the convolution are computed.
+
+ The convolution is given by:
+
+    y[n] = sum_{i=0}^{n} x[i] h[n-i],        n=0,...,L-1
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ convolve.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Convolve (
+    Word16 x[],        // (i)     : input vector
+    Word16 h[],        // (i)     : impulse response
+    Word16 y[],        // (o)     : output vector
+    Word16 L           // (i)     : vector size
+)
+{
+    Word16 i, n;
+    Word32 s;
+
+    for (n = 0; n < L; n++)
+    {
+        s = 0;                  move32 ();
+        for (i = 0; i <= n; i++)
+        {
+            s = L_mac (s, x[i], h[n - i]);
+        }
+        s = L_shl (s, 3);
+        y[n] = extract_h (s);   move16 ();
+    }
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Convolve(
+    Word16 x[],        /* (i)     : input vector                           */
+    Word16 h[],        /* (i)     : impulse response                       */
+    Word16 y[],        /* (o)     : output vector                          */
+    Word16 L           /* (i)     : vector size                            */
+)
+{
+    register Word16 i, n;
+    Word32 s1, s2;
+
+
+    for (n = 1; n < L; n = n + 2)
+    {
+
+        h = h + n;
+
+        s2 = ((Word32) * (x)) * *(h--);
+        s1 = ((Word32) * (x++)) * *(h);
+
+        for (i = (n - 1) >> 1; i != 0; i--)
+        {
+            s2 = amrnb_fxp_mac_16_by_16bb((Word32) * (x), (Word32) * (h--), s2);
+            s1 = amrnb_fxp_mac_16_by_16bb((Word32) * (x++), (Word32) * (h), s1);
+            s2 = amrnb_fxp_mac_16_by_16bb((Word32) * (x), (Word32) * (h--), s2);
+            s1 = amrnb_fxp_mac_16_by_16bb((Word32) * (x++), (Word32) * (h), s1);
+        }
+
+        s2 = amrnb_fxp_mac_16_by_16bb((Word32) * (x), (Word32) * (h), s2);
+
+        *(y++) = (Word16)(s1 >> 12);
+        *(y++) = (Word16)(s2 >> 12);
+
+        x = x - n;
+
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.h
new file mode 100644 (file)
index 0000000..1f2b503
--- /dev/null
@@ -0,0 +1,83 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : convolve.h
+*      Purpose          : Perform the convolution between two vectors x[]
+*                       : and h[] and write the result in the vector y[].
+*                       : All vectors are of length L and only the first
+*                       : L samples of the convolution are computed.
+*
+********************************************************************************
+*/
+#ifndef convolve_h
+#define convolve_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    ********************************************************************************
+    */
+
+    /*
+    ********************************************************************************
+    *                         DECLARATION OF PROTOTYPES
+    ********************************************************************************
+    */
+    void Convolve(
+        Word16 x[],        /* (i)  : input vector                               */
+        Word16 h[],        /* (i)  : impulse response                           */
+        Word16 y[],        /* (o)  : output vector                              */
+        Word16 L           /* (i)  : vector size                                */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp
new file mode 100644 (file)
index 0000000..32fbdd1
--- /dev/null
@@ -0,0 +1,350 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: cor_h.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "cnst.h"
+#include "cor_h.h"
+#include "basicop_malloc.h"
+#include "inv_sqrt.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cor_h
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    h = vector containing the impulse response of the weighted synthesis
+        filter; vector contents are of type Word16; vector length is
+        2 * L_SUBFR
+    sign = vector containing the sign information for the correlation
+           values; vector contents are of type Word16; vector length is
+           L_CODE
+    rr = autocorrelation matrix; matrix contents are of type Word16;
+         matrix dimension is L_CODE by L_CODE
+
+ Outputs:
+    rr contents are the newly calculated autocorrelation values
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes correlations of the impulse response (h) needed for
+ the codebook search, and includes the sign information into the correlations.
+
+ The correlations are given by:
+    rr[i][j] = sum_{n=i}^{L-1} h[n-i] h[n-j];   i>=j; i,j=0,...,L-1
+
+ The sign information is included by:
+    rr[i][j] = rr[i][j]*sign[i]*sign[j]
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cor_h.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void cor_h (
+    Word16 h[],         // (i) : impulse response of weighted synthesis
+                                 filter
+    Word16 sign[],      // (i) : sign of d[n]
+    Word16 rr[][L_CODE] // (o) : matrix of autocorrelation
+)
+{
+    Word16 i, j, k, dec, h2[L_CODE];
+    Word32 s;
+
+    // Scaling for maximum precision
+
+    s = 2;
+    for (i = 0; i < L_CODE; i++)
+        s = L_mac (s, h[i], h[i]);
+
+    j = sub (extract_h (s), 32767);
+    if (j == 0)
+    {
+        for (i = 0; i < L_CODE; i++)
+        {
+            h2[i] = shr (h[i], 1);
+        }
+    }
+    else
+    {
+        s = L_shr (s, 1);
+        k = extract_h (L_shl (Inv_sqrt (s), 7));
+        k = mult (k, 32440);                     // k = 0.99*k
+
+        for (i = 0; i < L_CODE; i++)
+        {
+            h2[i] = pv_round (L_shl (L_mult (h[i], k), 9));
+        }
+    }
+
+    // build matrix rr[]
+    s = 0;
+    i = L_CODE - 1;
+    for (k = 0; k < L_CODE; k++, i--)
+    {
+        s = L_mac (s, h2[k], h2[k]);
+        rr[i][i] = pv_round (s);
+    }
+
+    for (dec = 1; dec < L_CODE; dec++)
+    {
+        s = 0;
+        j = L_CODE - 1;
+        i = sub (j, dec);
+        for (k = 0; k < (L_CODE - dec); k++, i--, j--)
+        {
+            s = L_mac (s, h2[k], h2[k + dec]);
+            rr[j][i] = mult (pv_round (s), mult (sign[i], sign[j]));
+            rr[i][j] = rr[j][i];
+        }
+    }
+}
+
+---------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void cor_h(
+    Word16 h[],          /* (i) : impulse response of weighted synthesis
+                                  filter                                  */
+    Word16 sign[],       /* (i) : sign of d[n]                            */
+    Word16 rr[][L_CODE], /* (o) : matrix of autocorrelation               */
+    Flag  *pOverflow
+)
+{
+    register Word16 i;
+    register Word16 dec;
+
+    Word16 h2[L_CODE];
+    Word32 s;
+    Word32 s2;
+    Word16 tmp1;
+    Word16 tmp2;
+    Word16 tmp11;
+    Word16 tmp22;
+
+    Word16 *p_h;
+    Word16 *p_h2;
+    Word16 *rr1;
+    Word16 *rr2;
+    Word16 *rr3;
+    Word16 *p_rr_ref1;
+    Word16 *p_sign1;
+    Word16 *p_sign2;
+
+    /* Scaling for maximum precision */
+
+    /* Initialize accumulator to 1 since left shift happens    */
+    /* after the accumulation of the sum of squares (original  */
+    /* code initialized s to 2)                                */
+    s = 1;
+    p_h = h;
+
+    for (i = (L_CODE >> 1); i != 0 ; i--)
+    {
+        tmp1 = *(p_h++);
+        s = amrnb_fxp_mac_16_by_16bb((Word32) tmp1, (Word32) tmp1, s);
+        tmp1 = *(p_h++);
+        s = amrnb_fxp_mac_16_by_16bb((Word32) tmp1, (Word32) tmp1, s);
+
+    }
+
+    s <<= 1;
+
+    if (s & MIN_32)
+    {
+        p_h2 = h2;
+        p_h  = h;
+
+        for (i = (L_CODE >> 1); i != 0; i--)
+        {
+            *(p_h2++) =  *(p_h++)  >> 1;
+            *(p_h2++) =  *(p_h++)  >> 1;
+        }
+    }
+    else
+    {
+
+        s >>= 1;
+
+        s = Inv_sqrt(s, pOverflow);
+
+        if (s < (Word32) 0x00ffffffL)
+        {
+            /* k = 0.99*k */
+            dec = (Word16)(((s >> 9) * 32440) >> 15);
+        }
+        else
+        {
+            dec = 32440;  /* 0.99 */
+        }
+
+        p_h  = h;
+        p_h2 = h2;
+
+        for (i = (L_CODE >> 1); i != 0; i--)
+        {
+            *(p_h2++) = (Word16)((amrnb_fxp_mac_16_by_16bb((Word32) * (p_h++), (Word32) dec, 0x020L)) >> 6);
+            *(p_h2++) = (Word16)((amrnb_fxp_mac_16_by_16bb((Word32) * (p_h++), (Word32) dec, 0x020L)) >> 6);
+        }
+    }
+    /* build matrix rr[] */
+
+    s = 0;
+
+    p_h2 = h2;
+
+    rr1 = &rr[L_CODE-1][L_CODE-1];
+
+    for (i = L_CODE >> 1; i != 0 ; i--)
+    {
+        tmp1   = *(p_h2++);
+        s = amrnb_fxp_mac_16_by_16bb((Word32) tmp1, (Word32) tmp1, s);
+        *rr1 = (Word16)((s + 0x00004000L) >> 15);
+        rr1 -= (L_CODE + 1);
+        tmp1   = *(p_h2++);
+        s = amrnb_fxp_mac_16_by_16bb((Word32) tmp1, (Word32) tmp1, s);
+        *rr1 = (Word16)((s + 0x00004000L) >> 15);
+        rr1 -= (L_CODE + 1);
+    }
+
+
+    p_rr_ref1 = rr[L_CODE-1];
+
+    for (dec = 1; dec < L_CODE; dec += 2)
+    {
+        rr1 = &p_rr_ref1[L_CODE-1-dec];
+
+        rr2 = &rr[L_CODE-1-dec][L_CODE-1];
+        rr3 = &rr[L_CODE-1-(dec+1)][L_CODE-1];
+
+        s  = 0;
+        s2 = 0;
+
+        p_sign1 = &sign[L_CODE - 1];
+        p_sign2 = &sign[L_CODE - 1 - dec];
+
+        p_h2 = h2;
+        p_h  = &h2[dec];
+
+        for (i = (L_CODE - dec - 1); i != 0 ; i--)
+        {
+            s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_h2), (Word32) * (p_h++), s);
+            s2 = amrnb_fxp_mac_16_by_16bb((Word32) * (p_h2++), (Word32) * (p_h), s2);
+
+            tmp1  = (Word16)((s + 0x00004000L) >> 15);
+            tmp11 = (Word16)((s2 + 0x00004000L) >> 15);
+
+            tmp2  = ((Word32) * (p_sign1) * *(p_sign2--)) >> 15;
+            tmp22 = ((Word32) * (p_sign1--) * *(p_sign2)) >> 15;
+
+            *rr2 = ((Word32) tmp1 * tmp2) >> 15;
+            *(rr1--) = *rr2;
+            *rr1 = ((Word32) tmp11 * tmp22) >> 15;
+            *rr3 = *rr1;
+
+            rr1 -= (L_CODE);
+            rr2 -= (L_CODE + 1);
+            rr3 -= (L_CODE + 1);
+
+        }
+
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_h2), (Word32) * (p_h), s);
+
+        tmp1 = (Word16)((s + 0x00004000L) >> 15);
+
+        tmp2 = ((Word32) * (p_sign1) * *(p_sign2)) >> 15;
+        *rr1 = ((Word32) tmp1 * tmp2) >> 15;
+
+        *rr2 = *rr1;
+
+        rr1 -= (L_CODE + 1);
+        rr2 -= (L_CODE + 1);
+
+    }
+
+    return;
+
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.h
new file mode 100644 (file)
index 0000000..59b9d68
--- /dev/null
@@ -0,0 +1,96 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef COR_H_H
+#define COR_H_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+#include "cor_h_x.h"                /* Used by legacy files */
+#include "cor_h_x2.h"               /* Used by legacy files */
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void cor_h(
+        Word16 h[],          /* (i) : impulse response of weighted synthesis
+                                  filter                                  */
+        Word16 sign[],       /* (i) : sign of d[n]                            */
+        Word16 rr[][L_CODE], /* (o) : matrix of autocorrelation               */
+        Flag  *pOverflow
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp
new file mode 100644 (file)
index 0000000..7bb54bb
--- /dev/null
@@ -0,0 +1,273 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: cor_h_x.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "cor_h_x.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cor_h_x
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    h = vector containing the impulse response of the weighted synthesis
+        filter; vector contents are of type Word16; vector length is
+        2 * L_SUBFR
+    x = target signal vector; vector contents are of type Word16; vector
+        length is L_SUBFR
+    dn = vector containing the correlation between the target and the
+         impulse response; vector contents are of type Word16; vector
+         length is L_CODE
+    sf = scaling factor of type Word16 ; 2 when mode is MR122, 1 for all
+         other modes
+
+ Outputs:
+    dn contents are the newly calculated correlation values
+
+    pOverflow = pointer of type Flag * to overflow indicator.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes the correlation between the target signal (x) and the
+ impulse response (h).
+
+ The correlation is given by: d[n] = sum_{i=n}^{L-1} x[i] h[i-n],
+ where: n=0,...,L-1
+
+ d[n] is normalized such that the sum of 5 maxima of d[n] corresponding to
+ each position track does not saturate.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cor_h.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void cor_h_x (
+    Word16 h[],    // (i): impulse response of weighted synthesis filter
+    Word16 x[],    // (i): target
+    Word16 dn[],   // (o): correlation between target and h[]
+    Word16 sf      // (i): scaling factor: 2 for 12.2, 1 for others
+)
+{
+    cor_h_x2(h, x, dn, sf, NB_TRACK, STEP);
+}
+
+
+void cor_h_x2 (
+    Word16 h[],    // (i): impulse response of weighted synthesis filter
+    Word16 x[],    // (i): target
+    Word16 dn[],   // (o): correlation between target and h[]
+    Word16 sf,     // (i): scaling factor: 2 for 12.2, 1 for others
+    Word16 nb_track,// (i): the number of ACB tracks
+    Word16 step    // (i): step size from one pulse position to the next
+                           in one track
+)
+{
+    Word16 i, j, k;
+    Word32 s, y32[L_CODE], max, tot;
+
+    // first keep the result on 32 bits and find absolute maximum
+
+    tot = 5;
+
+    for (k = 0; k < nb_track; k++)
+    {
+        max = 0;
+        for (i = k; i < L_CODE; i += step)
+        {
+            s = 0;
+            for (j = i; j < L_CODE; j++)
+                s = L_mac (s, x[j], h[j - i]);
+
+            y32[i] = s;
+
+            s = L_abs (s);
+            if (L_sub (s, max) > (Word32) 0L)
+                max = s;
+        }
+        tot = L_add (tot, L_shr (max, 1));
+    }
+
+    j = sub (norm_l (tot), sf);
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        dn[i] = pv_round (L_shl (y32[i], j));
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void cor_h_x(
+    Word16 h[],       /* (i): impulse response of weighted synthesis filter */
+    Word16 x[],       /* (i): target                                        */
+    Word16 dn[],      /* (o): correlation between target and h[]            */
+    Word16 sf,        /* (i): scaling factor: 2 for 12.2, 1 for others      */
+    Flag   *pOverflow /* (o): pointer to overflow flag                      */
+)
+{
+    register Word16 i;
+    register Word16 j;
+    register Word16 k;
+
+    Word32 s;
+    Word32 y32[L_CODE];
+    Word32 max;
+    Word32 tot;
+
+    Word16 *p_x;
+    Word16 *p_ptr;
+    Word32 *p_y32;
+
+
+    tot = 5;
+    for (k = 0; k < NB_TRACK; k++)              /* NB_TRACK = 5 */
+    {
+        max = 0;
+        for (i = k; i < L_CODE; i += STEP)      /* L_CODE = 40; STEP = 5 */
+        {
+            s = 0;
+            p_x = &x[i];
+            p_ptr = h;
+
+            for (j = (L_CODE - i - 1) >> 1; j != 0; j--)
+            {
+                s += ((Word32) * (p_x++) * *(p_ptr++)) << 1;
+                s += ((Word32) * (p_x++) * *(p_ptr++)) << 1;
+            }
+
+            s += ((Word32) * (p_x++) * *(p_ptr++)) << 1;
+
+            if (!((L_CODE - i) & 1))    /* if even number of iterations */
+            {
+                s += ((Word32) * (p_x++) * *(p_ptr++)) << 1;
+            }
+
+            y32[i] = s;
+
+            if (s < 0)
+            {
+                s = -s;
+            }
+
+            if (s > max)
+            {
+                max = s;
+            }
+        }
+
+        tot += (max >> 1);
+    }
+
+
+    j = norm_l(tot) - sf;
+
+    p_ptr = dn;
+    p_y32 = y32;;
+
+    for (i = L_CODE >> 1; i != 0; i--)
+    {
+        s = L_shl(*(p_y32++), j, pOverflow);
+        *(p_ptr++) = (s + 0x00008000) >> 16;
+        s = L_shl(*(p_y32++), j, pOverflow);
+        *(p_ptr++) = (s + 0x00008000) >> 16;
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.h
new file mode 100644 (file)
index 0000000..66ada72
--- /dev/null
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains prototype declaration for cor_h_x function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef COR_H_X_H
+#define COR_H_X_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void cor_h_x(
+        Word16 h[],       /* (i): impulse response of weighted synthesis filter */
+        Word16 x[],       /* (i): target                                        */
+        Word16 dn[],      /* (o): correlation between target and h[]            */
+        Word16 sf,        /* (i): scaling factor: 2 for 12.2, 1 for others      */
+        Flag   *pOverflow /* (o): pointer to overflow flag                      */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp
new file mode 100644 (file)
index 0000000..9d72ab3
--- /dev/null
@@ -0,0 +1,240 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: cor_h_x2.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "cor_h_x.h"
+#include "cor_h_x2.h" // BX
+#include "basic_op.h"
+#include "l_abs.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define LOG2_OF_32  5
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cor_h_x2
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    h = vector containing the impulse response of the weighted synthesis
+        filter; vector contents are of type Word16; vector length is
+        2 * L_SUBFR
+    x = target signal vector; vector contents are of type Word16; vector
+        length is L_SUBFR
+    dn = vector containing the correlation between the target and the
+         impulse response; vector contents are of type Word16; vector
+         length is L_CODE
+    sf = scaling factor of type Word16 ; 2 when mode is MR122, 1 for all
+         other modes
+    nb_track = number of ACB tracks (Word16)
+    step = step size between pulses in one track (Word16)
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    dn contents are the newly calculated correlation values
+    pOverflow = 1 if the math functions called by cor_h_x2 result in overflow
+    else zero.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes the correlation between the target signal (x) and the
+ impulse response (h).
+
+ The correlation is given by: d[n] = sum_{i=n}^{L-1} x[i] h[i-n],
+ where: n=0,...,L-1
+
+ d[n] is normalized such that the sum of 5 maxima of d[n] corresponding to
+ each position track does not saturate.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ cor_h.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+The original etsi reference code uses a global flag Overflow. However, in the
+actual implementation a pointer to a the overflow flag is passed in.
+
+void cor_h_x2 (
+    Word16 h[],    // (i): impulse response of weighted synthesis filter
+    Word16 x[],    // (i): target
+    Word16 dn[],   // (o): correlation between target and h[]
+    Word16 sf,     // (i): scaling factor: 2 for 12.2, 1 for others
+    Word16 nb_track,// (i): the number of ACB tracks
+    Word16 step    // (i): step size from one pulse position to the next
+                           in one track
+)
+{
+    Word16 i, j, k;
+    Word32 s, y32[L_CODE], max, tot;
+
+    // first keep the result on 32 bits and find absolute maximum
+
+    tot = 5;
+
+    for (k = 0; k < nb_track; k++)
+    {
+        max = 0;
+        for (i = k; i < L_CODE; i += step)
+        {
+            s = 0;
+            for (j = i; j < L_CODE; j++)
+                s = L_mac (s, x[j], h[j - i]);
+
+            y32[i] = s;
+
+            s = L_abs (s);
+            if (L_sub (s, max) > (Word32) 0L)
+                max = s;
+        }
+        tot = L_add (tot, L_shr (max, 1));
+    }
+
+    j = sub (norm_l (tot), sf);
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        dn[i] = pv_round (L_shl (y32[i], j));
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void cor_h_x2(
+    Word16 h[],    /* (i): impulse response of weighted synthesis filter */
+    Word16 x[],    /* (i): target                                        */
+    Word16 dn[],   /* (o): correlation between target and h[]            */
+    Word16 sf,     /* (i): scaling factor: 2 for 12.2, 1 for others      */
+    Word16 nb_track,/* (i): the number of ACB tracks                     */
+    Word16 step,   /* (i): step size from one pulse position to the next
+                           in one track                                  */
+    Flag *pOverflow
+)
+{
+    register Word16 i;
+    register Word16 j;
+    register Word16 k;
+    Word32 s;
+    Word32 y32[L_CODE];
+    Word32 max;
+    Word32 tot;
+
+
+    /* first keep the result on 32 bits and find absolute maximum */
+    tot = LOG2_OF_32;
+    for (k = 0; k < nb_track; k++)
+    {
+        max = 0;
+        for (i = k; i < L_CODE; i += step)
+        {
+            s = 0;
+
+            for (j = i; j < L_CODE; j++)
+            {
+                s = amrnb_fxp_mac_16_by_16bb((Word32)x[j], (Word32)h[j-i], s);
+            }
+
+            s = s << 1;
+            y32[i] = s;
+            s = L_abs(s);
+
+            if (s > max)
+            {
+                max = s;
+            }
+        }
+        tot = (tot + (max >> 1));
+    }
+
+    j = norm_l(tot) - sf;
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        dn[i] = pv_round(L_shl(y32[i], j, pOverflow), pOverflow);
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.h
new file mode 100644 (file)
index 0000000..8f43b99
--- /dev/null
@@ -0,0 +1,108 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: cor_h_x2.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains prototype declaration for cor_h_x2 function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef COR_H_X2_H
+#define COR_H_X2_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void cor_h_x2(
+        Word16 h[],    /* (i): impulse response of weighted synthesis filter */
+        Word16 x[],    /* (i): target                                        */
+        Word16 dn[],   /* (o): correlation between target and h[]            */
+        Word16 sf,     /* (i): scaling factor: 2 for 12.2, 1 for others      */
+        Word16 nb_track,/* (i): the number of ACB tracks                     */
+        Word16 step,   /* (i): step size from one pulse position to the next
+                           in one track                                  */
+        Flag *pOverflow
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _COR_H_X2_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/corrwght_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/corrwght_tab.cpp
new file mode 100644 (file)
index 0000000..34b8a68
--- /dev/null
@@ -0,0 +1,170 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+
+
+
+ Filename: corrwght_tab.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the tables for correlation weights
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "p_ol_wgh.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here. Include conditional
+    ; compile variables also.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; [Variable declaration - defined here and used outside this module]
+    ----------------------------------------------------------------------------*/
+    const Word16 corrweight[251] =
+    {
+        20473,  20506,  20539,  20572,  20605,  20644,  20677,
+        20716,  20749,  20788,  20821,  20860,  20893,  20932,
+        20972,  21011,  21050,  21089,  21129,  21168,  21207,
+        21247,  21286,  21332,  21371,  21417,  21456,  21502,
+        21542,  21588,  21633,  21679,  21725,  21771,  21817,
+        21863,  21909,  21961,  22007,  22059,  22105,  22158,
+        22210,  22263,  22315,  22367,  22420,  22472,  22531,
+        22584,  22643,  22702,  22761,  22820,  22879,  22938,
+        23003,  23062,  23128,  23193,  23252,  23324,  23390,
+        23455,  23527,  23600,  23665,  23744,  23816,  23888,
+        23967,  24045,  24124,  24202,  24288,  24366,  24451,
+        24537,  24628,  24714,  24805,  24904,  24995,  25094,
+        25192,  25297,  25395,  25500,  25611,  25723,  25834,
+        25952,  26070,  26188,  26313,  26444,  26575,  26706,
+        26844,  26988,  27132,  27283,  27440,  27597,  27761,
+        27931,  28108,  28285,  28475,  28665,  28869,  29078,
+        29295,  29524,  29760,  30002,  30258,  30527,  30808,
+        31457,  32767,  32767,  32767,  32767,  32767,
+        32767,  32767,  31457,  30808,  30527,  30258,  30002,
+        29760,  29524,  29295,  29078,  28869,  28665,  28475,
+        28285,  28108,  27931,  27761,  27597,  27440,  27283,
+        27132,  26988,  26844,  26706,  26575,  26444,  26313,
+        26188,  26070,  25952,  25834,  25723,  25611,  25500,
+        25395,  25297,  25192,  25094,  24995,  24904,  24805,
+        24714,  24628,  24537,  24451,  24366,  24288,  24202,
+        24124,  24045,  23967,  23888,  23816,  23744,  23665,
+        23600,  23527,  23455,  23390,  23324,  23252,  23193,
+        23128,  23062,  23003,  22938,  22879,  22820,  22761,
+        22702,  22643,  22584,  22531,  22472,  22420,  22367,
+        22315,  22263,  22210,  22158,  22105,  22059,  22007,
+        21961,  21909,  21863,  21817,  21771,  21725,  21679,
+        21633,  21588,  21542,  21502,  21456,  21417,  21371,
+        21332,  21286,  21247,  21207,  21168,  21129,  21089,
+        21050,  21011,  20972,  20932,  20893,  20860,  20821,
+        20788,  20749,  20716,  20677,  20644,  20605,  20572,
+        20539,  20506,  20473,  20434,  20401,  20369,  20336
+    };
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ None
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] corrwght.tab, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.cpp
new file mode 100644 (file)
index 0000000..0214987
--- /dev/null
@@ -0,0 +1,173 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: div_32.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+#include    "div_32.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: div_32
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_num = 32 bit signed integer (Word32) whose value falls in the
+                range : 0x0000 0000 < L_num < L_denom
+    L_denom_hi = 16 bit positive normalized integer whose value falls in
+               the range : 0x4000 < hi < 0x7fff
+    L_denom_lo = 16 bit positive integer whose value falls in the range :
+               0 < lo < 0x7fff
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the 32 bit divide operation resulted in overflow
+
+ Returns:
+    result = 32-bit quotient of of the division of two 32 bit integers
+                L_num / L_denom (Word32)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function is a fractional integer division of two 32 bit numbers, the
+ numerator L_num and the denominator L_denom. The denominator is formed by
+ combining denom_hi and denom_lo. Note that denom_hi is a normalized numbers.
+ The numerator and denominator must be positive and the numerator must be
+ less than the denominator.
+
+ The division is done as follows:
+ 1. Find 1/L_denom by first approximating: approx = 1 / denom_hi.
+ 2. 1/L_denom = approx * (2.0 - L_denom * approx ).
+ 3. result = L_num * (1/L_denom).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] div_32() function in oper_32b.c,  UMTS GSM AMR speech codec, R99 -
+ Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word32 Div_32(Word32 L_num,
+              Word16 L_denom_hi,
+              Word16 L_denom_lo,
+              Flag   *pOverflow)
+{
+
+    Word16 approx;
+    Word16 hi;
+    Word16 lo;
+    Word16 n_hi;
+    Word16 n_lo;
+    Word32 result;
+
+    /* First approximation: 1 / L_denom = 1/L_denom_hi */
+
+    approx = div_s((Word16) 0x3fff, L_denom_hi);
+
+    /* 1/L_denom = approx * (2.0 - L_denom * approx) */
+
+    result = Mpy_32_16(L_denom_hi, L_denom_lo, approx, pOverflow);
+    /* result is > 0 , and less than 1.0 */
+    result =  0x7fffffffL - result;
+
+    hi = (Word16)(result >> 16);
+    lo = (result >> 1) - (hi << 15);
+
+    result = Mpy_32_16(hi, lo, approx, pOverflow);
+
+    /* L_num * (1/L_denom) */
+
+    hi = (Word16)(result >> 16);
+    lo = (result >> 1) - (hi << 15);
+
+    n_hi = (Word16)(L_num >> 16);
+    n_lo = (L_num >> 1) - (n_hi << 15);
+
+    result = Mpy_32(n_hi, n_lo, hi, lo, pOverflow);
+    result = L_shl(result, 2, pOverflow);
+
+    return (result);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.h
new file mode 100644 (file)
index 0000000..281be6a
--- /dev/null
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: div_32.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the Div_32 function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef DIV_32_H
+#define DIV_32_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include        "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word32 Div_32(Word32 L_num,
+    Word16 L_denom_hi,
+    Word16 L_denom_lo,
+    Flag   *pOverflow) ;
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DIV_32_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp
new file mode 100644 (file)
index 0000000..f4f25f9
--- /dev/null
@@ -0,0 +1,1004 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dtx_enc.cpp
+ Functions: dtx_enc_init
+           dtx_enc_reset
+           dtx_enc_exit
+           dtx_enc
+           dtx_buffer
+           tx_dtx_handler
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the various functions that perform the computation of the
+ Silence Indicator (SID) parameters when in Discontinuous Transmission (DTX)
+ mode.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "dtx_enc.h"
+#include "q_plsf.h"
+#include "typedef.h"
+#include "mode.h"
+#include "basic_op.h"
+#include "log2.h"
+#include "lsp_lsf.h"
+#include "reorder.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+extern Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow);
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dtx_enc_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to an array of pointers to structures of type
+         dtx_encState
+
+ Outputs:
+    pointer pointed to by st is set to the address of the allocated
+      memory
+
+ Returns:
+    return_value = 0, if initialization was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function allocates the state memory used by the dtx_enc function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dtx_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int dtx_enc_init (dtx_encState **st)
+{
+  dtx_encState* s;
+
+  if (st == (dtx_encState **) NULL){
+    fprintf(stderr, "dtx_enc_init: invalid parameter\n");
+    return -1;
+  }
+
+  *st = NULL;
+
+  // allocate memory
+  if ((s= (dtx_encState *) malloc(sizeof(dtx_encState))) == NULL){
+    fprintf(stderr, "dtx_enc_init: can not malloc state structure\n");
+    return -1;
+  }
+
+  dtx_enc_reset(s);
+  *st = s;
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 dtx_enc_init(dtx_encState **st, const Word16* lsp_init_data_ptr)
+{
+    dtx_encState* s;
+
+    if (st == (dtx_encState **) NULL)
+    {
+        return(-1);
+    }
+
+    *st = NULL;
+
+    /* allocate memory */
+    if ((s = (dtx_encState *) oscl_malloc(sizeof(dtx_encState))) == NULL)
+    {
+        return(-1);
+    }
+
+    dtx_enc_reset(s, lsp_init_data_ptr);
+    *st = s;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dtx_enc_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to structures of type dtx_encState
+
+ Outputs:
+    structure pointed to by st is initialized to its reset value
+
+ Returns:
+    return_value = 1, if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    lsp_init_data = table containing LSP initialization values;
+            table elements are constants of type Word16;
+            table length is M
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function initializes the fields of the state memory used by dtx_enc
+ to their reset values.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dtx_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int dtx_enc_reset (dtx_encState *st)
+{
+  Word16 i;
+
+  if (st == (dtx_encState *) NULL){
+    fprintf(stderr, "dtx_enc_reset: invalid parameter\n");
+    return -1;
+  }
+
+  st->hist_ptr = 0;
+  st->log_en_index = 0;
+  st->init_lsf_vq_index = 0;
+  st->lsp_index[0] = 0;
+  st->lsp_index[1] = 0;
+  st->lsp_index[2] = 0;
+
+  // Init lsp_hist[]
+  for(i = 0; i < DTX_HIST_SIZE; i++)
+  {
+    Copy(lsp_init_data, &st->lsp_hist[i * M], M);
+  }
+
+  // Reset energy history
+  Set_zero(st->log_en_hist, M);
+
+  st->dtxHangoverCount = DTX_HANG_CONST;
+  st->decAnaElapsedCount = 32767;
+
+  return 1;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 dtx_enc_reset(dtx_encState *st, const Word16* lsp_init_data_ptr)
+{
+    Word16 i;
+
+    if (st == (dtx_encState *) NULL)
+    {
+        return(-1);
+    }
+
+    st->hist_ptr = 0;
+    st->log_en_index = 0;
+    st->init_lsf_vq_index = 0;
+    st->lsp_index[0] = 0;
+    st->lsp_index[1] = 0;
+    st->lsp_index[2] = 0;
+
+    /* Init lsp_hist[] */
+    for (i = 0; i < DTX_HIST_SIZE; i++)
+    {
+        oscl_memcpy(&st->lsp_hist[i * M], lsp_init_data_ptr, M*sizeof(Word16));
+    }
+
+    /* Reset energy history */
+    oscl_memset(st->log_en_hist, 0, sizeof(Word16)*M);
+    st->dtxHangoverCount = DTX_HANG_CONST;
+    st->decAnaElapsedCount = 32767;
+
+    return(1);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dtx_enc_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to an array of pointers to structures of type
+         dtx_encState
+
+ Outputs:
+    st points to the NULL address
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function deallocates the state memory used by dtx_enc function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dtx_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void dtx_enc_exit (dtx_encState **st)
+{
+   if (st == NULL || *st == NULL)
+      return;
+
+   // deallocate memory
+   free(*st);
+   *st = NULL;
+
+   return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void dtx_enc_exit(dtx_encState **st)
+{
+    if (st == NULL || *st == NULL)
+    {
+        return;
+    }
+
+    /* deallocate memory */
+    oscl_free(*st);
+    *st = NULL;
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dtx_enc
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to structures of type dtx_encState
+    computeSidFlag = compute SID flag of type Word16
+    qSt = pointer to structures of type Q_plsfState
+    predState = pointer to structures of type gc_predState
+    anap = pointer to an array of pointers to analysis parameters of
+           type Word16
+
+ Outputs:
+    structure pointed to by st contains the newly calculated SID
+      parameters
+    structure pointed to by predState contains the new logarithmic frame
+      energy
+    pointer pointed to by anap points to the location of the new
+      logarithmic frame energy and new LSPs
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates the SID parameters when in the DTX mode.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dtx_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int dtx_enc(dtx_encState *st,        // i/o : State struct
+            Word16 computeSidFlag,   // i   : compute SID
+            Q_plsfState *qSt,        // i/o : Qunatizer state struct
+            gc_predState* predState, // i/o : State struct
+        Word16 **anap            // o   : analysis parameters
+        )
+{
+   Word16 i,j;
+   Word16 log_en;
+   Word16 lsf[M];
+   Word16 lsp[M];
+   Word16 lsp_q[M];
+   Word32 L_lsp[M];
+
+   // VOX mode computation of SID parameters
+   if ((computeSidFlag != 0)  ||
+        (st->log_en_index == 0))
+   {
+      // compute new SID frame if safe i.e don't
+      // compute immediately after a talk spurt
+      log_en = 0;
+      for (i = 0; i < M; i++)
+      {
+         L_lsp[i] = 0;
+      }
+
+      // average energy and lsp
+      for (i = 0; i < DTX_HIST_SIZE; i++)
+      {
+         log_en = add(log_en,
+                      shr(st->log_en_hist[i],2));
+
+         for (j = 0; j < M; j++)
+         {
+            L_lsp[j] = L_add(L_lsp[j],
+                             L_deposit_l(st->lsp_hist[i * M + j]));
+         }
+      }
+
+      log_en = shr(log_en, 1);
+      for (j = 0; j < M; j++)
+      {
+         lsp[j] = extract_l(L_shr(L_lsp[j], 3));   // divide by 8
+      }
+
+      //  quantize logarithmic energy to 6 bits
+      st->log_en_index = add(log_en, 2560);          // +2.5 in Q10
+      st->log_en_index = add(st->log_en_index, 128); // add 0.5/4 in Q10
+      st->log_en_index = shr(st->log_en_index, 8);
+
+      if (sub(st->log_en_index, 63) > 0)
+      {
+         st->log_en_index = 63;
+      }
+      if (st->log_en_index < 0)
+      {
+         st->log_en_index = 0;
+      }
+
+      // update gain predictor memory
+      log_en = shl(st->log_en_index, -2+10); // Q11 and divide by 4
+      log_en = sub(log_en, 2560);            // add 2.5 in Q11
+
+      log_en = sub(log_en, 9000);
+      if (log_en > 0)
+      {
+         log_en = 0;
+      }
+      if (sub(log_en, -14436) < 0)
+      {
+         log_en = -14436;
+      }
+
+      // past_qua_en for other modes than MR122
+      predState->past_qua_en[0] = log_en;
+      predState->past_qua_en[1] = log_en;
+      predState->past_qua_en[2] = log_en;
+      predState->past_qua_en[3] = log_en;
+
+      // scale down by factor 20*log10(2) in Q15
+      log_en = mult(5443, log_en);
+
+      // past_qua_en for mode MR122
+      predState->past_qua_en_MR122[0] = log_en;
+      predState->past_qua_en_MR122[1] = log_en;
+      predState->past_qua_en_MR122[2] = log_en;
+      predState->past_qua_en_MR122[3] = log_en;
+
+      // make sure that LSP's are ordered
+      Lsp_lsf(lsp, lsf, M);
+      Reorder_lsf(lsf, LSF_GAP, M);
+      Lsf_lsp(lsf, lsp, M);
+
+      // Quantize lsp and put on parameter list
+      Q_plsf_3(qSt, MRDTX, lsp, lsp_q, st->lsp_index,
+               &st->init_lsf_vq_index);
+   }
+
+   *(*anap)++ = st->init_lsf_vq_index; // 3 bits
+
+   *(*anap)++ = st->lsp_index[0];      // 8 bits
+   *(*anap)++ = st->lsp_index[1];      // 9 bits
+   *(*anap)++ = st->lsp_index[2];      // 9 bits
+
+
+   *(*anap)++ = st->log_en_index;      // 6 bits
+                                       // = 35 bits
+
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void dtx_enc(dtx_encState *st,        /* i/o : State struct                  */
+             Word16 computeSidFlag,   /* i   : compute SID                   */
+             Q_plsfState *qSt,        /* i/o : Qunatizer state struct        */
+             gc_predState* predState, /* i/o : State struct                  */
+             Word16 **anap,           /* o   : analysis parameters           */
+             Flag   *pOverflow        /* i/o : overflow indicator            */
+            )
+{
+    register Word16 i, j;
+    Word16 temp;
+    Word16 log_en;
+    Word16 lsf[M];
+    Word16 lsp[M];
+    Word16 lsp_q[M];
+    Word32 L_lsp[M];
+
+    /* VOX mode computation of SID parameters */
+
+    if ((computeSidFlag != 0)  ||
+            (st->log_en_index == 0))
+    {
+        /* compute new SID frame if safe i.e don't
+         * compute immediately after a talk spurt  */
+        log_en = 0;
+        for (i = M - 1; i >= 0; i--)
+        {
+            L_lsp[i] = 0;
+        }
+
+        /* average energy and lsp */
+        for (i = DTX_HIST_SIZE - 1; i >= 0; i--)
+        {
+            if (st->log_en_hist[i] < 0)
+            {
+                temp = ~((~(st->log_en_hist[i])) >> 2);
+            }
+            else
+            {
+                temp = st->log_en_hist[i] >> 2;
+            }
+            log_en = add_16(log_en, temp, pOverflow);
+
+            for (j = M - 1; j >= 0; j--)
+            {
+                L_lsp[j] = L_add(L_lsp[j],
+                                 (Word32)(st->lsp_hist[i * M + j]),
+                                 pOverflow);
+            }
+        }
+
+        if (log_en < 0)
+        {
+            log_en = ~((~log_en) >> 1);
+        }
+        else
+        {
+            log_en = log_en >> 1;
+        }
+
+        for (j = M - 1; j >= 0; j--)
+        {
+            /* divide by 8 */
+            if (L_lsp[j] < 0)
+            {
+                lsp[j] = (Word16)(~((~L_lsp[j]) >> 3));
+            }
+            else
+            {
+                lsp[j] = (Word16)(L_lsp[j] >> 3);
+            }
+        }
+
+        /*  quantize logarithmic energy to 6 bits */
+        /* +2.5 in Q10 */
+        st->log_en_index = log_en + 2560;
+        /* add 0.5/4 in Q10 */
+        st->log_en_index += 128;
+        if (st->log_en_index < 0)
+        {
+            st->log_en_index = ~((~st->log_en_index) >> 8);
+        }
+        else
+        {
+            st->log_en_index = st->log_en_index >> 8;
+        }
+
+        /*---------------------------------------------*/
+        /* Limit to max and min allowable 6-bit values */
+        /* Note: For assembly implementation, use the  */
+        /*       following:                            */
+        /*       if(st->long_en_index >> 6 != 0)       */
+        /*       {                                     */
+        /*           if(st->long_en_index < 0)         */
+        /*           {                                 */
+        /*               st->long_en_index = 0         */
+        /*           }                                 */
+        /*           else                              */
+        /*           {                                 */
+        /*               st->long_en_index = 63        */
+        /*           }                                 */
+        /*       }                                     */
+        /*---------------------------------------------*/
+        if (st->log_en_index > 63)
+        {
+            st->log_en_index = 63;
+        }
+        else if (st->log_en_index < 0)
+        {
+            st->log_en_index = 0;
+        }
+
+        /* update gain predictor memory */
+        /* Q11 and divide by 4 */
+        log_en = (Word16)(((Word32) st->log_en_index) << (-2 + 10));
+
+        log_en = sub(log_en, 11560, pOverflow);
+
+        if (log_en > 0)
+        {
+            log_en = 0;
+        }
+        else if (log_en < -14436)
+        {
+            log_en = -14436;
+        }
+
+        /* past_qua_en for other modes than MR122 */
+        predState->past_qua_en[0] = log_en;
+        predState->past_qua_en[1] = log_en;
+        predState->past_qua_en[2] = log_en;
+        predState->past_qua_en[3] = log_en;
+
+        /* scale down by factor 20*log10(2) in Q15 */
+        log_en = (Word16)(((Word32)(5443 * log_en)) >> 15);
+
+        /* past_qua_en for mode MR122 */
+        predState->past_qua_en_MR122[0] = log_en;
+        predState->past_qua_en_MR122[1] = log_en;
+        predState->past_qua_en_MR122[2] = log_en;
+        predState->past_qua_en_MR122[3] = log_en;
+
+        /* make sure that LSP's are ordered */
+        Lsp_lsf(lsp, lsf, M, pOverflow);
+        Reorder_lsf(lsf, LSF_GAP, M, pOverflow);
+        Lsf_lsp(lsf, lsp, M, pOverflow);
+
+        /* Quantize lsp and put on parameter list */
+        Q_plsf_3(qSt, MRDTX, lsp, lsp_q, st->lsp_index,
+                 &st->init_lsf_vq_index, pOverflow);
+    }
+
+    *(*anap)++ = st->init_lsf_vq_index; /* 3 bits */
+    *(*anap)++ = st->lsp_index[0];      /* 8 bits */
+    *(*anap)++ = st->lsp_index[1];      /* 9 bits */
+    *(*anap)++ = st->lsp_index[2];      /* 9 bits */
+    *(*anap)++ = st->log_en_index;      /* 6 bits    */
+    /* = 35 bits */
+
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: dtx_buffer
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to structures of type dtx_encState
+    lsp_new = LSP vector whose elements are of type Word16; vector
+          length is M
+    speech = vector of speech samples of type Word16; vector length is
+         BFR_SIZE_GSM
+
+ Outputs:
+    structure pointed to by st contains the new LSPs and logarithmic
+      frame energy
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function handles the DTX buffer.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dtx_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int dtx_buffer(dtx_encState *st,   // i/o : State struct
+               Word16 lsp_new[],   // i   : LSP vector
+               Word16 speech[]     // i   : speech samples
+)
+{
+   Word16 i;
+   Word32 L_frame_en;
+   Word16 log_en_e;
+   Word16 log_en_m;
+   Word16 log_en;
+
+   // update pointer to circular buffer
+   st->hist_ptr = add(st->hist_ptr, 1);
+   if (sub(st->hist_ptr, DTX_HIST_SIZE) == 0)
+   {
+      st->hist_ptr = 0;
+   }
+
+   // copy lsp vector into buffer
+   Copy(lsp_new, &st->lsp_hist[st->hist_ptr * M], M);
+
+   // compute log energy based on frame energy
+   L_frame_en = 0;     // Q0
+   for (i=0; i < L_FRAME; i++)
+   {
+      L_frame_en = L_mac(L_frame_en, speech[i], speech[i]);
+   }
+   Log2(L_frame_en, &log_en_e, &log_en_m);
+
+   // convert exponent and mantissa to Word16 Q10
+   log_en = shl(log_en_e, 10);  // Q10
+   log_en = add(log_en, shr(log_en_m, 15-10));
+
+   // divide with L_FRAME i.e subtract with log2(L_FRAME) = 7.32193
+   log_en = sub(log_en, 8521);
+
+   // insert into log energy buffer with division by 2
+   log_en = shr(log_en, 1);
+   st->log_en_hist[st->hist_ptr] = log_en; // Q10
+
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void dtx_buffer(dtx_encState *st,   /* i/o : State struct                    */
+                Word16 lsp_new[],   /* i   : LSP vector                      */
+                Word16 speech[],    /* i   : speech samples                  */
+                Flag   *pOverflow   /* i/o : overflow indicator              */
+               )
+{
+
+    register Word16 i;
+    Word32 L_frame_en;
+    Word32 L_temp;
+    Word16 log_en_e;
+    Word16 log_en_m;
+    Word16 log_en;
+    Word16 *p_speech = &speech[0];
+
+    /* update pointer to circular buffer      */
+    st->hist_ptr += 1;
+
+    if (st->hist_ptr == DTX_HIST_SIZE)
+    {
+        st->hist_ptr = 0;
+    }
+
+    /* copy lsp vector into buffer */
+    oscl_memcpy(&st->lsp_hist[st->hist_ptr * M], lsp_new, M*sizeof(Word16));
+
+    /* compute log energy based on frame energy */
+    L_frame_en = 0;     /* Q0 */
+
+    for (i = L_FRAME; i != 0; i--)
+    {
+        L_frame_en += (((Word32) * p_speech) * *(p_speech)) << 1;
+        p_speech++;
+        if (L_frame_en < 0)
+        {
+            L_frame_en = MAX_32;
+            break;
+        }
+    }
+
+    Log2(L_frame_en, &log_en_e, &log_en_m, pOverflow);
+
+    /* convert exponent and mantissa to Word16 Q10 */
+    /* Q10 */
+    L_temp = ((Word32) log_en_e) << 10;
+    if (L_temp != (Word32)((Word16) L_temp))
+    {
+        *pOverflow = 1;
+        log_en = (log_en_e > 0) ? MAX_16 : MIN_16;
+    }
+    else
+    {
+        log_en = (Word16) L_temp;
+    }
+
+    log_en += log_en_m >> (15 - 10);
+
+    /* divide with L_FRAME i.e subtract with log2(L_FRAME) = 7.32193 */
+    log_en -= 8521;
+
+    /* insert into log energy buffer with division by 2 */
+
+    st->log_en_hist[st->hist_ptr] = log_en >> 1; /* Q10 */
+
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: tx_dtx_handler
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to structures of type dtx_encState
+    vad_flag = VAD decision flag of type Word16
+    usedMode = pointer to the currently used mode of type enum Mode
+
+ Outputs:
+    structure pointed to by st contains the newly calculated speech
+      hangover
+
+ Returns:
+    compute_new_sid_possible = flag to indicate a change in the
+                   used mode; store type is Word16
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function adds extra speech hangover to analyze speech on the decoding
+ side.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ dtx_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 tx_dtx_handler(dtx_encState *st,      // i/o : State struct
+                      Word16 vad_flag,       // i   : vad decision
+                      enum Mode *usedMode    // i/o : mode changed or not
+                      )
+{
+   Word16 compute_new_sid_possible;
+
+   // this state machine is in synch with the GSMEFR txDtx machine
+   st->decAnaElapsedCount = add(st->decAnaElapsedCount, 1);
+
+   compute_new_sid_possible = 0;
+
+   if (vad_flag != 0)
+   {
+      st->dtxHangoverCount = DTX_HANG_CONST;
+   }
+   else
+   {  // non-speech
+      if (st->dtxHangoverCount == 0)
+      {  // out of decoder analysis hangover
+         st->decAnaElapsedCount = 0;
+         *usedMode = MRDTX;
+         compute_new_sid_possible = 1;
+      }
+      else
+      { // in possible analysis hangover
+         st->dtxHangoverCount = sub(st->dtxHangoverCount, 1);
+
+         // decAnaElapsedCount + dtxHangoverCount < DTX_ELAPSED_FRAMES_THRESH
+         if (sub(add(st->decAnaElapsedCount, st->dtxHangoverCount),
+                 DTX_ELAPSED_FRAMES_THRESH) < 0)
+         {
+            *usedMode = MRDTX;
+            // if short time since decoder update, do not add extra HO
+         }
+         // else
+         //   override VAD and stay in
+         //   speech mode *usedMode
+         //   and add extra hangover
+      }
+   }
+
+   return compute_new_sid_possible;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 tx_dtx_handler(dtx_encState *st,      /* i/o : State struct           */
+                      Word16 vad_flag,       /* i   : vad decision           */
+                      enum Mode *usedMode,   /* i/o : mode changed or not    */
+                      Flag   *pOverflow      /* i/o : overflow indicator     */
+                     )
+{
+    Word16 compute_new_sid_possible;
+    Word16 count;
+
+    /* this state machine is in synch with the GSMEFR txDtx machine */
+    st->decAnaElapsedCount = add_16(st->decAnaElapsedCount, 1, pOverflow);
+
+    compute_new_sid_possible = 0;
+
+    if (vad_flag != 0)
+    {
+        st->dtxHangoverCount = DTX_HANG_CONST;
+    }
+    else
+    {  /* non-speech */
+        if (st->dtxHangoverCount == 0)
+        {  /* out of decoder analysis hangover  */
+            st->decAnaElapsedCount = 0;
+            *usedMode = MRDTX;
+            compute_new_sid_possible = 1;
+        }
+        else
+        { /* in possible analysis hangover */
+            st->dtxHangoverCount -= 1;
+
+            /* decAnaElapsedCount + dtxHangoverCount < */
+            /* DTX_ELAPSED_FRAMES_THRESH               */
+            count = add_16(st->decAnaElapsedCount, st->dtxHangoverCount,
+                           pOverflow);
+            if (count < DTX_ELAPSED_FRAMES_THRESH)
+            {
+                *usedMode = MRDTX;
+                /* if short time since decoder update, */
+                /* do not add extra HO                 */
+            }
+        }
+    }
+
+    return(compute_new_sid_possible);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.h
new file mode 100644 (file)
index 0000000..8142b15
--- /dev/null
@@ -0,0 +1,198 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dtx_enc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : dtx_enc.h
+      Purpose          : DTX mode computation of SID parameters
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef dtx_enc_h
+#define dtx_enc_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "q_plsf.h"
+#include "gc_pred.h"
+#include "mode.h"
+#include "dtx_common_def.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 lsp_hist[M * DTX_HIST_SIZE];
+        Word16 log_en_hist[DTX_HIST_SIZE];
+        Word16 hist_ptr;
+        Word16 log_en_index;
+        Word16 init_lsf_vq_index;
+        Word16 lsp_index[3];
+
+        /* DTX handler stuff */
+        Word16 dtxHangoverCount;
+        Word16 decAnaElapsedCount;
+
+    } dtx_encState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    /*
+    **************************************************************************
+    *  Function    : dtx_enc_init
+    *  Purpose     : Allocates memory and initializes state variables
+    *  Description : Stores pointer to filter status struct in *st. This
+    *                pointer has to be passed to dtx_enc in each call.
+    *  Returns     : 0 on success
+    *
+    **************************************************************************
+    */
+    Word16 dtx_enc_init(dtx_encState **st, const Word16* lsp_init_data_ptr);
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : dtx_enc_reset
+    *  Purpose     : Resets state memory
+    *  Returns     : 0 on success
+    *
+    **************************************************************************
+    */
+    Word16 dtx_enc_reset(dtx_encState *st, const Word16* lsp_init_data_ptr);
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : dtx_enc_exit
+    *  Purpose     : The memory used for state memory is freed
+    *  Description : Stores NULL in *st
+    *
+    **************************************************************************
+    */
+    void dtx_enc_exit(dtx_encState **st);
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : dtx_enc
+    *  Purpose     :
+    *  Description :
+    *
+    **************************************************************************
+    */
+    void dtx_enc(dtx_encState *st,        /* i/o : State struct                  */
+                 Word16 computeSidFlag,   /* i   : compute SID                   */
+                 Q_plsfState *qSt,        /* i/o : Qunatizer state struct        */
+                 gc_predState* predState, /* i/o : State struct                  */
+                 Word16 **anap,           /* o   : analysis parameters           */
+                 Flag   *pOverflow        /* i/o : overflow indicator            */
+                );
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : dtx_buffer
+    *  Purpose     : handles the DTX buffer
+    *
+    **************************************************************************
+    */
+    void dtx_buffer(dtx_encState *st,   /* i/o : State struct                    */
+                    Word16 lsp_new[],   /* i   : LSP vector                      */
+                    Word16 speech[],    /* i   : speech samples                  */
+                    Flag   *pOverflow   /* i/o : overflow indicator              */
+                   );
+
+    /*
+    **************************************************************************
+    *
+    *  Function    : tx_dtx_handler
+    *  Purpose     : adds extra speech hangover to analyze speech on the decoding side.
+    *  Description : returns 1 when a new SID analysis may be made
+    *                otherwise it adds the appropriate hangover after a sequence
+    *                with out updates of SID parameters .
+    *
+    **************************************************************************
+    */
+    Word16 tx_dtx_handler(dtx_encState *st,      /* i/o : State struct           */
+                          Word16 vad_flag,       /* i   : vad decision           */
+                          enum Mode *usedMode,   /* i/o : mode changed or not    */
+                          Flag   *pOverflow      /* i/o : overflow indicator     */
+                         );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _dtx_enc_h_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.cpp
new file mode 100644 (file)
index 0000000..0d604a7
--- /dev/null
@@ -0,0 +1,321 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: enc_lag3.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "enc_lag3.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: enc_lag3
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+  T0 = Pitch delay of type Word16
+  T0_frac = Fractional pitch delay of type Word16
+  T0_prev = Integer pitch delay of last subframe of type Word16
+  T0_min  = minimum of search range of type Word16
+  T0_max  = maximum of search range of type Word16
+  delta_flag = Flag for 1st (or 3rd) subframe of type Word16
+  flag4   = Flag for encoding with 4 bits of type Word16
+  pOverflow = pointer indicating overflow of type Flag
+
+ Outputs:
+  pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+  None
+
+ Global Variables Used:
+  None
+
+ Local Variables Needed:
+  None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function implements the encoding of fractional pitch lag with
+ 1/3 resolution.
+
+ *   FUNCTION:  Enc_lag3
+ *
+ *   PURPOSE:  Encoding of fractional pitch lag with 1/3 resolution.
+ *
+ *   DESCRIPTION:
+ *                    First and third subframes:
+ *                    --------------------------
+ *   The pitch range is divided as follows:
+ *           19 1/3  to   84 2/3   resolution 1/3
+ *           85      to   143      resolution 1
+ *
+ *   The period is encoded with 8 bits.
+ *   For the range with fractions:
+ *     index = (T-19)*3 + frac - 1;
+ *                         where T=[19..85] and frac=[-1,0,1]
+ *   and for the integer only range
+ *     index = (T - 85) + 197;        where T=[86..143]
+ *
+ *                    Second and fourth subframes:
+ *                    ----------------------------
+ *   For the 2nd and 4th subframes a resolution of 1/3 is always used,
+ *   and the search range is relative to the lag in previous subframe.
+ *   If t0 is the lag in the previous subframe then
+ *   t_min=t0-5   and  t_max=t0+4   and  the range is given by
+ *        t_min - 2/3   to  t_max + 2/3
+ *
+ *   The period in the 2nd (and 4th) subframe is encoded with 5 bits:
+ *     index = (T-(t_min-1))*3 + frac - 1;
+ *                 where T=[t_min-1..t_max+1]
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ enc_lag3.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+   Word16 index, i, tmp_ind, uplag;
+   Word16 tmp_lag;
+
+   if (delta_flag == 0)
+   {  // if 1st or 3rd subframe
+
+      // encode pitch delay (with fraction)
+
+      if (sub (T0, 85) <= 0)
+      {
+         // index = T0*3 - 58 + T0_frac
+         i = add (add (T0, T0), T0);
+         index = add (sub (i, 58), T0_frac);
+      }
+      else
+      {
+         index = add (T0, 112);
+      }
+   }
+   else
+   {   // if second or fourth subframe
+      if (flag4 == 0) {
+
+         // 'normal' encoding: either with 5 or 6 bit resolution
+
+         // index = 3*(T0 - T0_min) + 2 + T0_frac
+         i = sub (T0, T0_min);
+         i = add (add (i, i), i);
+         index = add (add (i, 2), T0_frac);
+      }
+      else {
+
+         // encoding with 4 bit resolution
+
+         tmp_lag = T0_prev;
+
+         if ( sub( sub(tmp_lag, T0_min), 5) > 0)
+            tmp_lag = add (T0_min, 5);
+         if ( sub( sub(T0_max, tmp_lag), 4) > 0)
+            tmp_lag = sub (T0_max, 4);
+
+         uplag = add (add (add (T0, T0), T0), T0_frac);
+
+         i = sub (tmp_lag, 2);
+         tmp_ind = add (add (i, i), i);
+
+         if (sub (tmp_ind, uplag) >= 0) {
+            index = add (sub (T0, tmp_lag), 5);
+         }
+         else {
+
+            i = add (tmp_lag, 1);
+            i = add (add (i, i), i);
+
+            if (sub (i, uplag) > 0) {
+
+                index = add ( sub (uplag, tmp_ind), 3);
+            }
+            else {
+
+               index = add (sub (T0, tmp_lag), 11);
+            }
+         }
+
+      } // end if (encoding with 4 bit resolution)
+   }   // end if (second of fourth subframe)
+
+   return index;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+
+Word16 Enc_lag3(         /* o  : Return index of encoding             */
+    Word16 T0,           /* i  : Pitch delay                          */
+    Word16 T0_frac,      /* i  : Fractional pitch delay               */
+    Word16 T0_prev,      /* i  : Integer pitch delay of last subframe */
+    Word16 T0_min,       /* i  : minimum of search range              */
+    Word16 T0_max,       /* i  : maximum of search range              */
+    Word16 delta_flag,   /* i  : Flag for 1st (or 3rd) subframe       */
+    Word16 flag4,        /* i  : Flag for encoding with 4 bits        */
+    Flag   *pOverflow
+)
+{
+    Word16 index, i, tmp_ind, uplag;
+    Word16 tmp_lag;
+    Word16 temp1;
+    Word16 temp2;
+
+
+
+    if (delta_flag == 0)
+    {  /* if 1st or 3rd subframe */
+
+        /* encode pitch delay (with fraction) */
+        temp1 = T0 - 85;
+        if (temp1 <= 0)
+        {
+            /* index = T0*3 - 58 + T0_frac   */
+            index = (T0 << 1) + T0 -  58 + T0_frac;
+        }
+        else
+        {
+            index = T0 + 112;
+        }
+    }
+    else
+    {   /* if second or fourth subframe */
+        if (flag4 == 0)
+        {
+
+            /* 'normal' encoding: either with 5 or 6 bit resolution */
+
+            /* index = 3*(T0 - T0_min) + 2 + T0_frac */
+            i = T0 - T0_min;
+            index = i + (i << 1) + 2 + T0_frac;
+        }
+        else
+        {
+
+            /* encoding with 4 bit resolution */
+
+            tmp_lag = T0_prev;
+            temp1 = tmp_lag - T0_min;
+            temp2 = temp1 - 5;
+            if (temp2 > 0)
+            {
+                tmp_lag = T0_min + 5;
+            }
+            temp1 = T0_max - tmp_lag;
+            temp2 = temp1 - 4;
+            if (temp2 > 0)
+            {
+                tmp_lag = T0_max - 4;
+            }
+            uplag  = T0 + (T0 << 1);
+            uplag += T0_frac;
+            i = tmp_lag - 2;
+
+            tmp_ind  = i + (i << 1);
+            temp1    = tmp_ind - uplag;
+
+            if (temp1 >= 0)
+            {
+                index = T0 - tmp_lag + 5;
+            }
+            else
+            {
+                i = tmp_lag + 1;
+
+                i += i << 1;
+
+                if (i > uplag)
+                {
+                    index = uplag - tmp_ind + 3;
+                }
+                else
+                {
+                    index = T0 - tmp_lag + 11;
+                }
+            }
+
+        } /* end if (encoding with 4 bit resolution) */
+    }   /* end if (second of fourth subframe) */
+
+    return index;
+}
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.h
new file mode 100644 (file)
index 0000000..b3dbaa4
--- /dev/null
@@ -0,0 +1,116 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: enc_lag3.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : enc_lag3.h
+      Purpose          : Encoding of fractional pitch lag with 1/3 resolution.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _ENC_LAG3_H_
+#define _ENC_LAG3_H_
+#define enc_lag3_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 past_gain;
+    } agcState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    Word16
+    Enc_lag3(                /* o  : Return index of encoding     */
+        Word16 T0,           /* i  : Pitch delay                          */
+        Word16 T0_frac,      /* i  : Fractional pitch delay               */
+        Word16 T0_prev,      /* i  : Integer pitch delay of last subframe */
+        Word16 T0_min,       /* i  : minimum of search range              */
+        Word16 T0_max,       /* i  : maximum of search range              */
+        Word16 delta_flag,   /* i  : Flag for 1st (or 3rd) subframe       */
+        Word16 flag4,        /* i  : Flag for encoding with 4 bits        */
+        Flag   *pOverflow
+    );
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _ENC_LAG3_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.cpp
new file mode 100644 (file)
index 0000000..6b81ff5
--- /dev/null
@@ -0,0 +1,193 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: enc_lag6.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "enc_lag6.h"
+#include "typedef.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Enc_lag6
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    T0 -- Word16 -- Pitch delay
+    T0_frac -- Word16 -- Fractional pitch delay
+    T0_min -- Word16 -- minimum of search range
+    delta_flag -- Word16 -- Flag for 1st (or 3rd) subframe
+
+ Outputs:
+    pOverflow -- Pointer to Flag -- overflow indicator
+
+ Returns:
+    Word16 -- Return index of encoding
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE:  Encoding of fractional pitch lag with 1/6 resolution.
+
+ DESCRIPTION:
+                  First and third subframes:
+                  --------------------------
+ The pitch range is divided as follows:
+         17 3/6  to   94 3/6   resolution 1/6
+         95      to   143      resolution 1
+
+ The period is encoded with 9 bits.
+ For the range with fractions:
+   index = (T-17)*6 + frac - 3;
+                       where T=[17..94] and frac=[-2,-1,0,1,2,3]
+ and for the integer only range
+   index = (T - 95) + 463;        where T=[95..143]
+
+                  Second and fourth subframes:
+                  ----------------------------
+ For the 2nd and 4th subframes a resolution of 1/6 is always used,
+ and the search range is relative to the lag in previous subframe.
+ If t0 is the lag in the previous subframe then
+ t_min=t0-5   and  t_max=t0+4   and  the range is given by
+     (t_min-1) 3/6   to  (t_max) 3/6
+
+ The period in the 2nd (and 4th) subframe is encoded with 6 bits:
+   index = (T-(t_min-1))*6 + frac - 3;
+               where T=[t_min-1..t_max] and frac=[-2,-1,0,1,2,3]
+
+ Note that only 61 values are used. If the decoder receives 61, 62,
+ or 63 as the relative pitch index, it means that a transmission
+ error occurred and the pitch from previous subframe should be used.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ enc_lag6.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Enc_lag6(         /* o : Return index of encoding             */
+    Word16 T0,           /* i : Pitch delay                          */
+    Word16 T0_frac,      /* i : Fractional pitch delay               */
+    Word16 T0_min,       /* i : minimum of search range              */
+    Word16 delta_flag,   /* i : Flag for 1st (or 3rd) subframe       */
+    Flag   *pOverflow    /* o : overflow indicator                   */
+)
+{
+    Word16 index;
+    Word16 i;
+    Word16 temp;
+
+    if (delta_flag == 0)          /* if 1st or 3rd subframe */
+    {
+        /* encode pitch delay (with fraction) */
+        if (T0 <= 94)
+        {
+            /* index = T0*6 - 105 + T0_frac */
+            i = (T0 << 3) - (T0 << 1) - 105;
+
+            index = i + T0_frac;
+        }
+        else
+        {
+            index = T0 + 368;
+        }
+
+    }
+    else
+        /* if second or fourth subframe */
+    {
+        /* index = 6*(T0-T0_min) + 3 + T0_frac  */
+        temp = (T0 - T0_min);
+
+        i = (temp << 3) - (temp << 1);
+        i += 3;
+
+        index = i + T0_frac;
+    }
+
+    return index;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.h
new file mode 100644 (file)
index 0000000..d9d0f5c
--- /dev/null
@@ -0,0 +1,110 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: enc_lag6.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, enc_lag6.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef enc_lag6_h
+#define enc_lag6_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 Enc_lag6(         /* o  : Return index of encoding             */
+        Word16 T0,           /* i  : Pitch delay                          */
+        Word16 T0_frac,      /* i  : Fractional pitch delay               */
+        Word16 T0_min,       /* i  : minimum of search range              */
+        Word16 delta_flag,   /* i  : Flag for 1st (or 3rd) subframe       */
+        Flag   *pOverflow    /* o  : Overflow indicator                   */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* enc_lag6_h */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_output_format_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_output_format_tab.cpp
new file mode 100644 (file)
index 0000000..39e81e8
--- /dev/null
@@ -0,0 +1,193 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+ Filename: enc_output_format_tab.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This file contains the tables of the number of data bytes per codec mode in
+ both WMF and IF2 output formats.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] AMR Speech Codec Frame Structure, 3GPP TS 26.101 version 4.1.0 Release 4,
+     June 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "amrencode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+    /* Number of data bytes in an encoder frame for each codec mode */
+    /* for WMF output format.                                       */
+    /* Each entry is the sum of the 3GPP frame type byte and the    */
+    /* number of packed core AMR data bytes                         */
+    const Word16 WmfEncBytesPerFrame[16] =
+    {
+        13, /* 4.75 */
+        14, /* 5.15 */
+        16, /* 5.90 */
+        18, /* 6.70 */
+        20, /* 7.40 */
+        21, /* 7.95 */
+        27, /* 10.2 */
+        32, /* 12.2 */
+        6,  /* GsmAmr comfort noise */
+        7,  /* Gsm-Efr comfort noise */
+        6,  /* IS-641 comfort noise */
+        6,  /* Pdc-Efr comfort noise */
+        0,  /* future use */
+        0,  /* future use */
+        0,  /* future use */
+        1   /* No transmission */
+    };
+
+
+    /* Number of data bytes in an encoder frame for each codec mode */
+    /* for IF2 output format                                        */
+    const Word16 If2EncBytesPerFrame[16] =
+    {
+        13, /* 4.75 */
+        14, /* 5.15 */
+        16, /* 5.90 */
+        18, /* 6.70 */
+        19, /* 7.40 */
+        21, /* 7.95 */
+        26, /* 10.2 */
+        31, /* 12.2 */
+        6, /* GsmAmr comfort noise */
+        6, /* Gsm-Efr comfort noise */
+        6, /* IS-641 comfort noise */
+        6, /* Pdc-Efr comfort noise */
+        0, /* future use */
+        0, /* future use */
+        0, /* future use */
+        1  /* No transmission */
+    };
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL FUNCTION REFERENCES
+    ; Declare functions defined elsewhere and referenced in this module
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; Define all local variables
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Function body here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Return nothing or data or data pointer
+----------------------------------------------------------------------------*/
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.cpp
new file mode 100644 (file)
index 0000000..dc9b7aa
--- /dev/null
@@ -0,0 +1,228 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Filename: ets_to_if2.cpp
+ Funtions: ets_to_if2
+
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "frame_type_3gpp.h"
+#include "ets_to_if2.h"
+#include "typedef.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ets_to_if2
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    frame_type_3gpp = decoder speech bit rate (enum Frame_Type_3GPP)
+    ets_input_ptr   = pointer to input encoded speech bits in ETS format (Word16)
+    if2_output_ptr  = pointer to output encoded speech bits in IF2 format (UWord8)
+
+ Outputs:
+    if2_output_ptr  = pointer to encoded speech bits in the IF2 format (UWord8)
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs a transformation on the data buffers. It converts the
+ data format from ETS (European Telecommunication Standard) to IF2. ETS format
+ has the encoded speech bits each separate with only one bit stored in each
+ word. IF2 is the storage format where the frame type is in the first four bits
+ of the first byte. The upper four bits of that byte contain the first four
+ encoded speech bits for the frame. The following bytes contain the rest of
+ the encoded speech bits. The final byte has padded zeros  to make the frame
+ byte aligned.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0 Release 4, June 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void ets_to_if2(
+    enum Frame_Type_3GPP frame_type_3gpp,
+    Word16 *ets_input_ptr,
+    UWord8 *if2_output_ptr,
+    CommonAmrTbls* common_amr_tbls)
+{
+    Word16  i;
+    Word16  k;
+    Word16  j = 0;
+    Word16 *ptr_temp;
+    Word16  bits_left;
+    UWord8  accum;
+    const Word16* const* reorderBits_ptr = common_amr_tbls->reorderBits_ptr;
+    const Word16* numOfBits_ptr = common_amr_tbls->numOfBits_ptr;
+
+    if (frame_type_3gpp < AMR_SID)
+    {
+        if2_output_ptr[j++] = (UWord8)(frame_type_3gpp) |
+                              (ets_input_ptr[reorderBits_ptr[frame_type_3gpp][0]] << 4) |
+                              (ets_input_ptr[reorderBits_ptr[frame_type_3gpp][1]] << 5) |
+                              (ets_input_ptr[reorderBits_ptr[frame_type_3gpp][2]] << 6) |
+                              (ets_input_ptr[reorderBits_ptr[frame_type_3gpp][3]] << 7);
+
+        for (i = 4; i < numOfBits_ptr[frame_type_3gpp] - 7;)
+        {
+            if2_output_ptr[j]  =
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]];
+            if2_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 1;
+            if2_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 2;
+            if2_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 3;
+            if2_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 4;
+            if2_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 5;
+            if2_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 6;
+            if2_output_ptr[j++] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 7;
+        }
+
+        bits_left = 4 + numOfBits_ptr[frame_type_3gpp] -
+                    ((4 + numOfBits_ptr[frame_type_3gpp]) & 0xFFF8);
+
+        if (bits_left != 0)
+        {
+            if2_output_ptr[j] = 0;
+
+            for (k = 0; k < bits_left; k++)
+            {
+                if2_output_ptr[j] |=
+                    (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << k;
+            }
+        }
+    }
+    else
+    {
+        if (frame_type_3gpp != AMR_NO_DATA)
+        {
+            /* First octet contains 3GPP frame type and */
+            /* first 4 bits of encoded parameters       */
+            if2_output_ptr[j++] = (UWord8)(frame_type_3gpp) |
+                                  (ets_input_ptr[0] << 4) | (ets_input_ptr[1] << 5) |
+                                  (ets_input_ptr[2] << 6) | (ets_input_ptr[3] << 7);
+            ptr_temp = &ets_input_ptr[4];
+
+            bits_left = ((4 + numOfBits_ptr[frame_type_3gpp]) & 0xFFF8);
+
+            for (i = (bits_left - 7) >> 3; i > 0; i--)
+            {
+                accum  = (UWord8) * (ptr_temp++);
+                accum |= (UWord8) * (ptr_temp++) << 1;
+                accum |= (UWord8) * (ptr_temp++) << 2;
+                accum |= (UWord8) * (ptr_temp++) << 3;
+                accum |= (UWord8) * (ptr_temp++) << 4;
+                accum |= (UWord8) * (ptr_temp++) << 5;
+                accum |= (UWord8) * (ptr_temp++) << 6;
+                accum |= (UWord8) * (ptr_temp++) << 7;
+
+                if2_output_ptr[j++] = accum;
+            }
+
+            bits_left = 4 + numOfBits_ptr[frame_type_3gpp] - bits_left;
+
+            if (bits_left != 0)
+            {
+                if2_output_ptr[j] = 0;
+
+                for (i = 0; i < bits_left; i++)
+                {
+                    if2_output_ptr[j] |= (ptr_temp[i] << i);
+                }
+            }
+        }
+        else
+        {
+            /* When there is no data, LSnibble of first octet */
+            /* is the 3GPP frame type, MSnibble is zeroed out */
+            if2_output_ptr[j++] = (UWord8)(frame_type_3gpp);
+        }
+
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.h
new file mode 100644 (file)
index 0000000..cbdfde5
--- /dev/null
@@ -0,0 +1,111 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ets_to_if2.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the ets_to_if2 function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef ETS_TO_IF2_H
+#define ETS_TO_IF2_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "mode.h"
+#include "typedef.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void ets_to_if2(enum Frame_Type_3GPP mode,
+    Word16   *ets_input_ptr,
+    UWord8   *if2_output_ptr,
+    CommonAmrTbls* common_amr_tbls);
+
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.cpp
new file mode 100644 (file)
index 0000000..76634b0
--- /dev/null
@@ -0,0 +1,300 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ets_to_wmf.cpp
+ Functions: ets_to_wmf
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "ets_to_wmf.h"
+#include "typedef.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ets_to_wmf
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    frame_type_3gpp = decoder speech bit rate (enum Frame_Type_3GPP)
+    ets_input_ptr   = pointer to input encoded speech bits in ETS format (Word16)
+    wmf_output_ptr  = pointer to output encoded speech bits in WMF format(UWord8)
+
+ Outputs:
+    wmf_output_ptr  = pointer to encoded speech bits in the WMF format (UWord8)
+
+ Returns:
+    None
+
+ Global Variables Used:
+    numOfBits = table of values that describe the number of bits per frame for
+                each 3GPP frame type mode. The table is type const Word16 and has
+                NUM_MODES elements. This table is located in bitreorder_tab.c.
+    reorderBits = table of pointers that point to tables used to reorder the
+                  encoded speech bits when converting from ETS to WMF or IF2
+                  format. The table is of type const Word16 * and contains
+                  NUM_MODES-1 elements. This table is located in bitreorder_tab.c.
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs a transformation on the data buffers. It converts the
+ data format from ETS (European Telecommunication Standard) to WMF (wireless
+ multimedia forum). ETS format has the encoded speech bits each separate with
+ only one bit stored in each word. WMF is the storage format where the frame
+ type is in the first four bits of the first byte. This first byte has the
+ upper four bits as padded zeroes. The following bytes contain the rest of the
+ encoded speech bits. The final byte has padded zeros to make the frame byte
+ aligned.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void ets_to_wmf(
+    enum Frame_Type_3GPP frame_type_3gpp,
+    Word16 *ets_input_ptr,
+    UWord8 *wmf_output_ptr,
+    CommonAmrTbls* common_amr_tbls)
+{
+    Word16  i;
+    Word16  k = 0;
+    Word16  j = 0;
+    Word16 *ptr_temp;
+    Word16  bits_left;
+    UWord8  accum;
+    const Word16* const* reorderBits_ptr = common_amr_tbls->reorderBits_ptr;
+    const Word16* numOfBits_ptr = common_amr_tbls->numOfBits_ptr;
+
+    wmf_output_ptr[j++] = (UWord8)(frame_type_3gpp) & 0x0f;
+
+    if (frame_type_3gpp < AMR_SID)
+    {
+
+        for (i = 0; i < numOfBits_ptr[frame_type_3gpp] - 7;)
+        {
+            wmf_output_ptr[j]  =
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 7;
+            wmf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 6;
+            wmf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 5;
+            wmf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 4;
+            wmf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 3;
+            wmf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 2;
+            wmf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 1;
+            wmf_output_ptr[j++] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]];
+        }
+
+        bits_left = numOfBits_ptr[frame_type_3gpp] -
+                    (numOfBits_ptr[frame_type_3gpp] & 0xFFF8);
+
+        wmf_output_ptr[j] = 0;
+
+        for (k = 0; k < bits_left; k++)
+        {
+            wmf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << (7 - k);
+
+        }
+    }
+    else
+    {
+
+        ptr_temp = &ets_input_ptr[0];
+
+        for (i = numOfBits_ptr[frame_type_3gpp] - 7; i > 0; i -= 8)
+        {
+            accum  = (UWord8) * (ptr_temp++) << 7;
+            accum |= (UWord8) * (ptr_temp++) << 6;
+            accum |= (UWord8) * (ptr_temp++) << 5;
+            accum |= (UWord8) * (ptr_temp++) << 4;
+            accum |= (UWord8) * (ptr_temp++) << 3;
+            accum |= (UWord8) * (ptr_temp++) << 2;
+            accum |= (UWord8) * (ptr_temp++) << 1;
+            accum |= (UWord8) * (ptr_temp++);
+
+            wmf_output_ptr[j++] = accum;
+        }
+
+        bits_left = numOfBits_ptr[frame_type_3gpp] -
+                    (numOfBits_ptr[frame_type_3gpp] & 0xFFF8);
+
+        wmf_output_ptr[j] = 0;
+
+        for (i = 0; i < bits_left; i++)
+        {
+            wmf_output_ptr[j] |= *(ptr_temp++) << (7 - i);
+        }
+    }
+
+    return;
+}
+
+
+
+void ets_to_ietf(
+    enum Frame_Type_3GPP frame_type_3gpp,
+    Word16 *ets_input_ptr,
+    UWord8 *ietf_output_ptr,
+    CommonAmrTbls* common_amr_tbls)
+{
+    Word16  i;
+    Word16  k = 0;
+    Word16  j = 0;
+    Word16 *ptr_temp;
+    Word16  bits_left;
+    UWord8  accum;
+    const Word16* const* reorderBits_ptr = common_amr_tbls->reorderBits_ptr;
+    const Word16* numOfBits_ptr = common_amr_tbls->numOfBits_ptr;
+
+    ietf_output_ptr[j++] = (UWord8)(frame_type_3gpp << 3);
+
+    if (frame_type_3gpp < AMR_SID)
+    {
+        for (i = 0; i < numOfBits_ptr[frame_type_3gpp] - 7;)
+        {
+            ietf_output_ptr[j]  =
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 7;
+            ietf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 6;
+            ietf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 5;
+            ietf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 4;
+            ietf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 3;
+            ietf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 2;
+            ietf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 1;
+            ietf_output_ptr[j++] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]];
+        }
+
+        bits_left = numOfBits_ptr[frame_type_3gpp] -
+                    (numOfBits_ptr[frame_type_3gpp] & 0xFFF8);
+
+        ietf_output_ptr[j] = 0;
+
+        for (k = 0; k < bits_left; k++)
+        {
+            ietf_output_ptr[j] |=
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << (7 - k);
+
+        }
+    }
+    else
+    {
+
+        ptr_temp = &ets_input_ptr[0];
+
+        for (i = numOfBits_ptr[frame_type_3gpp] - 7; i > 0; i -= 8)
+        {
+            accum  = (UWord8) * (ptr_temp++) << 7;
+            accum |= (UWord8) * (ptr_temp++) << 6;
+            accum |= (UWord8) * (ptr_temp++) << 5;
+            accum |= (UWord8) * (ptr_temp++) << 4;
+            accum |= (UWord8) * (ptr_temp++) << 3;
+            accum |= (UWord8) * (ptr_temp++) << 2;
+            accum |= (UWord8) * (ptr_temp++) << 1;
+            accum |= (UWord8) * (ptr_temp++);
+
+            ietf_output_ptr[j++] = accum;
+        }
+
+        bits_left = numOfBits_ptr[frame_type_3gpp] -
+                    (numOfBits_ptr[frame_type_3gpp] & 0xFFF8);
+
+        ietf_output_ptr[j] = 0;
+
+        for (i = 0; i < bits_left; i++)
+        {
+            ietf_output_ptr[j] |= *(ptr_temp++) << (7 - i);
+        }
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.h
new file mode 100644 (file)
index 0000000..c26ca30
--- /dev/null
@@ -0,0 +1,115 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ets_to_wmf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the ets_to_wmf function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef ETS_TO_WMF_H
+#define ETS_TO_WMF_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "frame_type_3gpp.h"
+#include "typedef.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void ets_to_wmf(enum Frame_Type_3GPP frame_type_3gpp,
+    Word16   *ets_input_ptr,
+    UWord8   *wmf_output_ptr,
+    CommonAmrTbls* common_amr_tbls);
+
+    void ets_to_ietf(enum Frame_Type_3GPP frame_type_3gpp,
+                     Word16 *ets_input_ptr,
+                     UWord8 *ietf_output_ptr,
+                     CommonAmrTbls* common_amr_tbls);
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.cpp
new file mode 100644 (file)
index 0000000..9d8e670
--- /dev/null
@@ -0,0 +1,442 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: g_adapt.cpp
+ Functions:
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "g_adapt.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "oper_32b.h"
+#include "cnst.h"
+#include "gmed_n.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define LTP_GAIN_THR1 2721 /* 2721 Q13 = 0.3322 ~= 1.0 / (10*log10(2)) */
+#define LTP_GAIN_THR2 5443 /* 5443 Q13 = 0.6644 ~= 2.0 / (10*log10(2)) */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gain_adapt_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- double pointer to GainAdaptState
+
+ Outputs:
+    st -- double ponter to GainAdaptState
+
+ Returns:
+    -1 if an error occurs during memory initialization
+     0 if OK
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Allocates state memory and initializes state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ g_adapt.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 gain_adapt_init(GainAdaptState **st)
+{
+    GainAdaptState* s;
+
+    if (st == (GainAdaptState **) NULL)
+    {
+        /* fprintf(stderr, "gain_adapt_init: invalid parameter\n"); */
+        return -1;
+    }
+    *st = NULL;
+
+    /* allocate memory */
+    if ((s = (GainAdaptState *) oscl_malloc(sizeof(GainAdaptState))) == NULL)
+    {
+        /* fprintf(stderr, "gain_adapt_init: can't malloc state structure\n"); */
+        return -1;
+    }
+    gain_adapt_reset(s);
+    *st = s;
+
+    return 0;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gain_adapt_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- double pointer to GainAdaptState
+
+ Outputs:
+    st -- double ponter to GainAdaptState
+
+ Returns:
+    -1 if an error occurs
+     0 if OK
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Initializes state memory to zero
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ g_adapt.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 gain_adapt_reset(GainAdaptState *st)
+{
+    Word16 i;
+
+    if (st == (GainAdaptState *) NULL)
+    {
+        /* fprintf(stderr, "gain_adapt_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    st->onset = 0;
+    st->prev_alpha = 0;
+    st->prev_gc = 0;
+
+    for (i = 0; i < LTPG_MEM_SIZE; i++)
+    {
+        st->ltpg_mem[i] = 0;
+    }
+
+    return 0;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gain_adapt_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- double pointer to GainAdaptState
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    The memory used for state memory is freed
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ g_adapt.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void gain_adapt_exit(GainAdaptState **st)
+{
+    if (st == NULL || *st == NULL)
+        return;
+
+    /* deallocate memory */
+    oscl_free(*st);
+    *st = NULL;
+
+    return;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gain_adapt
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- double pointer to GainAdaptState
+    ltpg -- Word16 -- ltp coding gain (log2()), Q13
+    gain_cod -- Word16 -- code gain, Q1
+
+ Outputs:
+    alpha -- Pointer to Word16 --  gain adaptation factor,   Q15
+    pOverflow -- Pointer to Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose:    calculate pitch/codebook gain adaptation factor alpha
+             (and update the adaptor state)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ g_adapt.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void gain_adapt(
+    GainAdaptState *st,  /* i  : state struct                  */
+    Word16 ltpg,         /* i  : ltp coding gain (log2()), Q13 */
+    Word16 gain_cod,     /* i  : code gain,                Q1  */
+    Word16 *alpha,       /* o  : gain adaptation factor,   Q15 */
+    Flag   *pOverflow
+)
+{
+    Word16 adapt;      /* adaptdation status; 0, 1, or 2       */
+    Word16 result;     /* alpha factor, Q13                    */
+    Word16 filt;       /* median-filtered LTP coding gain, Q13 */
+    Word16 tmp;
+    Word16 i;
+
+    /* basic adaptation */
+    if (ltpg <= LTP_GAIN_THR1)
+    {
+        adapt = 0;
+    }
+    else
+    {
+        if (ltpg <= LTP_GAIN_THR2)
+        {
+            adapt = 1;
+        }
+        else
+        {
+            adapt = 2;
+        }
+    }
+
+    /*
+     * // onset indicator
+     * if ((cbGain > onFact * cbGainMem[0]) && (cbGain > 100.0))
+     *     onset = 8;
+     * else
+     *     if (onset)
+     *         onset--;
+     */
+    /* tmp = cbGain / onFact; onFact = 2.0; 200 Q1 = 100.0 */
+    tmp = shr_r(gain_cod, 1, pOverflow);
+
+    if ((tmp > st->prev_gc) && (gain_cod > 200))
+    {
+        st->onset = 8;
+    }
+    else
+    {
+        if (st->onset != 0)
+        {
+            st->onset--;
+        }
+    }
+
+    /*
+     *  // if onset, increase adaptor state
+     *  if (onset && (gainAdapt < 2)) gainAdapt++;
+     */
+    if ((st->onset != 0) && (adapt < 2))
+    {
+        adapt += 1;
+    }
+
+    st->ltpg_mem[0] = ltpg;
+    filt = gmed_n(st->ltpg_mem, 5);  /* function result */
+
+    if (adapt == 0)
+    {
+        if (filt > 5443) /* 5443 Q13 = 0.66443... */
+        {
+            result = 0;
+        }
+        else
+        {
+            if (filt < 0)
+            {
+                result = 16384;  /* 16384 Q15 = 0.5 */
+            }
+            else
+            {   /* result       =   0.5 - 0.75257499*filt     */
+                /* result (Q15) = 16384 - 24660 * (filt << 2) */
+                filt = shl(filt, 2, pOverflow);  /* Q15 */
+                result = mult(24660, filt, pOverflow);
+                result = 16384 - result;
+            }
+        }
+    }
+    else
+    {
+        result = 0;
+    }
+    /*
+     *  if (prevAlpha == 0.0) result = 0.5 * (result + prevAlpha);
+     */
+    if (st->prev_alpha == 0)
+    {
+        result = shr(result, 1, pOverflow);
+    }
+
+    /* store the result */
+    *alpha = result;
+
+    /* update adapter state memory */
+    st->prev_alpha = result;
+    st->prev_gc = gain_cod;
+
+    for (i = LTPG_MEM_SIZE - 1; i > 0; i--)
+    {
+        st->ltpg_mem[i] = st->ltpg_mem[i-1];
+    }
+    /* mem[0] is just present for convenience in calling the gmed_n[5]
+     * function above. The memory depth is really LTPG_MEM_SIZE-1.
+     */
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.h
new file mode 100644 (file)
index 0000000..f63d41e
--- /dev/null
@@ -0,0 +1,145 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: g_adapt.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, g_adapt.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef g_adapt_h
+#define g_adapt_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+#define LTPG_MEM_SIZE 5 /* number of stored past LTP coding gains + 1 */
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 onset;                   /* onset state,                   Q0  */
+        Word16 prev_alpha;              /* previous adaptor output,       Q15 */
+        Word16 prev_gc;                 /* previous code gain,            Q1  */
+
+        Word16 ltpg_mem[LTPG_MEM_SIZE]; /* LTP coding gain history,       Q13 */
+        /* (ltpg_mem[0] not used for history) */
+    } GainAdaptState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 gain_adapt_init(GainAdaptState **st);
+    /* initialize one instance of the gain adaptor
+       Stores pointer to state struct in *st. This pointer has to
+       be passed to gain_adapt and gain_adapt_update in each call.
+       returns 0 on success
+     */
+
+    Word16 gain_adapt_reset(GainAdaptState *st);
+    /* reset of gain adaptor state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+
+    void gain_adapt_exit(GainAdaptState **st);
+    /* de-initialize gain adaptor state (i.e. free state struct)
+       stores NULL in *st
+     */
+
+    /*************************************************************************
+     *
+     *  Function:   gain_adapt()
+     *  Purpose:    calculate pitch/codebook gain adaptation factor alpha
+     *              (and update the adaptor state)
+     *
+     **************************************************************************
+     */
+    void gain_adapt(
+        GainAdaptState *st,  /* i  : state struct                  */
+        Word16 ltpg,         /* i  : ltp coding gain (log2()), Q   */
+        Word16 gain_cod,     /* i  : code gain,                Q13 */
+        Word16 *alpha,       /* o  : gain adaptation factor,   Q15 */
+        Flag   *pOverflow    /* o  : overflow indicator            */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.cpp
new file mode 100644 (file)
index 0000000..595935c
--- /dev/null
@@ -0,0 +1,277 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: g_code.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "g_code.h"
+#include    "cnst.h"
+#include    "basic_op.h"
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: G_code
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    xn2[] = target vector (Word16)
+    y2[] = filtered innovation vector
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the innovative gain calculation resulted in overflow
+
+ Returns:
+    gain = Gain of Innovation code (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes the innovative codebook gain.
+
+ The innovative codebook gain is given by
+    g = <x[], y[]> / <y[], y[]>
+
+ where x[] is the target vector, y[] is the filtered innovative codevector,
+ and <> denotes dot product.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] g_code.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 G_code (         // out   : Gain of innovation code
+    Word16 xn2[],       // in    : target vector
+    Word16 y2[]         // in    : filtered innovation vector
+)
+{
+    Word16 i;
+    Word16 xy, yy, exp_xy, exp_yy, gain;
+    Word16 scal_y2[L_SUBFR];
+    Word32 s;
+
+// The original ETSI implementation uses a global overflow flag. However in
+// actual implementation a pointer to Overflow flag is passed into the
+// function for access by the low level math functions.
+
+    // Scale down Y[] by 2 to avoid overflow
+
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        scal_y2[i] = shr (y2[i], 1);
+    }
+
+    // Compute scalar product <X[],Y[]>
+
+    s = 1L; // Avoid case of all zeros
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        s = L_mac (s, xn2[i], scal_y2[i]);
+    }
+    exp_xy = norm_l (s);
+    xy = extract_h (L_shl (s, exp_xy));
+
+    // If (xy < 0) gain = 0
+
+    if (xy <= 0)
+        return ((Word16) 0);
+
+    // Compute scalar product <Y[],Y[]>
+
+    s = 0L;
+    for (i = 0; i < L_SUBFR; i++)
+    {
+        s = L_mac (s, scal_y2[i], scal_y2[i]);
+    }
+    exp_yy = norm_l (s);
+    yy = extract_h (L_shl (s, exp_yy));
+
+    // compute gain = xy/yy
+
+    xy = shr (xy, 1);                 // Be sure xy < yy
+    gain = div_s (xy, yy);
+
+    // Denormalization of division
+    i = add (exp_xy, 5);              // 15-1+9-18 = 5
+    i = sub (i, exp_yy);
+
+    gain = shl (shr (gain, i), 1);    // Q0 -> Q1/
+
+    return (gain);
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word16 G_code(          /* o     : Gain of innovation code         */
+    Word16 xn2[],       /* i     : target vector                   */
+    Word16 y2[],        /* i     : filtered innovation vector      */
+    Flag   *pOverflow   /* i/o   : overflow flag                   */
+)
+{
+    Word16 i;
+    Word16 xy, yy, exp_xy, exp_yy, gain;
+    Word32 s;
+
+    Word16 *p_xn2 = xn2;
+    Word16 *p_y2  = y2;
+    Word16 temp;
+    Word32 temp2;
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    /* Compute scalar product <X[],Y[]> */
+    s = 0;
+
+    for (i = (L_SUBFR >> 2); i != 0 ; i--)
+    {
+        temp2 = (Word32)(*(p_y2++) >> 1);
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_xn2++), temp2, s);
+        temp2 = (Word32)(*(p_y2++) >> 1);
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_xn2++), temp2, s);
+        temp2 = (Word32)(*(p_y2++) >> 1);
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_xn2++), temp2, s);
+        temp2 = (Word32)(*(p_y2++) >> 1);
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_xn2++), temp2, s);
+    }
+    s <<= 1;
+    exp_xy = norm_l(s + 1); /* Avoid case of all zeros, add 1 */
+
+    if (exp_xy < 17)        /* extra right shift to be sure xy < yy */
+    {
+        xy = (Word16)(s >> (17 - exp_xy));
+    }
+    else
+    {
+        xy = (Word16)(s << (exp_xy - 17));
+    }
+
+    /* If (xy < 0) gain = 0  */
+
+    if (xy <= 0)
+    {
+        return ((Word16) 0);
+    }
+
+    /* Compute scalar product <Y[],Y[]> */
+
+    s = 0L;
+    p_y2  = y2;
+
+    for (i = (L_SUBFR >> 1); i != 0 ; i--)
+    {
+        temp = *(p_y2++) >> 1;
+        s += ((Word32) temp * temp) >> 2;
+        temp = *(p_y2++) >> 1;
+        s += ((Word32) temp * temp) >> 2;
+    }
+    s <<= 3;
+    exp_yy = norm_l(s);
+
+    if (exp_yy < 16)
+    {
+        yy = (Word16)(s >> (16 - exp_yy));
+    }
+    else
+    {
+        yy = (Word16)(s << (exp_yy - 16));
+    }
+
+    gain = div_s(xy, yy);
+
+    /* Denormalization of division */
+    i  = exp_xy + 5;                                /* 15-1+9-18 = 5 */
+    i -= exp_yy;
+
+    // gain = shl (shr (gain, i), 1);    /* Q0 -> Q1 */
+
+    if (i > 1)
+    {
+        gain >>= i - 1;
+    }
+    else
+    {
+        gain <<= 1 - i;
+    }
+
+
+    return (gain);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.h
new file mode 100644 (file)
index 0000000..e7b8407
--- /dev/null
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: g_code.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the G_code() function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef G_CODE_H
+#define G_CODE_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 G_code(          /* o     : Gain of innovation code         */
+        Word16 xn2[],       /* i     : target vector                   */
+        Word16 y2[],        /* i     : filtered innovation vector      */
+        Flag   *pOverflow   /* i/o   : overflow flag                   */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _G_CODE_H */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.cpp
new file mode 100644 (file)
index 0000000..325e29b
--- /dev/null
@@ -0,0 +1,412 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: g_pitch.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "g_pitch.h"
+#include "mode.h"
+#include "cnst.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: G_pitch
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode = AMR mode (enum Mode)
+    xn = pointer to pitch target buffer (Word16)
+    y1 = pointer to filtered adaptive codebook buffer (Word16)
+    g_coeff  = pointer to buffer of correlations needed for gain quantization
+               (Word16)
+    L_subfr = length of subframe (Word16)
+    pOverflow = pointer to overflow flag (Flag)
+
+ Outputs:
+    g_coeff contains the mantissa and exponent of the two dot products.
+    pOverflow -> 1 if an overflow occurs
+
+ Returns:
+    gain =  ratio of dot products.(Word16)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes the pitch (adaptive codebook) gain. The adaptive
+ codebook gain is given by
+
+    g = <x[], y[]> / <y[], y[]>
+
+    where:  x[] is the target vector
+            y[] is the filtered adaptive codevector
+            <> denotes dot product.
+
+ The gain is limited to the range [0,1.2] (=0..19661 Q14)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ g_pitch.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 G_pitch     (    // o : Gain of pitch lag saturated to 1.2
+    enum Mode mode,     // i : AMR mode
+    Word16 xn[],        // i : Pitch target.
+    Word16 y1[],        // i : Filtered adaptive codebook.
+    Word16 g_coeff[],   // i : Correlations need for gain quantization
+    Word16 L_subfr      // i : Length of subframe.
+)
+{
+    Word16 i;
+    Word16 xy, yy, exp_xy, exp_yy, gain;
+    Word32 s;
+
+    Word16 scaled_y1[L_SUBFR];   // Usually dynamic allocation of (L_subfr)
+
+    // divide "y1[]" by 4 to avoid overflow
+
+// The reference ETSI code uses a global overflow Flag. However in the actual
+// implementation a pointer to the overflow flag is passed into the function.
+
+    for (i = 0; i < L_subfr; i++)
+    {
+        scaled_y1[i] = shr (y1[i], 2);
+    }
+
+    // Compute scalar product <y1[],y1[]>
+
+    // Q12 scaling / MR122
+    Overflow = 0;
+    s = 1L; // Avoid case of all zeros
+    for (i = 0; i < L_subfr; i++)
+    {
+        s = L_mac (s, y1[i], y1[i]);
+    }
+    if (Overflow == 0)       // Test for overflow
+    {
+        exp_yy = norm_l (s);
+        yy = pv_round (L_shl (s, exp_yy));
+    }
+    else
+    {
+        s = 1L; // Avoid case of all zeros
+        for (i = 0; i < L_subfr; i++)
+        {
+            s = L_mac (s, scaled_y1[i], scaled_y1[i]);
+        }
+        exp_yy = norm_l (s);
+        yy = pv_round (L_shl (s, exp_yy));
+        exp_yy = sub (exp_yy, 4);
+    }
+
+    // Compute scalar product <xn[],y1[]>
+
+    Overflow = 0;
+    s = 1L; // Avoid case of all zeros
+
+    for (i = 0; i < L_subfr; i++)
+    {
+        s = L_mac(s, xn[i], y1[i]);
+    }
+    if (Overflow == 0)
+    {
+        exp_xy = norm_l (s);
+        xy = pv_round (L_shl (s, exp_xy));
+    }
+    else
+    {
+        s = 1L; // Avoid case of all zeros
+        for (i = 0; i < L_subfr; i++)
+        {
+            s = L_mac (s, xn[i], scaled_y1[i]);
+        }
+        exp_xy = norm_l (s);
+        xy = pv_round (L_shl (s, exp_xy));
+        exp_xy = sub (exp_xy, 2);
+    }
+
+    g_coeff[0] = yy;
+    g_coeff[1] = sub (15, exp_yy);
+    g_coeff[2] = xy;
+    g_coeff[3] = sub (15, exp_xy);
+
+    // If (xy < 4) gain = 0
+
+    i = sub (xy, 4);
+
+    if (i < 0)
+        return ((Word16) 0);
+
+    // compute gain = xy/yy
+
+    xy = shr (xy, 1);                  // Be sure xy < yy
+    gain = div_s (xy, yy);
+
+    i = sub (exp_xy, exp_yy);      // Denormalization of division
+    gain = shr (gain, i);
+
+    // if(gain >1.2) gain = 1.2
+
+    if (sub (gain, 19661) > 0)
+    {
+        gain = 19661;
+    }
+
+    if (sub(mode, MR122) == 0)
+    {
+       // clear 2 LSBits
+       gain = gain & 0xfffC;
+    }
+
+    return (gain);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 G_pitch(         /* o : Gain of pitch lag saturated to 1.2       */
+    enum Mode mode,     /* i : AMR mode                                 */
+    Word16 xn[],        /* i : Pitch target.                            Q0  */
+    Word16 y1[],        /* i : Filtered adaptive codebook.              Q12 */
+    Word16 g_coeff[],   /* i : Correlations need for gain quantization  */
+    Word16 L_subfr,     /* i : Length of subframe.                      */
+    Flag   *pOverflow   /* i/o : Overflow flag                          */
+)
+{
+
+    Word16 i;
+    Word16 xy;
+    Word16 yy;
+    Word16 exp_xy;
+    Word16 exp_yy;
+    Word16 gain;
+    Word16 tmp;
+    Word32 s;
+    Word32 s1;
+    Word32 L_temp;                      /* Use this as an intermediate value */
+    Word16 *p_xn = &xn[0];
+    Word16 *p_y1 = &y1[0];
+
+    /* Compute scalar product <y1[],y1[]> */
+
+    /* Q12 scaling / MR122 */
+    *pOverflow = 0;
+    s = 0;
+
+    for (i = L_subfr >> 2; i != 0; i--)
+    {
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_y1), (Word32) * (p_y1), s);
+        p_y1++;
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_y1), (Word32) * (p_y1), s);
+        p_y1++;
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_y1), (Word32) * (p_y1), s);
+        p_y1++;
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_y1), (Word32) * (p_y1), s);
+        p_y1++;
+    }
+    if ((s >= 0) & (s < 0x40000000))
+    {
+        s <<= 1;
+        s  += 1;            /* Avoid case of all zeros */
+
+        exp_yy = norm_l(s);             /* Note 0<=exp_yy <= 31 */
+        L_temp = s << exp_yy;
+        yy = pv_round(L_temp, pOverflow);
+    }
+    else
+    {
+        s = 0;                      /* Avoid case of all zeros */
+        p_y1 = &y1[0];
+        for (i = (L_subfr >> 1); i != 0; i--)
+        {
+            tmp = *(p_y1++) >> 2;
+            s = amrnb_fxp_mac_16_by_16bb((Word32) tmp, (Word32) tmp, s);
+            tmp = *(p_y1++) >> 2;
+            s = amrnb_fxp_mac_16_by_16bb((Word32) tmp, (Word32) tmp, s);
+        }
+
+        s <<= 1;
+        s  += 1;            /* Avoid case of all zeros */
+
+        exp_yy = norm_l(s);
+        L_temp = s << exp_yy;
+        yy = pv_round(L_temp, pOverflow);
+        exp_yy = exp_yy - 4;
+
+    }
+
+    /* Compute scalar product <xn[],y1[]> */
+
+    s = 0;
+    p_y1 = &y1[0];
+    *pOverflow = 0;
+
+    for (i = L_subfr; i != 0; i--)
+    {
+        L_temp = ((Word32) * (p_xn++) * *(p_y1++));
+        s1 = s;
+        s = s1 + L_temp;
+
+        if ((s1 ^ L_temp) > 0)
+        {
+            if ((s1 ^ s) < 0)
+            {
+                *pOverflow = 1;
+                break;
+            }
+        }
+    }
+
+    if (!(*pOverflow))
+    {
+
+        s <<= 1;
+        s  += 1;            /* Avoid case of all zeros */
+
+        exp_xy = norm_l(s);             /* Note 0<=exp_yy <= 31 */
+        L_temp = s << exp_xy;
+        xy = pv_round(L_temp, pOverflow);
+    }
+    else
+    {
+        s = 0;  /* re-initialize calculations */
+        p_y1 = &y1[0];
+        p_xn = &xn[0];
+
+        for (i = (L_subfr >> 2); i != 0; i--)
+        {
+            L_temp = (Word32)(*(p_y1++) >> 2);
+            s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_xn++), L_temp, s);
+            L_temp = (Word32)(*(p_y1++) >> 2);
+            s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_xn++), L_temp, s);
+            L_temp = (Word32)(*(p_y1++) >> 2);
+            s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_xn++), L_temp, s);
+            L_temp = (Word32)(*(p_y1++) >> 2);
+            s = amrnb_fxp_mac_16_by_16bb((Word32) * (p_xn++), L_temp, s);
+        }
+
+        s <<= 1;
+        s  += 1;            /* Avoid case of all zeros */
+
+        exp_xy = norm_l(s);
+        L_temp = s << exp_xy;
+        xy = pv_round(L_temp, pOverflow);
+        exp_xy = exp_xy - 4;
+
+    }
+
+    g_coeff[0] = yy;
+    g_coeff[1] = 15 - exp_yy;
+    g_coeff[2] = xy;
+    g_coeff[3] = 15 - exp_xy;
+
+    /* If (xy < 4) gain = 0 */
+    if (xy < 4)
+    {
+        return ((Word16) 0);
+    }
+
+    /* compute gain = xy/yy */
+    /* Be sure xy < yy */
+
+    xy = xy >> 1;
+
+    gain = div_s(xy, yy);
+
+    i = exp_xy - exp_yy;               /* Denormalization of division */
+
+    gain = shr(gain, i, pOverflow);
+
+
+    /* if(gain >1.2) gain = 1.2 */
+    if (gain > 19661)
+    {
+        gain = 19661;
+    }
+
+    if (mode == MR122)
+    {
+        /* clear 2 LSBits */
+        gain = gain & 0xfffC;
+    }
+
+    return(gain);
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.h
new file mode 100644 (file)
index 0000000..fb33f66
--- /dev/null
@@ -0,0 +1,108 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: g_pitch.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the G_pitch() function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef G_PITCH_H
+#define G_PITCH_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "mode.h"
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 G_pitch(         /* o : Gain of pitch lag saturated to 1.2       */
+        enum Mode mode,     /* i : AMR mode                                 */
+        Word16 xn[],        /* i : Pitch target.                            */
+        Word16 y1[],        /* i : Filtered adaptive codebook.              */
+        Word16 g_coeff[],   /* i : Correlations need for gain quantization  */
+        Word16 L_subfr,     /* i : Length of subframe.                      */
+        Flag   *pOverflow   /* i/o : Overflow flag                          */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _G_PITCH_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.cpp
new file mode 100644 (file)
index 0000000..b9b191b
--- /dev/null
@@ -0,0 +1,658 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: gain_q.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+    Quantazation of gains
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "gain_q.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "qua_gain.h"
+#include "cnst.h"
+#include "mode.h"
+#include "g_code.h"
+#include "q_gain_c.h"
+#include "calc_en.h"
+#include "qgain795.h"
+#include "qgain475.h"
+#include "set_zero.h"
+#include "oscl_mem.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NPRED 4  /* number of prediction taps */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gainQuant_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- double pointer to gainQuantState
+
+ Outputs:
+    st -- double ponter to gainQuantState
+
+ Returns:
+    -1 if an error occurs during memory initialization
+     0 if OK
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Allocates state memory and initializes state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ gain_q.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 gainQuant_init(gainQuantState **state)
+{
+    gainQuantState* s;
+
+    if (state == (gainQuantState **) NULL)
+    {
+        /* fprintf(stderr, "gainQuant_init: invalid parameter\n"); */
+        return -1;
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (gainQuantState *) oscl_malloc(sizeof(gainQuantState))) == NULL)
+    {
+        /* fprintf(stderr, "gainQuant_init: can not malloc state structure\n"); */
+        return -1;
+    }
+
+    s->gain_idx_ptr = NULL;
+
+    s->adaptSt = NULL;
+
+    /* Init sub states */
+    if (gc_pred_reset(&s->gc_predSt)
+            || gc_pred_reset(&s->gc_predUnqSt)
+            || gain_adapt_init(&s->adaptSt))
+    {
+        gainQuant_exit(&s);
+        return -1;
+    }
+
+    gainQuant_reset(s);
+    *state = s;
+
+    return 0;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gainQuant_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- double pointer to gainQuantState
+
+ Outputs:
+    st -- double ponter to gainQuantState
+
+ Returns:
+    -1 if an error occurs
+     0 if OK
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Initializes state memory to zero
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ gain_q.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 gainQuant_reset(gainQuantState *state)
+{
+
+    if (state == (gainQuantState *) NULL)
+    {
+        /* fprintf(stderr, "gainQuant_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    state->sf0_exp_gcode0 = 0;
+    state->sf0_frac_gcode0 = 0;
+    state->sf0_exp_target_en = 0;
+    state->sf0_frac_target_en = 0;
+
+
+    oscl_memset((void *)state->sf0_exp_coeff,  0, 5*sizeof(*state->sf0_exp_coeff));
+    oscl_memset((void *)state->sf0_frac_coeff, 0, 5*sizeof(*state->sf0_frac_coeff));
+
+    state->gain_idx_ptr = NULL;
+
+    gc_pred_reset(&(state->gc_predSt));
+    gc_pred_reset(&(state->gc_predUnqSt));
+    gain_adapt_reset(state->adaptSt);
+
+    return 0;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gainQuant_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- double pointer to gainQuantState
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    The memory used for state memory is freed
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ gain_q.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void gainQuant_exit(gainQuantState **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    gain_adapt_exit(&(*state)->adaptSt);
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: gainQuant
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st   -- pointer to gainQuantState
+    mode -- enum Mode -- coder mode
+    res  -- Word16 array -- LP residual,                 Q0
+    exc  -- Word16 array -- LTP excitation (unfiltered), Q0
+    code -- Word16 array -- CB innovation (unfiltered),  Q13
+                            (unsharpened for MR475)
+    xn  -- Word16 array -- Target vector.
+    xn2 -- Word16 array -- Target vector.
+    y1  -- Word16 array -- Adaptive codebook.
+    Y2  -- Word16 array -- Filtered innovative vector.
+    g_coeff -- Word16 array -- Correlations <xn y1> <y1 y1>
+                               Compute in G_pitch().
+
+    even_subframe -- Word16 -- even subframe indicator flag
+    gp_limit -- Word16 -- pitch gain limit
+    gain_pit -- Word16 Pointer -- Pitch gain.
+
+ Outputs:
+    st -- pointer to gainQuantState
+    sf0_gain_pit -- Word16 Pointer -- Pitch gain sf 0.   MR475
+    sf0_gain_cod -- Word16 Pointer -- Code gain sf 0.    MR475
+    gain_pit -- Word16 Pointer -- Pitch gain.
+    gain_cod -- Word16 Pointer -- Code gain.
+                                  MR475: gain_* unquantized in even
+                                  subframes, quantized otherwise
+
+    anap -- Word16 Double Pointer -- Index of quantization
+
+    pOverflow -- Flag Pointer -- overflow indicator
+
+ Returns:
+    Zero
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Quantazation of gains
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ gain_q.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+
+
+void gainQuant(
+    gainQuantState *st,   /* i/o : State struct                      */
+    enum Mode mode,       /* i   : coder mode                        */
+    Word16 res[],         /* i   : LP residual,                 Q0   */
+    Word16 exc[],         /* i   : LTP excitation (unfiltered), Q0   */
+    Word16 code[],        /* i   : CB innovation (unfiltered),  Q13  */
+    /*       (unsharpened for MR475)           */
+    Word16 xn[],          /* i   : Target vector.                    */
+    Word16 xn2[],         /* i   : Target vector.                    */
+    Word16 y1[],          /* i   : Adaptive codebook.                */
+    Word16 Y2[],          /* i   : Filtered innovative vector.       */
+    Word16 g_coeff[],     /* i   : Correlations <xn y1> <y1 y1>      */
+    /*       Compute in G_pitch().             */
+    Word16 even_subframe, /* i   : even subframe indicator flag      */
+    Word16 gp_limit,      /* i   : pitch gain limit                  */
+    Word16 *sf0_gain_pit, /* o   : Pitch gain sf 0.   MR475          */
+    Word16 *sf0_gain_cod, /* o   : Code gain sf 0.    MR475          */
+    Word16 *gain_pit,     /* i/o : Pitch gain.                       */
+    Word16 *gain_cod,     /* o   : Code gain.                        */
+    /*       MR475: gain_* unquantized in even */
+    /*       subframes, quantized otherwise    */
+    Word16 **anap,        /* o   : Index of quantization             */
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of tbl ptrs */
+    Flag   *pOverflow     /* o   : overflow indicator                */
+)
+{
+    Word16 exp_gcode0;
+    Word16 frac_gcode0;
+    Word16 qua_ener_MR122;
+    Word16 qua_ener;
+    Word16 frac_coeff[5];
+    Word16 exp_coeff[5];
+    Word16 exp_en;
+    Word16 frac_en;
+    Word16 cod_gain_exp;
+    Word16 cod_gain_frac;
+    Word16 temp;
+
+    if (mode == MR475)
+    {
+        if (even_subframe != 0)
+        {
+            /* save position in output parameter stream and current
+               state of codebook gain predictor */
+            st->gain_idx_ptr = (*anap)++;
+
+//            gc_pred_copy(&(st->gc_predSt), &(st->gc_predUnqSt));
+
+            oscl_memcpy(st->gc_predUnqSt.past_qua_en,
+                        st->gc_predSt.past_qua_en,
+                        NPRED*sizeof(Word16));
+            oscl_memcpy(st->gc_predUnqSt.past_qua_en_MR122,
+                        st->gc_predSt.past_qua_en_MR122,
+                        NPRED*sizeof(Word16));
+
+
+            /* predict codebook gain (using "unquantized" predictor)*/
+            /* (note that code[] is unsharpened in MR475)           */
+            gc_pred(
+                &(st->gc_predUnqSt),
+                mode,
+                code,
+                &st->sf0_exp_gcode0,
+                &st->sf0_frac_gcode0,
+                &exp_en,
+                &frac_en,
+                pOverflow);
+
+            /* calculate energy coefficients for quantization
+               and store them in state structure (will be used
+               in next subframe when real quantizer is run) */
+            calc_filt_energies(
+                mode,
+                xn,
+                xn2,
+                y1,
+                Y2,
+                g_coeff,
+                st->sf0_frac_coeff,
+                st->sf0_exp_coeff,
+                &cod_gain_frac,
+                &cod_gain_exp,
+                pOverflow);
+
+            /* store optimum codebook gain (Q1) */
+            temp = cod_gain_exp + 1;
+
+            *gain_cod =
+                shl(
+                    cod_gain_frac,
+                    temp,
+                    pOverflow);
+
+            calc_target_energy(
+                xn,
+                &st->sf0_exp_target_en,
+                &st->sf0_frac_target_en,
+                pOverflow);
+
+            /* calculate optimum codebook gain and update
+               "unquantized" predictor                    */
+            MR475_update_unq_pred(
+                &(st->gc_predUnqSt),
+                st->sf0_exp_gcode0,
+                st->sf0_frac_gcode0,
+                cod_gain_exp,
+                cod_gain_frac,
+                pOverflow);
+
+            /* the real quantizer is not run here... */
+        }
+        else
+        {
+            /* predict codebook gain (using "unquantized" predictor) */
+            /* (note that code[] is unsharpened in MR475)            */
+            gc_pred(
+                &(st->gc_predUnqSt),
+                mode,
+                code,
+                &exp_gcode0,
+                &frac_gcode0,
+                &exp_en,
+                &frac_en,
+                pOverflow);
+
+            /* calculate energy coefficients for quantization */
+            calc_filt_energies(
+                mode,
+                xn,
+                xn2,
+                y1,
+                Y2,
+                g_coeff,
+                frac_coeff,
+                exp_coeff,
+                &cod_gain_frac,
+                &cod_gain_exp,
+                pOverflow);
+
+            calc_target_energy(
+                xn,
+                &exp_en,
+                &frac_en,
+                pOverflow);
+
+            /* run real (4-dim) quantizer and update real gain predictor */
+            *st->gain_idx_ptr =
+                MR475_gain_quant(
+                    &(st->gc_predSt),
+                    st->sf0_exp_gcode0,
+                    st->sf0_frac_gcode0,
+                    st->sf0_exp_coeff,
+                    st->sf0_frac_coeff,
+                    st->sf0_exp_target_en,
+                    st->sf0_frac_target_en,
+                    code,
+                    exp_gcode0,
+                    frac_gcode0,
+                    exp_coeff,
+                    frac_coeff,
+                    exp_en,
+                    frac_en,
+                    gp_limit,
+                    sf0_gain_pit,
+                    sf0_gain_cod,
+                    gain_pit,
+                    gain_cod,
+                    pOverflow);
+        }
+    }
+    else
+    {
+        /*-------------------------------------------------------------------*
+         *  predict codebook gain and quantize                               *
+         *  (also compute normalized CB innovation energy for MR795)         *
+         *-------------------------------------------------------------------*/
+        gc_pred(
+            &(st->gc_predSt),
+            mode,
+            code,
+            &exp_gcode0,
+            &frac_gcode0,
+            &exp_en,
+            &frac_en,
+            pOverflow);
+
+        if (mode == MR122)
+        {
+            *gain_cod =
+                G_code(
+                    xn2,
+                    Y2,
+                    pOverflow);
+
+            *(*anap)++ =
+                q_gain_code(
+                    mode,
+                    exp_gcode0,
+                    frac_gcode0,
+                    gain_cod,
+                    &qua_ener_MR122,
+                    &qua_ener,
+                    common_amr_tbls->qua_gain_code_ptr,
+                    pOverflow);
+        }
+        else
+        {
+            /* calculate energy coefficients for quantization */
+            calc_filt_energies(
+                mode,
+                xn,
+                xn2,
+                y1,
+                Y2,
+                g_coeff,
+                frac_coeff,
+                exp_coeff,
+                &cod_gain_frac,
+                &cod_gain_exp,
+                pOverflow);
+
+            if (mode == MR795)
+            {
+                MR795_gain_quant(
+                    st->adaptSt,
+                    res,
+                    exc,
+                    code,
+                    frac_coeff,
+                    exp_coeff,
+                    exp_en,
+                    frac_en,
+                    exp_gcode0,
+                    frac_gcode0,
+                    L_SUBFR,
+                    cod_gain_frac,
+                    cod_gain_exp,
+                    gp_limit,
+                    gain_pit,
+                    gain_cod,
+                    &qua_ener_MR122,
+                    &qua_ener,
+                    anap,
+                    common_amr_tbls,
+                    pOverflow);
+            }
+            else
+            {
+                *(*anap)++ =
+                    Qua_gain(
+                        mode,
+                        exp_gcode0,
+                        frac_gcode0,
+                        frac_coeff,
+                        exp_coeff,
+                        gp_limit,
+                        gain_pit,
+                        gain_cod,
+                        &qua_ener_MR122,
+                        &qua_ener,
+                        common_amr_tbls,
+                        pOverflow);
+            }
+        }
+
+        /*------------------------------------------------------------------*
+         *  update table of past quantized energies                         *
+         *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                         *
+         *  st->past_qua_en(Q10) = 20 * Log10(qua_gain_code) / constant     *
+         *                       = Log2(qua_gain_code)                      *
+         *                       = qua_ener                                 *
+         *                                           constant = 20*Log10(2) *
+         *------------------------------------------------------------------*/
+        gc_pred_update(
+            &(st->gc_predSt),
+            qua_ener_MR122,
+            qua_ener);
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.h
new file mode 100644 (file)
index 0000000..a0a7c2c
--- /dev/null
@@ -0,0 +1,161 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: gain_q.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, gain_q.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef gain_q_h
+#define gain_q_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "gc_pred.h"
+#include "g_adapt.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 sf0_exp_gcode0;
+        Word16 sf0_frac_gcode0;
+        Word16 sf0_exp_target_en;
+        Word16 sf0_frac_target_en;
+        Word16 sf0_exp_coeff[5];
+        Word16 sf0_frac_coeff[5];
+        Word16 *gain_idx_ptr;
+
+        gc_predState     gc_predSt;
+        gc_predState     gc_predUnqSt;
+        GainAdaptState   *adaptSt;
+    } gainQuantState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 gainQuant_init(gainQuantState **st);
+    /* initialize one instance of the pre processing state.
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to gainQuant in each call.
+       returns 0 on success
+     */
+    Word16 gainQuant_reset(gainQuantState *st);
+    /* reset of pre processing state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+    void gainQuant_exit(gainQuantState **st);
+    /* de-initialize pre processing state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    void gainQuant(
+        gainQuantState *st,   /* i/o : State struct                      */
+        enum Mode mode,       /* i   : coder mode                        */
+        Word16 res[],         /* i   : LP residual,                 Q0   */
+        Word16 exc[],         /* i   : LTP excitation (unfiltered), Q0   */
+        Word16 code[],        /* i   : CB innovation (unfiltered),  Q13  */
+        /*       (unsharpened for MR475)           */
+        Word16 xn[],          /* i   : Target vector.                    */
+        Word16 xn2[],         /* i   : Target vector.                    */
+        Word16 y1[],          /* i   : Adaptive codebook.                */
+        Word16 Y2[],          /* i   : Filtered innovative vector.       */
+        Word16 g_coeff[],     /* i   : Correlations <xn y1> <y1 y1>      */
+        /*       Compute in G_pitch().             */
+        Word16 even_subframe, /* i   : even subframe indicator flag      */
+        Word16 gp_limit,      /* i   : pitch gain limit                  */
+        Word16 *sf0_gain_pit, /* o   : Pitch gain sf 0.   MR475          */
+        Word16 *sf0_gain_cod, /* o   : Code gain sf 0.    MR475          */
+        Word16 *gain_pit,     /* i/o : Pitch gain.                       */
+        Word16 *gain_cod,     /* o   : Code gain.                        */
+        /*       MR475: gain_* unquantized in even */
+        /*       subframes, quantized otherwise    */
+        Word16 **anap,        /* o   : Index of quantization             */
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of tbl ptrs */
+        Flag   *pOverflow     /* o   : overflow indicator                */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* gain_q_h */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_enc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_enc.h
new file mode 100644 (file)
index 0000000..078b787
--- /dev/null
@@ -0,0 +1,176 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: gsmamr_enc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This header contains all the necessary information needed to use the
+ GSM AMR encoder library.
+
+------------------------------------------------------------------------------
+*/
+#ifndef _GSMAMR_ENC_H_
+#define _GSMAMR_ENC_H_
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "gsm_amr_typedefs.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ----------------------------------------------------------------------------*/
+    /* Number of 13-bit linear PCM samples per 20 ms frame */
+    /* L_FRAME = (8 kHz) * (20 msec) = 160 samples         */
+#define L_FRAME     160
+
+    /* Output format types */
+#define AMR_TX_WMF  0
+#define AMR_TX_IF2  1
+#define AMR_TX_ETS  2
+#define AMR_TX_IETF 3
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    enum Mode
+    {
+        MR475 = 0,/* 4.75 kbps */
+        MR515,    /* 5.15 kbps */
+        MR59,     /* 5.90 kbps */
+        MR67,     /* 6.70 kbps */
+        MR74,     /* 7.40 kbps */
+        MR795,    /* 7.95 kbps */
+        MR102,    /* 10.2 kbps */
+        MR122,    /* 12.2 kbps */
+        MRDTX,    /* DTX       */
+        N_MODES   /* Not Used  */
+    };
+
+    enum Frame_Type_3GPP
+    {
+        AMR_475 = 0,        /* 4.75 kbps    */
+        AMR_515,            /* 5.15 kbps    */
+        AMR_59,             /* 5.9 kbps     */
+        AMR_67,             /* 6.7 kbps     */
+        AMR_74,             /* 7.4 kbps     */
+        AMR_795,            /* 7.95 kbps    */
+        AMR_102,            /* 10.2 kbps    */
+        AMR_122,            /* 12.2 kbps    */
+        AMR_SID,            /* GSM AMR DTX  */
+        GSM_EFR_SID,        /* GSM EFR DTX  */
+        TDMA_EFR_SID,       /* TDMA EFR DTX */
+        PDC_EFR_SID,        /* PDC EFR DTX  */
+        FOR_FUTURE_USE1,    /* Unused 1     */
+        FOR_FUTURE_USE2,    /* Unused 2     */
+        FOR_FUTURE_USE3,    /* Unused 3     */
+        AMR_NO_DATA         /* No data      */
+    };
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ----------------------------------------------------------------------------*/
+    /* AMREncodeInit initializes the GSM AMR Encoder library by calling
+     * GSMInitEncode and sid_sync_init. If initialization was successful,
+     * init_status is set to zero, otherwise, it is set to -1.
+    */
+    int AMREncodeInit(
+        void **pEncStructure,
+        void **pSidSyncStructure,
+        Flag dtx_enable);
+
+    /* AMREncodeReset resets the state memory used by the Encoder and SID sync
+     * function. If reset was successful, reset_status is set to zero, otherwise,
+     * it is set to -1.
+    */
+    int AMREncodeReset(
+        void *pEncStructure,
+        void *pSidSyncStructure);
+
+    /* AMREncodeExit frees up the state memory used by the Encoder and SID
+     * synchronization function.
+    */
+    void AMREncodeExit(
+        void **pEncStructure,
+        void **pSidSyncStructure);
+
+    /*
+     * AMREncode is the entry point to the ETS Encoder library that encodes the raw
+     * data speech bits and converts the encoded bitstream into either an IF2-
+     * formatted bitstream, WMF-formatted bitstream, or ETS-formatted bitstream,
+     * depending on the the value of output_format. A zero is returned on success.
+     */
+    int AMREncode(
+        void *pEncState,
+        void *pSidSyncState,
+        enum Mode mode,
+        Word16 *pEncInput,
+        unsigned char *pEncOutput,
+        enum Frame_Type_3GPP *p3gpp_frame_type,
+        Word16 output_format
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* _GSMAMR_DEC_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_encoder_wrapper.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_encoder_wrapper.cpp
new file mode 100644 (file)
index 0000000..4bbe478
--- /dev/null
@@ -0,0 +1,228 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+#ifndef GSMAMR_ENC_H_INCLUDED
+#include "gsmamr_enc.h"
+#endif
+
+#ifndef GSMAMR_ENCODER_WRAPPER_H_INCLUDED
+#include "gsmamr_encoder_wrapper.h"
+#endif
+
+#ifndef OSCL_DLL_H_INCLUDED
+#include "oscl_dll.h"
+#endif
+
+// Define entry point for this DLL
+OSCL_DLL_ENTRY_POINT_DEFAULT()
+
+//----------------------------------------------------------------------------
+// CONSTANTS
+//----------------------------------------------------------------------------
+
+// Number of samples per frame
+#define KGAMR_NUM_SAMPLES_PER_FRAME   160
+
+// Default mode
+#define KDFLT_GAMR_MODE               MR475
+
+// Default bits per sample for input audio
+#define KDFLT_GAMR_BITS_PER_SAMPLE    16
+
+// Default sampling rate for input audio (in Hz)
+#define KDFLT_GAMR_SAMPLING_RATE      8000
+
+// Default input clock rate for input audio (in ticks/sec)
+#define KDFLT_GAMR_CLOCK_RATE         8000
+
+// Default number of channels
+#define KDFLT_GAMR_NUM_CHANNELS       1
+
+// length of uncompressed audio frame in bytes
+// Formula: (num_samples_per_frame * bits_per_sample) / num_bits_per_byte
+#define PV_GSM_AMR_20_MSEC_SIZE       \
+        ((KGAMR_NUM_SAMPLES_PER_FRAME * KDFLT_GAMR_BITS_PER_SAMPLE) / 8)
+
+
+///////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF
+CPvGsmAmrEncoder::CPvGsmAmrEncoder()
+{
+    // initialize member data to default values
+    iEncState = NULL;
+    iSidState = NULL;
+    iGsmAmrMode = (GSM_AMR_MODES)KDFLT_GAMR_MODE;
+    iLastModeUsed = 0;
+    iBitStreamFormat = AMR_TX_WMF;
+    iNumSamplesPerFrame = KGAMR_NUM_SAMPLES_PER_FRAME;
+}
+///////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF CPvGsmAmrEncoder::~CPvGsmAmrEncoder()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF int32 CPvGsmAmrEncoder::InitializeEncoder(int32 aMaxOutputBufferSize, TEncodeProperties* aProps)
+{
+    if (aProps == NULL)
+    {
+        // use default parameters
+        TEncodeProperties dfltProps;
+        aProps = &dfltProps;
+        dfltProps.iInBitsPerSample = KDFLT_GAMR_BITS_PER_SAMPLE;
+        dfltProps.iInSamplingRate = KDFLT_GAMR_SAMPLING_RATE;
+        dfltProps.iInClockRate = dfltProps.iInSamplingRate;
+        dfltProps.iInNumChannels = KDFLT_GAMR_NUM_CHANNELS;
+        iGsmAmrMode = (GSM_AMR_MODES)KDFLT_GAMR_MODE;
+        iBitStreamFormat = AMR_TX_WMF;
+    }
+    else
+    {
+        // check first if input parameters are valid
+        if ((IsModeValid(aProps->iMode) == false) ||
+                (aProps->iInBitsPerSample == 0) ||
+                (aProps->iInClockRate == 0) ||
+                (aProps->iInSamplingRate == 0) ||
+                (aProps->iInNumChannels == 0))
+        {
+            return GSMAMR_ENC_INVALID_PARAM;
+        }
+        // set AMR mode (bits per second)
+        iGsmAmrMode = (GSM_AMR_MODES)aProps->iMode;
+        if (aProps->iBitStreamFormat == AMR_TX_WMF)
+        {
+            iBitStreamFormat = AMR_TX_WMF;
+        }
+        else if (aProps->iBitStreamFormat == AMR_TX_IF2)
+        {
+            iBitStreamFormat = AMR_TX_IF2;
+        }
+        else if (aProps->iBitStreamFormat == AMR_TX_IETF)
+        {
+            iBitStreamFormat = AMR_TX_IETF;
+        }
+        else
+        {
+            iBitStreamFormat = AMR_TX_ETS;
+        }
+    }
+
+    iBytesPerSample = aProps->iInBitsPerSample / 8;
+
+    // set maximum buffer size for encoded data
+    iMaxOutputBufferSize = aMaxOutputBufferSize;
+    // return output parameters that will be used
+    aProps->iOutSamplingRate = KDFLT_GAMR_SAMPLING_RATE;
+    aProps->iOutNumChannels = KDFLT_GAMR_NUM_CHANNELS;
+    aProps->iOutClockRate = aProps->iOutSamplingRate;
+
+    // initialize AMR encoder
+    int32 nResult = AMREncodeInit(&iEncState, &iSidState, false);
+    if (nResult < 0) return(GSMAMR_ENC_CODEC_INIT_FAILURE);
+
+    return GSMAMR_ENC_NO_ERROR;
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF int32 CPvGsmAmrEncoder::Encode(TInputAudioStream& aInStream,
+        TOutputAudioStream& aOutStream)
+{
+    // check first if mode specified is invalid
+    if (IsModeValid(aInStream.iMode) == false)
+        return GSMAMR_ENC_INVALID_MODE;
+
+    // set AMR mode for this set of samples
+    iGsmAmrMode = (GSM_AMR_MODES)aInStream.iMode;
+
+    // get the maximum number of frames // BX
+    int32 bytesPerFrame = iNumSamplesPerFrame * iBytesPerSample;
+    int32 maxNumFrames = aInStream.iSampleLength / bytesPerFrame;
+    uint8 *pFrameIn  = aInStream.iSampleBuffer;
+    uint8 *pFrameOut = aOutStream.iBitStreamBuffer;
+    int32 i;
+
+    // encode samples
+    for (i = 0; i < maxNumFrames; i++)
+    {
+
+        // //////////////////////////////////////////
+        // encode this frame
+        // //////////////////////////////////////////
+        int32 * temp = & iLastModeUsed;
+        Word16 nStatus = AMREncode(iEncState, iSidState,    // BX, Word16 instead of int32 to avoid wierd case(IF2 format): the function returns 31, but nStatus ends up with a big wierd number
+                                   (Mode)iGsmAmrMode,
+                                   (Word16 *)pFrameIn,
+                                   (unsigned char *)pFrameOut,
+                                   (Frame_Type_3GPP*) temp,
+                                   iBitStreamFormat);
+
+        if (nStatus < 0)
+        {
+            // an error when encoding was received, so quit
+            return(GSMAMR_ENC_CODEC_ENCODE_FAILURE);
+        }
+
+        // save nStatus as this indicates the encoded frame size
+        int32 encFrameSize = (int32)nStatus;
+        aOutStream.iSampleFrameSize[i] = encFrameSize;
+        pFrameOut += encFrameSize;
+        pFrameIn  += bytesPerFrame;
+    }
+
+    // set other values to be returned
+    aOutStream.iNumSampleFrames = maxNumFrames;
+    return(GSMAMR_ENC_NO_ERROR);
+}
+
+////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF int32 CPvGsmAmrEncoder::CleanupEncoder()
+{
+    // call terminate function of GSM AMR encoder
+    AMREncodeExit(&iEncState, &iSidState);
+
+    iEncState = NULL;
+    iSidState = NULL;
+
+    return GSMAMR_ENC_NO_ERROR;
+}
+
+////////////////////////////////////////////////////////////////////////////
+OSCL_EXPORT_REF int32 CPvGsmAmrEncoder::Reset()
+{
+    // reset GSM AMR encoder (state memory and SID sync function.)
+    Word16 nStatus = AMREncodeReset(&iEncState, &iSidState);
+
+    if (nStatus < 0)
+    {
+        return GSMAMR_ENC_CODEC_ENCODE_FAILURE;
+    }
+    return GSMAMR_ENC_NO_ERROR;
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.cpp
new file mode 100644 (file)
index 0000000..e2a67f9
--- /dev/null
@@ -0,0 +1,308 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: hp_max.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "hp_max.h"
+#include    "basic_op.h"
+#include    "cnst.h"
+#include    "l_abs.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: hp_max
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    corr[] = correlation vector (Word16)
+    scal_sig[] = scaled signal vector (Word16)
+    L_frame = length of frame to compute pitch (Word16
+    lag_max = maximum lag (Word16)
+    lag_min = minimum lag (Word16)
+    cor_hp_max = pointer to max high-pass filtered norm. correlation (Word16)
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    cor_hp_max contains max high-pass filtered norm. correlation (Word16)
+    pOverflow -> 1 if the maximum correlation computation resulted in overflow
+
+ Returns:
+    0 (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function finds the maximum high-pass filtered correlation of scal_sig[]
+ in a given delay range.
+
+ The correlation is given by
+    corr[t] = <scal_sig[n],scal_sig[n-t]>,  t=lag_min,...,lag_max
+ The functions outputs the maximum high-pass filtered correlation after
+ normalization.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] hp_max.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 hp_max (
+    Word32 corr[],      // i   : correlation vector
+    Word16 scal_sig[],  // i   : scaled signal
+    Word16 L_frame,     // i   : length of frame to compute pitch
+    Word16 lag_max,     // i   : maximum lag
+    Word16 lag_min,     // i   : minimum lag
+    Word16 *cor_hp_max) // o   : max high-pass filtered norm. correlation
+{
+    Word16 i;
+    Word16 *p, *p1;
+    Word32 max, t0, t1;
+    Word16 max16, t016, cor_max;
+    Word16 shift, shift1, shift2;
+
+    max = MIN_32;
+    t0 = 0L;
+* The reference ETSI code uses a global flag for Overflow inside the math functions
+* saturate(). In the actual implementation a pointer to Overflow flag is passed in
+* as a parameter to the function
+
+    for (i = lag_max-1; i > lag_min; i--)
+    {
+       // high-pass filtering
+       t0 = L_sub (L_sub(L_shl(corr[-i], 1), corr[-i-1]), corr[-i+1]);
+       t0 = L_abs (t0);
+
+       if (L_sub (t0, max) >= 0)
+       {
+          max = t0;
+       }
+    }
+
+    // compute energy
+    p = scal_sig;
+    p1 = &scal_sig[0];
+    t0 = 0L;
+    for (i = 0; i < L_frame; i++, p++, p1++)
+    {
+       t0 = L_mac (t0, *p, *p1);
+    }
+
+    p = scal_sig;
+    p1 = &scal_sig[-1];
+    t1 = 0L;
+    for (i = 0; i < L_frame; i++, p++, p1++)
+    {
+       t1 = L_mac (t1, *p, *p1);
+    }
+
+    // high-pass filtering
+    t0 = L_sub(L_shl(t0, 1), L_shl(t1, 1));
+    t0 = L_abs (t0);
+
+    // max/t0
+    shift1 = sub(norm_l(max), 1);
+    max16  = extract_h(L_shl(max, shift1));
+    shift2 = norm_l(t0);
+    t016 =  extract_h(L_shl(t0, shift2));
+
+    if (t016 != 0)
+    {
+       cor_max = div_s(max16, t016);
+    }
+    else
+    {
+       cor_max = 0;
+    }
+
+    shift = sub(shift1, shift2);
+
+    if (shift >= 0)
+    {
+       *cor_hp_max = shr(cor_max, shift); // Q15
+    }
+    else
+    {
+       *cor_hp_max = shl(cor_max, negate(shift)); // Q15
+    }
+
+    return 0;
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word16 hp_max(
+    Word32 corr[],      /* i   : correlation vector.                      */
+    Word16 scal_sig[],  /* i   : scaled signal.                           */
+    Word16 L_frame,     /* i   : length of frame to compute pitch         */
+    Word16 lag_max,     /* i   : maximum lag                              */
+    Word16 lag_min,     /* i   : minimum lag                              */
+    Word16 *cor_hp_max, /* o   : max high-pass filtered norm. correlation */
+    Flag   *pOverflow   /* i/o : overflow Flag                            */
+)
+{
+    Word16 i;
+    Word16 *p, *p1;
+    Word32 max, t0, t1;
+    Word16 max16, t016, cor_max;
+    Word16 shift, shift1, shift2;
+    Word32 L_temp;
+
+    max = MIN_32;
+    t0 = 0L;
+
+    for (i = lag_max - 1; i > lag_min; i--)
+    {
+        /* high-pass filtering */
+        t0 = L_shl(corr[-i], 1, pOverflow);
+        L_temp = L_sub(t0, corr[-i-1], pOverflow);
+        t0 = L_sub(L_temp, corr[-i+1], pOverflow);
+        t0 = L_abs(t0);
+
+        if (t0 >= max)
+        {
+            max = t0;
+        }
+    }
+
+    /* compute energy */
+    p = scal_sig;
+    p1 = &scal_sig[0];
+    t0 = 0L;
+    for (i = 0; i < L_frame; i++, p++, p1++)
+    {
+        t0 = L_mac(t0, *p, *p1, pOverflow);
+    }
+
+    p = scal_sig;
+    p1 = &scal_sig[-1];
+    t1 = 0L;
+    for (i = 0; i < L_frame; i++, p++, p1++)
+    {
+        t1 = L_mac(t1, *p, *p1, pOverflow);
+    }
+
+    /* high-pass filtering */
+    L_temp = L_shl(t0, 1, pOverflow);
+    t1 = L_shl(t1, 1, pOverflow);
+    t0 = L_sub(L_temp, t1, pOverflow);
+    t0 = L_abs(t0);
+
+    /* max/t0 */
+    /*  shift1 = sub(norm_l(max), 1);
+        max16  = extract_h(L_shl(max, shift1));
+        shift2 = norm_l(t0);
+        t016 =  extract_h(L_shl(t0, shift2));   */
+
+    t016 = norm_l(max);
+    shift1 = t016 - 1;
+
+    L_temp = L_shl(max, shift1, pOverflow);
+    max16  = (Word16)(L_temp >> 16);
+
+    shift2 = norm_l(t0);
+    L_temp = L_shl(t0, shift2, pOverflow);
+    t016 = (Word16)(L_temp >> 16);
+
+    if (t016 != 0)
+    {
+        cor_max = div_s(max16, t016);
+    }
+    else
+    {
+        cor_max = 0;
+    }
+
+    shift = shift1 - shift2;
+
+    if (shift >= 0)
+    {
+        *cor_hp_max = shr(cor_max, shift, pOverflow); /* Q15 */
+    }
+    else
+    {
+        *cor_hp_max = shl(cor_max, negate(shift), pOverflow); /* Q15 */
+    }
+
+    return 0;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.h
new file mode 100644 (file)
index 0000000..67df2aa
--- /dev/null
@@ -0,0 +1,107 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: hp_max.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+       File             : hp_max.h
+       Purpose          : Find the maximum correlation of scal_sig[] in a given
+                          delay range.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef HP_MAX_H
+#define HP_MAX_H  "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    Word16 hp_max(
+        Word32 corr[],      /* i   : correlation vector.                      */
+        Word16 scal_sig[],  /* i   : scaled signal.                           */
+        Word16 L_frame,     /* i   : length of frame to compute pitch         */
+        Word16 lag_max,     /* i   : maximum lag                              */
+        Word16 lag_min,     /* i   : minimum lag                              */
+        Word16 *cor_hp_max, /* o   : max high-pass filtered norm. correlation */
+        Flag   *pOverflow   /* i/o : overflow Flag                            */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _HP_MAX_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.cpp
new file mode 100644 (file)
index 0000000..d8cf978
--- /dev/null
@@ -0,0 +1,208 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: inter_36.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "inter_36.h"
+#include "cnst.h"
+#include "inter_36_tab.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define UP_SAMP_MAX  6
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: inter_36
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pX    = pointer to input vector of type Word16
+    frac  = fraction  (-2..2 for 3*, -3..3 for 6*)  of type Word16
+    flag3 = if set, upsampling rate = 3 (6 otherwise) of type Word16
+    pOverflow = pointer to overflow flag
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+      File             : inter_36.c
+      Purpose          : Interpolating the normalized correlation
+                       : with 1/3 or 1/6 resolution.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ inter_36.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+    Word16 i, k;
+    Word16 *x1, *x2;
+    const Word16 *c1, *c2;
+    Word32 s;
+
+    if (flag3 != 0)
+    {
+      frac = shl (frac, 1);   // inter_3[k] = inter_6[2*k] -> k' = 2*k
+    }
+
+    if (frac < 0)
+    {
+        frac = add (frac, UP_SAMP_MAX);
+        x--;
+    }
+
+    x1 = &x[0];
+    x2 = &x[1];
+    c1 = &inter_6[frac];
+    c2 = &inter_6[sub (UP_SAMP_MAX, frac)];
+
+    s = 0;
+    for (i = 0, k = 0; i < L_INTER_SRCH; i++, k += UP_SAMP_MAX)
+    {
+        s = L_mac (s, x1[-i], c1[k]);
+        s = L_mac (s, x2[i], c2[k]);
+    }
+
+    return pv_round (s);
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 Interpol_3or6(   /* o : interpolated value                        */
+    Word16 *pX,         /* i : input vector                              */
+    Word16 frac,        /* i : fraction  (-2..2 for 3*, -3..3 for 6*)    */
+    Word16 flag3,       /* i : if set, upsampling rate = 3 (6 otherwise) */
+    Flag   *pOverflow
+)
+{
+    Word16 i;
+    Word16 k;
+    Word16 *pX1;
+    Word16 *pX2;
+    const Word16 *pC1;
+    const Word16 *pC2;
+    Word32 s;
+    Word16 temp1;
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    if (flag3 != 0)
+    {
+        frac <<= 1;
+        /* inter_3[k] = inter_6[2*k] -> k' = 2*k */
+    }
+
+    if (frac < 0)
+    {
+        frac += UP_SAMP_MAX;
+        pX--;
+    }
+
+    pX1   = &pX[0];
+    pX2   = &pX[1];
+    pC1   = &inter_6[frac];
+    temp1 = UP_SAMP_MAX - frac;
+    pC2   = &inter_6[temp1];
+
+    s = 0x04000;
+    k = 0;
+
+    for (i = (L_INTER_SRCH >> 1); i != 0; i--)
+    {
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (pX1--), (Word32) pC1[k], s);
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (pX2++), (Word32) pC2[k], s);
+        k += UP_SAMP_MAX;
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (pX1--), (Word32) pC1[k], s);
+        s = amrnb_fxp_mac_16_by_16bb((Word32) * (pX2++), (Word32) pC2[k], s);
+        k <<= 1;
+    }
+
+    return((Word16)(s >> 15));
+}
+
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.h
new file mode 100644 (file)
index 0000000..7c96471
--- /dev/null
@@ -0,0 +1,108 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: inter_36.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : inter_36.h
+      Purpose          : Interpolating the normalized correlation
+                       : with 1/3 or 1/6 resolution.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _INTER_36_H_
+#define _INTER_36_H_
+#define inter_36_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    Word16 Interpol_3or6(   /* (o)  : interpolated value                        */
+        Word16 *x,          /* (i)  : input vector                              */
+        Word16 frac,        /* (i)  : fraction  (-2..2 for 3*, -3..3 for 6*)    */
+        Word16 flag3,        /* (i)  : if set, upsampling rate = 3 (6 otherwise) */
+        Flag   *pOverflow
+    );
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _INTER_36_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.cpp
new file mode 100644 (file)
index 0000000..264d0bf
--- /dev/null
@@ -0,0 +1,174 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Filename: inter_36_tab.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    None
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+      File             : inter_36.tab
+      Purpose          : Tables for interpolating the normalized correlation
+                         with 1/3 or 1/6 resolution.
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "inter_36_tab.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+#define UP_SAMP_MAX  6
+#define FIR_SIZE     (UP_SAMP_MAX*L_INTER_SRCH+1)
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+    /* 1/6 resolution interpolation filter  (-3 dB at 3600 Hz) */
+    /* Note: The IS641 (7.4) 1/3 resolution filter is simply a subsampled
+             version of the 1/6 resolution filter, i.e. it uses
+             every second coefficient:
+
+             inter_3[k] = inter_6[2*k], 0 <= k <= 3*L_INTER_SRCH
+     */
+
+    const Word16 inter_6[FIR_SIZE] =
+    {
+        29519,
+        28316, 24906, 19838, 13896, 7945, 2755,
+        -1127, -3459, -4304, -3969, -2899, -1561,
+        -336, 534, 970, 1023, 823, 516,
+        220, 0, -131, -194, -215, 0
+    };
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL FUNCTION REFERENCES
+    ; Declare functions defined elsewhere and referenced in this module
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; Define all local variables
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Function body here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Return nothing or data or data pointer
+----------------------------------------------------------------------------*/
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.h
new file mode 100644 (file)
index 0000000..a99140a
--- /dev/null
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Filename: inter_36_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a table BytesUsed.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef INTER_36_TAB_H
+#define INTER_36_TAB_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 inter_6[];
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.cpp
new file mode 100644 (file)
index 0000000..eed4fc3
--- /dev/null
@@ -0,0 +1,160 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_abs.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_var1 = 32 bit long signed integer (Word32 ) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    L_var1 = absolute value of input (Word32)
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates the absolute value of L_var1; saturate in case
+ where the input is -214783648.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word32 L_abs (Word32 L_var1)
+{
+    Word32 L_var_out;
+
+    if (L_var1 == MIN_32)
+    {
+        L_var_out = MAX_32;
+    }
+    else
+    {
+        if (L_var1 < 0)
+        {
+            L_var_out = -L_var1;
+        }
+        else
+        {
+            L_var_out = L_var1;
+        }
+    }
+
+#if (WMOPS)
+    multiCounter[currCounter].L_abs++;
+#endif
+    return (L_var_out);
+}
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "l_abs.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word32 L_abs(Word32 L_var1)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+
+    Word32 y = L_var1 - (L_var1 < 0);
+    y = y ^(y >> 31);
+    return (y);
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.h
new file mode 100644 (file)
index 0000000..9a1eaa9
--- /dev/null
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_abs.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_abs function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_ABS_H
+#define L_ABS_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word32 L_abs(Word32 L_var1);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_comp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_comp.cpp
new file mode 100644 (file)
index 0000000..bd6c6f6
--- /dev/null
@@ -0,0 +1,140 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    hi = 16 bit signed integer (Word16) whose value falls in
+         the range : 0x8000 <= hi <= 0x7fff.
+    lo = 16 bit signed integer (Word16) whose value falls in
+         the range : 0x8000 <= lo <= 0x7fff.
+
+ Outputs:
+    pOverflow = 1 if overflow happens in a math function called by this function.
+    L_out = 32-bit result of (hi<<16 + lo<<1).
+
+ Returns:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+        None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function composes a 32 bit integer from two 16 bit double precision
+ format (DPF) numbers hi and lo by the following operation:
+ 1. Deposit hi into the 16 MS bits of the 32 bit output L_out.
+ 2. Shift lo left by 1.
+ 3. Add results from 1 and 2 with saturation to return the 32 bit result
+    L_out.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] oper_32b.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "l_comp.h"
+#include "basic_op.h"
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+Word32 L_Comp(Word16 hi, Word16 lo, Flag *pOverflow)
+{
+
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+    Word32 L_32;
+    Word32 temp32;
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+
+    L_32 = ((Word32)hi << 16);
+
+    temp32 = L_mac(L_32, lo, 1, pOverflow);
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+
+    return (temp32);       /* = hi<<16 + lo<<1 */
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_extract.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_extract.cpp
new file mode 100644 (file)
index 0000000..ba348d3
--- /dev/null
@@ -0,0 +1,146 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+
+
+
+ Filename: l_extract.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: L_extract
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_var = 32 bit signed integer (Word32) whose value falls
+           in the range : 0x8000 0000 <= L_32 <= 0x7fff ffff.
+
+    pL_var_hi =  pointer to the most significant word of L_var (Word16).
+
+    pL_var_lo =  pointer to the least significant word of L_var shifted
+              to the left by 1 (Word16).
+
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow -> 1 if the 32 bit add operation resulted in overflow
+    pL_var_hi -> MS word of L_32.
+    pL_var_lo -> LS word of L_32 shifted left by 1.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function extracts two 16-bit double precision format (DPF) numbers
+ from a 32-bit integer. The MS word of L_var will be stored in the location
+ pointed to by pL_var_hi and the shifted LS word of L_var will be stored in
+ the location pointed to by pL_var_lo.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] L_extract() function in oper_32b.c,  UMTS GSM AMR speech codec, R99 -
+ Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void L_Extract(Word32 L_var,
+               Word16 *pL_var_hi,
+               Word16 *pL_var_lo,
+               Flag   *pOverflow)
+{
+
+    Word32  temp;
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    temp = (L_var >> 16);
+
+    *(pL_var_hi) = (Word16) temp;
+    *(pL_var_lo) = (Word16)((L_var >> 1) - (temp << 15));
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp
new file mode 100644 (file)
index 0000000..9699095
--- /dev/null
@@ -0,0 +1,144 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    L_var1 = 32 bit long signed integer (Word32) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    L_var1 = 32-bit negation of input
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function negates the 32 bit variable, L_var1, with saturation; saturate
+ in the case where input is -2147483648 (0x8000 0000).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [1] basicop2.c, ETS Version 2.0.0, February 8, 1999
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word32 L_negate (Word32 L_var1)
+{
+    Word32 L_var_out;
+
+    L_var_out = (L_var1 == MIN_32) ? MAX_32 : -L_var1;
+#if (WMOPS)
+    multiCounter[currCounter].L_negate++;
+#endif
+    return (L_var_out);
+}
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+Word32 L_negate(register Word32 L_var1)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; Function body here
+    ----------------------------------------------------------------------------*/
+    L_var1 = (L_var1 == MIN_32) ? MAX_32 : -L_var1;
+
+    /*----------------------------------------------------------------------------
+    ; Return nothing or data or data pointer
+    ----------------------------------------------------------------------------*/
+    return (L_var1);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.cpp
new file mode 100644 (file)
index 0000000..9b733d8
--- /dev/null
@@ -0,0 +1,163 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: lag_wind.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "lag_wind.h"
+#include "lag_wind_tab.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lag_wind
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    m = LPC order of type Word16
+    r_h[] = pointer to autocorrelations (msb) of type Word16
+    r_l[] = pointer to autocorrelations (lsb) of type Word16
+    pOverflow = pointer to overflow flag
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+      File             : lag_wind.c
+      Purpose          : Lag windowing of autocorrelations.
+
+    FUNCTION:  Lag_window()
+
+    PURPOSE:  Lag windowing of autocorrelations.
+
+    DESCRIPTION:
+          r[i] = r[i]*lag_wind[i],   i=1,...,10
+
+      r[i] and lag_wind[i] are in special double precision format.
+      See "oper_32b.c" for the format.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lag_wind.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+    Word16 i;
+    Word32 x;
+
+    for (i = 1; i <= m; i++)
+    {
+        x = Mpy_32 (r_h[i], r_l[i], lag_h[i - 1], lag_l[i - 1], pOverflow);
+        L_Extract (x, &r_h[i], &r_l[i], pOverflow);
+    }
+    return;
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void Lag_window(
+    Word16 m,           /* (i)     : LPC order                        */
+    Word16 r_h[],       /* (i/o)   : Autocorrelations  (msb)          */
+    Word16 r_l[],       /* (i/o)   : Autocorrelations  (lsb)          */
+    Flag   *pOverflow
+)
+{
+    Word16 i;
+    Word32 x;
+    const Word16 *p_lag_h = &lag_h[0];
+    const Word16 *p_lag_l = &lag_l[0];
+    Word16 *p_r_h = &r_h[1];
+    Word16 *p_r_l = &r_l[1];
+
+    for (i = m; i != 0 ; i--)
+    {
+        x = Mpy_32(*(p_r_h), *(p_r_l), *(p_lag_h++), *(p_lag_l++), pOverflow);
+        *(p_r_h) = (Word16)(x >> 16);
+        *(p_r_l++) = (x >> 1) - (*(p_r_h++) << 15);
+    }
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.h
new file mode 100644 (file)
index 0000000..b533c42
--- /dev/null
@@ -0,0 +1,108 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: lag_wind.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : lag_wind.h
+      Purpose          : Lag windowing of autocorrelations.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _LAG_WIND_H_
+#define _LAG_WIND_H_
+#define lag_wind_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    void Lag_window(
+        Word16 m,          /* (i)    : LPC order                                */
+        Word16 r_h[],      /* (i/o)  : Autocorrelations  (msb)                  */
+        Word16 r_l[],      /* (i/o)  : Autocorrelations  (lsb)                  */
+        Flag   *pOverflow
+    );
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _LAG_WIND_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.cpp
new file mode 100644 (file)
index 0000000..c16090a
--- /dev/null
@@ -0,0 +1,197 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Filename: lag_wind_tab.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    None
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    None
+
+ Pointers and Buffers Modified:
+    None
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+      File             : lag_wind.tab
+      Purpose          : Table of lag_window for autocorrelation.
+
+ *-----------------------------------------------------*
+ | Table of lag_window for autocorrelation.            |
+ |                                                     |
+ | noise floor = 1.0001   = (0.9999  on r[1] ..r[10])  |
+ | Bandwitdh expansion = 60 Hz                         |
+ |                                                     |
+ |                                                     |
+ | lag_wind[0] =  1.00000000    (not stored)           |
+ | lag_wind[1] =  0.99879038                           |
+ | lag_wind[2] =  0.99546897                           |
+ | lag_wind[3] =  0.98995781                           |
+ | lag_wind[4] =  0.98229337                           |
+ | lag_wind[5] =  0.97252619                           |
+ | lag_wind[6] =  0.96072036                           |
+ | lag_wind[7] =  0.94695264                           |
+ | lag_wind[8] =  0.93131179                           |
+ | lag_wind[9] =  0.91389757                           |
+ | lag_wind[10]=  0.89481968                           |
+ -------------------------------------------------------
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ None
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "lag_wind_tab.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+    const Word16 lag_h[10] =
+    {
+        32728,
+        32619,
+        32438,
+        32187,
+        31867,
+        31480,
+        31029,
+        30517,
+        29946,
+        29321
+    };
+
+    const Word16 lag_l[10] =
+    {
+        11904,
+        17280,
+        30720,
+        25856,
+        24192,
+        28992,
+        24384,
+        7360,
+        19520,
+        14784
+    };
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL FUNCTION REFERENCES
+    ; Declare functions defined elsewhere and referenced in this module
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; Define all local variables
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Function body here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Return nothing or data or data pointer
+----------------------------------------------------------------------------*/
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.h
new file mode 100644 (file)
index 0000000..ed04706
--- /dev/null
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Filename: lag_wind_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares tables used by lag_wind.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef LAG_WIND_TAB_H
+#define LAG_WIND_TAB_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+    extern const Word16 lag_h[];
+    extern const Word16 lag_l[];
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp
new file mode 100644 (file)
index 0000000..cbd27d7
--- /dev/null
@@ -0,0 +1,759 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: levinson.cpp
+ Funtions: Levinson_init
+           Levinson_reset
+           Levinson_exit
+           Levinson
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the function the implements the Levinson-Durbin algorithm
+ using double-precision arithmetic. This file also includes functions to
+ initialize, allocate, and deallocate memory used by the Levinson function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "levinson.h"
+#include "basicop_malloc.h"
+#include "basic_op.h"
+#include "l_abs.h"
+#include "div_32.h"
+#include "cnst.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Levinson_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to an array of pointers to structures of type
+            LevinsonState
+
+ Outputs:
+    pointer pointed to by state points to the newly allocated memory to
+      be used by Levinson function
+
+ Returns:
+    return_value = 0, if initialization was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function allocates and initializes the state memory used by the
+ Levinson function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ levinson.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Levinson_init (LevinsonState **state)
+{
+  LevinsonState* s;
+
+  if (state == (LevinsonState **) NULL){
+      //fprint(stderr, "Levinson_init: invalid parameter\n");
+      return -1;
+  }
+  *state = NULL;
+
+  // allocate memory
+  if ((s= (LevinsonState *) malloc(sizeof(LevinsonState))) == NULL){
+      //fprint(stderr, "Levinson_init: can not malloc state structure\n");
+      return -1;
+  }
+
+  Levinson_reset(s);
+  *state = s;
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Levinson_init(LevinsonState **state)
+{
+    LevinsonState* s;
+
+    if (state == (LevinsonState **) NULL)
+    {
+        /*  fprint(stderr, "Levinson_init: invalid parameter\n");  */
+        return(-1);
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (LevinsonState *) oscl_malloc(sizeof(LevinsonState))) == NULL)
+    {
+        /*  fprint(stderr, "Levinson_init:
+                            can not malloc state structure\n");  */
+        return(-1);
+    }
+
+    Levinson_reset(s);
+    *state = s;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Levinson_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to structures of type LevinsonState
+
+ Outputs:
+    old_A field of structure pointed to by state is initialized to 4096
+      (first location) and the rest to zeros
+
+ Returns:
+    return_value = 0, if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function initializes the state memory used by the Levinson function to
+ zero.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ levinson.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Levinson_reset (LevinsonState *state)
+{
+  Word16 i;
+
+  if (state == (LevinsonState *) NULL){
+      fprint(stderr, "Levinson_reset: invalid parameter\n");
+      return -1;
+  }
+
+  state->old_A[0] = 4096;
+  for(i = 1; i < M + 1; i++)
+      state->old_A[i] = 0;
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Levinson_reset(LevinsonState *state)
+{
+    Word16 i;
+
+    if (state == (LevinsonState *) NULL)
+    {
+        /*  fprint(stderr, "Levinson_reset: invalid parameter\n");  */
+        return(-1);
+    }
+
+    state->old_A[0] = 4096;
+    for (i = 1; i < M + 1; i++)
+    {
+        state->old_A[i] = 0;
+    }
+
+    return(0);
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Levinson_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to an array of pointers to structures of type
+            LevinsonState
+
+ Outputs:
+    pointer pointed to by state is set to the NULL address
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function deallocates the state memory used by the Levinson function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ levinson.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Levinson_exit (LevinsonState **state)
+{
+  if (state == NULL || *state == NULL)
+      return;
+
+  // deallocate memory
+  free(*state);
+  *state = NULL;
+
+  return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Levinson_exit(LevinsonState **state)
+{
+    if (state == NULL || *state == NULL)
+    {
+        return;
+    }
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Levinson
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to structures of type LevinsonState
+    Rh = vector containing most significant byte of
+         autocorrelation values (Word16)
+    Rl = vector containing least significant byte of
+         autocorrelation values (Word16)
+    A = vector of LPC coefficients (10th order) (Word16)
+    rc = vector containing first four reflection coefficients (Word16)
+    pOverflow = pointer to overflow indicator (Flag)
+
+ Outputs:
+    A contains the newly calculated LPC coefficients
+    rc contains the newly calculated reflection coefficients
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function implements the Levinson-Durbin algorithm using double-
+ precision arithmetic. This is used to compute the Linear Predictive (LP)
+ filter parameters from the speech autocorrelation values.
+
+ The algorithm implemented is as follows:
+    A[0] = 1
+    K    = -R[1]/R[0]
+    A[1] = K
+    Alpha = R[0] * (1-K**2]
+
+    FOR  i = 2 to M
+
+        S =  SUM ( R[j]*A[i-j] ,j=1,i-1 ) +  R[i]
+        K = -S / Alpha
+
+        FOR j = 1 to  i-1
+            An[j] = A[j] + K*A[i-j]  where   An[i] = new A[i]
+        ENDFOR
+
+        An[i]=K
+        Alpha=Alpha * (1-K**2)
+
+    END
+
+ where:
+    R[i] = autocorrelations
+    A[i] = filter coefficients
+    K = reflection coefficient
+    Alpha = prediction gain
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ levinson.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Levinson (
+    LevinsonState *st,
+    Word16 Rh[],       // i : Rh[m+1] Vector of autocorrelations (msb)
+    Word16 Rl[],       // i : Rl[m+1] Vector of autocorrelations (lsb)
+    Word16 A[],        // o : A[m]    LPC coefficients  (m = 10)
+    Word16 rc[]        // o : rc[4]   First 4 reflection coefficients
+)
+{
+    Word16 i, j;
+    Word16 hi, lo;
+    Word16 Kh, Kl;                // reflexion coefficient; hi and lo
+    Word16 alp_h, alp_l, alp_exp; // Prediction gain; hi lo and exponent
+    Word16 Ah[M + 1], Al[M + 1];  // LPC coef. in double prec.
+    Word16 Anh[M + 1], Anl[M + 1];// LPC coef.for next iteration in double
+                                     prec.
+    Word32 t0, t1, t2;            // temporary variable
+
+    // K = A[1] = -R[1] / R[0]
+
+    t1 = L_Comp (Rh[1], Rl[1]);
+    t2 = L_abs (t1);                    // abs R[1]
+    t0 = Div_32 (t2, Rh[0], Rl[0]);     // R[1]/R[0]
+    if (t1 > 0)
+       t0 = L_negate (t0);             // -R[1]/R[0]
+    L_Extract (t0, &Kh, &Kl);           // K in DPF
+
+    rc[0] = pv_round (t0);
+
+    t0 = L_shr (t0, 4);                 // A[1] in
+    L_Extract (t0, &Ah[1], &Al[1]);     // A[1] in DPF
+
+    //  Alpha = R[0] * (1-K**2)
+
+    t0 = Mpy_32 (Kh, Kl, Kh, Kl);       // K*K
+    t0 = L_abs (t0);                    // Some case <0 !!
+    t0 = L_sub ((Word32) 0x7fffffffL, t0); // 1 - K*K
+    L_Extract (t0, &hi, &lo);           // DPF format
+    t0 = Mpy_32 (Rh[0], Rl[0], hi, lo); // Alpha in
+
+    // Normalize Alpha
+
+    alp_exp = norm_l (t0);
+    t0 = L_shl (t0, alp_exp);
+    L_Extract (t0, &alp_h, &alp_l);     // DPF format
+
+     *--------------------------------------*
+     * ITERATIONS  I=2 to M                 *
+     *--------------------------------------*
+
+    for (i = 2; i <= M; i++)
+    {
+       // t0 = SUM ( R[j]*A[i-j] ,j=1,i-1 ) +  R[i]
+
+       t0 = 0;
+       for (j = 1; j < i; j++)
+       {
+          t0 = L_add (t0, Mpy_32 (Rh[j], Rl[j], Ah[i - j], Al[i - j]));
+       }
+       t0 = L_shl (t0, 4);
+
+       t1 = L_Comp (Rh[i], Rl[i]);
+       t0 = L_add (t0, t1);            // add R[i]
+
+       // K = -t0 / Alpha
+
+       t1 = L_abs (t0);
+       t2 = Div_32 (t1, alp_h, alp_l); // abs(t0)/Alpha
+       if (t0 > 0)
+          t2 = L_negate (t2);         // K =-t0/Alpha
+       t2 = L_shl (t2, alp_exp);       // denormalize; compare to Alpha
+       L_Extract (t2, &Kh, &Kl);       // K in DPF
+
+       if (sub (i, 5) < 0)
+       {
+          rc[i - 1] = pv_round (t2);
+       }
+       // Test for unstable filter. If unstable keep old A(z)
+
+       if (sub (abs_s (Kh), 32750) > 0)
+       {
+          for (j = 0; j <= M; j++)
+          {
+             A[j] = st->old_A[j];
+          }
+
+          for (j = 0; j < 4; j++)
+          {
+             rc[j] = 0;
+          }
+
+          return 0;
+       }
+        *------------------------------------------*
+        *  Compute new LPC coeff. -> An[i]         *
+        *  An[j]= A[j] + K*A[i-j]     , j=1 to i-1 *
+        *  An[i]= K                                *
+        *------------------------------------------*
+
+       for (j = 1; j < i; j++)
+       {
+          t0 = Mpy_32 (Kh, Kl, Ah[i - j], Al[i - j]);
+          t0 = L_add(t0, L_Comp(Ah[j], Al[j]));
+          L_Extract (t0, &Anh[j], &Anl[j]);
+       }
+       t2 = L_shr (t2, 4);
+       L_Extract (t2, &Anh[i], &Anl[i]);
+
+       //  Alpha = Alpha * (1-K**2)
+
+       t0 = Mpy_32 (Kh, Kl, Kh, Kl);           // K*K
+       t0 = L_abs (t0);                        // Some case <0 !!
+       t0 = L_sub ((Word32) 0x7fffffffL, t0);  // 1 - K*K
+       L_Extract (t0, &hi, &lo);               // DPF format
+       t0 = Mpy_32 (alp_h, alp_l, hi, lo);
+
+       // Normalize Alpha
+
+       j = norm_l (t0);
+       t0 = L_shl (t0, j);
+       L_Extract (t0, &alp_h, &alp_l);         // DPF format
+       alp_exp = add (alp_exp, j);             // Add normalization to
+                                                  alp_exp
+
+       // A[j] = An[j]
+
+       for (j = 1; j <= i; j++)
+       {
+          Ah[j] = Anh[j];
+          Al[j] = Anl[j];
+       }
+    }
+
+    A[0] = 4096;
+    for (i = 1; i <= M; i++)
+    {
+       t0 = L_Comp (Ah[i], Al[i]);
+       st->old_A[i] = A[i] = pv_round (L_shl (t0, 1));
+    }
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Levinson(
+    LevinsonState *st,
+    Word16 Rh[],       /* i : Rh[m+1] Vector of autocorrelations (msb) */
+    Word16 Rl[],       /* i : Rl[m+1] Vector of autocorrelations (lsb) */
+    Word16 A[],        /* o : A[m]    LPC coefficients  (m = 10)       */
+    Word16 rc[],       /* o : rc[4]   First 4 reflection coefficients  */
+    Flag   *pOverflow
+)
+{
+    register Word16 i;
+    register Word16 j;
+    Word16 hi;
+    Word16 lo;
+    Word16 Kh;                    /* reflexion coefficient; hi and lo   */
+    Word16 Kl;
+    Word16 alp_h;                 /* Prediction gain; hi lo and exponent*/
+    Word16 alp_l;
+    Word16 alp_exp;
+    Word16 Ah[M + 1];             /* LPC coef. in double prec.          */
+    Word16 Al[M + 1];
+    Word16 Anh[M + 1];            /* LPC coef.for next iteration in     */
+    Word16 Anl[M + 1];            /* double prec.                       */
+    register Word32 t0;           /* temporary variable                 */
+    register Word32 t1;           /* temporary variable                 */
+    register Word32 t2;           /* temporary variable                 */
+
+    Word16 *p_Rh;
+    Word16 *p_Rl;
+    Word16 *p_Ah;
+    Word16 *p_Al;
+    Word16 *p_Anh;
+    Word16 *p_Anl;
+    Word16 *p_A;
+
+    /* K = A[1] = -R[1] / R[0] */
+    t1 = ((Word32) * (Rh + 1)) << 16;
+    t1 += *(Rl + 1) << 1;
+
+    t2 = L_abs(t1);         /* abs R[1] - required by Div_32 */
+    t0 = Div_32(t2, *Rh, *Rl, pOverflow);  /* R[1]/R[0]        */
+
+    if (t1 > 0)
+    {
+        t0 = L_negate(t0);  /* -R[1]/R[0]       */
+    }
+
+    /* K in DPF         */
+    Kh = (Word16)(t0 >> 16);
+    Kl = (Word16)((t0 >> 1) - ((Word32)(Kh) << 15));
+
+    *rc = pv_round(t0, pOverflow);
+
+    t0 = t0 >> 4;
+
+    /* A[1] in DPF      */
+    *(Ah + 1) = (Word16)(t0 >> 16);
+
+    *(Al + 1) = (Word16)((t0 >> 1) - ((Word32)(*(Ah + 1)) << 15));
+
+    /*  Alpha = R[0] * (1-K**2) */
+    t0 = Mpy_32(Kh, Kl, Kh, Kl, pOverflow);         /* K*K              */
+    t0 = L_abs(t0);                                 /* Some case <0 !!  */
+    t0 = 0x7fffffffL - t0;                          /* 1 - K*K          */
+
+    /* DPF format       */
+    hi = (Word16)(t0 >> 16);
+    lo = (Word16)((t0 >> 1) - ((Word32)(hi) << 15));
+
+    t0 = Mpy_32(*Rh, *Rl, hi, lo, pOverflow);      /* Alpha in         */
+
+    /* Normalize Alpha */
+
+    alp_exp = norm_l(t0);
+    t0 = t0 << alp_exp;
+
+    /* DPF format       */
+    alp_h = (Word16)(t0 >> 16);
+    alp_l = (Word16)((t0 >> 1) - ((Word32)(alp_h) << 15));
+
+    /*--------------------------------------*
+    * ITERATIONS  I=2 to M                 *
+    *--------------------------------------*/
+
+    for (i = 2; i <= M; i++)
+    {
+        /* t0 = SUM ( R[j]*A[i-j] ,j=1,i-1 ) +  R[i] */
+
+        t0 = 0;
+        p_Rh = &Rh[1];
+        p_Rl = &Rl[1];
+        p_Ah = &Ah[i-1];
+        p_Al = &Al[i-1];
+        for (j = 1; j < i; j++)
+        {
+            t0 += (((Word32) * (p_Rh)* *(p_Al--)) >> 15);
+            t0 += (((Word32) * (p_Rl++)* *(p_Ah)) >> 15);
+            t0 += ((Word32) * (p_Rh++)* *(p_Ah--));
+        }
+
+        t0 = t0 << 5;
+
+        t1 = ((Word32) * (Rh + i) << 16) + ((Word32)(*(Rl + i)) << 1);
+        t0 += t1;
+
+        /* K = -t0 / Alpha */
+
+        t1 = L_abs(t0);
+        t2 = Div_32(t1, alp_h, alp_l, pOverflow);  /* abs(t0)/Alpha        */
+
+        if (t0 > 0)
+        {
+            t2 = L_negate(t2);          /* K =-t0/Alpha     */
+        }
+
+        t2 = L_shl(t2, alp_exp, pOverflow);  /* denormalize; compare to Alpha */
+        Kh = (Word16)(t2 >> 16);
+        Kl = (Word16)((t2 >> 1) - ((Word32)(Kh) << 15));
+
+        if (i < 5)
+        {
+            *(rc + i - 1) = (Word16)((t2 + 0x00008000L) >> 16);
+        }
+        /* Test for unstable filter. If unstable keep old A(z) */
+        if ((abs_s(Kh)) > 32750)
+        {
+            oscl_memcpy(A, &(st->old_A[0]), sizeof(Word16)*(M + 1));
+            oscl_memset(rc, 0, sizeof(Word16)*4);
+            return(0);
+        }
+        /*------------------------------------------*
+        *  Compute new LPC coeff. -> An[i]         *
+        *  An[j]= A[j] + K*A[i-j]     , j=1 to i-1 *
+        *  An[i]= K                                *
+        *------------------------------------------*/
+        p_Ah = &Ah[i-1];
+        p_Al = &Al[i-1];
+        p_Anh = &Anh[1];
+        p_Anl = &Anl[1];
+        for (j = 1; j < i; j++)
+        {
+            t0  = (((Word32)Kh* *(p_Al--)) >> 15);
+            t0 += (((Word32)Kl* *(p_Ah)) >> 15);
+            t0 += ((Word32)Kh* *(p_Ah--));
+
+            t0 += (Ah[j] << 15) + Al[j];
+
+            *(p_Anh) = (Word16)(t0 >> 15);
+            *(p_Anl++) = (Word16)(t0 - ((Word32)(*(p_Anh++)) << 15));
+        }
+
+        *(p_Anh) = (Word16)(t2 >> 20);
+        *(p_Anl) = (Word16)((t2 >> 5) - ((Word32)(*(Anh + i)) << 15));
+
+        /*  Alpha = Alpha * (1-K**2) */
+
+        t0 = Mpy_32(Kh, Kl, Kh, Kl, pOverflow);  /* K*K             */
+        t0 = L_abs(t0);                          /* Some case <0 !! */
+        t0 = 0x7fffffffL - t0;                   /* 1 - K*K          */
+
+        hi = (Word16)(t0 >> 16);
+        lo = (Word16)((t0 >> 1) - ((Word32)(hi) << 15));
+
+        t0  = (((Word32)alp_h * lo) >> 15);
+        t0 += (((Word32)alp_l * hi) >> 15);
+        t0 += ((Word32)alp_h * hi);
+
+        t0 <<= 1;
+        /* Normalize Alpha */
+
+        j = norm_l(t0);
+        t0 <<= j;
+        alp_h = (Word16)(t0 >> 16);
+        alp_l = (Word16)((t0 >> 1) - ((Word32)(alp_h) << 15));
+        alp_exp += j;             /* Add normalization to alp_exp */
+
+        /* A[j] = An[j] */
+        oscl_memcpy(&Ah[1], &Anh[1], sizeof(Word16)*i);
+        oscl_memcpy(&Al[1], &Anl[1], sizeof(Word16)*i);
+    }
+
+    p_A = &A[0];
+    *(p_A++) = 4096;
+    p_Ah = &Ah[1];
+    p_Al = &Al[1];
+
+    for (i = 1; i <= M; i++)
+    {
+        t0 = ((Word32) * (p_Ah++) << 15) + *(p_Al++);
+        st->old_A[i] = *(p_A++) = (Word16)((t0 + 0x00002000) >> 14);
+    }
+
+    return(0);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.h
new file mode 100644 (file)
index 0000000..dec6718
--- /dev/null
@@ -0,0 +1,131 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: levinson.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : lag_wind.h
+      Purpose          : Lag windowing of autocorrelations.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _LEVINSON_H_
+#define _LEVINSON_H_
+#define levinson_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 old_A[M + 1];     /* Last A(z) for case of unstable filter */
+    } LevinsonState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    Word16 Levinson_init(LevinsonState **st);
+    /* initialize one instance of the pre processing state.
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to Levinson in each call.
+       returns 0 on success
+     */
+
+    Word16 Levinson_reset(LevinsonState *st);
+    /* reset of pre processing state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+    void Levinson_exit(LevinsonState **st);
+    /* de-initialize pre processing state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    Word16 Levinson(
+        LevinsonState *st,
+        Word16 Rh[],       /* i : Rh[m+1] Vector of autocorrelations (msb) */
+        Word16 Rl[],       /* i : Rl[m+1] Vector of autocorrelations (lsb) */
+        Word16 A[],        /* o : A[m]    LPC coefficients  (m = 10)       */
+        Word16 rc[],        /* o : rc[4]   First 4 reflection coefficients  */
+        Flag   *pOverflow
+    );
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _LEVINSON_H_ */
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lflg_upd.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lflg_upd.cpp
new file mode 100644 (file)
index 0000000..0e2e5bd
--- /dev/null
@@ -0,0 +1,183 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lflg_upd.cpp
+ Functions: LTP_flag_update
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ LTP_flag update for AMR VAD option 2
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "l_extract.h"
+#include "mpy_32_16.h"
+
+#include "vad2.h"
+#include "mode.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- Pointer to vadState2
+    mode -- Word16 -- AMR mode
+
+ Outputs:
+    st -- Pointer to vadState2
+    pOverflow -- Pointer to Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ LTP_flag update for AMR VAD option 2
+
+
+ PURPOSE:
+   Set LTP_flag if the LTP gain > LTP_THRESHOLD, where the value of
+   LTP_THRESHOLD depends on the LTP analysis window length.
+
+ INPUTS:
+
+   mode
+                   AMR mode
+   vadState->L_R0
+                   LTP energy
+   vadState->L_Rmax
+                   LTP maximum autocorrelation
+ OUTPUTS:
+
+   vadState->LTP_flag
+                   Set if LTP gain > LTP_THRESHOLD
+
+ RETURN VALUE:
+
+   none
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lflg_upd.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void LTP_flag_update(
+    vadState2 * st,
+    Word16 mode,
+    Flag   *pOverflow)
+{
+    Word16 thresh;
+    Word16 hi1;
+    Word16 lo1;
+    Word32 Ltmp;
+
+    if ((mode == MR475) || (mode == MR515))
+    {
+        thresh = 18022; /* (Word16)(32768.0*0.55); */
+    }
+    else if (mode == MR102)
+    {
+        thresh = 19660; /* (Word16)(32768.0*0.60); */
+    }
+    else
+    {
+        thresh = 21299; /* (Word16)(32768.0*0.65); */
+    }
+
+    L_Extract(st->L_R0, &hi1, &lo1, pOverflow);
+
+    Ltmp = Mpy_32_16(hi1, lo1, thresh, pOverflow);
+
+    if (st->L_Rmax > Ltmp)
+    {
+        st->LTP_flag = TRUE;
+    }
+    else
+    {
+        st->LTP_flag = FALSE;
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.cpp
new file mode 100644 (file)
index 0000000..bd0e990
--- /dev/null
@@ -0,0 +1,467 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: lpc.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "lpc.h"
+#include "typedef.h"
+#include "oper_32b.h"
+#include "autocorr.h"
+#include "lag_wind.h"
+#include "levinson.h"
+#include "cnst.h"
+#include "mode.h"
+#include "sub.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lpc_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to pointer of state data of type lpcState
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function initializes the state data for the LPC module.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+  lpcState* s;
+
+  if (state == (lpcState **) NULL){
+      // fprintf(stderr, "lpc_init: invalid parameter\n");
+      return -1;
+  }
+  *state = NULL;
+
+  // allocate memory
+  if ((s= (lpcState *) malloc(sizeof(lpcState))) == NULL){
+      // fprintf(stderr, "lpc_init: can not malloc state structure\n");
+      return -1;
+  }
+
+  s->levinsonSt = NULL;
+
+  // Init sub states
+  if (Levinson_init(&s->levinsonSt)) {
+     lpc_exit(&s);
+     return -1;
+  }
+
+
+  lpc_reset(s);
+  *state = s;
+
+  return 0;
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 lpc_init(lpcState **state)
+{
+    lpcState* s;
+
+    if (state == (lpcState **) NULL)
+    {
+        /* fprintf(stderr, "lpc_init: invalid parameter\n"); */
+        return -1;
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (lpcState *) oscl_malloc(sizeof(lpcState))) == NULL)
+    {
+        /* fprintf(stderr, "lpc_init: can not malloc state structure\n"); */
+        return -1;
+    }
+
+    s->levinsonSt = NULL;
+
+    /* Init sub states */
+    if (Levinson_init(&s->levinsonSt))
+    {
+        lpc_exit(&s);
+        return -1;
+    }
+
+    lpc_reset(s);
+    *state = s;
+
+    return 0;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lpc_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to pointer of state data of type lpcState
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function resets the state data for the LPC module.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+  if (state == (lpcState *) NULL){
+      // fprintf(stderr, "lpc_reset: invalid parameter\n");
+      return -1;
+  }
+
+  Levinson_reset(state->levinsonSt);
+
+  return 0;
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 lpc_reset(lpcState *state)
+{
+
+    if (state == (lpcState *) NULL)
+    {
+        /* fprintf(stderr, "lpc_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    Levinson_reset(state->levinsonSt);
+
+    return 0;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lpc_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to pointer of state data of type lpcState
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function frees the state data for the LPC module.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+  if (state == NULL || *state == NULL)
+      return;
+
+  Levinson_exit(&(*state)->levinsonSt);
+
+  // deallocate memory
+  free(*state);
+  *state = NULL;
+
+  return;
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void lpc_exit(lpcState **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    Levinson_exit(&(*state)->levinsonSt);
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: lpc
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to state data of type lpcState
+    mode  = coder mode of type enum Mode
+    x[]   = pointer to input signal (Q15) of type Word16
+    x_12k2[] = pointer to input signal (EFR) (Q15) of type Word16
+    pOverflow = pointer to overflow indicator of type Flag
+
+ Outputs:
+    a[]   = pointer to predictor coefficients (Q12) of type Word16
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function executes the LPC functionality for GSM AMR.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+   Word16 rc[4];                  // First 4 reflection coefficients Q15
+   Word16 rLow[MP1], rHigh[MP1];  // Autocorrelations low and hi
+                                  // No fixed Q value but normalized
+                                  // so that overflow is avoided
+
+   if ( sub ((Word16)mode, (Word16)MR122) == 0)
+   {
+       // Autocorrelations
+       Autocorr(x_12k2, M, rHigh, rLow, window_160_80);
+       // Lag windowing
+       Lag_window(M, rHigh, rLow);
+       // Levinson Durbin
+       Levinson(st->levinsonSt, rHigh, rLow, &a[MP1], rc);
+
+       // Autocorrelations
+       Autocorr(x_12k2, M, rHigh, rLow, window_232_8);
+       // Lag windowing
+       Lag_window(M, rHigh, rLow);
+       // Levinson Durbin
+       Levinson(st->levinsonSt, rHigh, rLow, &a[MP1 * 3], rc);
+   }
+   else
+   {
+       // Autocorrelations
+       Autocorr(x, M, rHigh, rLow, window_200_40);
+       // Lag windowing
+       Lag_window(M, rHigh, rLow);
+       // Levinson Durbin
+       Levinson(st->levinsonSt, rHigh, rLow, &a[MP1 * 3], rc);
+   }
+
+   return 0;
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void lpc(
+    lpcState *st,     /* i/o: State struct                */
+    enum Mode mode,   /* i  : coder mode                  */
+    Word16 x[],       /* i  : Input signal           Q15  */
+    Word16 x_12k2[],  /* i  : Input signal (EFR)     Q15  */
+    Word16 a[],       /* o  : predictor coefficients Q12  */
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct with table ptrs */
+    Flag   *pOverflow
+)
+{
+    Word16 rc[4];                  /* First 4 reflection coefficients Q15 */
+    Word16 rLow[MP1], rHigh[MP1];  /* Autocorrelations low and hi      */
+    /* No fixed Q value but normalized  */
+    /* so that overflow is avoided      */
+
+    const Word16* window_160_80_ptr = common_amr_tbls->window_160_80_ptr;
+    const Word16* window_232_8_ptr = common_amr_tbls->window_232_8_ptr;
+    const Word16* window_200_40_ptr = common_amr_tbls->window_200_40_ptr;
+
+    if (mode == MR122)
+    {
+        /* Autocorrelations */
+        Autocorr(x_12k2, M, rHigh, rLow, window_160_80_ptr, pOverflow);
+        /* Lag windowing    */
+        Lag_window(M, rHigh, rLow, pOverflow);
+        /* Levinson Durbin  */
+        Levinson(st->levinsonSt, rHigh, rLow, &a[MP1], rc, pOverflow);
+
+        /* Autocorrelations */
+        Autocorr(x_12k2, M, rHigh, rLow, window_232_8_ptr, pOverflow);
+        /* Lag windowing    */
+        Lag_window(M, rHigh, rLow, pOverflow);
+        /* Levinson Durbin  */
+        Levinson(st->levinsonSt, rHigh, rLow, &a[MP1 * 3], rc, pOverflow);
+    }
+    else
+    {
+        /* Autocorrelations */
+        Autocorr(x, M, rHigh, rLow, window_200_40_ptr, pOverflow);
+        /* Lag windowing    */
+        Lag_window(M, rHigh, rLow, pOverflow);
+        /* Levinson Durbin  */
+        Levinson(st->levinsonSt, rHigh, rLow, &a[MP1 * 3], rc, pOverflow);
+    }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.h
new file mode 100644 (file)
index 0000000..e0b40b2
--- /dev/null
@@ -0,0 +1,138 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: lpc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : lpc.h
+      Purpose          : 2 LP analyses centered at 2nd and 4th subframe
+                         for mode 12.2. For all other modes a
+                         LP analysis centered at 4th subframe is
+                         performed.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _LPC_H_
+#define _LPC_H_
+#define lpc_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "levinson.h"
+#include "mode.h"
+#include "get_const_tbls.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        LevinsonState *levinsonSt;
+    } lpcState;
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    Word16 lpc_init(lpcState **st);
+    /* initialize one instance of the pre processing state.
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to lpc in each call.
+       returns 0 on success
+     */
+
+    Word16 lpc_reset(lpcState *st);
+    /* reset of pre processing state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+    void lpc_exit(lpcState **st);
+    /* de-initialize pre processing state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    void lpc(
+        lpcState *st,     /* i/o: State struct                */
+        enum Mode mode,   /* i  : coder mode                  */
+        Word16 x[],       /* i  : Input signal           Q15  */
+        Word16 x_12k2[],  /* i  : Input signal (EFR)     Q15  */
+        Word16 a[],       /* o  : predictor coefficients Q12  */
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct with table ptrs */
+        Flag   *pOverflow
+    );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _LPC_H_ */
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.cpp
new file mode 100644 (file)
index 0000000..43b3f02
--- /dev/null
@@ -0,0 +1,216 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ol_ltp.cpp
+ Functions: ol_ltp
+
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "ol_ltp.h"
+#include "cnst.h"
+#include "pitch_ol.h"
+#include "p_ol_wgh.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ol_ltp
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to pitchOLWghtState structure
+    vadSt = pointer to a vadState structure
+    mode = coder mode (Mode)
+    wsp = pointer to buffer of signal used to compute the Open loop pitch
+    T_op = pointer to open loop pitch lag
+    old_lags = pointer to history with old stored Cl lags (Word16)
+    ol_gain_flg = pointer to OL gain flag (Word16)
+    idx = 16 bit value specifies the frame index
+    dtx = Data of type 'Flag' used for dtx. Use dtx=1, do not use dtx=0
+    pOverflow = pointer to Overflow indicator (Flag)
+
+ Outputs:
+    pOverflow -> 1 if processing this funvction results in satuaration
+
+ Returns:
+    Zero
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes the open loop pitch lag.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ol_ltp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int ol_ltp(
+    pitchOLWghtState *st, // i/o : State struct
+    vadState *vadSt,      // i/o : VAD state struct
+    enum Mode mode,       // i   : coder mode
+    Word16 wsp[],         // i   : signal used to compute the OL pitch, Q0
+                          //       uses signal[-pit_max] to signal[-1]
+    Word16 *T_op,         // o   : open loop pitch lag,                 Q0
+    Word16 old_lags[],    // i   : history with old stored Cl lags
+    Word16 ol_gain_flg[], // i   : OL gain flag
+    Word16 idx,           // i   : index
+    Flag dtx              // i   : dtx flag; use dtx=1, do not use dtx=0
+    )
+{
+   if (sub ((Word16)mode, (Word16)MR102) != 0 )
+   {
+      ol_gain_flg[0] = 0;
+      ol_gain_flg[1] = 0;
+   }
+
+   if (sub ((Word16)mode, (Word16)MR475) == 0 || sub ((Word16)mode, (Word16)MR515) == 0 )
+   {
+      *T_op = Pitch_ol(vadSt, mode, wsp, PIT_MIN, PIT_MAX, L_FRAME, idx, dtx);
+   }
+   else
+   {
+      if ( sub ((Word16)mode, (Word16)MR795) <= 0 )
+      {
+         *T_op = Pitch_ol(vadSt, mode, wsp, PIT_MIN, PIT_MAX, L_FRAME_BY2,
+                          idx, dtx);
+      }
+      else if ( sub ((Word16)mode, (Word16)MR102) == 0 )
+      {
+         *T_op = Pitch_ol_wgh(st, vadSt, wsp, PIT_MIN, PIT_MAX, L_FRAME_BY2,
+                              old_lags, ol_gain_flg, idx, dtx);
+      }
+      else
+      {
+         *T_op = Pitch_ol(vadSt, mode, wsp, PIT_MIN_MR122, PIT_MAX,
+                          L_FRAME_BY2, idx, dtx);
+      }
+   }
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void ol_ltp(
+    pitchOLWghtState *st, /* i/o : State struct                            */
+    vadState *vadSt,      /* i/o : VAD state struct                        */
+    enum Mode mode,       /* i   : coder mode                              */
+    Word16 wsp[],         /* i   : signal used to compute the OL pitch, Q0 */
+    /*       uses signal[-pit_max] to signal[-1]     */
+    Word16 *T_op,         /* o   : open loop pitch lag,                 Q0 */
+    Word16 old_lags[],    /* i   : history with old stored Cl lags         */
+    Word16 ol_gain_flg[], /* i   : OL gain flag                            */
+    Word16 idx,           /* i   : index                                   */
+    Flag dtx,             /* i   : dtx flag; use dtx=1, do not use dtx=0   */
+    Flag *pOverflow       /* i/o : overflow indicator                      */
+)
+{
+    if ((mode != MR102))
+    {
+        ol_gain_flg[0] = 0;
+        ol_gain_flg[1] = 0;
+    }
+
+    if ((mode == MR475) || (mode == MR515))
+    {
+        *T_op = Pitch_ol(vadSt, mode, wsp, PIT_MIN, PIT_MAX, L_FRAME, idx, dtx,
+                         pOverflow);
+    }
+    else
+    {
+        if (mode <= MR795)
+        {
+            *T_op = Pitch_ol(vadSt, mode, wsp, PIT_MIN, PIT_MAX, L_FRAME_BY2,
+                             idx, dtx, pOverflow);
+        }
+        else if (mode == MR102)
+        {
+            *T_op = Pitch_ol_wgh(st, vadSt, wsp, PIT_MIN, PIT_MAX, L_FRAME_BY2,
+                                 old_lags, ol_gain_flg, idx, dtx, pOverflow);
+        }
+        else
+        {
+            *T_op = Pitch_ol(vadSt, mode, wsp, PIT_MIN_MR122, PIT_MAX,
+                             L_FRAME_BY2, idx, dtx, pOverflow);
+        }
+    }
+
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.h
new file mode 100644 (file)
index 0000000..044e1c4
--- /dev/null
@@ -0,0 +1,114 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ol_ltp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+       File             : ol_ltp.h
+       Purpose          : Compute the open loop pitch lag.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef OL_LTP_H
+#define OL_LTP_H "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "p_ol_wgh.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    void ol_ltp(
+        pitchOLWghtState *st, /* i/o : State struct                            */
+        vadState *vadSt,      /* i/o : VAD state struct                        */
+        enum Mode mode,       /* i   : coder mode                              */
+        Word16 wsp[],         /* i   : signal used to compute the OL pitch, Q0 */
+        /*       uses signal[-pit_max] to signal[-1]     */
+        Word16 *T_op,         /* o   : open loop pitch lag,                 Q0 */
+        Word16 old_lags[],    /* i   : history with old stored Cl lags         */
+        Word16 ol_gain_flg[], /* i   : OL gain flag                            */
+        Word16 idx,           /* i   : index                                   */
+        Flag dtx,             /* i   : dtx flag; use dtx=1, do not use dtx=0   */
+        Flag *pOverflow       /* i/o : overflow Flag                           */
+    );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _OL_LTP_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/p_ol_wgh.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/p_ol_wgh.cpp
new file mode 100644 (file)
index 0000000..3a239e3
--- /dev/null
@@ -0,0 +1,892 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: p_ol_wgh.cpp
+ Functions: p_ol_wgh_init
+           p_ol_wgh_reset
+           p_ol_wgh_exit
+           Lag_max
+           Pitch_ol_wgh
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ The modules in this file compute the open loop pitch lag with weighting.
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "p_ol_wgh.h"
+#include "typedef.h"
+#include "cnst.h"
+#include "basic_op.h"
+#include "gmed_n.h"
+#include "inv_sqrt.h"
+#include "vad1.h"
+#include "calc_cor.h"
+#include "hp_max.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: p_ol_wgh_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs
+    state = pointer to a pointer of structure type pitchOLWghtState
+
+ Outputs:
+    None
+
+ Returns:
+    0 if the memory allocation is a success
+    -1 if the memory allocation fails
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function allocates state memory and initializes state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ p_ol_wgh.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int p_ol_wgh_init (pitchOLWghtState **state)
+{
+    pitchOLWghtState* s;
+
+    if (state == (pitchOLWghtState **) NULL){
+        // fprintf(stderr, "p_ol_wgh_init: invalid parameter\n");
+        return -1;
+    }
+    *state = NULL;
+
+    // allocate memory
+    if ((s= (pitchOLWghtState *) malloc(sizeof(pitchOLWghtState))) == NULL){
+        // fprintf(stderr, "p_ol_wgh_init: can not malloc state structure\n");
+        return -1;
+    }
+
+    p_ol_wgh_reset(s);
+
+    *state = s;
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 p_ol_wgh_init(pitchOLWghtState **state)
+{
+    pitchOLWghtState* s;
+
+    if (state == (pitchOLWghtState **) NULL)
+    {
+        /* fprintf(stderr, "p_ol_wgh_init: invalid parameter\n"); */
+        return -1;
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (pitchOLWghtState *) oscl_malloc(sizeof(pitchOLWghtState))) == NULL)
+    {
+        /* fprintf(stderr, "p_ol_wgh_init: can not malloc state structure\n"); */
+        return -1;
+    }
+
+    p_ol_wgh_reset(s);
+
+    *state = s;
+
+    return 0;
+}
+
+/*----------------------------------------------------------------------------
+; End Function: p_ol_wgh_init
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: p_ol_wgh_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs
+    st = pointer to structure type pitchOLWghtState
+
+ Outputs:
+    None
+
+ Returns:
+    0 if the memory initialization is a success
+    -1 if the memory initialization fails
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function initializes state memory to zero
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ p_ol_wgh.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int p_ol_wgh_reset (pitchOLWghtState *st)
+{
+   if (st == (pitchOLWghtState *) NULL){
+      // fprintf(stderr, "p_ol_wgh_reset: invalid parameter\n");
+      return -1;
+   }
+
+   // Reset pitch search states
+   st->old_T0_med = 40;
+   st->ada_w = 0;
+   st->wght_flg = 0;
+
+   return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 p_ol_wgh_reset(pitchOLWghtState *st)
+{
+    if (st == (pitchOLWghtState *) NULL)
+    {
+        /* fprintf(stderr, "p_ol_wgh_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    /* Reset pitch search states */
+    st->old_T0_med = 40;
+    st->ada_w = 0;
+    st->wght_flg = 0;
+
+    return 0;
+}
+
+/*----------------------------------------------------------------------------
+; End Function: p_ol_wgh_reset
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: p_ol_wgh_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs
+    st = pointer to a pointer of structure type pitchOLWghtState
+
+ Outputs:
+    None
+
+ Returns:
+    0 if the memory initialization is a success
+    -1 if the memory initialization fails
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function frees the memory used for state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ p_ol_wgh.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void p_ol_wgh_exit (pitchOLWghtState **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    // deallocate memory
+    free(*state);
+    *state = NULL;
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void p_ol_wgh_exit(pitchOLWghtState **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+
+/*----------------------------------------------------------------------------
+; End Function: p_ol_wgh_exit
+----------------------------------------------------------------------------*/
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Lag_max
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    corr = pointer to buffer of correlation values (Word32)
+    scal_sig = pointer to buffer of scaled signal values (Word16)
+    scal_fac = scaled signal factor (Word16)
+    scal_flag = EFR compatible scaling flag (Word16)
+    L_frame = length of frame to compute pitch (Word16)
+    lag_max = maximum lag (Word16)
+    lag_min = minimum lag (Word16)
+    cor_max = pointer to the normalized correlation of selected lag (Word16)
+    rmax = pointer to max(<s[i]*s[j]>), (Word32)
+    r0 = pointer to the residual energy (Word32)
+    dtx  = dtx flag; equal to 1, if dtx is enabled, 0, otherwise (Flag)
+    pOverflow = Pointer to overflow (Flag)
+
+ Outputs:
+    cor_max contains the newly calculated normalized correlation of the
+      selected lag
+    rmax contains the newly calculated max(<s[i]*s[j]>)
+    r0 contains the newly calculated residual energy
+    pOverflow -> 1 if the math functions called by this routine saturate.
+
+ Returns:
+    p_max = lag of the max correlation found (Word16)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function finds the lag that has maximum correlation of scal_sig[] in a
+ given delay range.
+ The correlation is given by
+    cor[t] = <scal_sig[n],scal_sig[n-t]>,  t=lag_min,...,lag_max
+ The functions outputs the maximum correlation after normalization and the
+ corresponding lag.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ p_ol_wgh.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static Word16 Lag_max ( // o : lag found
+    vadState *vadSt,    // i/o : VAD state struct
+    Word32 corr[],      // i   : correlation vector.
+    Word16 scal_sig[],  // i : scaled signal.
+    Word16 L_frame,     // i : length of frame to compute pitch
+    Word16 lag_max,     // i : maximum lag
+    Word16 lag_min,     // i : minimum lag
+    Word16 old_lag,     // i : old open-loop lag
+    Word16 *cor_max,    // o : normalized correlation of selected lag
+    Word16 wght_flg,    // i : is weighting function used
+    Word16 *gain_flg,   // o : open-loop flag
+    Flag dtx            // i   : dtx flag; use dtx=1, do not use dtx=0
+    )
+{
+    Word16 i, j;
+    Word16 *p, *p1;
+    Word32 max, t0;
+    Word16 t0_h, t0_l;
+    Word16 p_max;
+    const Word16 *ww, *we;
+    Word32 t1;
+
+    ww = &corrweight[250];
+    we = &corrweight[123 + lag_max - old_lag];
+
+    max = MIN_32;
+    p_max = lag_max;
+
+    for (i = lag_max; i >= lag_min; i--)
+    {
+       t0 = corr[-i];
+
+       // Weighting of the correlation function.
+       L_Extract (corr[-i], &t0_h, &t0_l);
+       t0 = Mpy_32_16 (t0_h, t0_l, *ww);
+       ww--;
+       if (wght_flg > 0) {
+          // Weight the neighbourhood of the old lag
+          L_Extract (t0, &t0_h, &t0_l);
+          t0 = Mpy_32_16 (t0_h, t0_l, *we);
+          we--;
+       }
+
+       if (L_sub (t0, max) >= 0)
+       {
+          max = t0;
+          p_max = i;
+       }
+    }
+
+    p  = &scal_sig[0];
+    p1 = &scal_sig[-p_max];
+    t0 = 0;
+    t1 = 0;
+
+    for (j = 0; j < L_frame; j++, p++, p1++)
+    {
+       t0 = L_mac (t0, *p, *p1);
+       t1 = L_mac (t1, *p1, *p1);
+    }
+
+    if (dtx)
+    {  // no test() call since this if is only in simulation env
+#ifdef VAD2
+       vadSt->L_Rmax = L_add(vadSt->L_Rmax, t0);   // Save max correlation
+       vadSt->L_R0 =   L_add(vadSt->L_R0, t1);        // Save max energy
+#else
+       // update and detect tone
+       vad_tone_detection_update (vadSt, 0);
+       vad_tone_detection (vadSt, t0, t1);
+#endif
+    }
+
+    // gain flag is set according to the open_loop gain
+    // is t2/t1 > 0.4 ?
+    *gain_flg = pv_round(L_msu(t0, pv_round(t1), 13107));
+
+    *cor_max = 0;
+
+    return (p_max);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 Lag_max(  /* o : lag found                               */
+    vadState *vadSt,    /* i/o : VAD state struct                      */
+    Word32 corr[],      /* i   : correlation vector.                   */
+    Word16 scal_sig[],  /* i : scaled signal.                          */
+    Word16 L_frame,     /* i : length of frame to compute pitch        */
+    Word16 lag_max,     /* i : maximum lag                             */
+    Word16 lag_min,     /* i : minimum lag                             */
+    Word16 old_lag,     /* i : old open-loop lag                       */
+    Word16 *cor_max,    /* o : normalized correlation of selected lag  */
+    Word16 wght_flg,    /* i : is weighting function used              */
+    Word16 *gain_flg,   /* o : open-loop flag                          */
+    Flag dtx,           /* i : dtx flag; use dtx=1, do not use dtx=0   */
+    Flag   *pOverflow   /* o : overflow flag                           */
+)
+{
+    Word16 i;
+    Word16 j;
+    Word16 *p;
+    Word16 *p1;
+    Word32 max;
+    Word32 t0;
+    Word16 t0_h;
+    Word16 t0_l;
+    Word16 p_max;
+    const Word16 *ww;
+    const Word16 *we;
+    Word32 t1;
+    Word16 temp;
+
+    ww = &corrweight[250];
+    we = &corrweight[123 + lag_max - old_lag];
+
+    max = MIN_32;
+    p_max = lag_max;
+
+    for (i = lag_max; i >= lag_min; i--)
+    {
+        t0 = corr[-i];
+
+        /* Weighting of the correlation function.   */
+        L_Extract(corr[-i], &t0_h, &t0_l, pOverflow);
+        t0 = Mpy_32_16(t0_h, t0_l, *ww, pOverflow);
+        ww--;
+        if (wght_flg > 0)
+        {
+            /* Weight the neighbourhood of the old lag. */
+            L_Extract(t0, &t0_h, &t0_l, pOverflow);
+            t0 = Mpy_32_16(t0_h, t0_l, *we, pOverflow);
+            we--;
+        }
+
+        /*       if (L_sub (t0, max) >= 0) */
+        if (t0 >= max)
+        {
+            max = t0;
+            p_max = i;
+        }
+    }
+    p  = &scal_sig[0];
+    p1 = &scal_sig[-p_max];
+    t0 = 0;
+    t1 = 0;
+
+    for (j = 0; j < L_frame; j++, p++, p1++)
+    {
+        t0 = L_mac(t0, *p, *p1, pOverflow);
+        t1 = L_mac(t1, *p1, *p1, pOverflow);
+    }
+
+    if (dtx)
+    {  /* no test() call since this if is only in simulation env */
+#ifdef VAD2
+        /* Save max correlation */
+        vadSt->L_Rmax = L_add(vadSt->L_Rmax, t0, pOverflow);
+        /* Save max energy */
+        vadSt->L_R0 =   L_add(vadSt->L_R0, t1, pOverflow);
+#else
+        /* update and detect tone */
+        vad_tone_detection_update(vadSt, 0, pOverflow);
+        vad_tone_detection(vadSt, t0, t1, pOverflow);
+#endif
+    }
+
+    /* gain flag is set according to the open_loop gain */
+    /* is t2/t1 > 0.4 ? */
+    temp = pv_round(t1, pOverflow);
+    t1 = L_msu(t0, temp, 13107, pOverflow);
+    *gain_flg = pv_round(t1, pOverflow);
+
+    *cor_max = 0;
+
+    return (p_max);
+}
+/*----------------------------------------------------------------------------
+; End Function: Lag_max
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pitch_ol_wgh
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to pitchOLWghtState structure
+    vadSt = pointer to a vadState structure
+    signal = pointer to buffer of signal used to compute the open loop
+         pitch where signal[-pit_max] to signal[-1] should be known
+    pit_min = 16 bit value specifies the minimum pitch lag
+    pit_max = 16 bit value specifies the maximum pitch lag
+    L_frame = 16 bit value specifies the length of frame to compute pitch
+    old_lags = pointer to history with old stored Cl lags (Word16)
+    ol_gain_flg = pointer to OL gain flag (Word16)
+    idx = 16 bit value specifies the frame index
+    dtx = Data of type 'Flag' used for dtx. Use dtx=1, do not use dtx=0
+    pOverflow = pointer to Overflow indicator (Flag)
+ Outputs
+    st = The pitchOLWghtState may be modified
+    vadSt = The vadSt state structure may be modified.
+    pOverflow -> 1 if the math functions invoked by this routine saturate.
+
+ Returns:
+    p_max1 = 16 bit value representing the open loop pitch lag.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs an open-loop pitch search with weighting
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_ol.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 Pitch_ol_wgh (     // o   : open loop pitch lag
+    pitchOLWghtState *st, // i/o : State struct
+    vadState *vadSt,      // i/o : VAD state struct/
+    Word16 signal[],      // i   : signal used to compute the open loop pitch
+                          //       signal[-pit_max] to signal[-1] should be known
+    Word16 pit_min,       // i   : minimum pitch lag
+    Word16 pit_max,       // i   : maximum pitch lag
+    Word16 L_frame,       // i   : length of frame to compute pitch
+    Word16 old_lags[],    // i   : history with old stored Cl lags
+    Word16 ol_gain_flg[], // i   : OL gain flag
+    Word16 idx,           // i   : index
+    Flag dtx              // i   : dtx flag; use dtx=1, do not use dtx=0
+    )
+{
+    Word16 i;
+    Word16 max1;
+    Word16 p_max1;
+    Word32 t0;
+#ifndef VAD2
+    Word16 corr_hp_max;
+#endif
+    Word32 corr[PIT_MAX+1], *corr_ptr;
+
+    // Scaled signal
+    Word16 scaled_signal[PIT_MAX + L_FRAME];
+    Word16 *scal_sig;
+
+    scal_sig = &scaled_signal[pit_max];
+
+    t0 = 0L;
+    for (i = -pit_max; i < L_frame; i++)
+    {
+        t0 = L_mac (t0, signal[i], signal[i]);
+    }
+    //
+    // Scaling of input signal
+    //
+    //   if Overflow        -> scal_sig[i] = signal[i]>>2
+    //   else if t0 < 1^22  -> scal_sig[i] = signal[i]<<2
+    //   else               -> scal_sig[i] = signal[i]
+
+    //
+    //  Verification for risk of overflow.
+    //
+
+    // Test for overflow
+    if (L_sub (t0, MAX_32) == 0L)
+    {
+        for (i = -pit_max; i < L_frame; i++)
+        {
+            scal_sig[i] = shr (signal[i], 3);
+        }
+    }
+    else if (L_sub (t0, (Word32) 1048576L) < (Word32) 0)
+    {
+        for (i = -pit_max; i < L_frame; i++)
+        {
+            scal_sig[i] = shl (signal[i], 3);
+        }
+    }
+    else
+    {
+        for (i = -pit_max; i < L_frame; i++)
+        {
+            scal_sig[i] = signal[i];
+        }
+    }
+
+    // calculate all coreelations of scal_sig, from pit_min to pit_max
+    corr_ptr = &corr[pit_max];
+    comp_corr (scal_sig, L_frame, pit_max, pit_min, corr_ptr);
+
+    p_max1 = Lag_max (vadSt, corr_ptr, scal_sig, L_frame, pit_max, pit_min,
+                      st->old_T0_med, &max1, st->wght_flg, &ol_gain_flg[idx],
+                      dtx);
+
+    if (ol_gain_flg[idx] > 0)
+    {
+       // Calculate 5-point median of previous lag
+       for (i = 4; i > 0; i--) // Shift buffer
+       {
+          old_lags[i] = old_lags[i-1];
+       }
+       old_lags[0] = p_max1;
+       st->old_T0_med = gmed_n (old_lags, 5);
+       st->ada_w = 32767; // Q15 = 1.0
+    }
+    else
+    {
+       st->old_T0_med = p_max1;
+       st->ada_w = mult(st->ada_w, 29491);      // = ada_w = ada_w * 0.9
+    }
+
+    if (sub(st->ada_w, 9830) < 0)  // ada_w - 0.3
+    {
+       st->wght_flg = 0;
+    }
+    else
+    {
+       st->wght_flg = 1;
+    }
+
+#ifndef VAD2
+    if (dtx)
+    {  // no test() call since this if is only in simulation env
+       if (sub(idx, 1) == 0)
+       {
+          // calculate max high-passed filtered correlation of all lags
+          hp_max (corr_ptr, scal_sig, L_frame, pit_max, pit_min, &corr_hp_max);
+
+          // update complex background detector
+          vad_complex_detection_update(vadSt, corr_hp_max);
+       }
+    }
+#endif
+
+    return (p_max1);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Pitch_ol_wgh(      /* o   : open loop pitch lag                            */
+    pitchOLWghtState *st, /* i/o : State struct                                   */
+    vadState *vadSt,      /* i/o : VAD state struct                               */
+    Word16 signal[],      /* i   : signal used to compute the open loop pitch     */
+    /*       signal[-pit_max] to signal[-1] should be known */
+    Word16 pit_min,       /* i   : minimum pitch lag                              */
+    Word16 pit_max,       /* i   : maximum pitch lag                              */
+    Word16 L_frame,       /* i   : length of frame to compute pitch               */
+    Word16 old_lags[],    /* i   : history with old stored Cl lags                */
+    Word16 ol_gain_flg[], /* i   : OL gain flag                                   */
+    Word16 idx,           /* i   : index                                          */
+    Flag dtx,             /* i   : dtx flag; use dtx=1, do not use dtx=0          */
+    Flag   *pOverflow     /* o   : overflow flag                                  */
+)
+{
+    Word16 i;
+    Word16 max1;
+    Word16 p_max1;
+    Word32 t0;
+#ifndef VAD2
+    Word16 corr_hp_max;
+#endif
+    Word32 corr[PIT_MAX+1], *corr_ptr;
+
+    /* Scaled signal */
+    Word16 scaled_signal[PIT_MAX + L_FRAME];
+    Word16 *scal_sig;
+
+    scal_sig = &scaled_signal[pit_max];
+
+    t0 = 0L;
+    for (i = -pit_max; i < L_frame; i++)
+    {
+        t0 = L_mac(t0, signal[i], signal[i], pOverflow);
+    }
+    /*--------------------------------------------------------*
+     * Scaling of input signal.                               *
+     *                                                        *
+     *   if Overflow        -> scal_sig[i] = signal[i]>>2     *
+     *   else if t0 < 1^22  -> scal_sig[i] = signal[i]<<2     *
+     *   else               -> scal_sig[i] = signal[i]        *
+     *--------------------------------------------------------*/
+
+    /*--------------------------------------------------------*
+     *  Verification for risk of overflow.                    *
+     *--------------------------------------------------------*/
+
+    /* Test for overflow */
+    if (L_sub(t0, MAX_32, pOverflow) == 0L)
+    {
+        for (i = -pit_max; i < L_frame; i++)
+        {
+            scal_sig[i] = shr(signal[i], 3, pOverflow);
+        }
+    }
+    else if (L_sub(t0, (Word32) 1048576L, pOverflow) < (Word32) 0)
+    {
+        for (i = -pit_max; i < L_frame; i++)
+        {
+            scal_sig[i] = shl(signal[i], 3, pOverflow);
+        }
+    }
+    else
+    {
+        for (i = -pit_max; i < L_frame; i++)
+        {
+            scal_sig[i] = signal[i];
+        }
+    }
+
+    /* calculate all coreelations of scal_sig, from pit_min to pit_max */
+    corr_ptr = &corr[pit_max];
+    comp_corr(scal_sig, L_frame, pit_max, pit_min, corr_ptr);
+
+    p_max1 = Lag_max(vadSt, corr_ptr, scal_sig, L_frame, pit_max, pit_min,
+                     st->old_T0_med, &max1, st->wght_flg, &ol_gain_flg[idx],
+                     dtx, pOverflow);
+
+    if (ol_gain_flg[idx] > 0)
+    {
+        /* Calculate 5-point median of previous lags */
+        for (i = 4; i > 0; i--) /* Shift buffer */
+        {
+            old_lags[i] = old_lags[i-1];
+        }
+        old_lags[0] = p_max1;
+        st->old_T0_med = gmed_n(old_lags, 5);
+        st->ada_w = 32767; /* Q15 = 1.0 */
+    }
+    else
+    {
+        st->old_T0_med = p_max1;
+        /* = ada_w = ada_w * 0.9 */
+        st->ada_w = (Word16)((Word32)(st->ada_w * 29491) >> 15);
+    }
+
+    if (sub(st->ada_w, 9830, pOverflow) < 0)  /* ada_w - 0.3 */
+    {
+        st->wght_flg = 0;
+    }
+    else
+    {
+        st->wght_flg = 1;
+    }
+
+#ifndef VAD2
+    if (dtx)
+    {  /* no test() call since this if is only in simulation env */
+        if (sub(idx, 1, pOverflow) == 0)
+        {
+            /* calculate max high-passed filtered correlation of all lags */
+            hp_max(corr_ptr, scal_sig, L_frame, pit_max, pit_min, &corr_hp_max, pOverflow);
+
+            /* update complex background detector */
+            vad_complex_detection_update(vadSt, corr_hp_max);
+        }
+    }
+#endif
+
+    return (p_max1);
+}
+
+/*----------------------------------------------------------------------------
+; End Function: Pitch_ol_wgh
+----------------------------------------------------------------------------*/
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.cpp
new file mode 100644 (file)
index 0000000..5f70021
--- /dev/null
@@ -0,0 +1,1462 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pitch_fr.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+      File             : pitch_fr.c
+      Purpose          : Find the pitch period with 1/3 or 1/6 subsample
+                       : resolution (closed loop).
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "pitch_fr.h"
+#include "oper_32b.h"
+#include "cnst.h"
+#include "enc_lag3.h"
+#include "enc_lag6.h"
+#include "inter_36.h"
+#include "inv_sqrt.h"
+#include "convolve.h"
+
+#include "basic_op.h"
+#include "oscl_mem.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+ * mode dependent parameters used in Pitch_fr()
+ * Note: order of MRxx in 'enum Mode' is important!
+ */
+static const struct
+{
+    Word16 max_frac_lag;     /* lag up to which fractional lags are used    */
+    Word16 flag3;            /* enable 1/3 instead of 1/6 fract. resolution */
+    Word16 first_frac;       /* first fractional to check                   */
+    Word16 last_frac;        /* last fractional to check                    */
+    Word16 delta_int_low;    /* integer lag below TO to start search from   */
+    Word16 delta_int_range;  /* integer range around T0                     */
+    Word16 delta_frc_low;    /* fractional below T0                         */
+    Word16 delta_frc_range;  /* fractional range around T0                  */
+    Word16 pit_min;          /* minimum pitch                               */
+} mode_dep_parm[N_MODES] =
+{
+    /* MR475 */  { 84,  1, -2,  2,  5, 10,  5,  9, PIT_MIN },
+    /* MR515 */  { 84,  1, -2,  2,  5, 10,  5,  9, PIT_MIN },
+    /* MR59  */  { 84,  1, -2,  2,  3,  6,  5,  9, PIT_MIN },
+    /* MR67  */  { 84,  1, -2,  2,  3,  6,  5,  9, PIT_MIN },
+    /* MR74  */  { 84,  1, -2,  2,  3,  6,  5,  9, PIT_MIN },
+    /* MR795 */  { 84,  1, -2,  2,  3,  6, 10, 19, PIT_MIN },
+    /* MR102 */  { 84,  1, -2,  2,  3,  6,  5,  9, PIT_MIN },
+    /* MR122 */  { 94,  0, -3,  3,  3,  6,  5,  9, PIT_MIN_MR122 }
+};
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Norm_Corr
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    exc[] = pointer to buffer of type Word16
+    xn[]  = pointer to buffer of type Word16
+    h[]   = pointer to buffer of type Word16
+    L_subfr = length of sub frame (Word16)
+    t_min  = the minimum table value of type Word16
+    t_max = the maximum table value of type Word16
+    corr_norm[] = pointer to buffer of type Word16
+
+ Outputs:
+    pOverflow = 1 if the math functions called result in overflow else zero.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  FUNCTION:   Norm_Corr()
+
+  PURPOSE: Find the normalized correlation between the target vector
+           and the filtered past excitation.
+
+  DESCRIPTION:
+     The normalized correlation is given by the correlation between the
+     target and filtered past excitation divided by the square root of
+     the energy of filtered excitation.
+                   corr[k] = <x[], y_k[]>/sqrt(y_k[],y_k[])
+     where x[] is the target vector and y_k[] is the filtered past
+     excitation at delay k.
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_fr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static void Norm_Corr (Word16 exc[], Word16 xn[], Word16 h[], Word16 L_subfr,
+                       Word16 t_min, Word16 t_max, Word16 corr_norm[])
+{
+    Word16 i, j, k;
+    Word16 corr_h, corr_l, norm_h, norm_l;
+    Word32 s;
+
+    // Usally dynamic allocation of (L_subfr)
+    Word16 excf[L_SUBFR];
+    Word16 scaling, h_fac, *s_excf, scaled_excf[L_SUBFR];
+
+    k = -t_min;
+
+    // compute the filtered excitation for the first delay t_min
+
+    Convolve (&exc[k], h, excf, L_subfr);
+
+    // scale "excf[]" to avoid overflow
+
+    for (j = 0; j < L_subfr; j++) {
+        scaled_excf[j] = shr (excf[j], 2);
+    }
+
+    // Compute 1/sqrt(energy of excf[])
+
+    s = 0;
+    for (j = 0; j < L_subfr; j++) {
+        s = L_mac (s, excf[j], excf[j]);
+    }
+    if (L_sub (s, 67108864L) <= 0) {            // if (s <= 2^26)
+        s_excf = excf;
+        h_fac = 15 - 12;
+        scaling = 0;
+    }
+    else {
+        // "excf[]" is divided by 2
+        s_excf = scaled_excf;
+        h_fac = 15 - 12 - 2;
+        scaling = 2;
+    }
+
+    // loop for every possible period
+
+    for (i = t_min; i <= t_max; i++) {
+        // Compute 1/sqrt(energy of excf[])
+
+        s = 0;
+        for (j = 0; j < L_subfr; j++) {
+            s = L_mac (s, s_excf[j], s_excf[j]);
+        }
+
+        s = Inv_sqrt (s);
+        L_Extract (s, &norm_h, &norm_l);
+
+        // Compute correlation between xn[] and excf[]
+
+        s = 0;
+        for (j = 0; j < L_subfr; j++) {
+            s = L_mac (s, xn[j], s_excf[j]);
+        }
+        L_Extract (s, &corr_h, &corr_l);
+
+        // Normalize correlation = correlation * (1/sqrt(energy))
+
+        s = Mpy_32 (corr_h, corr_l, norm_h, norm_l);
+
+        corr_norm[i] = extract_h (L_shl (s, 16));
+
+            // modify the filtered excitation excf[] for the next iteration
+
+        if (sub (i, t_max) != 0) {
+            k--;
+            for (j = L_subfr - 1; j > 0; j--) {
+                s = L_mult (exc[k], h[j]);
+                s = L_shl (s, h_fac);
+                s_excf[j] = add (extract_h (s), s_excf[j - 1]);
+            }
+            s_excf[0] = shr (exc[k], scaling);
+        }
+    }
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void Norm_Corr(Word16 exc[],
+                      Word16 xn[],
+                      Word16 h[],
+                      Word16 L_subfr,
+                      Word16 t_min,
+                      Word16 t_max,
+                      Word16 corr_norm[],
+                      Flag *pOverflow)
+{
+    Word16 i;
+    Word16 j;
+    Word16 k;
+    Word16 corr_h;
+    Word16 corr_l;
+    Word16 norm_h;
+    Word16 norm_l;
+    Word32 s;
+    Word32 s2;
+    Word16 excf[L_SUBFR];
+    Word16 scaling;
+    Word16 h_fac;
+    Word16 *s_excf;
+    Word16 scaled_excf[L_SUBFR];
+    Word16 *p_s_excf;
+    Word16 *p_excf;
+    Word16  temp;
+    Word16 *p_x;
+    Word16 *p_h;
+
+    k = -t_min;
+
+    /* compute the filtered excitation for the first delay t_min */
+
+    Convolve(&exc[k], h, excf, L_subfr);
+
+    /* scale "excf[]" to avoid overflow */
+    s = 0;
+    p_s_excf = scaled_excf;
+    p_excf   = excf;
+
+    for (j = (L_subfr >> 1); j != 0; j--)
+    {
+        temp = *(p_excf++);
+        *(p_s_excf++) = temp >> 2;
+        s += (Word32) temp * temp;
+        temp = *(p_excf++);
+        *(p_s_excf++) = temp >> 2;
+        s += (Word32) temp * temp;
+    }
+
+
+    if (s <= (67108864L >> 1))
+    {
+        s_excf = excf;
+        h_fac = 12;
+        scaling = 0;
+    }
+    else
+    {
+        /* "excf[]" is divided by 2 */
+        s_excf = scaled_excf;
+        h_fac = 14;
+        scaling = 2;
+    }
+
+    /* loop for every possible period */
+
+    for (i = t_min; i <= t_max; i++)
+    {
+        /* Compute 1/sqrt(energy of excf[]) */
+
+        s   = s2 = 0;
+        p_x      = xn;
+        p_s_excf = s_excf;
+        j        = L_subfr >> 1;
+
+        while (j--)
+        {
+            s  += (Word32) * (p_x++) * *(p_s_excf);
+            s2 += ((Word32)(*(p_s_excf)) * (*(p_s_excf)));
+            p_s_excf++;
+            s  += (Word32) * (p_x++) * *(p_s_excf);
+            s2 += ((Word32)(*(p_s_excf)) * (*(p_s_excf)));
+            p_s_excf++;
+        }
+
+        s2     = s2 << 1;
+        s2     = Inv_sqrt(s2, pOverflow);
+        norm_h = (Word16)(s2 >> 16);
+        norm_l = (Word16)((s2 >> 1) - (norm_h << 15));
+        corr_h = (Word16)(s >> 15);
+        corr_l = (Word16)((s) - (corr_h << 15));
+
+        /* Normalize correlation = correlation * (1/sqrt(energy)) */
+
+        s = Mpy_32(corr_h, corr_l, norm_h, norm_l, pOverflow);
+
+        corr_norm[i] = (Word16) s ;
+
+        /* modify the filtered excitation excf[] for the next iteration */
+        if (i != t_max)
+        {
+            k--;
+            temp = exc[k];
+            p_s_excf = &s_excf[L_subfr - 1];
+            p_h = &h[L_subfr - 1];
+
+            p_excf = &s_excf[L_subfr - 2];
+            for (j = (L_subfr - 1) >> 1; j != 0; j--)
+            {
+                s = ((Word32) temp * *(p_h--)) >> h_fac;
+                *(p_s_excf--) = (Word16) s  + *(p_excf--);
+                s = ((Word32) temp * *(p_h--)) >> h_fac;
+                *(p_s_excf--) = (Word16) s  + *(p_excf--);
+            }
+
+            s = ((Word32) temp * *(p_h)) >> h_fac;
+            *(p_s_excf--) = (Word16) s  + *(p_excf);
+
+            *(p_s_excf) = temp >> scaling;
+        }
+
+    }
+    return;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: searchFrac
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    lag = pointer to integer pitch of type Word16
+    frac = pointer to starting point of search fractional pitch of type Word16
+    last_frac = endpoint of search  of type Word16
+    corr[] = pointer to normalized correlation of type Word16
+    flag3 = subsample resolution (3: =1 / 6: =0) of type Word16
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   FUNCTION:   searchFrac()
+
+   PURPOSE: Find fractional pitch
+
+   DESCRIPTION:
+      The function interpolates the normalized correlation at the
+      fractional positions around lag T0. The position at which the
+      interpolation function reaches its maximum is the fractional pitch.
+      Starting point of the search is frac, end point is last_frac.
+      frac is overwritten with the fractional pitch.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_fr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static void searchFrac (
+    Word16 *lag,       // i/o : integer pitch
+    Word16 *frac,      // i/o : start point of search -
+                               fractional pitch
+    Word16 last_frac,  // i   : endpoint of search
+    Word16 corr[],     // i   : normalized correlation
+    Word16 flag3       // i   : subsample resolution
+                                (3: =1 / 6: =0)
+)
+{
+    Word16 i;
+    Word16 max;
+    Word16 corr_int;
+
+    // Test the fractions around T0 and choose the one which maximizes
+    // the interpolated normalized correlation.
+
+    max = Interpol_3or6 (&corr[*lag], *frac, flag3); // function result
+
+    for (i = add (*frac, 1); i <= last_frac; i++) {
+        corr_int = Interpol_3or6 (&corr[*lag], i, flag3);
+        if (sub (corr_int, max) > 0) {
+            max = corr_int;
+            *frac = i;
+        }
+    }
+
+    if (flag3 == 0) {
+        // Limit the fraction value in the interval [-2,-1,0,1,2,3]
+
+        if (sub (*frac, -3) == 0) {
+            *frac = 3;
+            *lag = sub (*lag, 1);
+        }
+    }
+    else {
+        // limit the fraction value between -1 and 1
+
+        if (sub (*frac, -2) == 0) {
+            *frac = 1;
+            *lag = sub (*lag, 1);
+        }
+        if (sub (*frac, 2) == 0) {
+            *frac = -1;
+            *lag = add (*lag, 1);
+        }
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void searchFrac(
+    Word16 *lag,       /* i/o : integer pitch           */
+    Word16 *frac,      /* i/o : start point of search -
+                                fractional pitch        */
+    Word16 last_frac,  /* i   : endpoint of search      */
+    Word16 corr[],     /* i   : normalized correlation  */
+    Word16 flag3,      /* i   : subsample resolution
+                                (3: =1 / 6: =0)         */
+    Flag   *pOverflow
+)
+{
+    Word16 i;
+    Word16 max;
+    Word16 corr_int;
+
+    /* Test the fractions around T0 and choose the one which maximizes   */
+    /* the interpolated normalized correlation.                          */
+
+    max = Interpol_3or6(&corr[*lag], *frac, flag3, pOverflow);
+    /* function result */
+
+    for (i = *frac + 1; i <= last_frac; i++)
+    {
+        corr_int = Interpol_3or6(&corr[*lag], i, flag3, pOverflow);
+        if (corr_int > max)
+        {
+            max = corr_int;
+            *frac = i;
+        }
+    }
+
+    if (flag3 == 0)
+    {
+        /* Limit the fraction value in the interval [-2,-1,0,1,2,3] */
+
+        if (*frac == -3)
+        {
+            *frac = 3;
+            (*lag)--;
+        }
+    }
+    else
+    {
+        /* limit the fraction value between -1 and 1 */
+
+        if (*frac == -2)
+        {
+            *frac = 1;
+            (*lag)--;
+        }
+        if (*frac == 2)
+        {
+            *frac = -1;
+            (*lag)++;
+        }
+    }
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: getRange
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    T0 = integer pitch of type Word16
+    delta_low = search start offset of type Word16
+    delta_range = search range of type Word16
+    pitmin = minimum pitch of type Word16
+    pitmax = maximum pitch of type Word16
+    t0_min = search range minimum of type Word16
+    t0_max = search range maximum of type Word16
+
+ Outputs:
+    pOverflow = 1 if the math functions called result in overflow else zero.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   FUNCTION:   getRange()
+
+   PURPOSE: Sets range around open-loop pitch or integer pitch of last subframe
+
+   DESCRIPTION:
+      Takes integer pitch T0 and calculates a range around it with
+        t0_min = T0-delta_low  and t0_max = (T0-delta_low) + delta_range
+      t0_min and t0_max are bounded by pitmin and pitmax
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_fr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static void getRange (
+    Word16 T0,           // i : integer pitch
+    Word16 delta_low,    // i : search start offset
+    Word16 delta_range,  // i : search range
+    Word16 pitmin,       // i : minimum pitch
+    Word16 pitmax,       // i : maximum pitch
+    Word16 *t0_min,      // o : search range minimum
+    Word16 *t0_max)      // o : search range maximum
+{
+    *t0_min = sub(T0, delta_low);
+    if (sub(*t0_min, pitmin) < 0) {
+        *t0_min = pitmin;
+    }
+    *t0_max = add(*t0_min, delta_range);
+    if (sub(*t0_max, pitmax) > 0) {
+        *t0_max = pitmax;
+        *t0_min = sub(*t0_max, delta_range);
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+static void getRange(
+    Word16 T0,           /* i : integer pitch          */
+    Word16 delta_low,    /* i : search start offset    */
+    Word16 delta_range,  /* i : search range           */
+    Word16 pitmin,       /* i : minimum pitch          */
+    Word16 pitmax,       /* i : maximum pitch          */
+    Word16 *t0_min,      /* o : search range minimum   */
+    Word16 *t0_max,      /* o : search range maximum   */
+    Flag   *pOverflow)
+{
+
+    Word16 temp;
+    OSCL_UNUSED_ARG(pOverflow);
+
+    temp = *t0_min;
+    temp = T0 - delta_low;
+    if (temp < pitmin)
+    {
+        temp = pitmin;
+    }
+    *t0_min = temp;
+
+    temp +=  delta_range;
+    if (temp > pitmax)
+    {
+        temp = pitmax;
+        *t0_min = pitmax - delta_range;
+    }
+    *t0_max = temp;
+
+}
+
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pitch_fr_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a pointer of structure type Pitch_fr_State.
+
+ Outputs:
+    None
+
+ Returns:
+    Returns a zero if successful and -1 if not successful.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function:   Pitch_fr_init
+  Purpose:    Allocates state memory and initializes state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_fr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Pitch_fr_init (Pitch_frState **state)
+{
+    Pitch_frState* s;
+
+    if (state == (Pitch_frState **) NULL){
+        // fprintf(stderr, "Pitch_fr_init: invalid parameter\n");
+        return -1;
+    }
+    *state = NULL;
+
+    // allocate memory
+    if ((s= (Pitch_frState *) malloc(sizeof(Pitch_frState))) == NULL){
+        // fprintf(stderr, "Pitch_fr_init: can not malloc state structure\n");
+        return -1;
+    }
+
+    Pitch_fr_reset(s);
+    *state = s;
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 Pitch_fr_init(Pitch_frState **state)
+{
+    Pitch_frState* s;
+
+    if (state == (Pitch_frState **) NULL)
+    {
+        /* fprintf(stderr, "Pitch_fr_init: invalid parameter\n"); */
+        return -1;
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (Pitch_frState *) oscl_malloc(sizeof(Pitch_frState))) == NULL)
+    {
+        /* fprintf(stderr, "Pitch_fr_init: can not malloc state structure\n"); */
+        return -1;
+    }
+
+    Pitch_fr_reset(s);
+    *state = s;
+
+    return 0;
+}
+
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pitch_fr_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a pointer of structure type Pitch_fr_State.
+
+ Outputs:
+    None
+
+ Returns:
+    Returns a zero if successful and -1 if not successful.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function:   Pitch_fr_reset
+  Purpose:    Initializes state memory to zero
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_fr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Pitch_fr_reset (Pitch_frState *state)
+{
+
+    if (state == (Pitch_frState *) NULL){
+        // fprintf(stderr, "Pitch_fr_reset: invalid parameter\n");
+        return -1;
+    }
+
+    state->T0_prev_subframe = 0;
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 Pitch_fr_reset(Pitch_frState *state)
+{
+
+    if (state == (Pitch_frState *) NULL)
+    {
+        /* fprintf(stderr, "Pitch_fr_reset: invalid parameter\n"); */
+        return -1;
+    }
+
+    state->T0_prev_subframe = 0;
+
+    return 0;
+}
+
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pitch_fr_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a pointer of structure type Pitch_fr_State.
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function:   Pitch_fr_exit
+  Purpose:    The memory for state is freed.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_fr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Pitch_fr_exit (Pitch_frState **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    // deallocate memory
+    free(*state);
+    *state = NULL;
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void Pitch_fr_exit(Pitch_frState **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pitch_fr
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to stat structure of type Pitch_frState
+    mode = codec mode of type enum Mode
+    T_op[] = pointer to open loop pitch lags of type Word16
+    exc[] = pointer to excitation buffer of type Word16
+    xn[] = pointer to target vector of type Word16
+    h[] = pointer to impulse response of synthesis and weighting filters
+          of type Word16
+    L_subfr = length of subframe of type Word16
+    i_subfr = subframe offset of type Word16
+
+ Outputs:
+    pit_frac = pointer to pitch period (fractional) of type Word16
+    resu3 = pointer to subsample resolution of type Word16
+    ana_index = pointer to index of encoding of type Word16
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   FUNCTION:   Pitch_fr()
+
+   PURPOSE: Find the pitch period with 1/3 or 1/6 subsample resolution
+            (closed loop).
+
+   DESCRIPTION:
+         - find the normalized correlation between the target and filtered
+           past excitation in the search range.
+         - select the delay with maximum normalized correlation.
+         - interpolate the normalized correlation at fractions -3/6 to 3/6
+           with step 1/6 around the chosen delay.
+         - The fraction which gives the maximum interpolated value is chosen.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_fr.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 Pitch_fr (        // o   : pitch period (integer)
+    Pitch_frState *st,   // i/o : State struct
+    enum Mode mode,      // i   : codec mode
+    Word16 T_op[],       // i   : open loop pitch lags
+    Word16 exc[],        // i   : excitation buffer                      Q0
+    Word16 xn[],         // i   : target vector                          Q0
+    Word16 h[],          // i   : impulse response of synthesis and
+                                  weighting filters                     Q12
+    Word16 L_subfr,      // i   : Length of subframe
+    Word16 i_subfr,      // i   : subframe offset
+    Word16 *pit_frac,    // o   : pitch period (fractional)
+    Word16 *resu3,       // o   : subsample resolution 1/3 (=1) or 1/6 (=0)
+    Word16 *ana_index    // o   : index of encoding
+)
+{
+    Word16 i;
+    Word16 t_min, t_max;
+    Word16 t0_min, t0_max;
+    Word16 max, lag, frac;
+    Word16 tmp_lag;
+    Word16 *corr;
+    Word16 corr_v[40];    // Total length = t0_max-t0_min+1+2*L_INTER_SRCH
+
+    Word16 max_frac_lag;
+    Word16 flag3, flag4;
+    Word16 last_frac;
+    Word16 delta_int_low, delta_int_range;
+    Word16 delta_frc_low, delta_frc_range;
+    Word16 pit_min;
+    Word16 frame_offset;
+    Word16 delta_search;
+
+    //-----------------------------------------------------------------------
+     //                      set mode specific variables
+     //----------------------------------------------------------------------
+
+    max_frac_lag    = mode_dep_parm[mode].max_frac_lag;
+    flag3           = mode_dep_parm[mode].flag3;
+    frac            = mode_dep_parm[mode].first_frac;
+    last_frac       = mode_dep_parm[mode].last_frac;
+    delta_int_low   = mode_dep_parm[mode].delta_int_low;
+    delta_int_range = mode_dep_parm[mode].delta_int_range;
+
+    delta_frc_low   = mode_dep_parm[mode].delta_frc_low;
+    delta_frc_range = mode_dep_parm[mode].delta_frc_range;
+    pit_min         = mode_dep_parm[mode].pit_min;
+
+    //-----------------------------------------------------------------------
+    //                 decide upon full or differential search
+    //-----------------------------------------------------------------------
+
+    delta_search = 1;
+
+    if ((i_subfr == 0) || (sub(i_subfr,L_FRAME_BY2) == 0)) {
+
+        // Subframe 1 and 3
+
+        if (((sub((Word16)mode, (Word16)MR475) != 0) && (sub((Word16)mode,
+            (Word16)MR515) != 0)) ||
+            (sub(i_subfr,L_FRAME_BY2) != 0)) {
+
+            // set t0_min, t0_max for full search
+            // this is *not* done for mode MR475, MR515 in subframe 3
+
+            delta_search = 0; // no differential search
+
+            // calculate index into T_op which contains the open-loop
+            // pitch estimations for the 2 big subframes
+
+            frame_offset = 1;
+            if (i_subfr == 0)
+                frame_offset = 0;
+
+            // get T_op from the corresponding half frame and
+            // set t0_min, t0_max
+
+            getRange (T_op[frame_offset], delta_int_low, delta_int_range,
+                      pit_min, PIT_MAX, &t0_min, &t0_max);
+        }
+        else {
+
+            // mode MR475, MR515 and 3. Subframe: delta search as well
+            getRange (st->T0_prev_subframe, delta_frc_low, delta_frc_range,
+                      pit_min, PIT_MAX, &t0_min, &t0_max);
+        }
+    }
+    else {
+
+        // for Subframe 2 and 4
+        // get range around T0 of previous subframe for delta search
+
+        getRange (st->T0_prev_subframe, delta_frc_low, delta_frc_range,
+                  pit_min, PIT_MAX, &t0_min, &t0_max);
+    }
+
+    //-----------------------------------------------------------------------
+                Find interval to compute normalized correlation
+     -----------------------------------------------------------------------
+
+    t_min = sub (t0_min, L_INTER_SRCH);
+    t_max = add (t0_max, L_INTER_SRCH);
+
+    corr = &corr_v[-t_min];
+
+    //-----------------------------------------------------------------------
+      Compute normalized correlation between target and filtered excitation
+     -----------------------------------------------------------------------
+
+    Norm_Corr (exc, xn, h, L_subfr, t_min, t_max, corr);
+
+    //-----------------------------------------------------------------------
+                                Find integer pitch
+     -----------------------------------------------------------------------
+
+    max = corr[t0_min];
+    lag = t0_min;
+
+    for (i = t0_min + 1; i <= t0_max; i++) {
+        if (sub (corr[i], max) >= 0) {
+            max = corr[i];
+            lag = i;
+        }
+    }
+
+    //-----------------------------------------------------------------------
+                             Find fractional pitch
+     -----------------------------------------------------------------------
+    if ((delta_search == 0) && (sub (lag, max_frac_lag) > 0)) {
+
+        // full search and integer pitch greater than max_frac_lag
+        // fractional search is not needed, set fractional to zero
+
+        frac = 0;
+    }
+    else {
+
+        // if differential search AND mode MR475 OR MR515 OR MR59 OR MR67
+        // then search fractional with 4 bits resolution
+
+       if ((delta_search != 0) &&
+           ((sub ((Word16)mode, (Word16)MR475) == 0) ||
+            (sub ((Word16)mode, (Word16)MR515) == 0) ||
+            (sub ((Word16)mode, (Word16)MR59) == 0) ||
+            (sub ((Word16)mode, (Word16)MR67) == 0))) {
+
+          // modify frac or last_frac according to position of last
+          // integer pitch: either search around integer pitch,
+          // or only on left or right side
+
+          tmp_lag = st->T0_prev_subframe;
+          if ( sub( sub(tmp_lag, t0_min), 5) > 0)
+             tmp_lag = add (t0_min, 5);
+          if ( sub( sub(t0_max, tmp_lag), 4) > 0)
+               tmp_lag = sub (t0_max, 4);
+
+          if ((sub (lag, tmp_lag) == 0) ||
+              (sub (lag, sub(tmp_lag, 1)) == 0)) {
+
+             // normal search in fractions around T0
+
+             searchFrac (&lag, &frac, last_frac, corr, flag3);
+
+          }
+          else if (sub (lag, sub (tmp_lag, 2)) == 0) {
+             // limit search around T0 to the right side
+             frac = 0;
+             searchFrac (&lag, &frac, last_frac, corr, flag3);
+          }
+          else if (sub (lag, add(tmp_lag, 1)) == 0) {
+             // limit search around T0 to the left side
+             last_frac = 0;
+             searchFrac (&lag, &frac, last_frac, corr, flag3);
+          }
+          else {
+             // no fractional search
+             frac = 0;
+            }
+       }
+       else
+          // test the fractions around T0
+          searchFrac (&lag, &frac, last_frac, corr, flag3);
+    }
+
+    //-----------------------------------------------------------------------
+     //                           encode pitch
+     //-----------------------------------------------------------------------
+
+    if (flag3 != 0) {
+       // flag4 indicates encoding with 4 bit resolution;
+       // this is needed for mode MR475, MR515 and MR59
+
+       flag4 = 0;
+       if ( (sub ((Word16)mode, (Word16)MR475) == 0) ||
+            (sub ((Word16)mode, (Word16)MR515) == 0) ||
+            (sub ((Word16)mode, (Word16)MR59) == 0) ||
+            (sub ((Word16)mode, (Word16)MR67) == 0) ) {
+          flag4 = 1;
+       }
+
+       // encode with 1/3 subsample resolution
+
+       *ana_index = Enc_lag3(lag, frac, st->T0_prev_subframe,
+                             t0_min, t0_max, delta_search, flag4);
+       // function result
+
+    }
+    else
+    {
+       // encode with 1/6 subsample resolution
+
+       *ana_index = Enc_lag6(lag, frac, t0_min, delta_search);
+       // function result
+    }
+
+     //-----------------------------------------------------------------------
+     //                          update state variables
+     //-----------------------------------------------------------------------
+
+    st->T0_prev_subframe = lag;
+
+     //-----------------------------------------------------------------------
+     //                      update output variables
+     //-----------------------------------------------------------------------
+
+    *resu3    = flag3;
+
+    *pit_frac = frac;
+
+    return (lag);
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 Pitch_fr(         /* o   : pitch period (integer)                    */
+    Pitch_frState *st,   /* i/o : State struct                              */
+    enum Mode mode,      /* i   : codec mode                                */
+    Word16 T_op[],       /* i   : open loop pitch lags                      */
+    Word16 exc[],        /* i   : excitation buffer                      Q0 */
+    Word16 xn[],         /* i   : target vector                          Q0 */
+    Word16 h[],          /* i   : impulse response of synthesis and
+                                  weighting filters                     Q12 */
+    Word16 L_subfr,      /* i   : Length of subframe                        */
+    Word16 i_subfr,      /* i   : subframe offset                           */
+    Word16 *pit_frac,    /* o   : pitch period (fractional)                 */
+    Word16 *resu3,       /* o   : subsample resolution 1/3 (=1) or 1/6 (=0) */
+    Word16 *ana_index,   /* o   : index of encoding                         */
+    Flag   *pOverflow
+)
+{
+    Word16 i;
+    Word16 t_min;
+    Word16 t_max;
+    Word16 t0_min = 0;
+    Word16 t0_max;
+    Word16 max;
+    Word16 lag;
+    Word16 frac;
+    Word16 tmp_lag;
+    Word16 *corr;
+    Word16 corr_v[40];    /* Total length = t0_max-t0_min+1+2*L_INTER_SRCH */
+
+    Word16 max_frac_lag;
+    Word16 flag3;
+    Word16 flag4;
+    Word16 last_frac;
+    Word16 delta_int_low;
+    Word16 delta_int_range;
+    Word16 delta_frc_low;
+    Word16 delta_frc_range;
+    Word16 pit_min;
+    Word16 frame_offset;
+    Word16 delta_search;
+
+    /*-----------------------------------------------------------------------*
+     *                      set mode specific variables                      *
+     *-----------------------------------------------------------------------*/
+
+    max_frac_lag    = mode_dep_parm[mode].max_frac_lag;
+    flag3           = mode_dep_parm[mode].flag3;
+    frac            = mode_dep_parm[mode].first_frac;
+    last_frac       = mode_dep_parm[mode].last_frac;
+    delta_int_low   = mode_dep_parm[mode].delta_int_low;
+    delta_int_range = mode_dep_parm[mode].delta_int_range;
+
+    delta_frc_low   = mode_dep_parm[mode].delta_frc_low;
+    delta_frc_range = mode_dep_parm[mode].delta_frc_range;
+    pit_min         = mode_dep_parm[mode].pit_min;
+
+    /*-----------------------------------------------------------------------*
+     *                 decide upon full or differential search               *
+     *-----------------------------------------------------------------------*/
+
+    delta_search = 1;
+
+    if ((i_subfr == 0) || (i_subfr == L_FRAME_BY2))
+    {
+
+        /* Subframe 1 and 3 */
+
+        if (((mode != MR475) && (mode != MR515)) || (i_subfr != L_FRAME_BY2))
+        {
+
+            /* set t0_min, t0_max for full search */
+            /* this is *not* done for mode MR475, MR515 in subframe 3 */
+
+            delta_search = 0; /* no differential search */
+
+            /* calculate index into T_op which contains the open-loop */
+            /* pitch estimations for the 2 big subframes */
+
+            frame_offset = 1;
+            if (i_subfr == 0)
+                frame_offset = 0;
+
+            /* get T_op from the corresponding half frame and */
+            /* set t0_min, t0_max */
+
+            getRange(T_op[frame_offset], delta_int_low, delta_int_range,
+                     pit_min, PIT_MAX, &t0_min, &t0_max, pOverflow);
+        }
+        else
+        {
+
+            /* mode MR475, MR515 and 3. Subframe: delta search as well */
+            getRange(st->T0_prev_subframe, delta_frc_low, delta_frc_range,
+                     pit_min, PIT_MAX, &t0_min, &t0_max, pOverflow);
+        }
+    }
+    else
+    {
+
+        /* for Subframe 2 and 4 */
+        /* get range around T0 of previous subframe for delta search */
+
+        getRange(st->T0_prev_subframe, delta_frc_low, delta_frc_range,
+                 pit_min, PIT_MAX, &t0_min, &t0_max, pOverflow);
+    }
+
+    /*-----------------------------------------------------------------------*
+     *           Find interval to compute normalized correlation             *
+     *-----------------------------------------------------------------------*/
+
+    t_min = t0_min - L_INTER_SRCH;
+    t_max = t0_max + L_INTER_SRCH;
+
+    corr = &corr_v[-t_min];
+
+    /*-----------------------------------------------------------------------*
+     * Compute normalized correlation between target and filtered excitation *
+     *-----------------------------------------------------------------------*/
+
+    Norm_Corr(exc, xn, h, L_subfr, t_min, t_max, corr, pOverflow);
+
+    /*-----------------------------------------------------------------------*
+     *                           Find integer pitch                          *
+     *-----------------------------------------------------------------------*/
+
+    max = corr[t0_min];
+    lag = t0_min;
+
+    for (i = t0_min + 1; i <= t0_max; i++)
+    {
+        if (corr[i] >= max)
+        {
+            max = corr[i];
+            lag = i;
+        }
+    }
+
+    /*-----------------------------------------------------------------------*
+     *                        Find fractional pitch                          *
+     *-----------------------------------------------------------------------*/
+    if ((delta_search == 0) && (lag > max_frac_lag))
+    {
+
+        /* full search and integer pitch greater than max_frac_lag */
+        /* fractional search is not needed, set fractional to zero */
+
+        frac = 0;
+    }
+    else
+    {
+
+        /* if differential search AND mode MR475 OR MR515 OR MR59 OR MR67   */
+        /* then search fractional with 4 bits resolution           */
+
+        if ((delta_search != 0) &&
+                ((mode == MR475) || (mode == MR515) ||
+                 (mode == MR59) || (mode == MR67)))
+        {
+
+            /* modify frac or last_frac according to position of last */
+            /* integer pitch: either search around integer pitch, */
+            /* or only on left or right side */
+
+            tmp_lag = st->T0_prev_subframe;
+            if ((tmp_lag - t0_min) > 5)
+            {
+                tmp_lag = t0_min + 5;
+            }
+            if ((t0_max - tmp_lag) > 4)
+            {
+                tmp_lag = t0_max - 4;
+            }
+
+            if ((lag == tmp_lag) || (lag == (tmp_lag - 1)))
+            {
+
+                /* normal search in fractions around T0 */
+
+                searchFrac(&lag, &frac, last_frac, corr, flag3, pOverflow);
+
+            }
+            else if (lag == (tmp_lag - 2))
+            {
+                /* limit search around T0 to the right side */
+                frac = 0;
+                searchFrac(&lag, &frac, last_frac, corr, flag3, pOverflow);
+            }
+            else if (lag == (tmp_lag + 1))
+            {
+                /* limit search around T0 to the left side */
+                last_frac = 0;
+                searchFrac(&lag, &frac, last_frac, corr, flag3, pOverflow);
+            }
+            else
+            {
+                /* no fractional search */
+                frac = 0;
+            }
+        }
+        else
+            /* test the fractions around T0 */
+            searchFrac(&lag, &frac, last_frac, corr, flag3, pOverflow);
+    }
+
+    /*-----------------------------------------------------------------------*
+     *                           encode pitch                                *
+     *-----------------------------------------------------------------------*/
+
+    if (flag3 != 0)
+    {
+        /* flag4 indicates encoding with 4 bit resolution;         */
+        /* this is needed for mode MR475, MR515 and MR59           */
+
+        flag4 = 0;
+        if ((mode == MR475) || (mode == MR515) ||
+                (mode == MR59) || (mode == MR67))
+        {
+            flag4 = 1;
+        }
+
+        /* encode with 1/3 subsample resolution */
+
+        *ana_index = Enc_lag3(lag, frac, st->T0_prev_subframe,
+                              t0_min, t0_max, delta_search, flag4, pOverflow);
+        /* function result */
+
+    }
+    else
+    {
+        /* encode with 1/6 subsample resolution */
+
+        *ana_index = Enc_lag6(lag, frac, t0_min, delta_search, pOverflow);
+        /* function result */
+    }
+
+    /*-----------------------------------------------------------------------*
+     *                          update state variables                       *
+     *-----------------------------------------------------------------------*/
+
+    st->T0_prev_subframe = lag;
+
+    /*-----------------------------------------------------------------------*
+     *                      update output variables                          *
+     *-----------------------------------------------------------------------*/
+
+    *resu3    = flag3;
+
+    *pit_frac = frac;
+
+    return (lag);
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.h
new file mode 100644 (file)
index 0000000..f48d171
--- /dev/null
@@ -0,0 +1,137 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pitch_fr.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+      File             : pitch_fr.h
+      Purpose          : Find the pitch period with 1/3 or 1/6 subsample
+                       : resolution (closed loop).
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _PITCH_FR_H_
+#define _PITCH_FR_H_
+#define pitch_fr_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 T0_prev_subframe;   /* integer pitch lag of previous sub-frame */
+    } Pitch_frState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    Word16 Pitch_fr_init(Pitch_frState **st);
+    /* initialize one instance of the pre processing state.
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to Pitch_fr in each call.
+       returns 0 on success
+     */
+
+    Word16 Pitch_fr_reset(Pitch_frState *st);
+    /* reset of pre processing state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+
+    void Pitch_fr_exit(Pitch_frState **st);
+    /* de-initialize pre processing state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    Word16 Pitch_fr(         /* o   : pitch period (integer)                    */
+        Pitch_frState *st,   /* i/o : State struct                              */
+        enum Mode mode,      /* i   : codec mode                                */
+        Word16 T_op[],       /* i   : open loop pitch lags                      */
+        Word16 exc[],        /* i   : excitation buffer                         */
+        Word16 xn[],         /* i   : target vector                             */
+        Word16 h[],          /* i   : impulse response of synthesis and
+                                  weighting filters                         */
+        Word16 L_subfr,      /* i   : Length of subframe                        */
+        Word16 i_subfr,      /* i   : subframe offset                           */
+        Word16 *pit_frac,    /* o   : pitch period (fractional)                 */
+        Word16 *resu3,       /* o   : subsample resolution 1/3 (=1) or 1/6 (=0) */
+        Word16 *ana_index,   /* o   : index of encoding                         */
+        Flag   *pOverflow
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _PITCH_FR_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp
new file mode 100644 (file)
index 0000000..d8efa1e
--- /dev/null
@@ -0,0 +1,1165 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pitch_ol.cpp
+ Funtions: Pitch_ol
+           Lag_max
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ The modules in this file compute the open loop pitch lag.
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "pitch_ol.h"
+#include "typedef.h"
+#include "basicop_malloc.h"
+#include "cnst.h"
+#include "inv_sqrt.h"
+#include "vad.h"
+#include "calc_cor.h"
+#include "hp_max.h"
+#include "oscl_mem.h"
+#include "basic_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define THRESHOLD 27853
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Lag_max
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS (If VAD2 is defined)
+
+ Inputs
+    corr = pointer to buffer of correlation values (Word32)
+    scal_sig = pointer to buffer of scaled signal values (Word16)
+    scal_fac = scaled signal factor (Word16)
+    scal_flag = EFR compatible scaling flag (Word16)
+    L_frame = length of frame to compute pitch (Word16)
+    lag_max = maximum lag (Word16)
+    lag_min = minimum lag (Word16)
+    cor_max = pointer to the normalized correlation of selected lag (Word16)
+    rmax = pointer to max(<s[i]*s[j]>), (Word32)
+    r0 = pointer to the residual energy (Word32)
+    dtx  = dtx flag; equal to 1, if dtx is enabled, 0, otherwise (Flag)
+
+ Outputs:
+    cor_max contains the newly calculated normalized correlation of the
+      selected lag
+    rmax contains the newly calculated max(<s[i]*s[j]>)
+    r0 contains the newly calculated residual energy
+
+ Returns:
+    p_max = lag of the max correlation found (Word16)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS (If VAD2 is not defined)
+
+ Inputs
+    vadSt = pointer to a vadState structure
+    corr = pointer to buffer of correlation values (Word32)
+    scal_sig = pointer to buffer of scaled signal values (Word16)
+    scal_fac = scaled signal factor (Word16)
+    scal_flag = EFR compatible scaling flag (Word16)
+    L_frame = length of frame to compute pitch (Word16)
+    lag_max = maximum lag (Word16)
+    lag_min = minimum lag (Word16)
+    cor_max = pointer to the normalized correlation of selected lag (Word16)
+    dtx  = dtx flag; equal to 1, if dtx is enabled, 0, otherwise (Flag)
+    pOverflow = pointer to overflow indicator (Flag)
+
+ Outputs:
+    cor_max contains the newly calculated normalized correlation of the
+      selected lag
+    vadSt contains the updated VAD state parameters
+    pOverflow -> 1 if the math operations called by this routine saturate
+
+ Returns:
+    p_max = lag of the max correlation found (Word16)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Find the lag that has maximum correlation of scal_sig in a given delay range.
+ The correlation is given by:
+
+         cor[t] = <scal_sig[n],scal_sig[n-t]>,  t=lag_min,...,lag_max
+
+ The function returns the maximum correlation after normalization and the
+ corresponding lag.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_ol.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+#ifdef VAD2
+static Word16 Lag_max ( // o   : lag found
+    Word32 corr[],      // i   : correlation vector.
+    Word16 scal_sig[],  // i   : scaled signal.
+    Word16 scal_fac,    // i   : scaled signal factor.
+    Word16 scal_flag,   // i   : if 1 use EFR compatible scaling
+    Word16 L_frame,     // i   : length of frame to compute pitch
+    Word16 lag_max,     // i   : maximum lag
+    Word16 lag_min,     // i   : minimum lag
+    Word16 *cor_max,    // o   : normalized correlation of selected lag
+    Word32 *rmax,       // o   : max(<s[i]*s[j]>)
+    Word32 *r0,         // o   : residual energy
+    Flag dtx            // i   : dtx flag; use dtx=1, do not use dtx=0
+    )
+#else
+static Word16 Lag_max ( // o   : lag found
+    vadState *vadSt,    // i/o : VAD state struct
+    Word32 corr[],      // i   : correlation vector.
+    Word16 scal_sig[],  // i   : scaled signal.
+    Word16 scal_fac,    // i   : scaled signal factor.
+    Word16 scal_flag,   // i   : if 1 use EFR compatible scaling
+    Word16 L_frame,     // i   : length of frame to compute pitch
+    Word16 lag_max,     // i   : maximum lag
+    Word16 lag_min,     // i   : minimum lag
+    Word16 *cor_max,    // o   : normalized correlation of selected lag
+    Flag dtx            // i   : dtx flag; use dtx=1, do not use dtx=0
+    )
+#endif
+{
+    Word16 i, j;
+    Word16 *p;
+    Word32 max, t0;
+    Word16 max_h, max_l, ener_h, ener_l;
+    Word16 p_max = 0; // initialization only needed to keep gcc silent
+
+    max = MIN_32;
+    p_max = lag_max;
+
+    for (i = lag_max, j = (PIT_MAX-lag_max-1); i >= lag_min; i--, j--)
+    {
+       if (L_sub (corr[-i], max) >= 0)
+       {
+          max = corr[-i];
+          p_max = i;
+       }
+    }
+
+    // compute energy
+
+    t0 = 0;
+    p = &scal_sig[-p_max];
+    for (i = 0; i < L_frame; i++, p++)
+    {
+        t0 = L_mac (t0, *p, *p);
+    }
+    // 1/sqrt(energy)
+
+    if (dtx)
+    {  // no test() call since this if is only in simulation env
+#ifdef VAD2
+       *rmax = max;
+       *r0 = t0;
+#else
+       // check tone
+       vad_tone_detection (vadSt, max, t0);
+#endif
+    }
+
+    t0 = Inv_sqrt (t0);
+
+    if (scal_flag)
+    {
+       t0 = L_shl (t0, 1);
+    }
+
+    // max = max/sqrt(energy)
+
+    L_Extract (max, &max_h, &max_l);
+    L_Extract (t0, &ener_h, &ener_l);
+
+    t0 = Mpy_32 (max_h, max_l, ener_h, ener_l);
+
+    if (scal_flag)
+    {
+      t0 = L_shr (t0, scal_fac);
+      *cor_max = extract_h (L_shl (t0, 15)); // divide by 2
+    }
+    else
+    {
+      *cor_max = extract_l(t0);
+    }
+
+    return (p_max);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+#ifdef VAD2
+static Word16 Lag_max(  /* o   : lag found                               */
+    Word32 corr[],      /* i   : correlation vector.                     */
+    Word16 scal_sig[],  /* i   : scaled signal.                          */
+    Word16 scal_fac,    /* i   : scaled signal factor.                   */
+    Word16 scal_flag,   /* i   : if 1 use EFR compatible scaling         */
+    Word16 L_frame,     /* i   : length of frame to compute pitch        */
+    Word16 lag_max,     /* i   : maximum lag                             */
+    Word16 lag_min,     /* i   : minimum lag                             */
+    Word16 *cor_max,    /* o   : normalized correlation of selected lag  */
+    Word32 *rmax,       /* o   : max(<s[i]*s[j]>)                        */
+    Word32 *r0,         /* o   : residual energy                         */
+    Flag dtx,           /* i   : dtx flag; use dtx=1, do not use dtx=0   */
+    Flag *pOverflow     /* i/o : overflow Flag                           */
+)
+#else
+static Word16 Lag_max(  /* o   : lag found                               */
+    vadState *vadSt,    /* i/o : VAD state struct                        */
+    Word32 corr[],      /* i   : correlation vector.                     */
+    Word16 scal_sig[],  /* i   : scaled signal.                          */
+    Word16 scal_fac,    /* i   : scaled signal factor.                   */
+    Word16 scal_flag,   /* i   : if 1 use EFR compatible scaling         */
+    Word16 L_frame,     /* i   : length of frame to compute pitch        */
+    Word16 lag_max,     /* i   : maximum lag                             */
+    Word16 lag_min,     /* i   : minimum lag                             */
+    Word16 *cor_max,    /* o   : normalized correlation of selected lag  */
+    Flag dtx,           /* i   : dtx flag; use dtx=1, do not use dtx=0   */
+    Flag *pOverflow     /* i/o : overflow Flag                           */
+)
+#endif
+{
+    register Word16 i;
+    Word16 *p;
+    Word32 max;
+    Word32 t0;
+    Word16 max_h;
+    Word16 max_l;
+    Word16 ener_h;
+    Word16 ener_l;
+    Word16 p_max = 0; /* initialization only needed to keep gcc silent */
+    Word32 L_temp;
+    Word32 L_temp_2;
+    Word32 L_temp_3;
+    Word32  *p_corr = &corr[-lag_max];
+
+    max = MIN_32;
+    p_max = lag_max;
+
+    for (i = lag_max; i >= lag_min; i--)
+    {
+        /* The negative array index is equivalent to a negative */
+        /* address offset, i.e., corr[-i] == *(corr - i)        */
+        if (*(p_corr++) >= max)
+        {
+            p_corr--;
+            max = *(p_corr++);
+            p_max = i;
+        }
+    }
+
+    /* compute energy */
+
+    t0 = 0;
+
+    /* The negative array index is equivalent to a negative          */
+    /* address offset, i.e., scal_sig[-p_max] == *(scal_sig - p_max) */
+    p = &scal_sig[-p_max];
+    for (i = (L_frame >> 2); i != 0; i--)
+    {
+        t0 = amrnb_fxp_mac_16_by_16bb((Word32) * (p), (Word32) * (p), t0);
+        p++;
+        t0 = amrnb_fxp_mac_16_by_16bb((Word32) * (p), (Word32) * (p), t0);
+        p++;
+        t0 = amrnb_fxp_mac_16_by_16bb((Word32) * (p), (Word32) * (p), t0);
+        p++;
+        t0 = amrnb_fxp_mac_16_by_16bb((Word32) * (p), (Word32) * (p), t0);
+        p++;
+    }
+
+    t0 <<= 1;
+    /* 1/sqrt(energy) */
+
+    if (dtx)
+    {  /* no test() call since this if is only in simulation env */
+        /* check tone */
+#ifdef VAD2
+        *rmax = max;
+        *r0 = t0;
+#else
+        /* check tone */
+        vad_tone_detection(vadSt, max, t0, pOverflow);
+#endif
+    }
+
+    t0 = Inv_sqrt(t0, pOverflow);
+
+    if (scal_flag)
+    {
+        if (t0 > (Word32) 0x3fffffffL)
+        {
+            t0 = MAX_32;
+        }
+        else
+        {
+            t0 = t0 << 1;
+        }
+    }
+
+    /* max = max/sqrt(energy)  */
+    /* The following code is an inlined version of */
+    /* L_Extract (max, &max_h, &max_l), i.e.       */
+    /*                                             */
+    /* *max_h = extract_h (max);                   */
+    max_h = (Word16)(max >> 16);
+
+    /* L_temp_2 = L_shr(max,1), which is used in      */
+    /* the calculation of *max_l (see next operation) */
+    L_temp_2 = max >> 1;
+
+    /* *max_l = extract_l (L_msu (L_shr (max, 1), *max_h, 16384)); */
+    L_temp_3 = (Word32)(max_h << 15);
+
+    L_temp = L_temp_2 - L_temp_3;
+
+    max_l = (Word16)L_temp;
+
+    /* The following code is an inlined version of */
+    /* L_Extract (t0, &ener_h, &ener_l), i.e.      */
+    /*                                             */
+    /* *ener_h = extract_h (t0);                   */
+    ener_h = (Word16)(t0 >> 16);
+
+    /* L_temp_2 = L_shr(t0,1), which is used in        */
+    /* the calculation of *ener_l (see next operation) */
+
+    L_temp_2 = t0 >> 1;
+
+    L_temp_3 = (Word32)(ener_h << 15);
+
+    L_temp = L_temp_2 - L_temp_3;
+
+    ener_l = (Word16)L_temp;
+
+    t0 = Mpy_32(max_h, max_l, ener_h, ener_l, pOverflow);
+
+    if (scal_flag)
+    {
+        t0 = L_shr(t0, scal_fac, pOverflow);
+
+        if (t0 > (Word32) 0X0000FFFFL)
+        {
+            *cor_max = MAX_16;
+        }
+        else if (t0 < (Word32) 0xFFFF0000L)
+        {
+            *cor_max = MIN_16;
+        }
+        else
+        {
+            *cor_max = (Word16)(t0 >> 1);
+        }
+    }
+    else
+    {
+        *cor_max = (Word16)t0;
+    }
+
+    return (p_max);
+}
+
+/*----------------------------------------------------------------------------
+; End Function: Lag_max
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Lag_max_wrapper
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs
+    corr = pointer to buffer of correlation values (Word32)
+    scal_sig = pointer to buffer of scaled signal values (Word16)
+    scal_fac = scaled signal factor (Word16)
+    scal_flag = EFR compatible scaling flag (Word16)
+    L_frame = length of frame to compute pitch (Word16)
+    lag_max = maximum lag (Word16)
+    lag_min = minimum lag (Word16)
+    cor_max = pointer to the normalized correlation of selected lag (Word16)
+    rmax = pointer to max(<s[i]*s[j]>), (Word32)
+    r0 = pointer to the residual energy (Word32)
+    dtx  = dtx flag; equal to 1, if dtx is enabled, 0, otherwise (Flag)
+    pOverflow = pointer to overflow indicator (Flag)
+
+ Outputs:
+    cor_max contains the newly calculated normalized correlation of the
+      selected lag
+    rmax contains the newly calculated max(<s[i]*s[j]>)
+    r0 contains the newly calculated residual energy
+    pOverflow -> 1 if the math operations called by this routine saturate
+
+ Returns:
+    p_max = lag of the max correlation found (Word16)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS (If VAD2 is not defined)
+
+ Inputs
+    vadSt = pointer to a vadState structure
+    corr = pointer to buffer of correlation values (Word32)
+    scal_sig = pointer to buffer of scaled signal values (Word16)
+    scal_fac = scaled signal factor (Word16)
+    scal_flag = EFR compatible scaling flag (Word16)
+    L_frame = length of frame to compute pitch (Word16)
+    lag_max = maximum lag (Word16)
+    lag_min = minimum lag (Word16)
+    cor_max = pointer to the normalized correlation of selected lag (Word16)
+    dtx  = dtx flag; equal to 1, if dtx is enabled, 0, otherwise (Flag)
+    pOverflow = pointer to overflow indicator (Flag)
+
+ Outputs:
+    cor_max contains the newly calculated normalized correlation of the
+      selected lag
+    vadSt contains the updated VAD state parameters
+    pOverflow -> 1 if the math operations called by this routine saturate
+
+ Returns:
+    p_max = lag of the max correlation found (Word16)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function provides external access to the local function Lag_max.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_ol.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+#ifdef VAD2
+ CALL Lag_max(corr = corr
+          scal_sig = scal_sig
+          scal_fac = scal_fac
+          scal_flag = scal_flag
+          L_frame = L_frame
+          lag_max = lag_max
+          lag_min = lag_min
+          cor_max = cor_max
+          rmax = rmax
+          r0 = r0
+          dtx = dtx
+          pOverflow = pOverflow)
+   MODIFYING(nothing)
+   RETURNING(temp)
+
+#else
+ CALL Lag_max(vadSt = vadSt
+          corr = corr
+          scal_sig = scal_sig
+          scal_fac = scal_fac
+          scal_flag = scal_flag
+          L_frame = L_frame
+          lag_max = lag_max
+          lag_min = lag_min
+          cor_max = cor_max
+          dtx = dtx
+          pOverflow = pOverflow)
+   MODIFYING(nothing)
+   RETURNING(temp)
+
+#endif
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+#ifdef VAD2
+Word16 Lag_max_wrapper(  /* o   : lag found                          */
+    Word32 corr[],      /* i   : correlation vector.                     */
+    Word16 scal_sig[],  /* i   : scaled signal.                          */
+    Word16 scal_fac,    /* i   : scaled signal factor.                   */
+    Word16 scal_flag,   /* i   : if 1 use EFR compatible scaling         */
+    Word16 L_frame,     /* i   : length of frame to compute pitch        */
+    Word16 lag_max,     /* i   : maximum lag                             */
+    Word16 lag_min,     /* i   : minimum lag                             */
+    Word16 *cor_max,    /* o   : normalized correlation of selected lag  */
+    Word32 *rmax,       /* o   : max(<s[i]*s[j]>)                        */
+    Word32 *r0,         /* o   : residual energy                         */
+    Flag dtx,           /* i   : dtx flag; use dtx=1, do not use dtx=0   */
+    Flag *pOverflow     /* i/o : overflow Flag                           */
+)
+{
+    Word16 temp;
+
+    temp = Lag_max(corr, scal_sig, scal_fac, scal_flag, L_frame, lag_max,
+                   lag_min, cor_max, rmax, r0, dtx, pOverflow);
+
+    return(temp);
+}
+
+#else
+Word16 Lag_max_wrapper(  /* o   : lag found                          */
+    vadState *vadSt,    /* i/o : VAD state struct                        */
+    Word32 corr[],      /* i   : correlation vector.                     */
+    Word16 scal_sig[],  /* i   : scaled signal.                          */
+    Word16 scal_fac,    /* i   : scaled signal factor.                   */
+    Word16 scal_flag,   /* i   : if 1 use EFR compatible scaling         */
+    Word16 L_frame,     /* i   : length of frame to compute pitch        */
+    Word16 lag_max,     /* i   : maximum lag                             */
+    Word16 lag_min,     /* i   : minimum lag                             */
+    Word16 *cor_max,    /* o   : normalized correlation of selected lag  */
+    Flag dtx,           /* i   : dtx flag; use dtx=1, do not use dtx=0   */
+    Flag *pOverflow     /* i/o : overflow Flag                           */
+)
+{
+    Word16 temp;
+
+    temp = Lag_max(vadSt, corr, scal_sig, scal_fac, scal_flag, L_frame,
+                   lag_max, lag_min, cor_max, dtx, pOverflow);
+
+    return(temp);
+}
+
+#endif
+
+/*----------------------------------------------------------------------------
+; End Function: Lag_max_wrapper
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pitch_ol
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    vadSt = pointer to a vadState structure
+    mode =  data of type enum Mode specifies the mode.
+    signal = pointer to buffer of signal used to compute the open loop
+         pitch
+    where signal[-pit_max] to signal[-1] should be known
+    pit_min = 16 bit value specifies the minimum pitch lag
+    pit_max = 16 bit value specifies the maximum pitch lag
+    L_frame = 16 bit value specifies the length of frame to compute pitch
+    idx = 16 bit value specifies the frame index
+    dtx = Data of type 'Flag' used for dtx. Use dtx=1, do not use dtx=0
+    pOverflow = pointer to overflow indicator (Flag)
+
+ Outputs
+    vadSt = The vadSt state structure may be modified.
+    pOverflow -> 1 if the math operations called by this routine saturate
+
+ Returns:
+    p_max1 = 16 bit value representing the open loop pitch lag.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function computes the open loop pitch lag based on the perceptually
+ weighted speech signal. This is done in the following steps:
+       - find three maxima of the correlation <sw[n],sw[n-T]>,
+         dividing the search range into three parts:
+              pit_min ... 2*pit_min-1
+            2*pit_min ... 4*pit_min-1
+            4*pit_min ...   pit_max
+       - divide each maximum by <sw[n-t], sw[n-t]> where t is the delay at
+         that maximum correlation.
+       - select the delay of maximum normalized correlation (among the
+         three candidates) while favoring the lower delay ranges.
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pitch_ol.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 Pitch_ol (      // o   : open loop pitch lag
+    vadState *vadSt,   // i/o : VAD state struct
+    enum Mode mode,    // i   : coder mode
+    Word16 signal[],   // i   : signal used to compute the open loop pitch
+                       //    signal[-pit_max] to signal[-1] should be known
+    Word16 pit_min,    // i   : minimum pitch lag
+    Word16 pit_max,    // i   : maximum pitch lag
+    Word16 L_frame,    // i   : length of frame to compute pitch
+    Word16 idx,        // i   : frame index
+    Flag dtx           // i   : dtx flag; use dtx=1, do not use dtx=0
+    )
+{
+    Word16 i, j;
+    Word16 max1, max2, max3;
+    Word16 p_max1, p_max2, p_max3;
+    Word16 scal_flag = 0;
+    Word32 t0;
+#ifdef VAD2
+    Word32  r01, r02, r03;
+    Word32  rmax1, rmax2, rmax3;
+#else
+    Word16 corr_hp_max;
+#endif
+    Word32 corr[PIT_MAX+1], *corr_ptr;
+
+    // Scaled signal
+
+    Word16 scaled_signal[L_FRAME + PIT_MAX];
+    Word16 *scal_sig, scal_fac;
+
+#ifndef VAD2
+    if (dtx)
+    {  // no test() call since this if is only in simulation env
+       // update tone detection
+       if ((sub(mode, MR475) == 0) || (sub(mode, MR515) == 0))
+       {
+          vad_tone_detection_update (vadSt, 1);
+       }
+       else
+       {
+          vad_tone_detection_update (vadSt, 0);
+       }
+    }
+#endif
+
+    scal_sig = &scaled_signal[pit_max];
+
+    t0 = 0L;
+    for (i = -pit_max; i < L_frame; i++)
+    {
+        t0 = L_mac (t0, signal[i], signal[i]);
+    }
+
+     *--------------------------------------------------------*
+     * Scaling of input signal.                               *
+     *                                                        *
+     *   if Overflow        -> scal_sig[i] = signal[i]>>3     *
+     *   else if t0 < 1^20  -> scal_sig[i] = signal[i]<<3     *
+     *   else               -> scal_sig[i] = signal[i]        *
+     *--------------------------------------------------------*
+
+     *--------------------------------------------------------*
+     *  Verification for risk of overflow.                    *
+     *--------------------------------------------------------*
+
+    if (L_sub (t0, MAX_32) == 0L)               // Test for overflow
+    {
+        for (i = -pit_max; i < L_frame; i++)
+        {
+            scal_sig[i] = shr (signal[i], 3);
+        }
+        scal_fac = 3;
+    }
+    else if (L_sub (t0, (Word32) 1048576L) < (Word32) 0)
+        // if (t0 < 2^20)
+    {
+        for (i = -pit_max; i < L_frame; i++)
+        {
+            scal_sig[i] = shl (signal[i], 3);
+        }
+        scal_fac = -3;
+    }
+    else
+    {
+        for (i = -pit_max; i < L_frame; i++)
+        {
+            scal_sig[i] = signal[i];
+        }
+        scal_fac = 0;
+    }
+
+    // calculate all coreelations of scal_sig, from pit_min to pit_max
+    corr_ptr = &corr[pit_max];
+    comp_corr (scal_sig, L_frame, pit_max, pit_min, corr_ptr);
+
+     *--------------------------------------------------------------------*
+     *  The pitch lag search is divided in three sections.                *
+     *  Each section cannot have a pitch multiple.                        *
+     *  We find a maximum for each section.                               *
+     *  We compare the maximum of each section by favoring small lags.    *
+     *                                                                    *
+     *  First section:  lag delay = pit_max     downto 4*pit_min          *
+     *  Second section: lag delay = 4*pit_min-1 downto 2*pit_min          *
+     *  Third section:  lag delay = 2*pit_min-1 downto pit_min            *
+     *--------------------------------------------------------------------*
+
+    // mode dependent scaling in Lag_max
+    if (sub(mode, MR122) == 0)
+    {
+       scal_flag = 1;
+    }
+    else
+    {
+       scal_flag = 0;
+    }
+
+#ifdef VAD2
+    j = shl (pit_min, 2);
+    p_max1 = Lag_max (corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                      pit_max, j, &max1, &rmax1, &r01, dtx);
+
+    i = sub (j, 1);
+    j = shl (pit_min, 1);
+    p_max2 = Lag_max (corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                      i, j, &max2, &rmax2, &r02, dtx);
+
+    i = sub (j, 1);
+    p_max3 = Lag_max (corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                      i, pit_min, &max3, &rmax3, &r03, dtx);
+#else
+    j = shl (pit_min, 2);
+    p_max1 = Lag_max (vadSt, corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                      pit_max, j, &max1, dtx);
+
+    i = sub (j, 1);
+    j = shl (pit_min, 1);
+    p_max2 = Lag_max (vadSt, corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                      i, j, &max2, dtx);
+
+    i = sub (j, 1);
+    p_max3 = Lag_max (vadSt, corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                      i, pit_min, &max3, dtx);
+
+    if (dtx)
+    {  // no test() call since this if is only in simulation env
+       if (sub(idx, 1) == 0)
+       {
+          // calculate max high-passed filtered correlation of all lags
+          hp_max (corr_ptr, scal_sig, L_frame, pit_max, pit_min, &corr_hp_max);
+
+          // update complex background detector
+          vad_complex_detection_update(vadSt, corr_hp_max);
+       }
+    }
+#endif
+
+     *--------------------------------------------------------------------*
+     * Compare the 3 sections maximum, and favor small lag.               *
+     *--------------------------------------------------------------------*
+
+    if (sub (mult (max1, THRESHOLD), max2) < 0)
+    {
+        max1 = max2;
+        p_max1 = p_max2;
+#ifdef VAD2
+        if (dtx)
+        {
+            rmax1 = rmax2;
+            r01 = r02;
+#endif
+    }
+    if (sub (mult (max1, THRESHOLD), max3) < 0)
+    {
+        p_max1 = p_max3;
+#ifdef VAD2
+        if (dtx)
+        {
+            rmax1 = rmax3;
+            r01 = r03;
+        }
+#endif
+    }
+
+#ifdef VAD2
+    if (dtx)
+    {
+        vadSt->L_Rmax = L_add(vadSt->L_Rmax, rmax1);   // Save max correlation
+        vadSt->L_R0 =   L_add(vadSt->L_R0, r01);        // Save max energy
+    }
+#endif
+
+    return (p_max1);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Pitch_ol(       /* o   : open loop pitch lag                         */
+    vadState *vadSt,   /* i/o : VAD state struct                            */
+    enum Mode mode,    /* i   : coder mode                                  */
+    Word16 signal[],   /* i   : signal used to compute the open loop pitch  */
+    /*    signal[-pit_max] to signal[-1] should be known */
+    Word16 pit_min,    /* i   : minimum pitch lag                           */
+    Word16 pit_max,    /* i   : maximum pitch lag                           */
+    Word16 L_frame,    /* i   : length of frame to compute pitch            */
+    Word16 idx,        /* i   : frame index                                 */
+    Flag dtx,          /* i   : dtx flag; use dtx=1, do not use dtx=0       */
+    Flag *pOverflow    /* i/o : overflow Flag                               */
+)
+{
+    Word16 i;
+    Word16 j;
+    Word16 max1;
+    Word16 max2;
+    Word16 max3;
+    Word16 p_max1;
+    Word16 p_max2;
+    Word16 p_max3;
+    Word16 scal_flag = 0;
+    Word32 t0;
+
+#ifdef VAD2
+    Word32 r01;
+    Word32 r02;
+    Word32 r03;
+    Word32 rmax1;
+    Word32 rmax2;
+    Word32 rmax3;
+#else
+    Word16 corr_hp_max;
+#endif
+    Word32 corr[PIT_MAX+1];
+    Word32 *corr_ptr;
+
+    /* Scaled signal */
+
+    Word16 scaled_signal[L_FRAME + PIT_MAX];
+    Word16 *scal_sig;
+    Word16 *p_signal;
+    Word16 scal_fac;
+    Word32 L_temp;
+
+#ifndef VAD2
+    if (dtx)
+    {   /* no test() call since this if is only in simulation env */
+        /* update tone detection */
+        if ((mode == MR475) || (mode == MR515))
+        {
+            vad_tone_detection_update(vadSt, 1, pOverflow);
+        }
+        else
+        {
+            vad_tone_detection_update(vadSt, 0, pOverflow);
+        }
+    }
+#endif
+
+
+    t0 = 0L;
+    p_signal = &signal[-pit_max];
+
+    for (i = -pit_max; i < L_frame; i++)
+    {
+        t0 += (((Word32) * (p_signal)) * *(p_signal)) << 1;
+        p_signal++;
+        if (t0 < 0)
+        {
+            t0 = MAX_32;
+            break;
+        }
+
+    }
+
+    /*--------------------------------------------------------*
+     * Scaling of input signal.                               *
+     *                                                        *
+     *   if Overflow        -> scal_sig[i] = signal[i]>>3     *
+     *   else if t0 < 1^20  -> scal_sig[i] = signal[i]<<3     *
+     *   else               -> scal_sig[i] = signal[i]        *
+     *--------------------------------------------------------*/
+
+    /*--------------------------------------------------------*
+     *  Verification for risk of overflow.                    *
+     *--------------------------------------------------------*/
+
+    scal_sig = &scaled_signal[0];
+    p_signal = &signal[-pit_max];
+
+    if (t0 == MAX_32)     /* Test for overflow */
+    {
+
+        for (i = (pit_max + L_frame) >> 1; i != 0; i--)
+        {
+            *(scal_sig++) = (Word16)(((Word32) * (p_signal++) >> 3));
+            *(scal_sig++) = (Word16)(((Word32) * (p_signal++) >> 3));
+        }
+
+        if ((pit_max + L_frame) & 1)
+        {
+            *(scal_sig) = (Word16)(((Word32) * (p_signal) >> 3));
+        }
+
+        scal_fac = 3;
+    }
+    else if (t0 < (Word32)1048576L)
+        /* if (t0 < 2^20) */
+    {
+        for (i = (pit_max + L_frame) >> 1; i != 0; i--)
+        {
+            *(scal_sig++) = (Word16)(((Word32) * (p_signal++) << 3));
+            *(scal_sig++) = (Word16)(((Word32) * (p_signal++) << 3));
+        }
+
+        if ((pit_max + L_frame) & 1)
+        {
+            *(scal_sig) = (Word16)(((Word32) * (p_signal) << 3));
+        }
+        scal_fac = -3;
+    }
+    else
+    {
+
+        oscl_memcpy(scal_sig, p_signal, (L_frame + pit_max)*sizeof(*signal));
+        scal_fac = 0;
+    }
+
+    /* calculate all coreelations of scal_sig, from pit_min to pit_max */
+    corr_ptr = &corr[pit_max];
+
+    scal_sig = &scaled_signal[pit_max];
+
+    comp_corr(scal_sig, L_frame, pit_max, pit_min, corr_ptr);
+
+    /*--------------------------------------------------------------------*
+     *  The pitch lag search is divided in three sections.                *
+     *  Each section cannot have a pitch multiple.                        *
+     *  We find a maximum for each section.                               *
+     *  We compare the maximum of each section by favoring small lags.    *
+     *                                                                    *
+     *  First section:  lag delay = pit_max     downto 4*pit_min          *
+     *  Second section: lag delay = 4*pit_min-1 downto 2*pit_min          *
+     *  Third section:  lag delay = 2*pit_min-1 downto pit_min            *
+     *--------------------------------------------------------------------*/
+
+    /* mode dependent scaling in Lag_max */
+
+    if (mode == MR122)
+    {
+        scal_flag = 1;
+    }
+    else
+    {
+        scal_flag = 0;
+    }
+
+#ifdef VAD2
+    L_temp = ((Word32)pit_min) << 2;
+    if (L_temp != (Word32)((Word16) L_temp))
+    {
+        *pOverflow = 1;
+        j = (pit_min > 0) ? MAX_16 : MIN_16;
+    }
+    else
+    {
+        j = (Word16)L_temp;
+    }
+
+    p_max1 = Lag_max(corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                     pit_max, j, &max1, &rmax1, &r01, dtx, pOverflow);
+
+    i = j - 1;
+
+    j = pit_min << 1;
+
+    p_max2 = Lag_max(corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                     i, j, &max2, &rmax2, &r02, dtx, pOverflow);
+
+    i = j - 1;
+
+    p_max3 = Lag_max(corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                     i, pit_min, &max3, &rmax3, &r03, dtx, pOverflow);
+
+#else
+    L_temp = ((Word32)pit_min) << 2;
+    if (L_temp != (Word32)((Word16) L_temp))
+    {
+        *pOverflow = 1;
+        j = (pit_min > 0) ? MAX_16 : MIN_16;
+    }
+    else
+    {
+        j = (Word16)L_temp;
+    }
+
+    p_max1 = Lag_max(vadSt, corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                     pit_max, j, &max1, dtx, pOverflow);
+
+    i = j - 1;
+
+
+    j = pit_min << 1;
+
+
+    p_max2 = Lag_max(vadSt, corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                     i, j, &max2, dtx, pOverflow);
+
+    i = j - 1;
+    p_max3 = Lag_max(vadSt, corr_ptr, scal_sig, scal_fac, scal_flag, L_frame,
+                     i, pit_min, &max3, dtx, pOverflow);
+
+    if (dtx)
+    {  /* no test() call since this if is only in simulation env */
+
+        if (idx == 1)
+        {
+            /* calculate max high-passed filtered correlation of all lags */
+            hp_max(corr_ptr, scal_sig, L_frame, pit_max, pit_min, &corr_hp_max,
+                   pOverflow);
+
+            /* update complex background detector */
+            vad_complex_detection_update(vadSt, corr_hp_max);
+        }
+    }
+#endif
+
+    /*--------------------------------------------------------------------*
+     * Compare the 3 sections maximum, and favor small lag.               *
+     *--------------------------------------------------------------------*/
+
+    i = (Word16)(((Word32)max1 * THRESHOLD) >> 15);
+
+    if (i < max2)
+    {
+        max1 = max2;
+        p_max1 = p_max2;
+
+#ifdef VAD2
+        if (dtx)
+        {
+            rmax1 = rmax2;
+            r01 = r02;
+        }
+#endif
+    }
+
+    i = (Word16)(((Word32)max1 * THRESHOLD) >> 15);
+
+
+    if (i < max3)
+    {
+        p_max1 = p_max3;
+
+#ifdef VAD2
+        if (dtx)
+        {
+            rmax1 = rmax3;
+            r01 = r03;
+        }
+#endif
+    }
+
+#ifdef VAD2
+    if (dtx)
+    {
+        /* Save max correlation */
+        vadSt->L_Rmax = L_add(vadSt->L_Rmax, rmax1, pOverflow);
+        /* Save max energy */
+        vadSt->L_R0 =   L_add(vadSt->L_R0, r01, pOverflow);
+    }
+#endif
+
+    return (p_max1);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.h
new file mode 100644 (file)
index 0000000..9b25895
--- /dev/null
@@ -0,0 +1,113 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pitch_ol.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+       File             : pitch_ol.h
+       Purpose          : Compute the open loop pitch lag.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef PITCH_OL_H
+#define PITCH_OL_H "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "vad.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    Word16 Pitch_ol(       /* o   : open loop pitch lag                         */
+        vadState *vadSt,   /* i/o : VAD state struct                            */
+        enum Mode mode,    /* i   : coder mode                                  */
+        Word16 signal[],   /* i   : signal used to compute the open loop pitch  */
+        /*    signal[-pit_max] to signal[-1] should be known */
+        Word16 pit_min,    /* i   : minimum pitch lag                           */
+        Word16 pit_max,    /* i   : maximum pitch lag                           */
+        Word16 L_frame,    /* i   : length of frame to compute pitch            */
+        Word16 idx,        /* i   : frame index                                 */
+        Flag dtx,          /* i   : dtx flag; use dtx=1, do not use dtx=0       */
+        Flag *pOverflow    /* i/o : overflow Flag                               */
+    );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* PITCH_OL_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.cpp
new file mode 100644 (file)
index 0000000..b0fcf75
--- /dev/null
@@ -0,0 +1,181 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pre_big.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+    Big subframe (2 subframes) preprocessing
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "pre_big.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "syn_filt.h"
+#include "weight_a.h"
+#include "residu.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: pre_big
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode = enum Mode -- coder mode
+    gamma1 = array of type const Word16 -- spectral exp. factor 1
+    gamma1_12k2 = array of type const Word16 -- spectral exp. factor 1 for EFR
+    gamma2 = array of type const Word16 -- spectral exp. factor 2
+    A_t = array of type Word16 -- A(z) unquantized, for 4 subframes, Q12
+    frameOffset = Word16 -- Start position in speech vector,   Q0
+    speech[] = array of type Word16 -- speech,                            Q0
+
+ Outputs:
+    mem_w = array of type Word16 -- synthesis filter memory state,     Q0
+    wsp   = array of type Word16 -- weighted speech                    Q0
+    pOverflow = pointer of type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pre_big.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void pre_big(
+    enum Mode mode,            /* i  : coder mode                             */
+    const Word16 gamma1[],     /* i  : spectral exp. factor 1                 */
+    const Word16 gamma1_12k2[],/* i  : spectral exp. factor 1 for EFR         */
+    const Word16 gamma2[],     /* i  : spectral exp. factor 2                 */
+    Word16 A_t[],              /* i  : A(z) unquantized, for 4 subframes, Q12 */
+    Word16 frameOffset,        /* i  : Start position in speech vector,   Q0  */
+    Word16 speech[],           /* i  : speech,                            Q0  */
+    Word16 mem_w[],            /* i/o: synthesis filter memory state,     Q0  */
+    Word16 wsp[],              /* o  : weighted speech                    Q0  */
+    Flag   *pOverflow          /* o  : overflow indicator                     */
+)
+{
+    Word16 Ap1[MP1];            /* A(z) with spectral expansion         */
+    Word16 Ap2[MP1];            /* A(z) with spectral expansion         */
+    const Word16 *g1;           /* Pointer to correct gammma1 vector    */
+    Word16 aOffset;
+    Word16 i;
+
+    if (mode <= MR795)
+    {
+        g1 = gamma1;
+    }
+    else
+    {
+        g1 = gamma1_12k2;
+    }
+
+    if (frameOffset > 0)
+    {
+        aOffset = MP1 << 1;
+    }
+    else
+    {
+        aOffset = 0;
+    }
+
+    /* process two subframes (which form the "big" subframe) */
+    for (i = 0; i < 2; i++)
+    {
+        Weight_Ai(&A_t[aOffset], g1, Ap1);
+        Weight_Ai(&A_t[aOffset], gamma2, Ap2);
+        Residu(Ap1, &speech[frameOffset], &wsp[frameOffset], L_SUBFR);
+
+        Syn_filt(Ap2, &wsp[frameOffset], &wsp[frameOffset], L_SUBFR, mem_w, 1);
+
+        aOffset += MP1;
+
+        frameOffset += L_SUBFR;
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.h
new file mode 100644 (file)
index 0000000..590750d
--- /dev/null
@@ -0,0 +1,117 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pre_big.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, pre_big.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef pre_big_h
+#define pre_big_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void pre_big(
+        enum Mode mode,            /* i  : coder mode                             */
+        const Word16 gamma1[],     /* i  : spectral exp. factor 1                 */
+        const Word16 gamma1_12k2[],/* i  : spectral exp. factor 1 for EFR         */
+        const Word16 gamma2[],     /* i  : spectral exp. factor 2                 */
+        Word16 A_t[],              /* i  : A(z) unquantized, for 4 subframes, Q12 */
+        Word16 frameOffset,        /* i  : Start position in speech vector,   Q0  */
+        Word16 speech[],           /* i  : speech,                            Q0  */
+        Word16 mem_w[],            /* i/o: synthesis filter memory state,     Q0  */
+        Word16 wsp[],              /* o  : weighted speech                    Q0  */
+        Flag   *pOverflow          /* o  : overflow indicator                     */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp
new file mode 100644 (file)
index 0000000..93d23b5
--- /dev/null
@@ -0,0 +1,483 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pre_proc.cpp
+ Funtions: Pre_Process_init
+           Pre_Process_reset
+           Pre_Process_exit
+           Pre_Process
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ These modules handle the preprocessing of input speech.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "pre_proc.h"
+#include "typedef.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pre_Process_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to an array of pointer to structures of type
+        Pre_ProcessState
+
+ Outputs:
+    Structure pointed to by the pointer pointed to by state is
+      initialized to its reset value
+    state points to the allocated memory
+
+ Returns:
+    return_value = 0 if memory was successfully initialized,
+                   otherwise returns -1.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Allocates state memory and initializes state memory.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pre_proc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Pre_Process_init (Pre_ProcessState **state)
+{
+  Pre_ProcessState* s;
+
+  if (state == (Pre_ProcessState **) NULL){
+      fprintf(stderr, "Pre_Process_init: invalid parameter\n");
+      return -1;
+  }
+  *state = NULL;
+
+  // allocate memory
+  if ((s= (Pre_ProcessState *) malloc(sizeof(Pre_ProcessState))) == NULL){
+      fprintf(stderr, "Pre_Process_init: can not malloc state structure\n");
+      return -1;
+  }
+
+  Pre_Process_reset(s);
+  *state = s;
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Pre_Process_init(Pre_ProcessState **state)
+{
+    Pre_ProcessState* s;
+
+    if (state == (Pre_ProcessState **) NULL)
+    {
+        /*  fprintf(stderr, "Pre_Process_init: invalid parameter\n");  */
+        return(-1);
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (Pre_ProcessState *) oscl_malloc(sizeof(Pre_ProcessState))) == NULL)
+    {
+        /*  fprintf(stderr, "Pre_Process_init:
+            can not malloc state structure\n");  */
+        return(-1);
+    }
+
+    Pre_Process_reset(s);
+    *state = s;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pre_Process_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to structure of type Pre_ProcessState
+
+ Outputs:
+    Structure pointed to by state is initialized to zero.
+
+ Returns:
+    return_value = 0 if memory was successfully reset,
+                   otherwise returns -1.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Initializes state memory to zero.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pre_proc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Pre_Process_reset (Pre_ProcessState *state)
+{
+  if (state == (Pre_ProcessState *) NULL){
+      fprintf(stderr, "Pre_Process_reset: invalid parameter\n");
+      return -1;
+  }
+
+  state->y2_hi = 0;
+  state->y2_lo = 0;
+  state->y1_hi = 0;
+  state->y1_lo = 0;
+  state->x0 = 0;
+  state->x1 = 0;
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Pre_Process_reset(Pre_ProcessState *state)
+{
+    if (state == (Pre_ProcessState *) NULL)
+    {
+        /*  fprintf(stderr, "Pre_Process_reset: invalid parameter\n");  */
+        return(-1);
+    }
+
+    state->y2_hi = 0;
+    state->y2_lo = 0;
+    state->y1_hi = 0;
+    state->y1_lo = 0;
+    state->x0 = 0;
+    state->x1 = 0;
+
+    return(0);
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pre_Process_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = a pointer to an array of pointers to structures of
+        type Pre_ProcessState
+
+ Outputs:
+    state points to a NULL address
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ The memory used for state memory is freed.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pre_proc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Pre_Process_exit (Pre_ProcessState **state)
+{
+  if (state == NULL || *state == NULL)
+      return;
+
+  // deallocate memory
+  free(*state);
+  *state = NULL;
+
+  return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Pre_Process_exit(Pre_ProcessState **state)
+{
+    if (state == NULL || *state == NULL)
+    {
+        return;
+    }
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Pre_Process
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = a pointer to a structure of type Pre_ProcessState
+    signal = input/output signal (Word16)
+    lg = length of signal (Word16)
+
+ Outputs:
+    st points to the updated structure
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    a = points to a buffer of filter coefficients
+    b = points to a buffer of filter coefficients
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This module performs the preprocessing of the input speech.
+ The signal is passed through a 2nd order high pass filtering with cut off
+ frequency at 80 Hz. The input is divided by two in the filtering process.
+
+    y[i] = b[0]*x[i]/2 + b[1]*x[i-1]/2 + b[2]*x[i-2]/2
+                     + a[1]*y[i-1] + a[2]*y[i-2];
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ pre_proc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Pre_Process (
+    Pre_ProcessState *st,
+    Word16 signal[], // input/output signal
+    Word16 lg)       // lenght of signal
+{
+    Word16 i, x2;
+    Word32 L_tmp;
+
+    for (i = 0; i < lg; i++)
+    {
+        x2 = st->x1;
+        st->x1 = st->x0;
+        st->x0 = signal[i];
+
+        //  y[i] = b[0]*x[i]/2 + b[1]*x[i-1]/2 + b140[2]*x[i-2]/2
+        //                     + a[1]*y[i-1] + a[2] * y[i-2];
+
+        L_tmp = Mpy_32_16 (st->y1_hi, st->y1_lo, a[1]);
+        L_tmp = L_add (L_tmp, Mpy_32_16 (st->y2_hi, st->y2_lo, a[2]));
+        L_tmp = L_mac (L_tmp, st->x0, b[0]);
+        L_tmp = L_mac (L_tmp, st->x1, b[1]);
+        L_tmp = L_mac (L_tmp, x2, b[2]);
+        L_tmp = L_shl (L_tmp, 3);
+        signal[i] = pv_round (L_tmp);
+
+        st->y2_hi = st->y1_hi;
+        st->y2_lo = st->y1_lo;
+        L_Extract (L_tmp, &st->y1_hi, &st->y1_lo);
+    }
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+/*
+    filter coefficients (fc = 80 Hz, coeff. b[] is divided by 2)
+    const Word16 b[3] = {1899, -3798, 1899};
+    const Word16 a[3] = {4096, 7807, -3733};
+
+*/
+
+void Pre_Process(
+    Pre_ProcessState *st,
+    Word16 signal[], /* input/output signal */
+    Word16 lg)       /* length of signal    */
+{
+    register Word16 i;
+    Word16 x_n_2;
+    Word16 x_n_1;
+    Word32 L_tmp;
+    Word16 *p_signal = signal;
+
+    x_n_2 = st->x1;
+    x_n_1 = st->x0;
+
+    for (i = lg; i != 0; i--)
+    {
+
+
+        /*  y[i] = b[0]*x[i]/2 + b[1]*x[i-1]/2 + b140[2]*x[i-2]/2  */
+        /*                     + a[1]*y[i-1] + a[2] * y[i-2];      */
+
+        L_tmp     = ((Word32) st->y1_hi) * 7807;
+        L_tmp    += (Word32)(((Word32) st->y1_lo * 7807) >> 15);
+
+        L_tmp    += ((Word32) st->y2_hi) * (-3733);
+        st->y2_hi =  st->y1_hi;
+        L_tmp    += (Word32)(((Word32) st->y2_lo * (-3733)) >> 15);
+        st->y2_lo =  st->y1_lo;
+
+        L_tmp    += ((Word32) x_n_2) * 1899;
+        x_n_2     =  x_n_1;
+        L_tmp    += ((Word32) x_n_1) * (-3798);
+        x_n_1     = *(p_signal);
+        L_tmp    += ((Word32) x_n_1) * 1899;
+
+
+        *(p_signal++) = (Word16)((L_tmp + 0x0000800L) >> 12);
+
+        st->y1_hi = (Word16)(L_tmp >> 12);
+        st->y1_lo = (Word16)((L_tmp << 3) - ((Word32)(st->y1_hi) << 15));
+
+    }
+
+    st->x1 = x_n_2;
+    st->x0 = x_n_1;
+
+    return;
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.h
new file mode 100644 (file)
index 0000000..abe676f
--- /dev/null
@@ -0,0 +1,114 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : pre_proc.h
+*      Purpose          : Preprocessing of input speech.
+*
+
+ Description:  Replaced "int" and/or "char" with OSCL defined types.
+
+********************************************************************************
+*/
+#ifndef pre_proc_h
+#define pre_proc_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         LOCAL VARIABLES AND TABLES
+    ********************************************************************************
+    */
+
+    /*
+    ********************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    ********************************************************************************
+    */
+    typedef struct
+    {
+        Word16 y2_hi;
+        Word16 y2_lo;
+        Word16 y1_hi;
+        Word16 y1_lo;
+        Word16 x0;
+        Word16 x1;
+    } Pre_ProcessState;
+
+    /*
+    ********************************************************************************
+    *                         DECLARATION OF PROTOTYPES
+    ********************************************************************************
+    */
+
+    Word16 Pre_Process_init(Pre_ProcessState **st);
+    /* initialize one instance of the pre processing state.
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to Pre_Process in each call.
+       returns 0 on success
+     */
+
+    Word16 Pre_Process_reset(Pre_ProcessState *st);
+    /* reset of pre processing state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+    void Pre_Process_exit(Pre_ProcessState **st);
+    /* de-initialize pre processing state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    void Pre_Process(
+        Pre_ProcessState *st,
+        Word16 signal[],   /* Input/output signal                               */
+        Word16 lg          /* Lenght of signal                                  */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.cpp
new file mode 100644 (file)
index 0000000..198ea4f
--- /dev/null
@@ -0,0 +1,263 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+
+
+
+ Filename: prm2bits.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "prm2bits.h"
+#include "mode.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+#define MASK      0x0001
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Int2bin
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    value = value to be converted to binary of type Word16
+    no_of_bits = number of bits associated with value of type Word16
+
+ Outputs:
+    bitstream = pointer to address where bits are written of type Word16
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  FUNCTION:  Int2bin
+
+  PURPOSE:  convert integer to binary and write the bits to the array
+            bitstream[]. The most significant bits are written first.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ prm2bits.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static void Int2bin (
+    Word16 value,       // input : value to be converted to binary
+    Word16 no_of_bits,  // input : number of bits associated with value
+    Word16 *bitstream   // output: address where bits are written
+)
+{
+    Word16 *pt_bitstream, i, bit;
+
+    pt_bitstream = &bitstream[no_of_bits];
+
+    for (i = 0; i < no_of_bits; i++)
+    {
+        bit = value & MASK;
+        if (bit == 0)
+        {
+            *--pt_bitstream = BIT_0;
+        }
+        else
+        {
+            *--pt_bitstream = BIT_1;
+        }
+        value = shr (value, 1);
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+static void Int2bin(
+    Word16 value,       /* input : value to be converted to binary      */
+    Word16 no_of_bits,  /* input : number of bits associated with value */
+    Word16 *bitstream   /* output: address where bits are written       */
+)
+{
+    Word16 *pt_bitstream;
+    Word16 i;
+
+    pt_bitstream = &bitstream[no_of_bits-1];
+
+    for (i = no_of_bits; i != 0; i--)
+    {
+        *(pt_bitstream--) = value & MASK;
+        value >>= 1;
+    }
+
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: prm2bits
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode  = AMR mode of type enum Mode
+    prm[] = pointer to analysis parameters of type Word16
+
+ Outputs:
+    bits[] = pointer to serial bits of type Word16
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  FUNCTION:    Prm2bits
+
+  PURPOSE:     converts the encoder parameter vector into a vector of serial
+               bits.
+
+  DESCRIPTION: depending on the mode, different numbers of parameters
+               (with differing numbers of bits) are processed. Details
+               are found in bitno.tab
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ prm2bits.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Prm2bits (
+    enum Mode mode,    // i : AMR mode
+    Word16 prm[],      // i : analysis parameters (size <= MAX_PRM_SIZE)
+    Word16 bits[]      // o : serial bits         (size <= MAX_SERIAL_SIZE)
+)
+{
+   Word16 i;
+
+   for (i = 0; i < prmno[mode]; i++)
+   {
+       Int2bin (prm[i], bitno[mode][i], bits);
+       bits += bitno[mode][i];
+       add(0,0);       // account for above pointer update
+   }
+
+   return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void Prm2bits(
+    enum Mode mode,    /* i : AMR mode                                      */
+    Word16 prm[],      /* i : analysis parameters (size <= MAX_PRM_SIZE)    */
+    Word16 bits[],      /* o : serial bits         (size <= MAX_SERIAL_SIZE) */
+    CommonAmrTbls* common_amr_tbls /* i : ptr to strcut of table ptrs        */
+)
+{
+    Word16 i;
+    const Word16 *p_mode;
+    Word16 *p_prm;
+    const Word16* prmno_ptr = common_amr_tbls->prmno_ptr;
+
+    p_mode = &common_amr_tbls->bitno_ptr[mode][0];
+    p_prm  = &prm[0];
+
+    for (i = prmno_ptr[mode]; i != 0; i--)
+    {
+        Int2bin(*(p_prm++), *(p_mode), bits);
+        bits += *(p_mode++);
+    }
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.h
new file mode 100644 (file)
index 0000000..a515df2
--- /dev/null
@@ -0,0 +1,83 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
+*                                R99   Version 3.2.0
+*                                REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+*      File             : prm2bits.h
+*      Purpose          : Converts the encoder parameter vector into a
+*                       : vector of serial bits.
+*
+********************************************************************************
+*/
+#ifndef prm2bits_h
+#define prm2bits_h "$Id $"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+#include "mode.h"
+#include "get_const_tbls.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*
+    ********************************************************************************
+    *                         DEFINITION OF DATA TYPES
+    ********************************************************************************
+    */
+
+    /*
+    ********************************************************************************
+    *                         DECLARATION OF PROTOTYPES
+    ********************************************************************************
+    */
+    void Prm2bits(
+        enum Mode mode,    /* i : AMR mode */
+        Word16 prm[],      /* input : analysis parameters                       */
+        Word16 bits[],      /* output: serial bits                              */
+        CommonAmrTbls* common_amr_tbls /* i : ptr to strcut of table ptrs       */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.cpp
new file mode 100644 (file)
index 0000000..fcaf18a
--- /dev/null
@@ -0,0 +1,253 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: q_gain_c.cpp
+ Functions: q_gain_code
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+    Scalar quantization of the innovative codebook gain.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "q_gain_c.h"
+#include "mode.h"
+#include "oper_32b.h"
+#include "basic_op.h"
+#include "log2.h"
+#include "pow2.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+#define NB_QUA_CODE 32
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: q_gain_code
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode -- enum Mode -- AMR mode
+    exp_gcode0 -- Word16 -- predicted CB gain (exponent),  Q0
+    frac_gcode0 -- Word16 -- predicted CB gain (fraction),  Q15
+    gain -- Pointer to Word16 -- quantized fixed codebook gain, Q1
+
+ Outputs:
+    gain -- Pointer to Word16 -- quantized fixed codebook gain, Q1
+
+    qua_ener_MR122 -- Pointer to Word16 -- quantized energy error, Q10
+                                           (for MR122 MA predictor update)
+
+    qua_ener -- Pointer to Word16 -- quantized energy error,        Q10
+                                     (for other MA predictor update)
+
+    pOverflow -- Pointer to Flag -- overflow indicator
+ Returns:
+    quantization index -- Word16 -- Q0
+
+ Global Variables Used:
+    qua_gain_code[]
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Scalar quantization of the innovative codebook gain.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ q_gain_c.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 q_gain_code(         /* o  : quantization index,            Q0  */
+    enum Mode mode,         /* i  : AMR mode                           */
+    Word16 exp_gcode0,      /* i  : predicted CB gain (exponent),  Q0  */
+    Word16 frac_gcode0,     /* i  : predicted CB gain (fraction),  Q15 */
+    Word16 *gain,           /* i/o: quantized fixed codebook gain, Q1  */
+    Word16 *qua_ener_MR122, /* o  : quantized energy error,        Q10 */
+    /*      (for MR122 MA predictor update)    */
+    Word16 *qua_ener,       /* o  : quantized energy error,        Q10 */
+    /*      (for other MA predictor update)    */
+    const Word16* qua_gain_code_ptr, /* i : ptr to read-only table           */
+    Flag   *pOverflow
+)
+{
+    const Word16 *p;
+    Word16 i;
+    Word16 index;
+    Word16 gcode0;
+    Word16 err;
+    Word16 err_min;
+    Word16 g_q0;
+    Word16 temp;
+
+    if (mode == MR122)
+    {
+        g_q0 = *gain >> 1; /* Q1 -> Q0 */
+    }
+    else
+    {
+        g_q0 = *gain;
+    }
+
+    /*-------------------------------------------------------------------*
+     *  predicted codebook gain                                          *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~                                          *
+     *  gc0     = Pow2(int(d)+frac(d))                                   *
+     *          = 2^exp + 2^frac                                         *
+     *                                                                   *
+     *-------------------------------------------------------------------*/
+
+    gcode0 = (Word16) Pow2(exp_gcode0, frac_gcode0, pOverflow);  /* predicted gain */
+
+    if (mode == MR122)
+    {
+        gcode0 = shl(gcode0, 4, pOverflow);
+    }
+    else
+    {
+        gcode0 = shl(gcode0, 5, pOverflow);
+    }
+
+    /*-------------------------------------------------------------------*
+     *                   Search for best quantizer                        *
+     *-------------------------------------------------------------------*/
+
+    p = &qua_gain_code_ptr[0];
+    err_min = ((Word32)gcode0 * *(p++)) >> 15;
+    err_min =  g_q0 - err_min;
+    if (err_min < 0)
+    {
+        err_min = -err_min;
+    }
+
+    p += 2;                                  /* skip quantized energy errors */
+    index = 0;
+
+    for (i = 1; i < NB_QUA_CODE; i++)
+    {
+        err = ((Word32)gcode0 * *(p++)) >> 15;
+        err =  g_q0 - err;
+
+        if (err < 0)
+        {
+            err = -err;
+        }
+
+        p += 2;                              /* skip quantized energy error */
+
+        if (err < err_min)
+        {
+            err_min = err;
+            index = i;
+        }
+    }
+
+    temp = index + (index << 1);
+
+    p = &qua_gain_code_ptr[temp];
+
+    temp  = (gcode0 * *(p++)) >> 15;
+    if (mode == MR122)
+    {
+        *gain =  temp << 1;
+    }
+    else
+    {
+        *gain = temp;
+    }
+
+    /* quantized error energies (for MA predictor update) */
+    *qua_ener_MR122 = *p++;
+    *qua_ener = *p;
+
+    return index;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.h
new file mode 100644 (file)
index 0000000..6482963
--- /dev/null
@@ -0,0 +1,125 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: q_gain_c.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, q_gain.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef q_gain_c_h
+#define q_gain_c_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "gc_pred.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*
+     * Function q_gain_code()                                                   *
+     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                  *
+     * Scalar quantization of the innovative codebook gain.                     *
+     *                                                                          *
+     * gc_pred() is used for MA prediction of the innovation energy             *
+     *--------------------------------------------------------------------------*/
+    Word16 q_gain_code(         /* o  : quantization index,            Q0  */
+        enum Mode mode,         /* i  : AMR mode                           */
+        Word16 exp_gcode0,      /* i  : predicted CB gain (exponent),  Q0  */
+        Word16 frac_gcode0,     /* i  : predicted CB gain (fraction),  Q15 */
+        Word16 *gain,           /* i/o: quantized fixed codebook gain, Q1  */
+        Word16 *qua_ener_MR122, /* o  : quantized energy error,        Q10 */
+        /*      (for MR122 MA predictor update)    */
+        Word16 *qua_ener,       /* o  : quantized energy error,        Q10 */
+        /*      (for other MA predictor update)    */
+        const Word16* qua_gain_code_ptr, /* i : ptr to read-only table           */
+        Flag   *pOverflow
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* q_gain_c_h */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.cpp
new file mode 100644 (file)
index 0000000..7748115
--- /dev/null
@@ -0,0 +1,237 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: q_gain_p.cpp
+ Functions: q_gain_pitch
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "q_gain_p.h"
+#include "typedef.h"
+#include "oper_32b.h"
+#include "cnst.h"
+#include "basic_op.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+#define NB_QUA_PITCH 16
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: q_gain_pitch
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode -- enum Mode -- AMR mode
+    gp_limit -- Word16 -- pitch gain limit
+    gain -- Pointer to Word16 -- Pitch gain (unquant/quant),              Q14
+
+ Outputs:
+    gain -- Pointer to Word16 -- Pitch gain (unquant/quant),              Q14
+
+    gain_cand -- Array of type Word16 -- pitch gain candidates (3),
+                                         MR795 only, Q14
+
+    gain_cind -- Array of type Word16 -- pitch gain cand. indices (3),
+                                         MR795 only, Q0
+
+    pOverflow -- Pointer to Flag -- overflow indicator
+
+ Returns:
+    Word16 -- index of quantization
+
+ Global Variables Used:
+    qua_gain_pitch
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ q_gain_p.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 q_gain_pitch(    /* Return index of quantization                      */
+    enum Mode mode,     /* i  : AMR mode                                     */
+    Word16 gp_limit,    /* i  : pitch gain limit                             */
+    Word16 *gain,       /* i/o: Pitch gain (unquant/quant),              Q14 */
+    Word16 gain_cand[], /* o  : pitch gain candidates (3),   MR795 only, Q14 */
+    Word16 gain_cind[], /* o  : pitch gain cand. indices (3),MR795 only, Q0  */
+    const Word16* qua_gain_pitch_ptr, /* i : ptr to read-only table          */
+    Flag   *pOverflow
+)
+{
+    Word16 i;
+    Word16 index;
+    Word16 err;
+    Word16 err_min;
+
+    err_min = sub(*gain, qua_gain_pitch_ptr[0], pOverflow);
+    err_min = abs_s(err_min);
+
+    index = 0;
+
+    for (i = 1; i < NB_QUA_PITCH; i++)
+    {
+        if (qua_gain_pitch_ptr[i] <= gp_limit)
+        {
+            err = sub(*gain, qua_gain_pitch_ptr[i], pOverflow);
+            err = abs_s(err);
+
+            if (err < err_min)
+            {
+                err_min = err;
+                index = i;
+            }
+        }
+    }
+
+    if (mode == MR795)
+    {
+        /* in MR795 mode, compute three gain_pit candidates around the index
+         * found in the quantization loop: the index found and the two direct
+         * neighbours, except for the extreme cases (i=0 or i=NB_QUA_PITCH-1),
+         * where the direct neighbour and the neighbour to that is used.
+         */
+        Word16 ii;
+
+        if (index == 0)
+        {
+            ii = index;
+        }
+        else
+        {
+            if (index == (NB_QUA_PITCH - 1) ||
+                    (qua_gain_pitch_ptr[index+1] > gp_limit))
+            {
+                ii = index - 2;
+            }
+            else
+            {
+                ii = index - 1;
+            }
+        }
+
+        /* store candidate indices and values */
+        for (i = 0; i < 3; i++)
+        {
+            gain_cind[i] = ii;
+            gain_cand[i] = qua_gain_pitch_ptr[ii];
+
+            ii += 1;
+        }
+
+        *gain = qua_gain_pitch_ptr[index];
+    }
+    else
+    {
+        /* in MR122 mode, just return the index and gain pitch found.
+         * If bitexactness is required, mask away the two LSBs (because
+         * in the original EFR, gain_pit was scaled Q12)
+         */
+        if (mode == MR122)
+        {
+            /* clear 2 LSBits */
+            *gain = qua_gain_pitch_ptr[index] & 0xFFFC;
+        }
+        else
+        {
+            *gain = qua_gain_pitch_ptr[index];
+        }
+    }
+    return index;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.h
new file mode 100644 (file)
index 0000000..ceaaa9b
--- /dev/null
@@ -0,0 +1,113 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: q_gain_p.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, q_gain_p.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef q_gain_p_h
+#define q_gain_p_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    Word16 q_gain_pitch(    /* Return index of quantization                      */
+        enum Mode mode,     /* i  : AMR mode                                     */
+        Word16 gp_limit,    /* i  : pitch gain limit                             */
+        Word16 *gain,       /* i/o: Pitch gain (unquant/quant),              Q14 */
+        Word16 gain_cand[], /* o  : pitch gain candidates (3),   MR795 only, Q14 */
+        Word16 gain_cind[], /* o  : pitch gain cand. indices (3),MR795 only, Q0  */
+        const Word16* qua_gain_pitch_ptr, /* i : ptr to read-only table          */
+        Flag   *pOverflow
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* q_gain_p_h */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.cpp
new file mode 100644 (file)
index 0000000..e5af47f
--- /dev/null
@@ -0,0 +1,1397 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: qgain475.cpp
+ Funtions: MR475_quant_store_results
+           MR475_update_unq_pred
+           MR475_gain_quant
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ These modules handle the quantization of pitch and codebook gains for MR475.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "qgain475.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "mode.h"
+#include "cnst.h"
+#include "pow2.h"
+#include "log2.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define MR475_VQ_SIZE 256
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/* The table contains the following data:
+ *
+ *    g_pitch(0)        (Q14) // for sub-
+ *    g_fac(0)          (Q12) // frame 0 and 2
+ *    g_pitch(1)        (Q14) // for sub-
+ *    g_fac(2)          (Q12) // frame 1 and 3
+ *
+ */
+static const Word16 table_gain_MR475[MR475_VQ_SIZE*4] =
+{
+    /*g_pit(0), g_fac(0),      g_pit(1), g_fac(1) */
+    812,          128,           542,      140,
+    2873,         1135,          2266,     3402,
+    2067,          563,         12677,      647,
+    4132,         1798,          5601,     5285,
+    7689,          374,          3735,      441,
+    10912,         2638,         11807,     2494,
+    20490,          797,          5218,      675,
+    6724,         8354,          5282,     1696,
+    1488,          428,          5882,      452,
+    5332,         4072,          3583,     1268,
+    2469,          901,         15894,     1005,
+    14982,         3271,         10331,     4858,
+    3635,         2021,          2596,      835,
+    12360,         4892,         12206,     1704,
+    13432,         1604,          9118,     2341,
+    3968,         1538,          5479,     9936,
+    3795,          417,          1359,      414,
+    3640,         1569,          7995,     3541,
+    11405,          645,          8552,      635,
+    4056,         1377,         16608,     6124,
+    11420,          700,          2007,      607,
+    12415,         1578,         11119,     4654,
+    13680,         1708,         11990,     1229,
+    7996,         7297,         13231,     5715,
+    2428,         1159,          2073,     1941,
+    6218,         6121,          3546,     1804,
+    8925,         1802,          8679,     1580,
+    13935,         3576,         13313,     6237,
+    6142,         1130,          5994,     1734,
+    14141,         4662,         11271,     3321,
+    12226,         1551,         13931,     3015,
+    5081,        10464,          9444,     6706,
+    1689,          683,          1436,     1306,
+    7212,         3933,          4082,     2713,
+    7793,          704,         15070,      802,
+    6299,         5212,          4337,     5357,
+    6676,          541,          6062,      626,
+    13651,         3700,         11498,     2408,
+    16156,          716,         12177,      751,
+    8065,        11489,          6314,     2256,
+    4466,          496,          7293,      523,
+    10213,         3833,          8394,     3037,
+    8403,          966,         14228,     1880,
+    8703,         5409,         16395,     4863,
+    7420,         1979,          6089,     1230,
+    9371,         4398,         14558,     3363,
+    13559,         2873,         13163,     1465,
+    5534,         1678,         13138,    14771,
+    7338,          600,          1318,      548,
+    4252,         3539,         10044,     2364,
+    10587,          622,         13088,      669,
+    14126,         3526,          5039,     9784,
+    15338,          619,          3115,      590,
+    16442,         3013,         15542,     4168,
+    15537,         1611,         15405,     1228,
+    16023,         9299,          7534,     4976,
+    1990,         1213,         11447,     1157,
+    12512,         5519,          9475,     2644,
+    7716,         2034,         13280,     2239,
+    16011,         5093,          8066,     6761,
+    10083,         1413,          5002,     2347,
+    12523,         5975,         15126,     2899,
+    18264,         2289,         15827,     2527,
+    16265,        10254,         14651,    11319,
+    1797,          337,          3115,      397,
+    3510,         2928,          4592,     2670,
+    7519,          628,         11415,      656,
+    5946,         2435,          6544,     7367,
+    8238,          829,          4000,      863,
+    10032,         2492,         16057,     3551,
+    18204,         1054,          6103,     1454,
+    5884,         7900,         18752,     3468,
+    1864,          544,          9198,      683,
+    11623,         4160,          4594,     1644,
+    3158,         1157,         15953,     2560,
+    12349,         3733,         17420,     5260,
+    6106,         2004,          2917,     1742,
+    16467,         5257,         16787,     1680,
+    17205,         1759,          4773,     3231,
+    7386,         6035,         14342,    10012,
+    4035,          442,          4194,      458,
+    9214,         2242,          7427,     4217,
+    12860,          801,         11186,      825,
+    12648,         2084,         12956,     6554,
+    9505,          996,          6629,      985,
+    10537,         2502,         15289,     5006,
+    12602,         2055,         15484,     1653,
+    16194,         6921,         14231,     5790,
+    2626,          828,          5615,     1686,
+    13663,         5778,          3668,     1554,
+    11313,         2633,          9770,     1459,
+    14003,         4733,         15897,     6291,
+    6278,         1870,          7910,     2285,
+    16978,         4571,         16576,     3849,
+    15248,         2311,         16023,     3244,
+    14459,        17808,         11847,     2763,
+    1981,         1407,          1400,      876,
+    4335,         3547,          4391,     4210,
+    5405,          680,         17461,      781,
+    6501,         5118,          8091,     7677,
+    7355,          794,          8333,     1182,
+    15041,         3160,         14928,     3039,
+    20421,          880,         14545,      852,
+    12337,        14708,          6904,     1920,
+    4225,          933,          8218,     1087,
+    10659,         4084,         10082,     4533,
+    2735,          840,         20657,     1081,
+    16711,         5966,         15873,     4578,
+    10871,         2574,          3773,     1166,
+    14519,         4044,         20699,     2627,
+    15219,         2734,         15274,     2186,
+    6257,         3226,         13125,    19480,
+    7196,          930,          2462,     1618,
+    4515,         3092,         13852,     4277,
+    10460,          833,         17339,      810,
+    16891,         2289,         15546,     8217,
+    13603,         1684,          3197,     1834,
+    15948,         2820,         15812,     5327,
+    17006,         2438,         16788,     1326,
+    15671,         8156,         11726,     8556,
+    3762,         2053,          9563,     1317,
+    13561,         6790,         12227,     1936,
+    8180,         3550,         13287,     1778,
+    16299,         6599,         16291,     7758,
+    8521,         2551,          7225,     2645,
+    18269,         7489,         16885,     2248,
+    17882,         2884,         17265,     3328,
+    9417,        20162,         11042,     8320,
+    1286,          620,          1431,      583,
+    5993,         2289,          3978,     3626,
+    5144,          752,         13409,      830,
+    5553,         2860,         11764,     5908,
+    10737,          560,          5446,      564,
+    13321,         3008,         11946,     3683,
+    19887,          798,          9825,      728,
+    13663,         8748,          7391,     3053,
+    2515,          778,          6050,      833,
+    6469,         5074,          8305,     2463,
+    6141,         1865,         15308,     1262,
+    14408,         4547,         13663,     4515,
+    3137,         2983,          2479,     1259,
+    15088,         4647,         15382,     2607,
+    14492,         2392,         12462,     2537,
+    7539,         2949,         12909,    12060,
+    5468,          684,          3141,      722,
+    5081,         1274,         12732,     4200,
+    15302,          681,          7819,      592,
+    6534,         2021,         16478,     8737,
+    13364,          882,          5397,      899,
+    14656,         2178,         14741,     4227,
+    14270,         1298,         13929,     2029,
+    15477,         7482,         15815,     4572,
+    2521,         2013,          5062,     1804,
+    5159,         6582,          7130,     3597,
+    10920,         1611,         11729,     1708,
+    16903,         3455,         16268,     6640,
+    9306,         1007,          9369,     2106,
+    19182,         5037,         12441,     4269,
+    15919,         1332,         15357,     3512,
+    11898,        14141,         16101,     6854,
+    2010,          737,          3779,      861,
+    11454,         2880,          3564,     3540,
+    9057,         1241,         12391,      896,
+    8546,         4629,         11561,     5776,
+    8129,          589,          8218,      588,
+    18728,         3755,         12973,     3149,
+    15729,          758,         16634,      754,
+    15222,        11138,         15871,     2208,
+    4673,          610,         10218,      678,
+    15257,         4146,          5729,     3327,
+    8377,         1670,         19862,     2321,
+    15450,         5511,         14054,     5481,
+    5728,         2888,          7580,     1346,
+    14384,         5325,         16236,     3950,
+    15118,         3744,         15306,     1435,
+    14597,         4070,         12301,    15696,
+    7617,         1699,          2170,      884,
+    4459,         4567,         18094,     3306,
+    12742,          815,         14926,      907,
+    15016,         4281,         15518,     8368,
+    17994,         1087,          2358,      865,
+    16281,         3787,         15679,     4596,
+    16356,         1534,         16584,     2210,
+    16833,         9697,         15929,     4513,
+    3277,         1085,          9643,     2187,
+    11973,         6068,          9199,     4462,
+    8955,         1629,         10289,     3062,
+    16481,         5155,         15466,     7066,
+    13678,         2543,          5273,     2277,
+    16746,         6213,         16655,     3408,
+    20304,         3363,         18688,     1985,
+    14172,        12867,         15154,    15703,
+    4473,         1020,          1681,      886,
+    4311,         4301,          8952,     3657,
+    5893,         1147,         11647,     1452,
+    15886,         2227,          4582,     6644,
+    6929,         1205,          6220,      799,
+    12415,         3409,         15968,     3877,
+    19859,         2109,          9689,     2141,
+    14742,         8830,         14480,     2599,
+    1817,         1238,          7771,      813,
+    19079,         4410,          5554,     2064,
+    3687,         2844,         17435,     2256,
+    16697,         4486,         16199,     5388,
+    8028,         2763,          3405,     2119,
+    17426,         5477,         13698,     2786,
+    19879,         2720,          9098,     3880,
+    18172,         4833,         17336,    12207,
+    5116,          996,          4935,      988,
+    9888,         3081,          6014,     5371,
+    15881,         1667,          8405,     1183,
+    15087,         2366,         19777,     7002,
+    11963,         1562,          7279,     1128,
+    16859,         1532,         15762,     5381,
+    14708,         2065,         20105,     2155,
+    17158,         8245,         17911,     6318,
+    5467,         1504,          4100,     2574,
+    17421,         6810,          5673,     2888,
+    16636,         3382,          8975,     1831,
+    20159,         4737,         19550,     7294,
+    6658,         2781,         11472,     3321,
+    19397,         5054,         18878,     4722,
+    16439,         2373,         20430,     4386,
+    11353,        26526,         11593,     3068,
+    2866,         1566,          5108,     1070,
+    9614,         4915,          4939,     3536,
+    7541,          878,         20717,      851,
+    6938,         4395,         16799,     7733,
+    10137,         1019,          9845,      964,
+    15494,         3955,         15459,     3430,
+    18863,          982,         20120,      963,
+    16876,        12887,         14334,     4200,
+    6599,         1220,          9222,      814,
+    16942,         5134,          5661,     4898,
+    5488,         1798,         20258,     3962,
+    17005,         6178,         17929,     5929,
+    9365,         3420,          7474,     1971,
+    19537,         5177,         19003,     3006,
+    16454,         3788,         16070,     2367,
+    8664,         2743,          9445,    26358,
+    10856,         1287,          3555,     1009,
+    5606,         3622,         19453,     5512,
+    12453,          797,         20634,      911,
+    15427,         3066,         17037,    10275,
+    18883,         2633,          3913,     1268,
+    19519,         3371,         18052,     5230,
+    19291,         1678,         19508,     3172,
+    18072,        10754,         16625,     6845,
+    3134,         2298,         10869,     2437,
+    15580,         6913,         12597,     3381,
+    11116,         3297,         16762,     2424,
+    18853,         6715,         17171,     9887,
+    12743,         2605,          8937,     3140,
+    19033,         7764,         18347,     3880,
+    20475,         3682,         19602,     3380,
+    13044,        19373,         10526,    23124
+};
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: MR475_quant_store_results
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pred_st = pointer to structure of type gc_predState
+    p = pointer to selected quantizer table entry (const Word16)
+    gcode0 = predicted CB gain (Word16)
+    exp_gcode0 = exponent of predicted CB gain (Word16)
+    gain_pit = pointer to Pitch gain (Word16)
+    gain_cod = pointer to Code gain (Word16)
+
+ Outputs:
+    pred_st points to the updated structure of type gc_predState
+    gain_pit points to Pitch gain
+    gain_cod points to Code gain
+    pOverflow points to overflow indicator (Flag)
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function calculates the final fixed codebook gain and the predictor
+ update values, and updates the gain predictor.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ qgain475.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static void MR475_quant_store_results(
+
+    gc_predState *pred_st, // i/o: gain predictor state struct
+    const Word16 *p,       // i  : pointer to selected quantizer table entry
+    Word16 gcode0,         // i  : predicted CB gain,     Q(14 - exp_gcode0)
+    Word16 exp_gcode0,     // i  : exponent of predicted CB gain,        Q0
+    Word16 *gain_pit,      // o  : Pitch gain,                           Q14
+    Word16 *gain_cod       // o  : Code gain,                            Q1
+)
+{
+
+    Word16 g_code, exp, frac, tmp;
+    Word32 L_tmp;
+
+    Word16 qua_ener_MR122; // o  : quantized energy error, MR122 version Q10
+    Word16 qua_ener;       // o  : quantized energy error,               Q10
+
+    // Read the quantized gains
+    *gain_pit = *p++;
+    g_code = *p++;
+
+    //------------------------------------------------------------------*
+     *  calculate final fixed codebook gain:                            *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                            *
+     *                                                                  *
+     *   gc = gc0 * g                                                   *
+     *------------------------------------------------------------------
+
+    L_tmp = L_mult(g_code, gcode0);
+    L_tmp = L_shr(L_tmp, sub(10, exp_gcode0));
+    *gain_cod = extract_h(L_tmp);
+
+    //------------------------------------------------------------------*
+     *  calculate predictor update values and update gain predictor:    *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    *
+     *                                                                  *
+     *   qua_ener       = log2(g)                                       *
+     *   qua_ener_MR122 = 20*log10(g)                                   *
+     *------------------------------------------------------------------
+
+    Log2 (L_deposit_l (g_code), &exp, &frac); // Log2(x Q12) = log2(x) + 12
+    exp = sub(exp, 12);
+
+    tmp = shr_r (frac, 5);
+    qua_ener_MR122 = add (tmp, shl (exp, 10));
+
+    L_tmp = Mpy_32_16(exp, frac, 24660); // 24660 Q12 ~= 6.0206 = 20*log10(2)
+    qua_ener = pv_round (L_shl (L_tmp, 13)); // Q12 * Q0 = Q13 -> Q10
+
+    gc_pred_update(pred_st, qua_ener_MR122, qua_ener);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void MR475_quant_store_results(
+    gc_predState *pred_st, /* i/o: gain predictor state struct               */
+    const Word16 *p,       /* i  : pointer to selected quantizer table entry */
+    Word16 gcode0,         /* i  : predicted CB gain,     Q(14 - exp_gcode0) */
+    Word16 exp_gcode0,     /* i  : exponent of predicted CB gain,        Q0  */
+    Word16 *gain_pit,      /* o  : Pitch gain,                           Q14 */
+    Word16 *gain_cod,      /* o  : Code gain,                            Q1  */
+    Flag   *pOverflow      /* o  : overflow indicator                        */
+)
+{
+    Word16 g_code;
+    Word16 exp;
+    Word16 frac;
+    Word16 tmp;
+    Word32 L_tmp;
+
+    Word16 qua_ener_MR122; /* o  : quantized energy error, MR122 version Q10 */
+    Word16 qua_ener;       /* o  : quantized energy error,               Q10 */
+
+
+    /* Read the quantized gains */
+    *gain_pit = *p++;
+    g_code = *p++;
+
+    /*------------------------------------------------------------------*
+     *  calculate final fixed codebook gain:                            *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                            *
+     *                                                                  *
+     *   gc = gc0 * g                                                   *
+     *------------------------------------------------------------------*/
+
+    L_tmp = ((Word32) g_code * gcode0) << 1;
+    tmp   = 10 - exp_gcode0;
+    L_tmp = L_shr(L_tmp, tmp, pOverflow);
+    *gain_cod = (Word16)(L_tmp >> 16);
+
+    /*------------------------------------------------------------------*
+     *  calculate predictor update values and update gain predictor:    *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    *
+     *                                                                  *
+     *   qua_ener       = log2(g)                                       *
+     *   qua_ener_MR122 = 20*log10(g)                                   *
+     *------------------------------------------------------------------*/
+
+    /* Log2(x Q12) = log2(x) + 12 */
+    Log2((Word32) g_code, &exp, &frac, pOverflow);
+    exp -= 12;
+
+    tmp = shr_r(frac, 5, pOverflow);
+    qua_ener_MR122 = exp << 10;
+    qua_ener_MR122 = tmp + qua_ener_MR122;
+
+    /* 24660 Q12 ~= 6.0206 = 20*log10(2) */
+    L_tmp = Mpy_32_16(exp, frac, 24660, pOverflow);
+    L_tmp = L_tmp << 13;
+
+    /* Q12 * Q0 = Q13 -> Q10 */
+    qua_ener = (Word16)((L_tmp + (Word32) 0x00008000L) >> 16);
+
+    gc_pred_update(pred_st, qua_ener_MR122, qua_ener);
+
+    return;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: MR475_update_unq_pred
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pred_st = pointer to structure of type gc_predState
+    exp_gcode0 = predicted CB gain (exponent MSW) (Word16)
+    frac_gcode0 = predicted CB gain (exponent LSW) (Word16)
+    cod_gain_exp = optimum codebook gain (exponent)(Word16)
+    cod_gain_frac = optimum codebook gain (fraction) (Word16)
+
+ Outputs:
+    pred_st points to the updated structure of type gc_predState
+    pOverflow points to overflow indicator (Flag)
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This module uses the optimum codebook gain and updates the "unquantized"
+ gain predictor with the (bounded) prediction error.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ qgain475.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void
+MR475_update_unq_pred(
+    gc_predState *pred_st, // i/o: gain predictor state struct
+    Word16 exp_gcode0,     // i  : predicted CB gain (exponent MSW),  Q0
+    Word16 frac_gcode0,    // i  : predicted CB gain (exponent LSW),  Q15
+    Word16 cod_gain_exp,   // i  : optimum codebook gain (exponent),  Q0
+    Word16 cod_gain_frac   // i  : optimum codebook gain (fraction),  Q15
+)
+{
+    Word16 tmp, exp, frac;
+    Word16 qua_ener, qua_ener_MR122;
+    Word32 L_tmp;
+
+    // calculate prediction error factor (given optimum CB gain gcu):
+    //   predErrFact = gcu / gcode0
+    //   (limit to MIN_PRED_ERR_FACT <= predErrFact <= MAX_PRED_ERR_FACT
+    //    -> limit qua_ener*)
+    //
+    // calculate prediction error (log):
+    //
+    //   qua_ener_MR122 = log2(predErrFact)
+    //   qua_ener       = 20*log10(predErrFact)
+
+    if (cod_gain_frac <= 0)
+    {
+        // if gcu <= 0 -> predErrFact = 0 < MIN_PRED_ERR_FACT
+        // -> set qua_ener(_MR122) directly
+        qua_ener = MIN_QUA_ENER;
+        qua_ener_MR122 = MIN_QUA_ENER_MR122;
+    }
+    else
+    {
+        // convert gcode0 from DPF to standard fraction/exponent format
+        // with normalized frac, i.e. 16384 <= frac <= 32767
+        // Note: exponent correction (exp=exp-14) is done after div_s
+        frac_gcode0 = extract_l (Pow2 (14, frac_gcode0));
+
+        // make sure cod_gain_frac < frac_gcode0  for div_s
+        if (sub(cod_gain_frac, frac_gcode0) >= 0)
+        {
+            cod_gain_frac = shr (cod_gain_frac, 1);
+            cod_gain_exp = add (cod_gain_exp, 1);
+        }
+
+        // predErrFact
+        //   = gcu / gcode0
+        //   = cod_gain_frac/frac_gcode0 * 2^(cod_gain_exp-(exp_gcode0-14))
+        //   = div_s (c_g_f, frac_gcode0)*2^-15 * 2^(c_g_e-exp_gcode0+14)
+        //   = div_s * 2^(cod_gain_exp-exp_gcode0 - 1)
+
+        frac = div_s (cod_gain_frac, frac_gcode0);
+        tmp = sub (sub (cod_gain_exp, exp_gcode0), 1);
+
+        Log2 (L_deposit_l (frac), &exp, &frac);
+        exp = add (exp, tmp);
+
+        // calculate prediction error (log2, Q10)
+        qua_ener_MR122 = shr_r (frac, 5);
+        qua_ener_MR122 = add (qua_ener_MR122, shl (exp, 10));
+
+        if (sub(qua_ener_MR122, MIN_QUA_ENER_MR122) < 0)
+        {
+            qua_ener = MIN_QUA_ENER;
+            qua_ener_MR122 = MIN_QUA_ENER_MR122;
+        }
+        else if (sub(qua_ener_MR122, MAX_QUA_ENER_MR122) > 0)
+        {
+            qua_ener = MAX_QUA_ENER;
+            qua_ener_MR122 = MAX_QUA_ENER_MR122;
+        }
+        else
+        {
+            // calculate prediction error (20*log10, Q10)
+            L_tmp = Mpy_32_16(exp, frac, 24660);
+            // 24660 Q12 ~= 6.0206 = 20*log10(2)
+            qua_ener = pv_round (L_shl (L_tmp, 13));
+            // Q12 * Q0 = Q13 -> Q26 -> Q10
+        }
+    }
+
+    // update MA predictor memory
+    gc_pred_update(pred_st, qua_ener_MR122, qua_ener);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void MR475_update_unq_pred(
+    gc_predState *pred_st, /* i/o: gain predictor state struct            */
+    Word16 exp_gcode0,     /* i  : predicted CB gain (exponent MSW),  Q0  */
+    Word16 frac_gcode0,    /* i  : predicted CB gain (exponent LSW),  Q15 */
+    Word16 cod_gain_exp,   /* i  : optimum codebook gain (exponent),  Q0  */
+    Word16 cod_gain_frac,  /* i  : optimum codebook gain (fraction),  Q15 */
+    Flag   *pOverflow      /* o  : overflow indicator                     */
+)
+{
+    Word16 tmp;
+    Word16 exp;
+    Word16 frac;
+    Word16 qua_ener;
+    Word16 qua_ener_MR122;
+    Word32 L_tmp;
+
+    /* calculate prediction error factor (given optimum CB gain gcu):
+     *
+     *   predErrFact = gcu / gcode0
+     *   (limit to MIN_PRED_ERR_FACT <= predErrFact <= MAX_PRED_ERR_FACT
+     *    -> limit qua_ener*)
+     *
+     * calculate prediction error (log):
+     *
+     *   qua_ener_MR122 = log2(predErrFact)
+     *   qua_ener       = 20*log10(predErrFact)
+     *
+     */
+
+    if (cod_gain_frac <= 0)
+    {
+        /* if gcu <= 0 -> predErrFact = 0 < MIN_PRED_ERR_FACT */
+        /* -> set qua_ener(_MR122) directly                   */
+        qua_ener = MIN_QUA_ENER;
+        qua_ener_MR122 = MIN_QUA_ENER_MR122;
+    }
+    else
+    {
+        /* convert gcode0 from DPF to standard fraction/exponent format */
+        /* with normalized frac, i.e. 16384 <= frac <= 32767            */
+        /* Note: exponent correction (exp=exp-14) is done after div_s   */
+        frac_gcode0 = (Word16)(Pow2(14, frac_gcode0, pOverflow));
+
+        /* make sure cod_gain_frac < frac_gcode0  for div_s */
+        if (cod_gain_frac >= frac_gcode0)
+        {
+            cod_gain_frac >>= 1;
+            cod_gain_exp += 1;
+        }
+
+        /*
+          predErrFact
+             = gcu / gcode0
+             = cod_gain_frac/frac_gcode0 * 2^(cod_gain_exp-(exp_gcode0-14))
+             = div_s (c_g_f, frac_gcode0)*2^-15 * 2^(c_g_e-exp_gcode0+14)
+             = div_s * 2^(cod_gain_exp-exp_gcode0 - 1)
+        */
+        frac = div_s(cod_gain_frac, frac_gcode0);
+        tmp = cod_gain_exp - exp_gcode0;
+        tmp -= 1;
+
+        Log2((Word32) frac, &exp, &frac, pOverflow);
+        exp += tmp;
+
+        /* calculate prediction error (log2, Q10) */
+        qua_ener_MR122 = shr_r(frac, 5, pOverflow);
+        tmp = exp << 10;
+        qua_ener_MR122 += tmp;
+
+        if (qua_ener_MR122 > MAX_QUA_ENER_MR122)
+        {
+            qua_ener = MAX_QUA_ENER;
+            qua_ener_MR122 = MAX_QUA_ENER_MR122;
+        }
+        else
+        {
+            /* calculate prediction error (20*log10, Q10) */
+            L_tmp = Mpy_32_16(exp, frac, 24660, pOverflow);
+            /* 24660 Q12 ~= 6.0206 = 20*log10(2) */
+            L_tmp =  L_shl(L_tmp, 13, pOverflow);
+            qua_ener = pv_round(L_tmp, pOverflow);
+
+            /* Q12 * Q0 = Q13 -> Q26 -> Q10     */
+        }
+    }
+
+    /* update MA predictor memory */
+    gc_pred_update(pred_st, qua_ener_MR122, qua_ener);
+
+
+    return;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: MR475_gain_quant
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pred_st = pointer to structure of type gc_predState
+    sf0_exp_gcode0 = predicted CB gain (exponent) (Word16)
+    f0_frac_gcode0 = predicted CB gain (fraction) (Word16)
+    sf0_exp_coeff = energy coeff. (exponent part) (Word16)
+    sf0_frac_coeff = energy coeff. ((fraction part) (Word16)
+    sf0_exp_target_en = exponent of target energy (Word16)
+    sf0_frac_target_en = fraction of target energy (Word16)
+    sf1_code_nosharp = innovative codebook vector  (Word16)
+    sf1_exp_gcode0 = predicted CB gain (exponent) (Word16)
+    sf1_frac_gcode0 = predicted CB gain (fraction) (Word16)
+    sf1_exp_coeff = energy coeff. (exponent part) (Word16)
+    sf1_frac_coeff = energy coeff. (fraction part) (Word16)
+    sf1_exp_target_en = exponent of target energy (Word16)
+    sf1_frac_target_en = fraction of target energy (Word16)
+    gp_limit = pitch gain limit (Word16)
+    sf0_gain_pit = pointer to Pitch gain (Word16)
+    sf0_gain_cod = pointer to Code gain (Word16)
+    sf1_gain_pit = pointer to Pitch gain (Word16)
+    sf1_gain_cod = pointer to Code gain (Word16)
+
+ Outputs:
+    pred_st points to the updated structure of type gc_predState
+    sf0_gain_pit points to Pitch gain
+    sf0_gain_cod points to Code gain
+    sf1_gain_pit points to Pitch gain
+    sf1_gain_cod points to Code gain
+
+ Returns:
+    index = index of quantization
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This module provides quantization of pitch and codebook gains for two
+ subframes using the predicted codebook gain.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ qgain475.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16
+MR475_gain_quant(              // o  : index of quantization.
+    gc_predState *pred_st,     // i/o: gain predictor state struct
+
+                               // data from subframe 0 (or 2)
+    Word16 sf0_exp_gcode0,     // i  : predicted CB gain (exponent),      Q0
+    Word16 sf0_frac_gcode0,    // i  : predicted CB gain (fraction),      Q15
+    Word16 sf0_exp_coeff[],    // i  : energy coeff. (5), exponent part,  Q0
+    Word16 sf0_frac_coeff[],   // i  : energy coeff. (5), fraction part,  Q15
+                               //      (frac_coeff and exp_coeff computed in
+                               //       calc_filt_energies())
+    Word16 sf0_exp_target_en,  // i  : exponent of target energy,         Q0
+    Word16 sf0_frac_target_en, // i  : fraction of target energy,         Q15
+
+                               // data from subframe 1 (or 3)
+    Word16 sf1_code_nosharp[], // i  : innovative codebook vector (L_SUBFR)
+                               //      (whithout pitch sharpening)
+    Word16 sf1_exp_gcode0,     // i  : predicted CB gain (exponent),      Q0
+    Word16 sf1_frac_gcode0,    // i  : predicted CB gain (fraction),      Q15
+    Word16 sf1_exp_coeff[],    // i  : energy coeff. (5), exponent part,  Q0
+    Word16 sf1_frac_coeff[],   // i  : energy coeff. (5), fraction part,  Q15
+                               //      (frac_coeff and exp_coeff computed in
+                               //       calc_filt_energies())
+    Word16 sf1_exp_target_en,  // i  : exponent of target energy,         Q0
+    Word16 sf1_frac_target_en, // i  : fraction of target energy,         Q15
+
+    Word16 gp_limit,           // i  : pitch gain limit
+
+    Word16 *sf0_gain_pit,      // o  : Pitch gain,                        Q14
+    Word16 *sf0_gain_cod,      // o  : Code gain,                         Q1
+
+    Word16 *sf1_gain_pit,      // o  : Pitch gain,                        Q14
+    Word16 *sf1_gain_cod       // o  : Code gain,                         Q1
+)
+{
+    const Word16 *p;
+    Word16 i, index = 0;
+    Word16 tmp;
+    Word16 exp;
+    Word16 sf0_gcode0, sf1_gcode0;
+    Word16 g_pitch, g2_pitch, g_code, g2_code, g_pit_cod;
+    Word16 coeff[10], coeff_lo[10], exp_max[10];  // 0..4: sf0; 5..9: sf1
+    Word32 L_tmp, dist_min;
+
+     *-------------------------------------------------------------------*
+     *  predicted codebook gain                                          *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~                                          *
+     *  gc0     = 2^exp_gcode0 + 2^frac_gcode0                           *
+     *                                                                   *
+     *  gcode0 (Q14) = 2^14*2^frac_gcode0 = gc0 * 2^(14-exp_gcode0)      *
+     *-------------------------------------------------------------------*
+
+    sf0_gcode0 = extract_l(Pow2(14, sf0_frac_gcode0));
+    sf1_gcode0 = extract_l(Pow2(14, sf1_frac_gcode0));
+
+     * For each subframe, the error energy (sum) to be minimized consists
+     * of five terms, t[0..4].
+     *
+     *                      t[0] =    gp^2  * <y1 y1>
+     *                      t[1] = -2*gp    * <xn y1>
+     *                      t[2] =    gc^2  * <y2 y2>
+     *                      t[3] = -2*gc    * <xn y2>
+     *                      t[4] =  2*gp*gc * <y1 y2>
+     *
+
+    // sf 0
+    // determine the scaling exponent for g_code: ec = ec0 - 11
+    exp = sub(sf0_exp_gcode0, 11);
+
+    // calculate exp_max[i] = s[i]-1
+    exp_max[0] = sub(sf0_exp_coeff[0], 13);
+    exp_max[1] = sub(sf0_exp_coeff[1], 14);
+    exp_max[2] = add(sf0_exp_coeff[2], add(15, shl(exp, 1)));
+    exp_max[3] = add(sf0_exp_coeff[3], exp);
+    exp_max[4] = add(sf0_exp_coeff[4], add(1, exp));
+
+    // sf 1
+    // determine the scaling exponent for g_code: ec = ec0 - 11
+    exp = sub(sf1_exp_gcode0, 11);
+
+    // calculate exp_max[i] = s[i]-1
+    exp_max[5] = sub(sf1_exp_coeff[0], 13);
+    exp_max[6] = sub(sf1_exp_coeff[1], 14);
+    exp_max[7] = add(sf1_exp_coeff[2], add(15, shl(exp, 1)));
+    exp_max[8] = add(sf1_exp_coeff[3], exp);
+    exp_max[9] = add(sf1_exp_coeff[4], add(1, exp));
+
+     *-------------------------------------------------------------------*
+     *  Gain search equalisation:                                        *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~                                        *
+     *  The MSE for the two subframes is weighted differently if there   *
+     *  is a big difference in the corresponding target energies         *
+     *-------------------------------------------------------------------*
+
+    // make the target energy exponents the same by de-normalizing the
+    // fraction of the smaller one. This is necessary to be able to compare
+    // them
+
+    exp = sf0_exp_target_en - sf1_exp_target_en;
+    if (exp > 0)
+    {
+        sf1_frac_target_en = shr (sf1_frac_target_en, exp);
+    }
+    else
+    {
+        sf0_frac_target_en = shl (sf0_frac_target_en, exp);
+    }
+
+    // assume no change of exponents
+    exp = 0;
+
+    // test for target energy difference; set exp to +1 or -1 to scale
+    // up/down coefficients for sf 1
+
+    tmp = shr_r (sf1_frac_target_en, 1);   // tmp = ceil(0.5*en(sf1))
+    if (sub (tmp, sf0_frac_target_en) > 0) // tmp > en(sf0)?
+    {
+        // target_energy(sf1) > 2*target_energy(sf0)
+        //   -> scale up MSE(sf0) by 2 by adding 1 to exponents 0..4
+        exp = 1;
+    }
+    else
+    {
+        tmp = shr (add (sf0_frac_target_en, 3), 2); // tmp=ceil(0.25*en(sf0))
+        if (sub (tmp, sf1_frac_target_en) > 0)      // tmp > en(sf1)?
+        {
+            // target_energy(sf1) < 0.25*target_energy(sf0)
+            //   -> scale down MSE(sf0) by 0.5 by subtracting 1 from
+            //      coefficients 0..4
+            exp = -1;
+        }
+    }
+
+    for (i = 0; i < 5; i++)
+    {
+        exp_max[i] = add (exp_max[i], exp);
+    }
+
+     *-------------------------------------------------------------------*
+     *  Find maximum exponent:                                           *
+     *  ~~~~~~~~~~~~~~~~~~~~~~                                           *
+     *                                                                   *
+     *  For the sum operation, all terms must have the same scaling;     *
+     *  that scaling should be low enough to prevent overflow. There-    *
+     *  fore, the maximum scale is determined and all coefficients are   *
+     *  re-scaled:                                                       *
+     *                                                                   *
+     *    exp = max(exp_max[i]) + 1;                                     *
+     *    e = exp_max[i]-exp;         e <= 0!                            *
+     *    c[i] = c[i]*2^e                                                *
+     *-------------------------------------------------------------------*
+
+    exp = exp_max[0];
+    for (i = 1; i < 10; i++)
+    {
+        if (sub(exp_max[i], exp) > 0)
+        {
+            exp = exp_max[i];
+        }
+    }
+    exp = add(exp, 1);      // To avoid overflow
+
+    p = &sf0_frac_coeff[0];
+    for (i = 0; i < 5; i++) {
+        tmp = sub(exp, exp_max[i]);
+        L_tmp = L_deposit_h(*p++);
+        L_tmp = L_shr(L_tmp, tmp);
+        L_Extract(L_tmp, &coeff[i], &coeff_lo[i]);
+    }
+    p = &sf1_frac_coeff[0];
+    for (; i < 10; i++) {
+        tmp = sub(exp, exp_max[i]);
+        L_tmp = L_deposit_h(*p++);
+        L_tmp = L_shr(L_tmp, tmp);
+        L_Extract(L_tmp, &coeff[i], &coeff_lo[i]);
+    }
+
+    //-------------------------------------------------------------------*
+     *  Codebook search:                                                 *
+     *  ~~~~~~~~~~~~~~~~                                                 *
+     *                                                                   *
+     *  For each pair (g_pitch, g_fac) in the table calculate the        *
+     *  terms t[0..4] and sum them up; the result is the mean squared    *
+     *  error for the quantized gains from the table. The index for the  *
+     *  minimum MSE is stored and finally used to retrieve the quantized *
+     *  gains                                                            *
+     *-------------------------------------------------------------------
+
+    // start with "infinite" MSE
+    dist_min = MAX_32;
+
+    p = &table_gain_MR475[0];
+
+    for (i = 0; i < MR475_VQ_SIZE; i++)
+    {
+        // subframe 0 (and 2) calculations
+        g_pitch = *p++;
+        g_code = *p++;
+
+        g_code = mult(g_code, sf0_gcode0);
+        g2_pitch = mult(g_pitch, g_pitch);
+        g2_code = mult(g_code, g_code);
+        g_pit_cod = mult(g_code, g_pitch);
+
+        L_tmp = Mpy_32_16(       coeff[0], coeff_lo[0], g2_pitch);
+        L_tmp = Mac_32_16(L_tmp, coeff[1], coeff_lo[1], g_pitch);
+        L_tmp = Mac_32_16(L_tmp, coeff[2], coeff_lo[2], g2_code);
+        L_tmp = Mac_32_16(L_tmp, coeff[3], coeff_lo[3], g_code);
+        L_tmp = Mac_32_16(L_tmp, coeff[4], coeff_lo[4], g_pit_cod);
+
+        tmp = sub (g_pitch, gp_limit);
+
+        // subframe 1 (and 3) calculations
+        g_pitch = *p++;
+        g_code = *p++;
+
+        if (tmp <= 0 && sub(g_pitch, gp_limit) <= 0)
+        {
+            g_code = mult(g_code, sf1_gcode0);
+            g2_pitch = mult(g_pitch, g_pitch);
+            g2_code = mult(g_code, g_code);
+            g_pit_cod = mult(g_code, g_pitch);
+
+            L_tmp = Mac_32_16(L_tmp, coeff[5], coeff_lo[5], g2_pitch);
+            L_tmp = Mac_32_16(L_tmp, coeff[6], coeff_lo[6], g_pitch);
+            L_tmp = Mac_32_16(L_tmp, coeff[7], coeff_lo[7], g2_code);
+            L_tmp = Mac_32_16(L_tmp, coeff[8], coeff_lo[8], g_code);
+            L_tmp = Mac_32_16(L_tmp, coeff[9], coeff_lo[9], g_pit_cod);
+
+            // store table index if MSE for this index is lower
+               than the minimum MSE seen so far
+            if (L_sub(L_tmp, dist_min) < (Word32) 0)
+            {
+                dist_min = L_tmp;
+                index = i;
+            }
+        }
+    }
+
+     *------------------------------------------------------------------*
+     *  read quantized gains and update MA predictor memories           *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           *
+     *------------------------------------------------------------------*
+
+    // for subframe 0, the pre-calculated gcode0/exp_gcode0 are the same
+    // as those calculated from the "real" predictor using quantized gains
+    tmp = shl(index, 2);
+    MR475_quant_store_results(pred_st,
+                              &table_gain_MR475[tmp],
+                              sf0_gcode0,
+                              sf0_exp_gcode0,
+                              sf0_gain_pit,
+                              sf0_gain_cod);
+
+    // calculate new predicted gain for subframe 1 (this time using
+    // the real, quantized gains)
+    gc_pred(pred_st, MR475, sf1_code_nosharp,
+            &sf1_exp_gcode0, &sf1_frac_gcode0,
+            &sf0_exp_gcode0, &sf0_gcode0); // last two args are dummy
+    sf1_gcode0 = extract_l(Pow2(14, sf1_frac_gcode0));
+
+    tmp = add (tmp, 2);
+    MR475_quant_store_results(pred_st,
+                              &table_gain_MR475[tmp],
+                              sf1_gcode0,
+                              sf1_exp_gcode0,
+                              sf1_gain_pit,
+                              sf1_gain_cod);
+
+    return index;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 MR475_gain_quant(       /* o  : index of quantization.                 */
+    gc_predState *pred_st,     /* i/o: gain predictor state struct            */
+
+    /* data from subframe 0 (or 2) */
+    Word16 sf0_exp_gcode0,     /* i  : predicted CB gain (exponent),      Q0  */
+    Word16 sf0_frac_gcode0,    /* i  : predicted CB gain (fraction),      Q15 */
+    Word16 sf0_exp_coeff[],    /* i  : energy coeff. (5), exponent part,  Q0  */
+    Word16 sf0_frac_coeff[],   /* i  : energy coeff. (5), fraction part,  Q15 */
+    /*      (frac_coeff and exp_coeff computed in  */
+    /*       calc_filt_energies())                 */
+    Word16 sf0_exp_target_en,  /* i  : exponent of target energy,         Q0  */
+    Word16 sf0_frac_target_en, /* i  : fraction of target energy,         Q15 */
+
+    /* data from subframe 1 (or 3) */
+    Word16 sf1_code_nosharp[], /* i  : innovative codebook vector (L_SUBFR)   */
+    /*      (whithout pitch sharpening)            */
+    Word16 sf1_exp_gcode0,     /* i  : predicted CB gain (exponent),      Q0  */
+    Word16 sf1_frac_gcode0,    /* i  : predicted CB gain (fraction),      Q15 */
+    Word16 sf1_exp_coeff[],    /* i  : energy coeff. (5), exponent part,  Q0  */
+    Word16 sf1_frac_coeff[],   /* i  : energy coeff. (5), fraction part,  Q15 */
+    /*      (frac_coeff and exp_coeff computed in  */
+    /*       calc_filt_energies())                 */
+    Word16 sf1_exp_target_en,  /* i  : exponent of target energy,         Q0  */
+    Word16 sf1_frac_target_en, /* i  : fraction of target energy,         Q15 */
+
+    Word16 gp_limit,           /* i  : pitch gain limit                       */
+
+    Word16 *sf0_gain_pit,      /* o  : Pitch gain,                        Q14 */
+    Word16 *sf0_gain_cod,      /* o  : Code gain,                         Q1  */
+
+    Word16 *sf1_gain_pit,      /* o  : Pitch gain,                        Q14 */
+    Word16 *sf1_gain_cod,      /* o  : Code gain,                         Q1  */
+    Flag   *pOverflow          /* o  : overflow indicator                     */
+)
+{
+    const Word16 *p;
+    Word16 i;
+    Word16 index = 0;
+    Word16 tmp;
+    Word16 exp;
+    Word16 sf0_gcode0;
+    Word16 sf1_gcode0;
+    Word16 g_pitch;
+    Word16 g2_pitch;
+    Word16 g_code;
+    Word16 g2_code;
+    Word16 g_pit_cod;
+    Word16 coeff[10];
+    Word16 coeff_lo[10];
+    Word16 exp_max[10];  /* 0..4: sf0; 5..9: sf1 */
+    Word32 L_tmp;
+    Word32 dist_min;
+
+    /*-------------------------------------------------------------------*
+     *  predicted codebook gain                                          *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~                                          *
+     *  gc0     = 2^exp_gcode0 + 2^frac_gcode0                           *
+     *                                                                   *
+     *  gcode0 (Q14) = 2^14*2^frac_gcode0 = gc0 * 2^(14-exp_gcode0)      *
+     *-------------------------------------------------------------------*/
+
+    sf0_gcode0 = (Word16)(Pow2(14, sf0_frac_gcode0, pOverflow));
+    sf1_gcode0 = (Word16)(Pow2(14, sf1_frac_gcode0, pOverflow));
+
+    /*
+     * For each subframe, the error energy (sum) to be minimized consists
+     * of five terms, t[0..4].
+     *
+     *                      t[0] =    gp^2  * <y1 y1>
+     *                      t[1] = -2*gp    * <xn y1>
+     *                      t[2] =    gc^2  * <y2 y2>
+     *                      t[3] = -2*gc    * <xn y2>
+     *                      t[4] =  2*gp*gc * <y1 y2>
+     *
+     */
+
+    /* sf 0 */
+    /* determine the scaling exponent for g_code: ec = ec0 - 11 */
+    exp = sf0_exp_gcode0 - 11;
+
+    /* calculate exp_max[i] = s[i]-1 */
+    exp_max[0] = (sf0_exp_coeff[0] - 13);
+    exp_max[1] = (sf0_exp_coeff[1] - 14);
+    exp_max[2] = (sf0_exp_coeff[2] + (15 + (exp << 1)));
+    exp_max[3] = (sf0_exp_coeff[3] + exp);
+    exp_max[4] = (sf0_exp_coeff[4] + (1 + exp));
+
+    /* sf 1 */
+    /* determine the scaling exponent for g_code: ec = ec0 - 11 */
+    exp = sf1_exp_gcode0 - 11;
+
+    /* calculate exp_max[i] = s[i]-1 */
+    exp_max[5] = (sf1_exp_coeff[0] - 13);
+    exp_max[6] = (sf1_exp_coeff[1] - 14);
+    exp_max[7] = (sf1_exp_coeff[2] + (15 + (exp << 1)));
+    exp_max[8] = (sf1_exp_coeff[3] + exp);
+    exp_max[9] = (sf1_exp_coeff[4] + (1 + exp));
+
+    /*-------------------------------------------------------------------*
+     *  Gain search equalisation:                                        *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~                                        *
+     *  The MSE for the two subframes is weighted differently if there   *
+     *  is a big difference in the corresponding target energies         *
+     *-------------------------------------------------------------------*/
+
+    /* make the target energy exponents the same by de-normalizing the
+       fraction of the smaller one. This is necessary to be able to compare
+       them
+     */
+    exp = sf0_exp_target_en - sf1_exp_target_en;
+    if (exp > 0)
+    {
+        sf1_frac_target_en >>= exp;
+    }
+    else
+    {
+        sf0_frac_target_en >>= (-exp);
+    }
+
+    /* assume no change of exponents */
+    exp = 0;
+
+    /* test for target energy difference; set exp to +1 or -1 to scale
+     * up/down coefficients for sf 1
+     */
+    tmp = shr_r(sf1_frac_target_en, 1, pOverflow);  /* tmp = ceil(0.5*en(sf1)) */
+
+    if (tmp > sf0_frac_target_en)          /* tmp > en(sf0)? */
+    {
+        /*
+         * target_energy(sf1) > 2*target_energy(sf0)
+         *   -> scale up MSE(sf0) by 2 by adding 1 to exponents 0..4
+         */
+        exp = 1;
+    }
+    else
+    {
+        tmp = ((sf0_frac_target_en + 3) >> 2); /* tmp=ceil(0.25*en(sf0)) */
+
+        if (tmp > sf1_frac_target_en)      /* tmp > en(sf1)? */
+        {
+            /*
+             * target_energy(sf1) < 0.25*target_energy(sf0)
+             *   -> scale down MSE(sf0) by 0.5 by subtracting 1 from
+             *      coefficients 0..4
+             */
+            exp = -1;
+        }
+    }
+
+    for (i = 0; i < 5; i++)
+    {
+        exp_max[i] += exp;
+    }
+
+    /*-------------------------------------------------------------------*
+     *  Find maximum exponent:                                           *
+     *  ~~~~~~~~~~~~~~~~~~~~~~                                           *
+     *                                                                   *
+     *  For the sum operation, all terms must have the same scaling;     *
+     *  that scaling should be low enough to prevent overflow. There-    *
+     *  fore, the maximum scale is determined and all coefficients are   *
+     *  re-scaled:                                                       *
+     *                                                                   *
+     *    exp = max(exp_max[i]) + 1;                                     *
+     *    e = exp_max[i]-exp;         e <= 0!                            *
+     *    c[i] = c[i]*2^e                                                *
+     *-------------------------------------------------------------------*/
+
+    exp = exp_max[0];
+    for (i = 9; i > 0; i--)
+    {
+        if (exp_max[i] > exp)
+        {
+            exp = exp_max[i];
+        }
+    }
+    exp++;      /* To avoid overflow */
+
+    p = &sf0_frac_coeff[0];
+    for (i = 0; i < 5; i++)
+    {
+        tmp = (exp - exp_max[i]);
+        L_tmp = ((Word32)(*p++) << 16);
+        L_tmp = L_shr(L_tmp, tmp, pOverflow);
+        coeff[i] = (Word16)(L_tmp >> 16);
+        coeff_lo[i] = (Word16)((L_tmp >> 1) - ((L_tmp >> 16) << 15));
+    }
+    p = &sf1_frac_coeff[0];
+    for (; i < 10; i++)
+    {
+        tmp = exp - exp_max[i];
+        L_tmp = ((Word32)(*p++) << 16);
+        L_tmp = L_shr(L_tmp, tmp, pOverflow);
+        coeff[i] = (Word16)(L_tmp >> 16);
+        coeff_lo[i] = (Word16)((L_tmp >> 1) - ((L_tmp >> 16) << 15));
+    }
+
+
+    /*-------------------------------------------------------------------*
+     *  Codebook search:                                                 *
+     *  ~~~~~~~~~~~~~~~~                                                 *
+     *                                                                   *
+     *  For each pair (g_pitch, g_fac) in the table calculate the        *
+     *  terms t[0..4] and sum them up; the result is the mean squared    *
+     *  error for the quantized gains from the table. The index for the  *
+     *  minimum MSE is stored and finally used to retrieve the quantized *
+     *  gains                                                            *
+     *-------------------------------------------------------------------*/
+
+    /* start with "infinite" MSE */
+    dist_min = MAX_32;
+
+    p = &table_gain_MR475[0];
+
+    for (i = 0; i < MR475_VQ_SIZE; i++)
+    {
+        /* subframe 0 (and 2) calculations */
+        g_pitch = *p++;
+        g_code = *p++;
+
+        /* Need to be there OKA */
+        g_code    = (Word16)(((Word32) g_code * sf0_gcode0) >> 15);
+        g2_pitch  = (Word16)(((Word32) g_pitch * g_pitch) >> 15);
+        g2_code   = (Word16)(((Word32) g_code * g_code) >> 15);
+        g_pit_cod = (Word16)(((Word32) g_code * g_pitch) >> 15);
+
+
+        L_tmp = Mpy_32_16(coeff[0], coeff_lo[0], g2_pitch, pOverflow) +
+                Mpy_32_16(coeff[1], coeff_lo[1], g_pitch, pOverflow) +
+                Mpy_32_16(coeff[2], coeff_lo[2], g2_code, pOverflow) +
+                Mpy_32_16(coeff[3], coeff_lo[3], g_code, pOverflow) +
+                Mpy_32_16(coeff[4], coeff_lo[4], g_pit_cod, pOverflow);
+
+        tmp = (g_pitch - gp_limit);
+
+        /* subframe 1 (and 3) calculations */
+        g_pitch = *p++;
+        g_code = *p++;
+
+        if ((tmp <= 0) && (g_pitch <= gp_limit))
+        {
+            g_code = (Word16)(((Word32) g_code * sf1_gcode0) >> 15);
+            g2_pitch  = (Word16)(((Word32) g_pitch * g_pitch) >> 15);
+            g2_code   = (Word16)(((Word32) g_code * g_code) >> 15);
+            g_pit_cod = (Word16)(((Word32) g_code * g_pitch) >> 15);
+
+            L_tmp += (Mpy_32_16(coeff[5], coeff_lo[5], g2_pitch, pOverflow) +
+                      Mpy_32_16(coeff[6], coeff_lo[6], g_pitch, pOverflow) +
+                      Mpy_32_16(coeff[7], coeff_lo[7], g2_code, pOverflow) +
+                      Mpy_32_16(coeff[8], coeff_lo[8], g_code, pOverflow) +
+                      Mpy_32_16(coeff[9], coeff_lo[9], g_pit_cod, pOverflow));
+
+            /* store table index if MSE for this index is lower
+               than the minimum MSE seen so far */
+            if (L_tmp < dist_min)
+            {
+                dist_min = L_tmp;
+                index = i;
+            }
+        }
+    }
+
+    /*------------------------------------------------------------------*
+     *  read quantized gains and update MA predictor memories           *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           *
+     *------------------------------------------------------------------*/
+
+    /* for subframe 0, the pre-calculated gcode0/exp_gcode0 are the same
+       as those calculated from the "real" predictor using quantized gains */
+    tmp = index << 2;
+    MR475_quant_store_results(pred_st,
+                              &table_gain_MR475[tmp],
+                              sf0_gcode0,
+                              sf0_exp_gcode0,
+                              sf0_gain_pit,
+                              sf0_gain_cod,
+                              pOverflow);
+
+    /* calculate new predicted gain for subframe 1 (this time using
+       the real, quantized gains)                                   */
+    gc_pred(pred_st, MR475, sf1_code_nosharp,
+            &sf1_exp_gcode0, &sf1_frac_gcode0,
+            &sf0_exp_gcode0, &sf0_gcode0, /* dummy args */
+            pOverflow);
+
+    sf1_gcode0 = (Word16)(Pow2(14, sf1_frac_gcode0, pOverflow));
+
+    tmp += 2;
+    MR475_quant_store_results(
+        pred_st,
+        &table_gain_MR475[tmp],
+        sf1_gcode0,
+        sf1_exp_gcode0,
+        sf1_gain_pit,
+        sf1_gain_cod,
+        pOverflow);
+
+    return(index);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.h
new file mode 100644 (file)
index 0000000..0dd3f46
--- /dev/null
@@ -0,0 +1,166 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: qgain475.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the defines and function prototypes used in the
+ quantization of pitch and codebook gains for MR475.
+
+------------------------------------------------------------------------------
+*/
+#ifndef _QGAIN475_H_
+#define _QGAIN475_H_
+#define qgain475_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "gc_pred.h"
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+    /* minimum allowed gain code prediction error: 102.887/4096 = 0.0251189 */
+#define MIN_QUA_ENER         ( -5443) /* Q10 <->    log2 (0.0251189) */
+#define MIN_QUA_ENER_MR122   (-32768) /* Q10 <-> 20*log10(0.0251189) */
+
+    /* minimum allowed gain code prediction error: 32000/4096 = 7.8125 */
+#define MAX_QUA_ENER         (  3037) /* Q10 <->    log2 (7.8125)    */
+#define MAX_QUA_ENER_MR122   ( 18284) /* Q10 <-> 20*log10(7.8125)    */
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+
+    /*************************************************************************
+     *
+     * FUNCTION:  MR475_update_unq_pred()
+     *
+     * PURPOSE:   use optimum codebook gain and update "unquantized"
+     *            gain predictor with the (bounded) prediction error
+     *
+     *************************************************************************/
+    void
+    MR475_update_unq_pred(
+        gc_predState *pred_st, /* i/o: gain predictor state struct            */
+        Word16 exp_gcode0,     /* i  : predicted CB gain (exponent),      Q0  */
+        Word16 frac_gcode0,    /* i  : predicted CB gain (fraction),      Q15 */
+        Word16 cod_gain_exp,   /* i  : optimum codebook gain (exponent),  Q0  */
+        Word16 cod_gain_frac,  /* i  : optimum codebook gain (fraction),  Q15 */
+        Flag   *pOverflow      /* o  : overflow indicator                     */
+    );
+
+    /*************************************************************************
+     *
+     * FUNCTION:  MR475_gain_quant()
+     *
+     * PURPOSE: Quantization of pitch and codebook gains for two subframes
+     *          (using predicted codebook gain)
+     *
+     *************************************************************************/
+
+    Word16
+    MR475_gain_quant(              /* o  : index of quantization.                 */
+        gc_predState *pred_st,     /* i/o: gain predictor state struct            */
+
+        /* data from subframe 0 (or 2) */
+        Word16 sf0_exp_gcode0,     /* i  : predicted CB gain (exponent),      Q0  */
+        Word16 sf0_frac_gcode0,    /* i  : predicted CB gain (fraction),      Q15 */
+        Word16 sf0_exp_coeff[],    /* i  : energy coeff. (5), exponent part,  Q0  */
+        Word16 sf0_frac_coeff[],   /* i  : energy coeff. (5), fraction part,  Q15 */
+        /*      (frac_coeff and exp_coeff computed in  */
+        /*       calc_filt_energies())                 */
+        Word16 sf0_exp_target_en,  /* i  : exponent of target energy,         Q0  */
+        Word16 sf0_frac_target_en, /* i  : fraction of target energy,         Q15 */
+
+        /* data from subframe 1 (or 3) */
+        Word16 sf1_code_nosharp[], /* i  : innovative codebook vector (L_SUBFR)   */
+        /*      (whithout pitch sharpening)            */
+        Word16 sf1_exp_gcode0,     /* i  : predicted CB gain (exponent),      Q0  */
+        Word16 sf1_frac_gcode0,    /* i  : predicted CB gain (fraction),      Q15 */
+        Word16 sf1_exp_coeff[],    /* i  : energy coeff. (5), exponent part,  Q0  */
+        Word16 sf1_frac_coeff[],   /* i  : energy coeff. (5), fraction part,  Q15 */
+        /*      (frac_coeff and exp_coeff computed in  */
+        /*       calc_filt_energies())                 */
+        Word16 sf1_exp_target_en,  /* i  : exponent of target energy,         Q0  */
+        Word16 sf1_frac_target_en, /* i  : fraction of target energy,         Q15 */
+
+        Word16 gp_limit,           /* i  : pitch gain limit                       */
+
+        Word16 *sf0_gain_pit,      /* o  : Pitch gain,                        Q14 */
+        Word16 *sf0_gain_cod,      /* o  : Code gain,                         Q1  */
+
+        Word16 *sf1_gain_pit,      /* o  : Pitch gain,                        Q14 */
+        Word16 *sf1_gain_cod,      /* o  : Code gain,                         Q1  */
+        Flag   *pOverflow          /* o  : overflow indicator                     */
+    );
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _QGAIN475_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.cpp
new file mode 100644 (file)
index 0000000..9bd4952
--- /dev/null
@@ -0,0 +1,832 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: qgain795.cpp
+ Functions: MR795_gain_code_quant3
+            MR795_gain_code_quant_mod
+            MR795_gain_quant
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "qgain795.h"
+#include "typedef.h"
+#include "basic_op.h"
+#include "cnst.h"
+#include "log2.h"
+#include "pow2.h"
+#include "sqrt_l.h"
+#include "g_adapt.h"
+#include "calc_en.h"
+#include "q_gain_p.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+#define NB_QUA_CODE 32
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: MR795_gain_code_quant3
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    exp_gcode0     -- Word16       -- predicted CB gain (exponent), Q0
+    gcode0         -- Word16       -- predicted CB gain (norm.)
+    g_pitch_cand[] -- Word16 array -- Pitch gain candidates (3),    Q14
+    g_pitch_cind[] -- Word16 array -- Pitch gain cand. indices (3), Q0
+    frac_coeff[]   -- Word16 array -- coefficients (5),             Q15
+    exp_coeff[]    -- Word16 array -- energy coefficients (5),      Q0
+                                      coefficients from calc_filt_ener()
+
+ Outputs:
+    gain_pit       -- Pointer to Word16 -- Pitch gain,                     Q14
+    gain_pit_ind   -- Pointer to Word16 -- Pitch gain index,               Q0
+    gain_cod       -- Pointer to Word16 -- Code gain,                      Q1
+    gain_cod_ind   -- Pointer to Word16 -- Code gain index,                Q0
+    qua_ener_MR122 -- Pointer to Word16 -- quantized energy error,         Q10
+                                          (for MR122 MA predictor update)
+
+    qua_ener -- Pointer to Word16 -- quantized energy error,       Q10
+                                     (for other MA predictor update)
+
+    pOverflow -- Pointer to Flag --  overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE: Pre-quantization of codebook gains, given three possible
+          LTP gains (using predicted codebook gain)
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ qgain795.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void
+MR795_gain_code_quant3(
+    Word16 exp_gcode0,        /* i  : predicted CB gain (exponent), Q0  */
+    Word16 gcode0,            /* i  : predicted CB gain (norm.),    Q14 */
+    Word16 g_pitch_cand[],    /* i  : Pitch gain candidates (3),    Q14 */
+    Word16 g_pitch_cind[],    /* i  : Pitch gain cand. indices (3), Q0  */
+    Word16 frac_coeff[],      /* i  : coefficients (5),             Q15 */
+    Word16 exp_coeff[],       /* i  : energy coefficients (5),      Q0  */
+    /*      coefficients from calc_filt_ener()*/
+    Word16 *gain_pit,         /* o  : Pitch gain,                   Q14 */
+    Word16 *gain_pit_ind,     /* o  : Pitch gain index,             Q0  */
+    Word16 *gain_cod,         /* o  : Code gain,                    Q1  */
+    Word16 *gain_cod_ind,     /* o  : Code gain index,              Q0  */
+    Word16 *qua_ener_MR122,   /* o  : quantized energy error,       Q10 */
+    /*      (for MR122 MA predictor update)   */
+    Word16 *qua_ener,         /* o  : quantized energy error,       Q10 */
+    /*      (for other MA predictor update)   */
+    const Word16* qua_gain_code_ptr, /* i : ptr to read-only table      */
+    Flag   *pOverflow         /* o  : overflow indicator                */
+)
+{
+    const Word16 *p;
+    Word16 i;
+    Word16 j;
+    Word16 cod_ind;
+    Word16 pit_ind;
+    Word16 e_max;
+    Word16 exp_code;
+    Word16 g_pitch;
+    Word16 g2_pitch;
+    Word16 g_code;
+    Word16 g2_code_h;
+    Word16 g2_code_l;
+    Word16 g_pit_cod_h;
+    Word16 g_pit_cod_l;
+    Word16 coeff[5];
+    Word16 coeff_lo[5];
+    Word16 exp_max[5];
+    Word32 L_tmp;
+    Word32 L_tmp0;
+    Word32 dist_min;
+
+    /*
+     * The error energy (sum) to be minimized consists of five terms, t[0..4].
+     *
+     *                      t[0] =    gp^2  * <y1 y1>
+     *                      t[1] = -2*gp    * <xn y1>
+     *                      t[2] =    gc^2  * <y2 y2>
+     *                      t[3] = -2*gc    * <xn y2>
+     *                      t[4] =  2*gp*gc * <y1 y2>
+     *
+     */
+
+    /* determine the scaling exponent for g_code: ec = ec0 - 10 */
+    exp_code = exp_gcode0 - 10;
+
+    /* calculate exp_max[i] = s[i]-1 */
+    exp_max[0] = exp_coeff[0] - 13;
+    exp_max[1] = exp_coeff[1] - 14;
+    exp_max[2] = exp_coeff[2] + shl(exp_code, 1, pOverflow) + 15;
+    exp_max[3] = exp_coeff[3] + exp_code;
+    exp_max[4] = exp_coeff[4] + (exp_code + 1);
+
+
+    /*-------------------------------------------------------------------*
+     *  Find maximum exponent:                                           *
+     *  ~~~~~~~~~~~~~~~~~~~~~~                                           *
+     *                                                                   *
+     *  For the sum operation, all terms must have the same scaling;     *
+     *  that scaling should be low enough to prevent overflow. There-    *
+     *  fore, the maximum scale is determined and all coefficients are   *
+     *  re-scaled:                                                       *
+     *                                                                   *
+     *    e_max = max(exp_max[i]) + 1;                                   *
+     *    e = exp_max[i]-e_max;         e <= 0!                          *
+     *    c[i] = c[i]*2^e                                                *
+     *-------------------------------------------------------------------*/
+
+    e_max = exp_max[0];
+    for (i = 1; i < 5; i++)     /* implemented flattened */
+    {
+        if (exp_max[i] > e_max)
+        {
+            e_max = exp_max[i];
+        }
+    }
+
+    e_max = add_16(e_max, 1, pOverflow);      /* To avoid overflow */
+
+    for (i = 0; i < 5; i++)
+    {
+        j = e_max - exp_max[i];
+        L_tmp = ((Word32)frac_coeff[i] << 16);
+        L_tmp = L_shr(L_tmp, j, pOverflow);
+        L_Extract(L_tmp, &coeff[i], &coeff_lo[i], pOverflow);
+    }
+
+
+    /*-------------------------------------------------------------------*
+     *  Codebook search:                                                 *
+     *  ~~~~~~~~~~~~~~~~                                                 *
+     *                                                                   *
+     *  For each of the candiates LTP gains in g_pitch_cand[], the terms *
+     *  t[0..4] are calculated from the values in the table (and the     *
+     *  pitch gain candidate) and summed up; the result is the mean      *
+     *  squared error for the LPT/CB gain pair. The index for the mini-  *
+     *  mum MSE is stored and finally used to retrieve the quantized CB  *
+     *  gain                                                             *
+     *-------------------------------------------------------------------*/
+
+    /* start with "infinite" MSE */
+    dist_min = MAX_32;
+    cod_ind = 0;
+    pit_ind = 0;
+
+    /* loop through LTP gain candidates */
+    for (j = 0; j < 3; j++)
+    {
+        /* pre-calculate terms only dependent on pitch gain */
+        g_pitch = g_pitch_cand[j];
+        g2_pitch = mult(g_pitch, g_pitch, pOverflow);
+        L_tmp0 = Mpy_32_16(coeff[0], coeff_lo[0], g2_pitch, pOverflow);
+        L_tmp0 = Mac_32_16(L_tmp0, coeff[1], coeff_lo[1], g_pitch, pOverflow);
+
+        p = &qua_gain_code_ptr[0];
+        for (i = 0; i < NB_QUA_CODE; i++)
+        {
+            g_code = *p++;                   /* this is g_fac        Q11 */
+            p++;                             /* skip log2(g_fac)         */
+            p++;                             /* skip 20*log10(g_fac)     */
+
+            g_code = mult(g_code, gcode0, pOverflow);
+
+            L_tmp = L_mult(g_code, g_code, pOverflow);
+            L_Extract(L_tmp, &g2_code_h, &g2_code_l, pOverflow);
+
+            L_tmp = L_mult(g_code, g_pitch, pOverflow);
+            L_Extract(L_tmp, &g_pit_cod_h, &g_pit_cod_l, pOverflow);
+
+            L_tmp = Mac_32(L_tmp0, coeff[2], coeff_lo[2],
+                           g2_code_h, g2_code_l, pOverflow);
+            L_tmp = Mac_32_16(L_tmp, coeff[3], coeff_lo[3],
+                              g_code, pOverflow);
+            L_tmp = Mac_32(L_tmp, coeff[4], coeff_lo[4],
+                           g_pit_cod_h, g_pit_cod_l, pOverflow);
+
+            /* store table index if MSE for this index is lower
+               than the minimum MSE seen so far; also store the
+               pitch gain for this (so far) lowest MSE          */
+            if (L_tmp < dist_min)
+            {
+                dist_min = L_tmp;
+                cod_ind = i;
+                pit_ind = j;
+            }
+        }
+    }
+
+    /*------------------------------------------------------------------*
+     *  read quantized gains and new values for MA predictor memories   *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   *
+     *------------------------------------------------------------------*/
+
+    /* Read the quantized gains */
+    p = &qua_gain_code_ptr[(cod_ind<<2) - cod_ind];
+
+    g_code = *p++;
+    *qua_ener_MR122 = *p++;
+    *qua_ener = *p;
+
+    /*------------------------------------------------------------------*
+     *  calculate final fixed codebook gain:                            *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                            *
+     *                                                                  *
+     *   gc = gc0 * g                                                   *
+     *------------------------------------------------------------------*/
+
+    L_tmp = L_mult(g_code, gcode0, pOverflow);
+    L_tmp = L_shr(L_tmp, 9 - exp_gcode0, pOverflow);
+    *gain_cod = (Word16)(L_tmp >> 16);
+    *gain_cod_ind = cod_ind;
+    *gain_pit = g_pitch_cand[pit_ind];
+    *gain_pit_ind = g_pitch_cind[pit_ind];
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: MR795_gain_code_quant_mod
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    gain_pit     -- Word16 -- pitch gain,                                   Q14
+    exp_gcode0   -- Word16 -- predicted CB gain (exponent),                 Q0
+    gcode0       -- Word16 -- predicted CB gain (norm.),                    Q14
+    frac_en[]    -- Word16 array -- energy coefficients (4), fraction part, Q15
+    exp_en[]     -- Word16 array -- energy coefficients (4), exponent part, Q0
+    alpha        -- Word16 -- gain adaptor factor (>0),                     Q15
+
+    gain_cod_unq -- Word16 -- Code gain (unquantized)
+                              (scaling: Q10 - exp_gcode0)
+
+    gain_cod     -- Pointer to Word16 -- Code gain (pre-/quantized),        Q1
+
+ Outputs:
+    qua_ener_MR122 -- Pointer to Word16 -- quantized energy error,       Q10
+                                           (for MR122 MA predictor update)
+    qua_ener       -- Pointer to Word16 -- quantized energy error,       Q10
+                                           (for other MA predictor update)
+    pOverflow      -- Pointer to Flag -- overflow indicator
+
+ Returns:
+    index of quantization (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE: Modified quantization of the MR795 codebook gain
+
+ Uses pre-computed energy coefficients in frac_en[]/exp_en[]
+
+       frac_en[0]*2^exp_en[0] = <res res>   // LP residual energy
+       frac_en[1]*2^exp_en[1] = <exc exc>   // LTP residual energy
+       frac_en[2]*2^exp_en[2] = <exc code>  // LTP/CB innovation dot product
+       frac_en[3]*2^exp_en[3] = <code code> // CB innovation energy
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ qgain795.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16
+MR795_gain_code_quant_mod(  /* o  : index of quantization.            */
+    Word16 gain_pit,        /* i  : pitch gain,                   Q14 */
+    Word16 exp_gcode0,      /* i  : predicted CB gain (exponent), Q0  */
+    Word16 gcode0,          /* i  : predicted CB gain (norm.),    Q14 */
+    Word16 frac_en[],       /* i  : energy coefficients (4),
+                                    fraction part,                Q15 */
+    Word16 exp_en[],        /* i  : energy coefficients (4),
+                                    eponent part,                 Q0  */
+    Word16 alpha,           /* i  : gain adaptor factor (>0),     Q15 */
+    Word16 gain_cod_unq,    /* i  : Code gain (unquantized)           */
+    /*      (scaling: Q10 - exp_gcode0)       */
+    Word16 *gain_cod,       /* i/o: Code gain (pre-/quantized),   Q1  */
+    Word16 *qua_ener_MR122, /* o  : quantized energy error,       Q10 */
+    /*      (for MR122 MA predictor update)   */
+    Word16 *qua_ener,       /* o  : quantized energy error,       Q10 */
+    /*      (for other MA predictor update)   */
+    const Word16* qua_gain_code_ptr, /* i : ptr to read-only ptr      */
+    Flag   *pOverflow       /* o  : overflow indicator                */
+)
+{
+    const Word16 *p;
+    Word16 i;
+    Word16 index;
+    Word16 tmp;
+    Word16 one_alpha;
+    Word16 exp;
+    Word16 e_max;
+
+    Word16 g2_pitch;
+    Word16 g_code;
+    Word16 g2_code_h;
+    Word16 g2_code_l;
+    Word16 d2_code_h;
+    Word16 d2_code_l;
+    Word16 coeff[5];
+    Word16 coeff_lo[5];
+    Word16 exp_coeff[5];
+    Word32 L_tmp;
+    Word32 L_t0;
+    Word32 L_t1;
+    Word32 dist_min;
+    Word16 gain_code;
+
+    /*
+      Steps in calculation of the error criterion (dist):
+      ---------------------------------------------------
+
+      underlined = constant; alp = FLP value of alpha, alpha = FIP
+      ----------
+
+
+        ExEn = gp^2 * LtpEn + 2.0*gp*gc[i] * XC + gc[i]^2 * InnEn;
+               ------------   ------         --             -----
+
+        aExEn= alp * ExEn
+             = alp*gp^2*LtpEn + 2.0*alp*gp*XC* gc[i] + alp*InnEn* gc[i]^2
+               --------------   -------------          ---------
+
+             =         t[1]   +              t[2]    +          t[3]
+
+        dist = d1 + d2;
+
+          d1 = (1.0 - alp) * InnEn * (gcu - gc[i])^2 = t[4]
+               -------------------    ---
+
+          d2 =        alp  * (ResEn - 2.0 * sqrt(ResEn*ExEn) + ExEn);
+                      ---     -----   ---        -----
+
+             =        alp  * (sqrt(ExEn) - sqrt(ResEn))^2
+                      ---                  -----------
+
+             =               (sqrt(aExEn) - sqrt(alp*ResEn))^2
+                                            ---------------
+
+             =               (sqrt(aExEn) -       t[0]     )^2
+                                                  ----
+
+     */
+
+    /*
+     * calculate scalings of the constant terms
+     */
+    gain_code = shl(*gain_cod, (10 - exp_gcode0), pOverflow);   /* Q1  -> Q11 (-ec0) */
+    g2_pitch = mult(gain_pit, gain_pit, pOverflow);               /* Q14 -> Q13        */
+    /* 0 < alpha <= 0.5 => 0.5 <= 1-alpha < 1, i.e one_alpha is normalized  */
+    one_alpha = add_16((32767 - alpha), 1, pOverflow);   /* 32768 - alpha */
+
+
+    /*  alpha <= 0.5 -> mult. by 2 to keep precision; compensate in exponent */
+    L_t1 = L_mult(alpha, frac_en[1], pOverflow);
+    L_t1 = L_shl(L_t1, 1, pOverflow);
+    tmp = (Word16)(L_t1 >> 16);
+
+    /* directly store in 32 bit variable because no further mult. required */
+    L_t1 = L_mult(tmp, g2_pitch, pOverflow);
+    exp_coeff[1] = exp_en[1] - 15;
+
+
+    tmp = (Word16)(L_shl(L_mult(alpha, frac_en[2], pOverflow), 1, pOverflow) >> 16);
+    coeff[2] = mult(tmp, gain_pit, pOverflow);
+    exp = exp_gcode0 - 10;
+    exp_coeff[2] = add_16(exp_en[2], exp, pOverflow);
+
+
+    /* alpha <= 0.5 -> mult. by 2 to keep precision; compensate in exponent */
+    coeff[3] = (Word16)(L_shl(L_mult(alpha, frac_en[3], pOverflow), 1, pOverflow) >> 16);
+    exp = shl(exp_gcode0, 1, pOverflow) - 7;
+    exp_coeff[3] = add_16(exp_en[3], exp, pOverflow);
+
+
+    coeff[4] = mult(one_alpha, frac_en[3], pOverflow);
+    exp_coeff[4] = add_16(exp_coeff[3], 1, pOverflow);
+
+
+    L_tmp = L_mult(alpha, frac_en[0], pOverflow);
+    /* sqrt_l returns normalized value and 2*exponent
+       -> result = val >> (exp/2)
+       exp_coeff holds 2*exponent for c[0]            */
+    /* directly store in 32 bit variable because no further mult. required */
+    L_t0 = sqrt_l_exp(L_tmp, &exp, pOverflow);  /* normalization included in sqrt_l_exp */
+    exp += 47;
+    exp_coeff[0] = exp_en[0] - exp;
+
+    /*
+     * Determine the maximum exponent occuring in the distance calculation
+     * and adjust all fractions accordingly (including a safety margin)
+     *
+     */
+
+    /* find max(e[1..4],e[0]+31) */
+    e_max = exp_coeff[0] + 31;
+    for (i = 1; i <= 4; i++)
+    {
+        if (exp_coeff[i] > e_max)
+        {
+            e_max = exp_coeff[i];
+        }
+    }
+
+    /* scale c[1]         (requires no further multiplication) */
+    tmp = e_max - exp_coeff[1];
+    L_t1 = L_shr(L_t1, tmp, pOverflow);
+
+    /* scale c[2..4] (used in Mpy_32_16 in the quantizer loop) */
+    for (i = 2; i <= 4; i++)
+    {
+        tmp = e_max - exp_coeff[i];
+        L_tmp = ((Word32)coeff[i] << 16);
+        L_tmp = L_shr(L_tmp, tmp, pOverflow);
+        L_Extract(L_tmp, &coeff[i], &coeff_lo[i], pOverflow);
+    }
+
+    /* scale c[0]         (requires no further multiplication) */
+    exp = e_max - 31;              /* new exponent */
+    tmp = exp - exp_coeff[0];
+    L_t0 = L_shr(L_t0, shr(tmp, 1, pOverflow), pOverflow);
+    /* perform correction by 1/sqrt(2) if exponent difference is odd */
+    if ((tmp & 0x1) != 0)
+    {
+        L_Extract(L_t0, &coeff[0], &coeff_lo[0], pOverflow);
+        L_t0 = Mpy_32_16(coeff[0], coeff_lo[0],
+                         23170, pOverflow);                    /* 23170 Q15 = 1/sqrt(2)*/
+    }
+
+    /* search the quantizer table for the lowest value
+       of the search criterion                           */
+    dist_min = MAX_32;
+    index = 0;
+    p = &qua_gain_code_ptr[0];
+
+    for (i = 0; i < NB_QUA_CODE; i++)
+    {
+        g_code = *p++;                   /* this is g_fac (Q11)  */
+        p++;                             /* skip log2(g_fac)     */
+        p++;                             /* skip 20*log10(g_fac) */
+        g_code = mult(g_code, gcode0, pOverflow);
+
+        /* only continue if    gc[i]            < 2.0*gc
+           which is equiv. to  g_code (Q10-ec0) < gain_code (Q11-ec0) */
+
+        if (g_code >= gain_code)
+        {
+            break;
+        }
+
+        L_tmp = L_mult(g_code, g_code, pOverflow);
+        L_Extract(L_tmp, &g2_code_h, &g2_code_l, pOverflow);
+
+        tmp = sub(g_code, gain_cod_unq, pOverflow);
+        L_tmp = L_mult(tmp, tmp, pOverflow);
+        L_Extract(L_tmp, &d2_code_h, &d2_code_l, pOverflow);
+
+        /* t2, t3, t4 */
+        L_tmp = Mac_32_16(L_t1, coeff[2], coeff_lo[2], g_code, pOverflow);
+        L_tmp = Mac_32(L_tmp,    coeff[3], coeff_lo[3], g2_code_h, g2_code_l, pOverflow);
+
+        L_tmp = sqrt_l_exp(L_tmp, &exp, pOverflow);
+        L_tmp = L_shr(L_tmp, shr(exp, 1, pOverflow), pOverflow);
+
+        /* d2 */
+        tmp = pv_round(L_sub(L_tmp, L_t0, pOverflow), pOverflow);
+        L_tmp = L_mult(tmp, tmp, pOverflow);
+
+        /* dist */
+        L_tmp = Mac_32(L_tmp, coeff[4], coeff_lo[4], d2_code_h, d2_code_l, pOverflow);
+
+        /* store table index if distance measure for this
+            index is lower than the minimum seen so far   */
+        if (L_tmp < dist_min)
+        {
+            dist_min = L_tmp;
+            index = i;
+        }
+    }
+
+    /*------------------------------------------------------------------*
+     *  read quantized gains and new values for MA predictor memories   *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   *
+     *------------------------------------------------------------------*/
+
+    /* Read the quantized gains */
+    p = &qua_gain_code_ptr[(index<<2) - index];
+    g_code = *p++;
+    *qua_ener_MR122 = *p++;
+    *qua_ener = *p;
+
+    /*------------------------------------------------------------------*
+     *  calculate final fixed codebook gain:                            *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                            *
+     *                                                                  *
+     *   gc = gc0 * g                                                   *
+     *------------------------------------------------------------------*/
+
+    L_tmp = L_mult(g_code, gcode0, pOverflow);
+    L_tmp = L_shr(L_tmp, 9 - exp_gcode0, pOverflow);
+    *gain_cod = (Word16)(L_tmp >> 16);
+
+    return index;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: MR795_gain_quant
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+MR795_gain_quant(
+
+
+ Inputs:
+    adapt_st      -- Pointer to GainAdaptState -- gain adapter state structure
+    res           -- Word16 array -- LP residual,                  Q0
+    exc           -- Word16 array -- LTP excitation (unfiltered),  Q0
+    code          -- Word16 array -- CB innovation (unfiltered),   Q13
+    frac_coeff    -- Word16 array -- coefficients (5),             Q15
+    exp_coeff     -- Word16 array -- energy coefficients (5),      Q0
+                                    coefficients from calc_filt_ener()
+    exp_code_en   -- Word16 -- innovation energy (exponent), Q0
+    frac_code_en  -- Word16 -- innovation energy (fraction), Q15
+    exp_gcode0    -- Word16 -- predicted CB gain (exponent), Q0
+    frac_gcode0   -- Word16 -- predicted CB gain (fraction), Q15
+    L_subfr       -- Word16 -- Subframe length
+    cod_gain_frac -- Word16 -- opt. codebook gain (fraction),Q15
+    cod_gain_exp  -- Word16 -- opt. codebook gain (exponent), Q0
+    gp_limit      -- Word16 -- pitch gain limit
+    gain_pit      -- Pointer to Word16 -- Pitch gain,              Q14
+
+ Output
+    adapt_st       -- Pointer to GainAdaptState -- gain adapter state structure
+    gain_pit       -- Pointer to Word16 -- Pitch gain,              Q14
+
+    gain_pit       -- Pointer to Word16 -- Pitch gain,                   Q14
+    gain_cod       -- Pointer to Word16 -- Code gain,                    Q1
+    qua_ener_MR122 -- Pointer to Word16 -- quantized energy error,       Q10
+                                           (for MR122 MA predictor update)
+
+    qua_ener       -- Pointer to Word16 -- quantized energy error,       Q10
+                                           (for other MA predictor update)
+
+    anap           -- Double Pointer to Word16 -- Index of quantization
+                                           (first gain pitch, then code pitch)
+
+    pOverflow      -- Pointer to Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ pitch and codebook quantization for MR795
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ qgain795.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void
+MR795_gain_quant(
+    GainAdaptState *adapt_st, /* i/o: gain adapter state structure       */
+    Word16 res[],             /* i  : LP residual,                  Q0   */
+    Word16 exc[],             /* i  : LTP excitation (unfiltered),  Q0   */
+    Word16 code[],            /* i  : CB innovation (unfiltered),   Q13  */
+    Word16 frac_coeff[],      /* i  : coefficients (5),             Q15  */
+    Word16 exp_coeff[],       /* i  : energy coefficients (5),      Q0   */
+    /*      coefficients from calc_filt_ener() */
+    Word16 exp_code_en,       /* i  : innovation energy (exponent), Q0   */
+    Word16 frac_code_en,      /* i  : innovation energy (fraction), Q15  */
+    Word16 exp_gcode0,        /* i  : predicted CB gain (exponent), Q0   */
+    Word16 frac_gcode0,       /* i  : predicted CB gain (fraction), Q15  */
+    Word16 L_subfr,           /* i  : Subframe length                    */
+    Word16 cod_gain_frac,     /* i  : opt. codebook gain (fraction),Q15  */
+    Word16 cod_gain_exp,      /* i  : opt. codebook gain (exponent), Q0  */
+    Word16 gp_limit,          /* i  : pitch gain limit                   */
+    Word16 *gain_pit,         /* i/o: Pitch gain,                   Q14  */
+    Word16 *gain_cod,         /* o  : Code gain,                    Q1   */
+    Word16 *qua_ener_MR122,   /* o  : quantized energy error,       Q10  */
+    /*      (for MR122 MA predictor update)    */
+    Word16 *qua_ener,         /* o  : quantized energy error,       Q10  */
+    /*      (for other MA predictor update)    */
+    Word16 **anap,            /* o  : Index of quantization              */
+    /*      (first gain pitch, then code pitch)*/
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs   */
+    Flag   *pOverflow         /* o  : overflow indicator                */
+)
+{
+    Word16 frac_en[4];
+    Word16 exp_en[4];
+    Word16 ltpg, alpha, gcode0;
+    Word16 g_pitch_cand[3];      /* pitch gain candidates   Q14 */
+    Word16 g_pitch_cind[3];      /* pitch gain indices      Q0  */
+    Word16 gain_pit_index;
+    Word16 gain_cod_index;
+    Word16 exp;
+    Word16 gain_cod_unq;         /* code gain (unq.) Q(10-exp_gcode0)  */
+
+
+    /* get list of candidate quantized pitch gain values
+     * and corresponding quantization indices
+     */
+    gain_pit_index = q_gain_pitch(MR795, gp_limit, gain_pit,
+                                  g_pitch_cand, g_pitch_cind, common_amr_tbls->qua_gain_pitch_ptr, pOverflow);
+
+    /*-------------------------------------------------------------------*
+     *  predicted codebook gain                                          *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~                                          *
+     *  gc0     = 2^exp_gcode0 + 2^frac_gcode0                           *
+     *                                                                   *
+     *  gcode0 (Q14) = 2^14*2^frac_gcode0 = gc0 * 2^(14-exp_gcode0)      *
+     *-------------------------------------------------------------------*/
+    gcode0 = (Word16)(Pow2(14, frac_gcode0, pOverflow));           /* Q14 */
+
+    /* pre-quantization of codebook gain
+     * (using three pitch gain candidates);
+     * result: best guess of pitch gain and code gain
+     */
+    MR795_gain_code_quant3(
+        exp_gcode0, gcode0, g_pitch_cand, g_pitch_cind,
+        frac_coeff, exp_coeff,
+        gain_pit, &gain_pit_index, gain_cod, &gain_cod_index,
+        qua_ener_MR122, qua_ener, common_amr_tbls->qua_gain_code_ptr, pOverflow);
+
+    /* calculation of energy coefficients and LTP coding gain */
+    calc_unfilt_energies(res, exc, code, *gain_pit, L_subfr,
+                         frac_en, exp_en, &ltpg, pOverflow);
+
+    /* run gain adaptor, calculate alpha factor to balance LTP/CB gain
+     * (this includes the gain adaptor update)
+     * Note: ltpg = 0 if frac_en[0] == 0, so the update is OK in that case
+     */
+    gain_adapt(adapt_st, ltpg, *gain_cod, &alpha, pOverflow);
+
+    /* if this is a very low energy signal (threshold: see
+     * calc_unfilt_energies) or alpha <= 0 then don't run the modified quantizer
+     */
+    if (frac_en[0] != 0 && alpha > 0)
+    {
+        /* innovation energy <cod cod> was already computed in gc_pred() */
+        /* (this overwrites the LtpResEn which is no longer needed)      */
+        frac_en[3] = frac_code_en;
+        exp_en[3] = exp_code_en;
+
+        /* store optimum codebook gain in Q(10-exp_gcode0) */
+        exp = sub(cod_gain_exp, exp_gcode0, pOverflow) + 10;
+        gain_cod_unq = shl(cod_gain_frac, exp, pOverflow);
+
+        /* run quantization with modified criterion */
+        gain_cod_index = MR795_gain_code_quant_mod(
+                             *gain_pit, exp_gcode0, gcode0,
+                             frac_en, exp_en, alpha, gain_cod_unq,
+                             gain_cod, qua_ener_MR122, qua_ener, common_amr_tbls->qua_gain_code_ptr,
+                             pOverflow); /* function result */
+    }
+
+    *(*anap)++ = gain_pit_index;
+    *(*anap)++ = gain_cod_index;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.h
new file mode 100644 (file)
index 0000000..a4d9a5a
--- /dev/null
@@ -0,0 +1,133 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: qgain795.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, qgain795.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef qgain795_h
+#define qgain795_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "g_adapt.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void
+    MR795_gain_quant(
+        GainAdaptState *adapt_st, /* i/o: gain adapter state structure       */
+        Word16 res[],             /* i  : LP residual,                  Q0   */
+        Word16 exc[],             /* i  : LTP excitation (unfiltered),  Q0   */
+        Word16 code[],            /* i  : CB innovation (unfiltered),   Q13  */
+        Word16 frac_coeff[],      /* i  : coefficients (5),             Q15  */
+        Word16 exp_coeff[],       /* i  : energy coefficients (5),      Q0   */
+        /*      coefficients from calc_filt_ener() */
+        Word16 exp_code_en,       /* i  : innovation energy (exponent), Q0   */
+        Word16 frac_code_en,      /* i  : innovation energy (fraction), Q15  */
+        Word16 exp_gcode0,        /* i  : predicted CB gain (exponent), Q0   */
+        Word16 frac_gcode0,       /* i  : predicted CB gain (fraction), Q15  */
+        Word16 L_subfr,           /* i  : Subframe length                    */
+        Word16 cod_gain_frac,     /* i  : opt. codebook gain (fraction),Q15  */
+        Word16 cod_gain_exp,      /* i  : opt. codebook gain (exponent), Q0  */
+        Word16 gp_limit,          /* i  : pitch gain limit                   */
+        Word16 *gain_pit,         /* i/o: Pitch gain (unquant/quant),   Q14  */
+        Word16 *gain_cod,         /* o  : Code gain,                    Q1   */
+        Word16 *qua_ener_MR122,   /* o  : quantized energy error,       Q10  */
+        /*      (for MR122 MA predictor update)    */
+        Word16 *qua_ener,         /* o  : quantized energy error,       Q10  */
+        /*      (for other MA predictor update)    */
+        Word16 **anap,            /* o  : Index of quantization              */
+        /*      (first gain pitch, then code pitch)*/
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs   */
+        Flag   *pOverflow         /* o  : overflow indicator                 */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* qgain795_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qua_gain.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qua_gain.cpp
new file mode 100644 (file)
index 0000000..5a4e1c8
--- /dev/null
@@ -0,0 +1,363 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: qua_gain.cpp
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+    Quantization of pitch and codebook gains.
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "qua_gain.h"
+#include "typedef.h"
+#include "basic_op.h"
+
+#include "mode.h"
+#include "cnst.h"
+#include "pow2.h"
+#include "gc_pred.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here. Include conditional
+    ; compile variables also.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; LOCAL VARIABLE DEFINITIONS
+    ; Variable declaration - defined here and used outside this module
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+
+ Inputs:
+    mode -- enum Mode -- AMR mode
+    Word16 exp_gcode0  -- Word16 -- predicted CB gain (exponent),       Q0
+    Word16 frac_gcode0 -- Word16 -- predicted CB gain (fraction),      Q15
+    Word16 frac_coeff -- Word16 Array -- energy coeff. (5), fraction part, Q15
+    Word16 exp_coeff  -- Word16 Array -- energy coeff. (5), exponent part,  Q0
+                                    (frac_coeff and exp_coeff computed in
+                                    calc_filt_energies())
+
+    Word16 gp_limit -- Word16 --  pitch gain limit
+
+ Outputs:
+    Word16 *gain_pit -- Pointer to Word16 -- Pitch gain,               Q14
+    Word16 *gain_cod -- Pointer to Word16 -- Code gain,                Q1
+    Word16 *qua_ener_MR122 -- Pointer to Word16 -- quantized energy error,  Q10
+                                                (for MR122 MA predictor update)
+    Word16 *qua_ener -- Pointer to Word16 -- quantized energy error,        Q10
+                                                (for other MA predictor update)
+    Flag   *pOverflow -- Pointer to Flag -- overflow indicator
+
+ Returns:
+    Word16 -- index of quantization.
+
+ Global Variables Used:
+
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Quantization of pitch and codebook gains.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ qua_gain.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+
+Word16
+Qua_gain(                   /* o  : index of quantization.                 */
+    enum Mode mode,         /* i  : AMR mode                               */
+    Word16 exp_gcode0,      /* i  : predicted CB gain (exponent),      Q0  */
+    Word16 frac_gcode0,     /* i  : predicted CB gain (fraction),      Q15 */
+    Word16 frac_coeff[],    /* i  : energy coeff. (5), fraction part,  Q15 */
+    Word16 exp_coeff[],     /* i  : energy coeff. (5), exponent part,  Q0  */
+    /*      (frac_coeff and exp_coeff computed in  */
+    /*       calc_filt_energies())                 */
+    Word16 gp_limit,        /* i  : pitch gain limit                       */
+    Word16 *gain_pit,       /* o  : Pitch gain,                        Q14 */
+    Word16 *gain_cod,       /* o  : Code gain,                         Q1  */
+    Word16 *qua_ener_MR122, /* o  : quantized energy error,            Q10 */
+    /*      (for MR122 MA predictor update)        */
+    Word16 *qua_ener,       /* o  : quantized energy error,            Q10 */
+    /*      (for other MA predictor update)        */
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of tables ptrs    */
+    Flag   *pOverflow       /* o  : overflow indicator                     */
+)
+{
+    const Word16 *p;
+    Word16 i;
+    Word16 j;
+    Word16 index = 0;
+    Word16 gcode0;
+    Word16 e_max;
+    Word16 temp;
+    Word16 exp_code;
+    Word16 g_pitch;
+    Word16 g2_pitch;
+    Word16 g_code;
+    Word16 g2_code;
+    Word16 g_pit_cod;
+    Word16 coeff[5];
+    Word16 coeff_lo[5];
+    Word16 exp_max[5];
+    Word32 L_tmp;
+    Word32 L_tmp2;
+    Word32 dist_min;
+    const Word16 *table_gain;
+    Word16 table_len;
+
+    if (mode == MR102 || mode == MR74 || mode == MR67)
+    {
+        table_len = VQ_SIZE_HIGHRATES;
+        table_gain = common_amr_tbls->table_gain_highrates_ptr;
+    }
+    else
+    {
+        table_len = VQ_SIZE_LOWRATES;
+        table_gain = common_amr_tbls->table_gain_lowrates_ptr;
+    }
+
+    /*-------------------------------------------------------------------*
+     *  predicted codebook gain                                          *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~                                          *
+     *  gc0     = 2^exp_gcode0 + 2^frac_gcode0                           *
+     *                                                                   *
+     *  gcode0 (Q14) = 2^14*2^frac_gcode0 = gc0 * 2^(14-exp_gcode0)      *
+     *-------------------------------------------------------------------*/
+
+    gcode0 = (Word16)(Pow2(14, frac_gcode0, pOverflow));
+
+    /*-------------------------------------------------------------------*
+     *  Scaling considerations:                                          *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~                                          *
+     *-------------------------------------------------------------------*/
+
+    /*
+     * The error energy (sum) to be minimized consists of five terms, t[0..4].
+     *
+     *                      t[0] =    gp^2  * <y1 y1>
+     *                      t[1] = -2*gp    * <xn y1>
+     *                      t[2] =    gc^2  * <y2 y2>
+     *                      t[3] = -2*gc    * <xn y2>
+     *                      t[4] =  2*gp*gc * <y1 y2>
+     *
+     */
+
+    /* determine the scaling exponent for g_code: ec = ec0 - 11 */
+    exp_code = exp_gcode0 - 11;
+
+    /* calculate exp_max[i] = s[i]-1 */
+    exp_max[0] = exp_coeff[0] - 13;
+    exp_max[1] = exp_coeff[1] - 14;
+
+    temp = shl(exp_code, 1, pOverflow);
+    temp += 15;
+    exp_max[2] = add_16(exp_coeff[2], temp, pOverflow);
+
+    exp_max[3] = add_16(exp_coeff[3], exp_code, pOverflow);
+
+    temp = exp_code + 1;
+    exp_max[4] = add_16(exp_coeff[4], temp, pOverflow);
+
+
+    /*-------------------------------------------------------------------*
+     *  Find maximum exponent:                                           *
+     *  ~~~~~~~~~~~~~~~~~~~~~~                                           *
+     *                                                                   *
+     *  For the sum operation, all terms must have the same scaling;     *
+     *  that scaling should be low enough to prevent overflow. There-    *
+     *  fore, the maximum scale is determined and all coefficients are   *
+     *  re-scaled:                                                       *
+     *                                                                   *
+     *    e_max = max(exp_max[i]) + 1;                                   *
+     *    e = exp_max[i]-e_max;         e <= 0!                          *
+     *    c[i] = c[i]*2^e                                                *
+     *-------------------------------------------------------------------*/
+
+    e_max = exp_max[0];
+    for (i = 1; i < 5; i++)
+    {
+        if (exp_max[i] > e_max)
+        {
+            e_max = exp_max[i];
+        }
+    }
+
+    e_max++;
+
+    for (i = 0; i < 5; i++)
+    {
+        j = e_max - exp_max[i];
+        L_tmp = ((Word32)frac_coeff[i] << 16);
+        L_tmp = L_shr(L_tmp, j, pOverflow);
+        L_Extract(L_tmp, &coeff[i], &coeff_lo[i], pOverflow);
+    }
+
+
+    /*-------------------------------------------------------------------*
+     *  Codebook search:                                                 *
+     *  ~~~~~~~~~~~~~~~~                                                 *
+     *                                                                   *
+     *  For each pair (g_pitch, g_fac) in the table calculate the        *
+     *  terms t[0..4] and sum them up; the result is the mean squared    *
+     *  error for the quantized gains from the table. The index for the  *
+     *  minimum MSE is stored and finally used to retrieve the quantized *
+     *  gains                                                            *
+     *-------------------------------------------------------------------*/
+
+    /* start with "infinite" MSE */
+    dist_min = MAX_32;
+
+    p = &table_gain[0];
+
+    for (i = 0; i < table_len; i++)
+    {
+        g_pitch = *p++;
+        g_code = *p++;                   /* this is g_fac        */
+        p++;                             /* skip log2(g_fac)     */
+        p++;                             /* skip 20*log10(g_fac) */
+
+        if (g_pitch <= gp_limit)
+        {
+            g_code = mult(g_code, gcode0, pOverflow);
+            g2_pitch = mult(g_pitch, g_pitch, pOverflow);
+            g2_code = mult(g_code, g_code, pOverflow);
+            g_pit_cod = mult(g_code, g_pitch, pOverflow);
+
+            L_tmp = Mpy_32_16(coeff[0], coeff_lo[0], g2_pitch, pOverflow);
+            L_tmp2 = Mpy_32_16(coeff[1], coeff_lo[1], g_pitch, pOverflow);
+            L_tmp = L_add(L_tmp, L_tmp2, pOverflow);
+
+            L_tmp2 = Mpy_32_16(coeff[2], coeff_lo[2], g2_code, pOverflow);
+            L_tmp = L_add(L_tmp, L_tmp2, pOverflow);
+
+            L_tmp2 =  Mpy_32_16(coeff[3], coeff_lo[3], g_code, pOverflow);
+            L_tmp = L_add(L_tmp, L_tmp2, pOverflow);
+
+            L_tmp2 = Mpy_32_16(coeff[4], coeff_lo[4], g_pit_cod, pOverflow);
+            L_tmp = L_add(L_tmp, L_tmp2, pOverflow);
+
+            /* store table index if MSE for this index is lower
+               than the minimum MSE seen so far */
+            if (L_tmp < dist_min)
+            {
+                dist_min = L_tmp;
+                index = i;
+            }
+        }
+    }
+
+    /*------------------------------------------------------------------*
+     *  read quantized gains and new values for MA predictor memories   *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   *
+     *------------------------------------------------------------------*/
+
+    /* Read the quantized gains */
+    p = &table_gain[shl(index, 2, pOverflow)];
+    *gain_pit = *p++;
+    g_code = *p++;
+    *qua_ener_MR122 = *p++;
+    *qua_ener = *p;
+
+    /*------------------------------------------------------------------*
+     *  calculate final fixed codebook gain:                            *
+     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                            *
+     *                                                                  *
+     *   gc = gc0 * g                                                   *
+     *------------------------------------------------------------------*/
+
+    L_tmp = L_mult(g_code, gcode0, pOverflow);
+    temp  = 10 - exp_gcode0;
+    L_tmp = L_shr(L_tmp, temp, pOverflow);
+
+    *gain_cod = (Word16)(L_tmp >> 16);
+
+    return index;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.cpp
new file mode 100644 (file)
index 0000000..f8bf23f
--- /dev/null
@@ -0,0 +1,916 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: s10_8pf.cpp
+ Funtions: search_10and8i40
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "s10_8pf.h"
+#include "cnst.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: search_10and8i40
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    nbPulse = nbPulses to find (Word16)
+    step = step size (Word16)
+    nbTracks = nbTracks (Word16)
+    dn[] = correlation between target and h[] (Word16)
+    rr[][] = matrix of autocorrelation (Word16)
+    ipos[] = starting position of each pulse (Word16)
+    pos_max[] = Position of maximum dn[] (Word16)
+    codvec[] = Algebraic codebook vector (Word16)
+    pOverflow = pointer to Overflow flag (Flag)
+
+ Outputs:
+    codvec[] = Algebraic codebook vector (Word16)
+    pOverflow -> 1 if processing this funvction results in satuaration
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function searches for the best codevector; It determines the positions
+ of the 10/8 pulses in the 40-sample frame.
+
+    search_10and8i40 (10,5,5,dn, rr, ipos, pos_max, codvec);   for GSMEFR
+    search_10and8i40 (8, 4,4,dn, rr, ipos, pos_max, codvec);   for 10.2
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ s10_8pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void search_10and8i40 (
+    Word16 nbPulse,      // i : nbpulses to find
+    Word16 step,         // i :  stepsize
+    Word16 nbTracks,     // i :  nbTracks
+    Word16 dn[],         // i : correlation between target and h[]
+    Word16 rr[][L_CODE], // i : matrix of autocorrelation
+    Word16 ipos[],       // i : starting position for each pulse
+    Word16 pos_max[],    // i : position of maximum of dn[]
+    Word16 codvec[]      // o : algebraic codebook vector
+)
+{
+   Word16 i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
+   Word16 i, j, k, pos, ia, ib;
+   Word16 psk, ps, ps0, ps1, ps2, sq, sq2;
+   Word16 alpk, alp, alp_16;
+   Word16 rrv[L_CODE];
+   Word32 s, alp0, alp1, alp2;
+   Word16 gsmefrFlag;
+
+
+   if (sub(nbPulse, 10) == 0)
+   {
+      gsmefrFlag=1;
+   }
+   else
+   {
+      gsmefrFlag=0;
+   }
+
+   // fix i0 on maximum of correlation position
+   i0 = pos_max[ipos[0]];
+
+   //
+   // i1 loop:                                                         *
+   //
+
+   // Default value
+
+   psk = -1;
+   alpk = 1;
+   for (i = 0; i < nbPulse; i++)
+   {
+      codvec[i] = i;
+   }
+
+   for (i = 1; i < nbTracks; i++)
+   {
+      i1 = pos_max[ipos[1]];
+      ps0 = add (dn[i0], dn[i1]);
+      alp0 = L_mult (rr[i0][i0], _1_16);
+      alp0 = L_mac (alp0, rr[i1][i1], _1_16);
+      alp0 = L_mac (alp0, rr[i0][i1], _1_8);
+
+      //
+      // i2 and i3 loop
+      //
+
+      for (i3 = ipos[3]; i3 < L_CODE; i3 += step)
+      {
+         s = L_mult (rr[i3][i3], _1_8);       // index incr= step+L_CODE
+         s = L_mac (s, rr[i0][i3], _1_4);     // index increment = step
+         s = L_mac (s, rr[i1][i3], _1_4);     // index increment = step
+         rrv[i3] = pv_round (s);
+      }
+
+      // Default value
+      sq = -1;
+      alp = 1;
+      ps = 0;
+      ia = ipos[2];
+      ib = ipos[3];
+
+      for (i2 = ipos[2]; i2 < L_CODE; i2 += step)
+      {
+         // index increment = step
+         ps1 = add (ps0, dn[i2]);
+
+         // index incr= step+L_CODE
+         alp1 = L_mac (alp0, rr[i2][i2], _1_16);
+
+         // index increment = step
+         alp1 = L_mac (alp1, rr[i0][i2], _1_8);
+
+         // index increment = step
+         alp1 = L_mac (alp1, rr[i1][i2], _1_8);
+
+         for (i3 = ipos[3]; i3 < L_CODE; i3 += step)
+         {
+            // index increment = step
+            ps2 = add (ps1, dn[i3]);
+
+            // index increment = step
+            alp2 = L_mac (alp1, rrv[i3], _1_2);
+
+            // index increment = step
+            alp2 = L_mac (alp2, rr[i2][i3], _1_8);
+
+            sq2 = mult (ps2, ps2);
+
+            alp_16 = pv_round (alp2);
+
+            s = L_msu (L_mult (alp, sq2), sq, alp_16);
+
+            if (s > 0)
+            {
+               sq = sq2;
+               ps = ps2;
+               alp = alp_16;
+               ia = i2;
+               ib = i3;
+            }
+         }
+      }
+      i2 = ia;
+      i3 = ib;
+
+        //
+        // i4 and i5 loop:
+        //
+
+        ps0 = ps;
+        alp0 = L_mult (alp, _1_2);
+
+        for (i5 = ipos[5]; i5 < L_CODE; i5 += step)
+        {
+            s = L_mult (rr[i5][i5], _1_8);
+            s = L_mac (s, rr[i0][i5], _1_4);
+            s = L_mac (s, rr[i1][i5], _1_4);
+            s = L_mac (s, rr[i2][i5], _1_4);
+            s = L_mac (s, rr[i3][i5], _1_4);
+            rrv[i5] = pv_round (s);
+        }
+
+        // Default value
+        sq = -1;
+        alp = 1;
+        ps = 0;
+        ia = ipos[4];
+        ib = ipos[5];
+
+        for (i4 = ipos[4]; i4 < L_CODE; i4 += step)
+        {
+            ps1 = add (ps0, dn[i4]);
+
+            alp1 = L_mac (alp0, rr[i4][i4], _1_32);
+            alp1 = L_mac (alp1, rr[i0][i4], _1_16);
+            alp1 = L_mac (alp1, rr[i1][i4], _1_16);
+            alp1 = L_mac (alp1, rr[i2][i4], _1_16);
+            alp1 = L_mac (alp1, rr[i3][i4], _1_16);
+
+            for (i5 = ipos[5]; i5 < L_CODE; i5 += step)
+            {
+                ps2 = add (ps1, dn[i5]);
+
+                alp2 = L_mac (alp1, rrv[i5], _1_4);
+                alp2 = L_mac (alp2, rr[i4][i5], _1_16);
+
+                sq2 = mult (ps2, ps2);
+
+                alp_16 = pv_round (alp2);
+
+                s = L_msu (L_mult (alp, sq2), sq, alp_16);
+
+                if (s > 0)
+                {
+                    sq = sq2;
+                    ps = ps2;
+                    alp = alp_16;
+                    ia = i4;
+                    ib = i5;
+                }
+            }
+        }
+        i4 = ia;
+        i5 = ib;
+
+        //
+        // i6 and i7 loop:
+        //
+
+        ps0 = ps;
+        alp0 = L_mult (alp, _1_2);
+
+        for (i7 = ipos[7]; i7 < L_CODE; i7 += step)
+        {
+            s = L_mult (rr[i7][i7], _1_16);
+            s = L_mac (s, rr[i0][i7], _1_8);
+            s = L_mac (s, rr[i1][i7], _1_8);
+            s = L_mac (s, rr[i2][i7], _1_8);
+            s = L_mac (s, rr[i3][i7], _1_8);
+            s = L_mac (s, rr[i4][i7], _1_8);
+            s = L_mac (s, rr[i5][i7], _1_8);
+            rrv[i7] = pv_round (s);
+        }
+
+        // Default value
+        sq = -1;
+        alp = 1;
+        ps = 0;
+        ia = ipos[6];
+        ib = ipos[7];
+
+        for (i6 = ipos[6]; i6 < L_CODE; i6 += step)
+        {
+            ps1 = add (ps0, dn[i6]);
+
+            alp1 = L_mac (alp0, rr[i6][i6], _1_64);
+            alp1 = L_mac (alp1, rr[i0][i6], _1_32);
+            alp1 = L_mac (alp1, rr[i1][i6], _1_32);
+            alp1 = L_mac (alp1, rr[i2][i6], _1_32);
+            alp1 = L_mac (alp1, rr[i3][i6], _1_32);
+            alp1 = L_mac (alp1, rr[i4][i6], _1_32);
+            alp1 = L_mac (alp1, rr[i5][i6], _1_32);
+
+            for (i7 = ipos[7]; i7 < L_CODE; i7 += step)
+            {
+                ps2 = add (ps1, dn[i7]);
+
+                alp2 = L_mac (alp1, rrv[i7], _1_4);
+                alp2 = L_mac (alp2, rr[i6][i7], _1_32);
+
+                sq2 = mult (ps2, ps2);
+
+                alp_16 = pv_round (alp2);
+
+                s = L_msu (L_mult (alp, sq2), sq, alp_16);
+
+                if (s > 0)
+                {
+                    sq = sq2;
+                    ps = ps2;
+                    alp = alp_16;
+                    ia = i6;
+                    ib = i7;
+                }
+            }
+        }
+        i6 = ia;
+        i7 = ib;
+
+        // now finished searching a set of 8 pulses
+
+        if(gsmefrFlag != 0){
+           // go on with the two last pulses for GSMEFR
+           //
+           // i8 and i9 loop:
+           //
+
+           ps0 = ps;
+           alp0 = L_mult (alp, _1_2);
+
+           for (i9 = ipos[9]; i9 < L_CODE; i9 += step)
+           {
+              s = L_mult (rr[i9][i9], _1_16);
+              s = L_mac (s, rr[i0][i9], _1_8);
+              s = L_mac (s, rr[i1][i9], _1_8);
+              s = L_mac (s, rr[i2][i9], _1_8);
+              s = L_mac (s, rr[i3][i9], _1_8);
+              s = L_mac (s, rr[i4][i9], _1_8);
+              s = L_mac (s, rr[i5][i9], _1_8);
+              s = L_mac (s, rr[i6][i9], _1_8);
+              s = L_mac (s, rr[i7][i9], _1_8);
+              rrv[i9] = pv_round (s);
+           }
+
+           // Default value
+           sq = -1;
+           alp = 1;
+           ps = 0;
+           ia = ipos[8];
+           ib = ipos[9];
+
+           for (i8 = ipos[8]; i8 < L_CODE; i8 += step)
+           {
+              ps1 = add (ps0, dn[i8]);
+
+              alp1 = L_mac (alp0, rr[i8][i8], _1_128);
+              alp1 = L_mac (alp1, rr[i0][i8], _1_64);
+              alp1 = L_mac (alp1, rr[i1][i8], _1_64);
+              alp1 = L_mac (alp1, rr[i2][i8], _1_64);
+              alp1 = L_mac (alp1, rr[i3][i8], _1_64);
+              alp1 = L_mac (alp1, rr[i4][i8], _1_64);
+              alp1 = L_mac (alp1, rr[i5][i8], _1_64);
+              alp1 = L_mac (alp1, rr[i6][i8], _1_64);
+              alp1 = L_mac (alp1, rr[i7][i8], _1_64);
+
+              for (i9 = ipos[9]; i9 < L_CODE; i9 += step)
+              {
+                 ps2 = add (ps1, dn[i9]);
+
+                 alp2 = L_mac (alp1, rrv[i9], _1_8);
+                 alp2 = L_mac (alp2, rr[i8][i9], _1_64);
+
+                 sq2 = mult (ps2, ps2);
+
+                 alp_16 = pv_round (alp2);
+
+                 s = L_msu (L_mult (alp, sq2), sq, alp_16);
+
+                 if (s > 0)
+                 {
+                    sq = sq2;
+                    ps = ps2;
+                    alp = alp_16;
+                    ia = i8;
+                    ib = i9;
+                 }
+              }
+           }
+        } // end  gsmefrFlag
+
+        //
+        // test and memorise if this combination is better than the last one/
+        //
+
+        s = L_msu (L_mult (alpk, sq), psk, alp);
+
+        if (s > 0)
+        {
+            psk = sq;
+            alpk = alp;
+            codvec[0] = i0;
+            codvec[1] = i1;
+            codvec[2] = i2;
+            codvec[3] = i3;
+            codvec[4] = i4;
+            codvec[5] = i5;
+            codvec[6] = i6;
+            codvec[7] = i7;
+
+            if (gsmefrFlag != 0)
+            {
+               codvec[8] = ia;
+               codvec[9] = ib;
+            }
+        }
+
+        //
+        // Cyclic permutation of i1,i2,i3,i4,i5,i6,i7,(i8 and i9)/
+        //
+
+        pos = ipos[1];
+        for (j = 1, k = 2; k < nbPulse; j++, k++)
+        {
+            ipos[j] = ipos[k];
+        }
+        ipos[sub(nbPulse,1)] = pos;
+   } // end 1..nbTracks  loop
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void search_10and8i40(
+    Word16 nbPulse,      /* i : nbpulses to find                       */
+    Word16 step,         /* i : stepsize                               */
+    Word16 nbTracks,     /* i : nbTracks                               */
+    Word16 dn[],         /* i : correlation between target and h[]     */
+    Word16 rr[][L_CODE], /* i : matrix of autocorrelation              */
+    Word16 ipos[],       /* i : starting position for each pulse       */
+    Word16 pos_max[],    /* i : position of maximum of dn[]            */
+    Word16 codvec[],     /* o : algebraic codebook vector              */
+    Flag   *pOverflow    /* i/o : overflow flag                        */
+)
+{
+    Word16 i0, i1, i2, i3, i4, i5, i6, i7, i9;
+    Word16 i, j, k/*, m*/;
+    Word16 pos, ia, ib;
+    Word16 psk;
+    Word16 sq, sq2;
+    Word16 alpk, alp, alp_16;
+    Word32 s;
+    Word32 alp0, alp1, alp2;
+    Word16 gsmefrFlag;
+    Word16 *p_codvec = codvec;
+    Word16  *p_temp2;
+
+    Word16  temp1[2*L_CODE];
+    Word16  *p_temp1;
+    Word16  ps2;
+    Word16  ps1;
+    Word16  ps;
+    Word16 ps0;
+
+    Word16  index[10];
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    if (nbPulse == 10)
+    {
+        gsmefrFlag = 1;
+    }
+    else
+    {
+        gsmefrFlag = 0;
+    }
+
+    /* fix i0 on maximum of correlation position */
+    i0 = pos_max[ipos[0]];
+    index[0] = i0;
+    /*------------------------------------------------------------------*
+    * i1 loop:                                                         *
+    *------------------------------------------------------------------*/
+
+    /* Default value */
+    psk = -1;
+    alpk = 1;
+    for (i = 0; i < nbPulse; i++)
+    {
+        *(p_codvec++) = i;
+    }
+
+    for (i = 1; i < nbTracks; i++)
+    {
+        i1 = pos_max[ipos[1]];
+        index[1] = i1;
+
+        /* ps0 = add (dn[i0], dn[i1], pOverflow);*/
+        ps0 = (Word16)((Word32) dn[i0] + dn[i1]);
+
+        /* alp0 = L_mult (rr[i0][i0], _1_16, pOverflow); */
+        alp0 = (Word32) rr[i0][i0] << 12;
+
+        /* alp0 = L_mac (alp0, rr[i1][i1], _1_16, pOverflow); */
+        alp0 += (Word32) rr[i1][i1] << 12;
+
+        /* alp0 = L_mac (alp0, rr[i0][i1], _1_8, pOverflow); */
+        alp0 += (Word32) rr[i0][i1] << 13;
+        alp0 += 0x00008000L;
+
+        /*----------------------------------------------------------------*
+        * i2 and i3 loop:                                                *
+        *----------------------------------------------------------------*/
+
+        p_temp1 = temp1;
+        for (i3 = ipos[3]; i3 < L_CODE; i3 += step)
+        {
+            p_temp2 = &rr[i3][0];
+            s  = (Word32) * (p_temp2 + i3) >> 1;
+            s += (Word32) * (p_temp2 + i0);
+            s += (Word32) * (p_temp2 + i1);
+            *(p_temp1++) = ps0 + dn[i3];
+            *(p_temp1++) = (Word16)((s + 2) >> 2);
+        }
+
+        /* Default value */
+        sq = -1;
+        alp = 1;
+        ps = 0;
+        ia = ipos[2];
+        ib = ipos[3];
+
+        s = (alp0 >> 12);
+
+        for (j = ipos[2]; j < L_CODE; j += step)
+        {
+            /* index increment = step  */
+            p_temp2 = &rr[j][0];
+
+            alp1 = (s + (Word32) * (p_temp2 + j)) >> 1;
+
+            alp1 += (Word32) * (p_temp2 + i0);
+
+            alp1 += (Word32) * (p_temp2 + i1);
+
+            p_temp1 = temp1;
+            ps1 = dn[j];
+
+
+            for (i3 = ipos[3]; i3 < L_CODE; i3 += step)
+            {
+                /* index increment = step */
+                ps2 = ps1 + *(p_temp1++);
+
+                sq2 = (Word16)(((Word32) ps2 * ps2) >> 15);
+
+                alp2 = (alp1 + p_temp2[i3]) >> 2;
+                alp2 = (alp2 + *(p_temp1++)) >> 1;  /*  alp2 is always > 0  */
+                if (((Word32) sq2 * alp) > ((Word32) sq * alp2))
+                {
+                    sq = sq2;
+                    ps = ps2;
+                    alp = (Word16)alp2;
+                    ia = j;
+                    ib = i3;
+                }
+            }
+
+        }
+        i2 = ia;
+        i3 = ib;
+        index[2] = ia;
+        index[3] = ib;
+
+        /*----------------------------------------------------------------*
+        * i4 and i5 loop:                                                *
+        *----------------------------------------------------------------*/
+
+        alp0 = ((Word32) alp << 15) + 0x00008000L;
+        p_temp1 = temp1;
+
+        for (i5 = ipos[5]; i5 < L_CODE; i5 += step)
+        {
+            p_temp2 = &rr[i5][0];
+            s = (Word32) * (p_temp2 + i5) >> 1;
+            s += (Word32) * (p_temp2 + i0);
+            s += (Word32) * (p_temp2 + i1);
+            s += (Word32) * (p_temp2 + i2);
+            s += (Word32) * (p_temp2 + i3);
+
+            *(p_temp1++) = ps + dn[i5];
+            *(p_temp1++) = (Word16)((s + 2) >> 2);
+        }
+
+        /* Default value */
+        sq = -1;
+        alp = 1;
+        ps = 0;
+        ia = ipos[4];
+        ib = ipos[5];
+
+        for (j = ipos[4]; j < L_CODE; j += step)
+        {
+            /* ps1 = add (ps0, dn[i4], pOverflow); */
+            p_temp2 = &rr[j][0];
+
+            /* alp1 = L_mac (alp0, rr[i4][i4], _1_32, pOverflow); */
+            alp1 = alp0 + ((Word32) * (p_temp2 + j) << 11);
+
+            /* alp1 = L_mac (alp1, rr[i0][i4], _1_16, pOverflow); */
+            alp1 += (Word32) * (p_temp2 + i0) << 12;
+
+            /* alp1 = L_mac (alp1, rr[i1][i4], _1_16, pOverflow); */
+            alp1 += (Word32) * (p_temp2 + i1) << 12;
+
+            /* alp1 = L_mac (alp1, rr[i2][i4], _1_16, pOverflow); */
+            alp1 += (Word32) * (p_temp2 + i2) << 12;
+
+            /* alp1 = L_mac (alp1, rr[i3][i4], _1_16, pOverflow); */
+            alp1 += (Word32) * (p_temp2 + i3) << 12;
+
+            p_temp1 = temp1;
+            ps1 =  dn[j];
+
+            for (i5 = ipos[5]; i5 < L_CODE; i5 += step)
+            {
+                ps2 = ps1 + *(p_temp1++);
+
+                alp2 = alp1 + ((Word32) * (p_temp2 + i5) << 12);
+
+                alp_16 = (Word16)((alp2 + ((Word32) * (p_temp1++) << 14)) >> 16);
+                sq2 = (Word16)(((Word32) ps2 * ps2) >> 15);
+
+                if (((Word32) sq2 * alp) > ((Word32) sq * alp_16))
+                {
+                    sq = sq2;
+                    ps = ps2;
+                    alp = alp_16;
+                    ia = j;
+                    ib = i5;
+                }
+
+            }
+        }
+        i4 = ia;
+        i5 = ib;
+        index[4] = ia;
+        index[5] = ib;
+
+        /*----------------------------------------------------------------*
+        * i6 and i7 loop:                                                *
+        *----------------------------------------------------------------*/
+
+        alp0 = ((Word32) alp << 15) + 0x00008000L;
+
+        p_temp1 = temp1;
+
+        for (i7 = ipos[7]; i7 < L_CODE; i7 += step)
+        {
+            s = (Word32) rr[i7][i7] >> 1;
+            s += (Word32) rr[i0][i7];
+            s += (Word32) rr[i1][i7];
+            s += (Word32) rr[i2][i7];
+            s += (Word32) rr[i3][i7];
+            s += (Word32) rr[i4][i7];
+            s += (Word32) rr[i5][i7];
+            *(p_temp1++) = ps + dn[i7];
+            *(p_temp1++) = (Word16)((s + 4) >> 3);
+        }
+
+
+        /* Default value */
+        sq = -1;
+        alp = 1;
+        ps = 0;
+        ia = ipos[6];
+        ib = ipos[7];
+
+        for (j = ipos[6]; j < L_CODE; j += step)
+        {
+            /* ps1 = add (ps0, dn[i6], pOverflow); */
+
+            p_temp2 = (Word16 *) & rr[j];
+
+            /* alp1 = L_mac (alp0, rr[i6][i6], _1_64, pOverflow); */
+            alp1 = alp0 + ((Word32) * (p_temp2 + j) << 10);
+
+            /* alp1 = L_mac (alp1, rr[i0][i6], _1_32, pOverflow); */
+            alp1 += (Word32) * (p_temp2 + i0) << 11;
+
+
+            /* alp1 = L_mac (alp1, rr[i1][i6], _1_32, pOverflow); */
+            alp1 += (Word32) * (p_temp2 + i1) << 11;
+
+            /* alp1 = L_mac (alp1, rr[i2][i6], _1_32, pOverflow); */
+            alp1 += (Word32) * (p_temp2 + i2) << 11;
+
+            /* alp1 = L_mac (alp1, rr[i3][i6], _1_32, pOverflow); */
+            alp1 += (Word32) * (p_temp2 + i3) << 11;
+
+            /* alp1 = L_mac (alp1, rr[i4][i6], _1_32, pOverflow); */
+            alp1 += (Word32) * (p_temp2 + i4) << 11;
+
+            /* alp1 = L_mac (alp1, rr[i5][i6], _1_32, pOverflow); */
+            alp1 += (Word32) * (p_temp2 + i5) << 11;
+
+            p_temp1 = temp1;
+            ps1 = dn[j];
+
+            for (i7 = ipos[7]; i7 < L_CODE; i7 += step)
+            {
+                ps2 = ps1 + *(p_temp1++);
+
+                alp2 = alp1 + ((Word32) * (p_temp2 + i7) << 11);
+
+                alp_16 = (Word16)((alp2 + ((Word32) * (p_temp1++) << 14)) >> 16);
+
+                sq2 = (Word16)(((Word32) ps2 * ps2) >> 15);
+
+                if (((Word32) sq2 * alp) > ((Word32) sq * alp_16))
+                {
+                    sq = sq2;
+                    ps = ps2;
+                    alp = alp_16;
+                    ia = j;
+                    ib = i7;
+                }
+            }
+        }
+
+        i6 = ia;
+        i7 = ib;
+        index[6] = ia;
+        index[7] = ib;
+
+        /* now finished searching a set of 8 pulses */
+
+        if (gsmefrFlag != 0)
+        {
+            /* go on with the two last pulses for GSMEFR                      */
+            /*----------------------------------------------------------------*
+            * i8 and i9 loop:                                                *
+            *----------------------------------------------------------------*/
+
+            alp0 = ((Word32) alp << 15) + 0x00008000L;
+
+            p_temp1 = temp1;
+
+            for (i9 = ipos[9]; i9 < L_CODE; i9 += step)
+            {
+                s = (Word32) rr[i9][i9] >> 1;
+                s += (Word32) rr[i0][i9];
+                s += (Word32) rr[i1][i9];
+                s += (Word32) rr[i2][i9];
+                s += (Word32) rr[i3][i9];
+                s += (Word32) rr[i4][i9];
+                s += (Word32) rr[i5][i9];
+                s += (Word32) rr[i6][i9];
+                s += (Word32) rr[i7][i9];
+
+                *(p_temp1++) = ps + dn[i9];
+                *(p_temp1++) = (Word16)((s + 4) >> 3);
+            }
+
+            /* Default value */
+            sq = -1;
+            alp = 1;
+            ps = 0;
+            ia = ipos[8];
+            ib = ipos[9];
+
+            for (j = ipos[8]; j < L_CODE; j += step)
+            {
+                /* ps1 = add (ps0, dn[i8], pOverflow); */
+                p_temp2 = &rr[j][0];
+
+                /* alp1 = L_mac (alp0, rr[i8][i8], _1_128, pOverflow); */
+                alp1 = alp0 + ((Word32) * (p_temp2 + j) << 9);
+
+                /* alp1 = L_mac (alp1, rr[i0][i8], _1_64, pOverflow); */
+                alp1 += (Word32) rr[i0][j] << 10;
+
+                /* alp1 = L_mac (alp1, rr[i1][i8], _1_64, pOverflow); */
+                alp1 += (Word32) rr[i1][j] << 10;
+
+                /* alp1 = L_mac (alp1, rr[i2][i8], _1_64, pOverflow); */
+                alp1 += (Word32) rr[i2][j] << 10;
+
+                /* alp1 = L_mac (alp1, rr[i3][i8], _1_64, pOverflow); */
+                alp1 += (Word32) rr[i3][j] << 10;
+
+                /* alp1 = L_mac (alp1, rr[i4][i8], _1_64, pOverflow); */
+                alp1 += (Word32) rr[i4][j] << 10;
+
+                /* alp1 = L_mac (alp1, rr[i5][i8], _1_64, pOverflow); */
+                alp1 += (Word32) rr[i5][j] << 10;
+
+                /* alp1 = L_mac (alp1, rr[i6][i8], _1_64, pOverflow); */
+                alp1 += (Word32) rr[i6][j] << 10;
+
+                /* alp1 = L_mac (alp1, rr[i7][i8], _1_64, pOverflow); */
+                alp1 += (Word32) rr[i7][j] << 10;
+
+                p_temp1 = temp1;
+                ps1 = dn[j];
+
+                for (i9 = ipos[9]; i9 < L_CODE; i9 += step)
+                {
+                    /* ps2 = add (ps1, dn[i9], pOverflow); */
+                    ps2 = ps1 + *(p_temp1++);
+
+                    /* sq2 = mult (ps2, ps2, pOverflow); */
+                    sq2 = (Word16)(((Word32) ps2 * ps2) >> 15);
+
+                    /* alp2 = L_mac (alp1, rrv[i9], _1_8, pOverflow); */
+                    alp2 = alp1 + ((Word32) * (p_temp2 + i9) << 10) ;
+
+                    /* alp2 = L_mac (alp2, rr[i8][i9], _1_64, pOverflow); */
+                    alp_16 = (Word16)((alp2 + ((Word32) * (p_temp1++) << 13)) >> 16);
+
+                    if (((Word32) sq2 * alp) > ((Word32) sq * alp_16))
+                    {
+                        sq = sq2;
+                        ps = ps2;
+                        alp = alp_16;
+                        ia = j;
+                        ib = i9;
+                    }
+                }
+            }
+
+            index[8] = ia;
+            index[9] = ib;
+
+        }/* end  gsmefrFlag */
+
+        /*----------------------------------------------------------------  *
+         * test and memorise if this combination is better than the last one.*
+         *----------------------------------------------------------------*/
+
+        if (((Word32) alpk * sq) > ((Word32) psk * alp))
+        {
+            psk = sq;
+            alpk = alp;
+
+            if (gsmefrFlag != 0)
+            {
+                oscl_memcpy(codvec, index, (2*NB_TRACK)*sizeof(*index));
+            }
+            else
+            {
+                oscl_memcpy(codvec, index, (2*NB_TRACK_MR102)*sizeof(*index));
+            }
+
+        }
+        /*----------------------------------------------------------------*
+        * Cyclic permutation of i1,i2,i3,i4,i5,i6,i7,(i8 and i9).          *
+        *----------------------------------------------------------------*/
+
+        pos = ipos[1];
+        for (j = 1, k = 2; k < nbPulse; j++, k++)
+        {
+            ipos[j] = ipos[k];
+        }
+        ipos[nbPulse-1] = pos;
+    } /* end 1..nbTracks  loop*/
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.h
new file mode 100644 (file)
index 0000000..5e84b76
--- /dev/null
@@ -0,0 +1,109 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: s10_8pf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the s10_8pf module.
+------------------------------------------------------------------------------
+*/
+
+#ifndef S10_8PF_H
+#define S10_8PF_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+#include    "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void search_10and8i40(
+        Word16 nbPulse,       /* i : nbpulses to find                       */
+        Word16 step,          /* i :  stepsize                              */
+        Word16 nbTracks,      /* i :  nbTracks                              */
+        Word16 dn[],          /* i : correlation between target and h[]     */
+        Word16 rr[][L_CODE],  /* i : matrix of autocorrelation              */
+        Word16 ipos[],        /* i : starting position for each pulse       */
+        Word16 pos_max[],     /* i : position of maximum of dn[]            */
+        Word16 codvec[],      /* o : algebraic codebook vector              */
+        Flag   *pOverflow     /* i/o : Overflow flag                        */
+    );
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _S10_8PF_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp
new file mode 100644 (file)
index 0000000..f759901
--- /dev/null
@@ -0,0 +1,539 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: set_sign.cpp
+ Funtions: set_sign
+           set_sign12k2
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This module contains the functions set_sign and set_sign12k2.
+ These functions are used to build a sign vector according
+ to the values in the input arrays.  These functions also
+ find the position in the input codes of the maximum correlation
+ and the starting position for each pulse.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "set_sign.h"
+#include "basic_op.h"
+#include "inv_sqrt.h"
+#include "cnst.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: set_sign
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    dn = buffer of correlation values (Word16)
+    sign = buffer containing sign of dn elements (Word16)
+    dn2 = buffer containing the maximum of correlation in each track.(Word16)
+    n = number of maximum correlations in dn2 (Word16)
+
+ Returns:
+    None
+
+ Outputs:
+    dn buffer is modified to contain the absolute value of its input
+    sign buffer is modified to contain the sign information for the
+      values in dn buffer
+    dn2 buffer is modified to denote the location of the maximum
+      correlation for each track.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+ This function builds sign vector according to dn buffer It also finds
+ the position of maximum of correlation in each track and the starting
+ position for each pulse.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ set_sign.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void set_sign(Word16 dn[],    i/o : correlation between target and h[]
+              Word16 sign[],  o   : sign of dn[]
+              Word16 dn2[],   o   : maximum of correlation in each track.
+              Word16 n        i   : # of maximum correlations in dn2[]
+)
+{
+   Word16 i, j, k;
+   Word16 val, min;
+   Word16 pos = 0;    //initialization only needed to keep gcc silent
+
+   // set sign according to dn[]
+
+   for (i = 0; i < L_CODE; i++) {
+      val = dn[i];
+
+      if (val >= 0) {
+         sign[i] = 32767;
+      } else {
+         sign[i] = -32767;
+         val = negate(val);
+      }
+      dn[i] = val;     // modify dn[] according to the fixed sign
+      dn2[i] = val;
+   }
+
+   // keep 8-n maximum positions/8 of each track and store it in dn2[]
+
+   for (i = 0; i < NB_TRACK; i++)
+   {
+      for (k = 0; k < (8-n); k++)
+      {
+         min = 0x7fff;
+         for (j = i; j < L_CODE; j += STEP)
+         {
+            if (dn2[j] >= 0)
+            {
+               val = sub(dn2[j], min);
+
+               if (val < 0)
+               {
+                  min = dn2[j];
+                  pos = j;
+               }
+            }
+         }
+         dn2[pos] = -1;
+      }
+   }
+
+   return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void set_sign(Word16 dn[],   /* i/o : correlation between target and h[]    */
+              Word16 sign[], /* o   : sign of dn[]                          */
+              Word16 dn2[],  /* o   : maximum of correlation in each track. */
+              Word16 n       /* i   : # of maximum correlations in dn2[]    */
+             )
+{
+    register Word16 i, j, k;
+    Word16 val, min;
+    Word16 pos = 0; /* initialization only needed to keep gcc silent */
+
+    /* set sign according to dn[] */
+    for (i = L_CODE - 1; i >= 0; i--)
+    {
+        val = dn[i];
+
+        if (val >= 0)
+        {
+            sign[i] = 32767;
+        }
+        else
+        {
+            sign[i] = -32767;
+            val = negate(val);
+            dn[i] = val;     /* modify dn[] according to the fixed sign */
+        }
+
+        dn2[i] = val;
+    }
+
+    /* keep 8-n maximum positions/8 of each track and store it in dn2[] */
+
+    for (i = 0; i < NB_TRACK; i++)
+    {
+        for (k = 0; k < (8 - n); k++)
+        {
+            min = 0x7fff;
+            for (j = i; j < L_CODE; j += STEP)
+            {
+                if (dn2[j] >= 0)
+                {
+                    if (dn2[j] < min)
+                    {
+                        min = dn2[j];
+                        pos = j;
+                    }
+                }
+            }
+            dn2[pos] = -1;
+        }
+    }
+
+    return;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: set_sign12k2()
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    dn = buffer of correlation values (Word16)
+    cn = buffer of residual after long term prediction (Word16)
+    sign = sign of correlation buffer elements (Word16)
+    pos_max = buffer containing position of maximum correlation (Word16)
+    nb_track = number of tracks (Word16)
+    ipos = buffer containing the starting position for each pulse (Word16)
+    step = step size in the tracks (Word16)
+    pOverflow = pointer to Overflow flag (Flag)
+
+ Outputs:
+    sign buffer contains the sign of correlation values
+    dn buffer contains the sign-adjusted correlation values
+    pos_max buffer contains the maximum correlation position
+    ipos buffer contains the starting position of each pulse
+    pOverflow -> 1 if the math operations called by this function result in
+    saturation
+
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function builds the sign vector according to dn and cn, and modifies
+ dn to include the sign information (dn[i]=sign[i]*dn[i]). It also finds
+ the position of maximum of correlation in each track and the starting
+ position for each pulse.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ set_sign.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void set_sign12k2 (
+    Word16 dn[],       //i/o : correlation between target and h[]
+    Word16 cn[],       //i   : residual after long term prediction
+    Word16 sign[],     //o   : sign of d[n]
+    Word16 pos_max[],  //o   : position of maximum correlation
+    Word16 nb_track,   //i   : number of tracks tracks
+    Word16 ipos[],     //o   : starting position for each pulse
+    Word16 step        //i   : the step size in the tracks
+)
+{
+    Word16 i, j;
+    Word16 val, cor, k_cn, k_dn, max, max_of_all;
+    Word16 pos = 0;      // initialization only needed to keep gcc silent
+    Word16 en[L_CODE];                  // correlation vector
+    Word32 s;
+
+    // The reference ETSI code uses a global flag for Overflow. However in the
+    // actual implementation a pointer to the overflow flag is passed in. This
+    // pointer is passed into the basic math functions called by this routine.
+
+    // calculate energy for normalization of cn[] and dn[]
+
+    s = 256;
+    for (i = 0; i < L_CODE; i++)
+    {
+        s = L_mac (s, cn[i], cn[i]);
+    }
+    s = Inv_sqrt (s);
+    k_cn = extract_h (L_shl (s, 5));
+
+    s = 256;
+    for (i = 0; i < L_CODE; i++)
+    {
+        s = L_mac (s, dn[i], dn[i]);
+    }
+    s = Inv_sqrt (s);
+    k_dn = extract_h (L_shl (s, 5));
+
+    for (i = 0; i < L_CODE; i++)
+    {
+        val = dn[i];
+        cor = pv_round (L_shl (L_mac (L_mult (k_cn, cn[i]), k_dn, val), 10));
+
+        if (cor >= 0)
+        {
+            sign[i] = 32767;                      // sign = +1
+        }
+        else
+        {
+            sign[i] = -32767;                     // sign = -1
+            cor = negate (cor);
+            val = negate (val);
+        }
+        // modify dn[] according to the fixed sign
+        dn[i] = val;
+        en[i] = cor;
+    }
+
+    max_of_all = -1;
+    for (i = 0; i < nb_track; i++)
+    {
+        max = -1;
+
+        for (j = i; j < L_CODE; j += step)
+        {
+            cor = en[j];
+            val = sub (cor, max);
+
+            if (val > 0)
+            {
+                max = cor;
+                pos = j;
+            }
+        }
+        // store maximum correlation position
+        pos_max[i] = pos;
+        val = sub (max, max_of_all);
+
+        if (val > 0)
+        {
+            max_of_all = max;
+            // starting position for i0
+            ipos[0] = i;
+        }
+    }
+
+    //
+    //     Set starting position of each pulse.
+    //
+
+    pos = ipos[0];
+    ipos[nb_track] = pos;
+
+    for (i = 1; i < nb_track; i++)
+    {
+        pos = add (pos, 1);
+
+        if (sub (pos, nb_track) >= 0)
+        {
+           pos = 0;
+        }
+        ipos[i] = pos;
+        ipos[add(i, nb_track)] = pos;
+    }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void set_sign12k2(
+    Word16 dn[],        /* i/o : correlation between target and h[]         */
+    Word16 cn[],        /* i   : residual after long term prediction        */
+    Word16 sign[],      /* o   : sign of d[n]                               */
+    Word16 pos_max[],   /* o   : position of maximum correlation            */
+    Word16 nb_track,    /* i   : number of tracks tracks                    */
+    Word16 ipos[],      /* o   : starting position for each pulse           */
+    Word16 step,        /* i   : the step size in the tracks                */
+    Flag   *pOverflow   /* i/o: overflow flag                               */
+)
+{
+    Word16 i, j;
+    Word16 val;
+    Word16 cor;
+    Word16 k_cn;
+    Word16 k_dn;
+    Word16 max;
+    Word16 max_of_all;
+    Word16 pos = 0; /* initialization only needed to keep gcc silent */
+    Word16 en[L_CODE];                  /* correlation vector */
+    Word32 s;
+    Word32 t;
+    Word32 L_temp;
+    Word16 *p_cn;
+    Word16 *p_dn;
+    Word16 *p_sign;
+    Word16 *p_en;
+
+    /* calculate energy for normalization of cn[] and dn[] */
+
+    s = 256;
+    t = 256;
+    p_cn = cn;
+    p_dn = dn;      /* crosscorrelation values do not have strong peaks, so
+                       scaling applied in cor_h_x (sf=2) guaranteed that the
+                       mac of the energy for this vector will not overflow */
+
+    for (i = L_CODE; i != 0; i--)
+    {
+        val = *(p_cn++);
+        s = L_mac(s, val, val, pOverflow);
+        val = *(p_dn++);
+        t += ((Word32) val * val) << 1;
+    }
+    s = Inv_sqrt(s, pOverflow);
+    k_cn = (Word16)((L_shl(s, 5, pOverflow)) >> 16);
+
+    t = Inv_sqrt(t, pOverflow);
+    k_dn = (Word16)(t >> 11);
+
+    p_cn   = &cn[L_CODE-1];
+    p_sign = &sign[L_CODE-1];
+    p_en   = &en[L_CODE-1];
+
+    for (i = L_CODE - 1; i >= 0; i--)
+    {
+        L_temp = ((Word32)k_cn * *(p_cn--)) << 1;
+        val = dn[i];
+        s = L_mac(L_temp, k_dn, val, pOverflow);
+        L_temp = L_shl(s, 10, pOverflow);
+        cor = pv_round(L_temp, pOverflow);
+
+        if (cor >= 0)
+        {
+            *(p_sign--) = 32767;                      /* sign = +1 */
+        }
+        else
+        {
+            *(p_sign--) = -32767;                     /* sign = -1 */
+            cor = negate(cor);
+
+            /* modify dn[] according to the fixed sign */
+            dn[i] = negate(val);
+        }
+
+        *(p_en--) = cor;
+    }
+
+    max_of_all = -1;
+    for (i = 0; i < nb_track; i++)
+    {
+        max = -1;
+
+        for (j = i; j < L_CODE; j += step)
+        {
+            cor = en[j];
+            if (cor > max)
+            {
+                max = cor;
+                pos = j;
+            }
+        }
+        /* store maximum correlation position */
+        pos_max[i] = pos;
+        if (max > max_of_all)
+        {
+            max_of_all = max;
+            /* starting position for i0 */
+            ipos[0] = i;
+        }
+    }
+
+    /*----------------------------------------------------------------*
+     *     Set starting position of each pulse.                       *
+     *----------------------------------------------------------------*/
+
+    pos = ipos[0];
+    ipos[nb_track] = pos;
+
+    for (i = 1; i < nb_track; i++)
+    {
+        pos++;
+
+        if (pos >= nb_track)
+        {
+            pos = 0;
+        }
+        ipos[ i] = pos;
+        ipos[ i + nb_track] = pos;
+    }
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.h
new file mode 100644 (file)
index 0000000..9ca482c
--- /dev/null
@@ -0,0 +1,113 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: set_sign.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the set_sign() and set_sign12k2() function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef SET_SIGN_H
+#define SET_SIGN_H "@(#)$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void set_sign(Word16 dn[],   /* i/o : correlation between target and h[]    */
+    Word16 sign[], /* o   : sign of dn[]                          */
+    Word16 dn2[],  /* o   : maximum of correlation in each track. */
+    Word16 n       /* i   : # of maximum correlations in dn2[]    */
+                 );
+
+    void set_sign12k2(
+        Word16 dn[],        /* i/o : correlation between target and h[]         */
+        Word16 cn[],        /* i   : residual after long term prediction        */
+        Word16 sign[],      /* o   : sign of d[n]                               */
+        Word16 pos_max[],   /* o   : position of maximum correlation            */
+        Word16 nb_track,    /* i   : number of tracks tracks                    */
+        Word16 ipos[],      /* o   : starting position for each pulse           */
+        Word16 step,        /* i   : the step size in the tracks                */
+        Flag   *pOverflow   /* i/o : overflow flag                              */
+    );
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SET_SIGN_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.cpp
new file mode 100644 (file)
index 0000000..2981e7b
--- /dev/null
@@ -0,0 +1,447 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: sid_sync.cpp
+ Functions: sid_sync_init
+            sid_sync_reset
+            sid_sync_exit
+            sid_sync_set_handover_debt
+            sid_sync
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ This file contains the functions that initialize, reset, exit, and perform
+ SID synchronization.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "basic_op.h"
+#include "mode.h"
+#include "sid_sync.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; [Define module specific macros here]
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; [Include all pre-processor statements here. Include conditional
+; compile variables also.]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; [List function prototypes here]
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; [Variable declaration - defined here and used outside this module]
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: sid_sync_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer containing a pointer to the state structure used for
+            SID synchronization (void)
+
+ Outputs:
+    None
+
+ Returns:
+    return_value = status of sid_sync_reset function; -1, if state is pointing
+                   to a NULL address (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function initialize one instance of the sid_sync module. It stores
+ the pointer to state struct in *st. This pointer has to be passed to sid_sync
+ in each call. This function returns 0 on success, otherwise, -1.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sid_sync.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 sid_sync_init(void **state)
+{
+    sid_syncState* s;
+
+    if (state == NULL)
+    {
+        /* fprintf(stderr, "sid_sync_init:invalid state parameter\n"); */
+        return -1;
+    }
+
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (sid_syncState *)
+             oscl_malloc(sizeof(sid_syncState))) == NULL)
+    {
+        /* fprintf(stderr,
+                "sid_sync_init: "
+                "can not malloc state structure\n"); */
+        return -1;
+    }
+    s->sid_update_rate = 8;
+
+    *state = (void *)s;
+
+    return(sid_sync_reset(s));
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: sid_sync_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to the state structure used for SID synchronization (void)
+
+ Outputs:
+    None
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs a reset of the sid_sync module by setting the state
+ memory to zero.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sid_sync.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 sid_sync_reset(void *st)
+{
+    sid_syncState *state = (sid_syncState *) st;
+
+    state->sid_update_counter = 3;
+    state->sid_handover_debt = 0;
+    state->prev_ft = TX_SPEECH_GOOD;
+
+    return 0;
+}
+
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: sid_sync_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer containing a pointer to the state structure used for
+            SID synchronization (void)
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function frees up the state structure used by sid_sync function. It
+ stores NULL in *state.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sid_sync.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void sid_sync_exit(void **state)
+{
+    sid_syncState **st = (sid_syncState **) state;
+
+    if (st == NULL || *st == NULL)
+    {
+        return;
+    }
+
+    /* deallocate memory */
+    oscl_free(*st);
+    *st = NULL;
+
+    return;
+
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: sid_sync_set_handover_debt
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to the state structure used for SID synchronization
+         (sid_syncState)
+    debtFrames = number of handover debt frames (Word16)
+
+ Outputs:
+    st->sid_handover_debt is set to debtFrames
+
+ Returns:
+    return_value = 0
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function updates the handover debt to debtFrames. Extra SID_UPD are
+ scheduled to update remote decoder CNI states, right after an handover.
+ This is primarily for use on MS UL side.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sid_sync.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void sid_sync_set_handover_debt(sid_syncState *st,
+                                Word16 debtFrames)
+{
+    /* debtFrames >= 0 */
+    st->sid_handover_debt = debtFrames;
+    return;
+}
+
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: sid_sync
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to the state structure used for SID synchronization
+            (sid_syncState)
+    mode = codec mode (enum Mode)
+    tx_frame_type = pointer to TX frame type store (enum TXFrameType)
+
+ Outputs:
+    tx_frame_type contains the new TX frame type
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function performs SID frame synchronization to ensure that the mode
+ only switches to a neighbouring mode.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sid_sync.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+void sid_sync(void *state,
+              enum Mode mode,
+              enum TXFrameType *tx_frame_type)
+{
+
+    sid_syncState *st = (sid_syncState *) state;
+
+    if (mode == MRDTX)
+    {
+
+        st->sid_update_counter--;
+
+        if (st->prev_ft == TX_SPEECH_GOOD)
+        {
+            *tx_frame_type = TX_SID_FIRST;
+            st->sid_update_counter = 3;
+        }
+        else
+        {
+            /* TX_SID_UPDATE or TX_NO_DATA */
+            if ((st->sid_handover_debt > 0) &&
+                    (st->sid_update_counter > 2))
+            {
+                /* ensure extra updates are  properly delayed after
+                   a possible SID_FIRST */
+                *tx_frame_type = TX_SID_UPDATE;
+                st->sid_handover_debt--;
+            }
+            else
+            {
+                if (st->sid_update_counter == 0)
+                {
+                    *tx_frame_type = TX_SID_UPDATE;
+                    st->sid_update_counter = st->sid_update_rate;
+                }
+                else
+                {
+                    *tx_frame_type = TX_NO_DATA;
+                }
+            }
+        }
+    }
+    else
+    {
+        st->sid_update_counter = st->sid_update_rate ;
+        *tx_frame_type = TX_SPEECH_GOOD;
+    }
+    st->prev_ft = *tx_frame_type;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.h
new file mode 100644 (file)
index 0000000..e5c33cf
--- /dev/null
@@ -0,0 +1,134 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: sid_sync.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the type definition and function prototypes used by the
+ SID synchronization functions.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _SID_SYNC_H_
+#define _SID_SYNC_H_
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "frame.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+#define sid_sync_h "$Id $"
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Word16 sid_update_rate;  /* Send SID Update every sid_update_rate frame */
+        Word16 sid_update_counter; /* Number of frames since last SID          */
+        Word16 sid_handover_debt;  /* Number of extra SID_UPD frames to schedule*/
+        enum TXFrameType prev_ft;
+    } sid_syncState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    /* initialize one instance of the sid_sync module
+       Stores pointer to state struct in *st. This pointer has to
+       be passed to sid_sync in each call.
+       returns 0 on success
+     */
+    Word16 sid_sync_init(void **st);
+
+    /* reset of sid_sync module (i.e. set state memory to zero)
+       returns 0 on success
+     */
+    Word16 sid_sync_reset(void *st);
+
+    /* de-initialize sid_sync module (i.e. free status struct)
+       stores NULL in *st
+     */
+    void sid_sync_exit(void **st);
+
+    /*  update handover debt
+        debtFrames extra SID_UPD are scheduled .
+        to update remote decoder CNI states, right after an handover.
+        (primarily for use on MS UL side )
+    */
+    void sid_sync_set_handover_debt(sid_syncState *st,  /* i/o: sid_sync state  */
+                                    Word16 debtFrames);
+
+    /* To ensure that the mode only switches to a neighbouring mode */
+    void sid_sync(void *st ,
+                  enum Mode mode,
+                  enum TXFrameType *tx_frame_type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _SID_SYNC_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.cpp
new file mode 100644 (file)
index 0000000..7a7f368
--- /dev/null
@@ -0,0 +1,655 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: sp_enc.cpp
+ Funtions: GSMInitEncode
+           Speech_Encode_Frame_reset
+           GSMEncodeFrameExit
+           Speech_Encode_Frame_First
+           GSMEncodeFrame
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+ These functions comprise the pre filtering and encoding of one speech frame.
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "sp_enc.h"
+#include "typedef.h"
+#include "cnst.h"
+#include "set_zero.h"
+#include "pre_proc.h"
+#include "prm2bits.h"
+#include "mode.h"
+#include "cod_amr.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: GSMInitEncode
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+ Inputs:
+    state = pointer to an array of pointers to structures of type
+            Speech_Decode_FrameState
+    dtx = flag to turn off or turn on DTX (Flag)
+    id = pointer to an array whose contents are of type char
+
+ Outputs:
+    pre_state field of the structure pointed to by the pointer pointed to
+      by state is set to NULL
+    cod_amr_state field of the structure pointed to by the pointer pointed to
+      by state is set to NULL
+    dtx field of the structure pointed to by the pointer pointed to by state
+      is set to the input dtx
+
+ Returns:
+    return_value = set to zero, if initialization was successful; -1,
+                   otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function allocates memory for filter structure and initializes state
+ memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sp_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+ Note: Original function name of Speech_Encode_Frame_init was changed to
+       GSMInitEncode in the Code section.
+
+int Speech_Encode_Frame_init (void **state_data,
+                   Flag   dtx,
+                   char  *id)
+{
+  Speech_Encode_FrameState* s;
+
+  if (state_data == NULL){
+      fprintf(stderr, "Speech_Encode_Frame_init: invalid parameter\n");
+      return -1;
+  }
+  *state_data = NULL;
+
+  // allocate memory
+  if ((s= (Speech_Encode_FrameState *) malloc(sizeof(Speech_Encode_FrameState))) == NULL){
+      fprintf(stderr, "Speech_Encode_Frame_init: can not malloc state "
+                      "structure\n");
+      return -1;
+  }
+
+  s->complexityCounter = getCounterId(id);
+
+  s->pre_state = NULL;
+  s->cod_amr_state = NULL;
+  s->dtx = dtx;
+
+  if (Pre_Process_init(&s->pre_state) ||
+      cod_amr_init(&s->cod_amr_state, s->dtx)) {
+      GSMEncodeFrameExit(&s);
+      return -1;
+  }
+
+  Speech_Encode_Frame_reset(s);
+  *state_data = (void *)s;
+
+  return 0;
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 GSMInitEncode(void **state_data,
+                     Flag   dtx,
+                     Word8  *id)
+{
+    Speech_Encode_FrameState* s;
+
+    OSCL_UNUSED_ARG(id);
+
+    if (state_data == NULL)
+    {
+        /*  fprintf(stderr, "Speech_Encode_Frame_init: invalid parameter\n");  */
+        return -1;
+    }
+    *state_data = NULL;
+
+    /* allocate memory */
+    if ((s = (Speech_Encode_FrameState *) oscl_malloc(sizeof(Speech_Encode_FrameState))) == NULL)
+    {
+        /*  fprintf(stderr, "Speech_Encode_Frame_init: can not malloc state "
+                        "structure\n");  */
+        return -1;
+    }
+
+    s->pre_state = NULL;
+    s->cod_amr_state = NULL;
+    s->dtx = dtx;
+
+    if (Pre_Process_init(&s->pre_state) ||
+            cod_amr_init(&s->cod_amr_state, s->dtx))
+    {
+        Speech_Encode_FrameState** temp = &s;
+        GSMEncodeFrameExit((void**)temp);
+        return -1;
+    }
+
+    Speech_Encode_Frame_reset(s);
+    *state_data = (void *)s;
+
+    return 0;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Speech_Encode_Frame_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to structures of type Speech_Decode_FrameState
+
+ Outputs:
+    None
+
+ Returns:
+    return_value = set to zero if reset was successful; -1, otherwise (int)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function resets state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sp_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Speech_Encode_Frame_reset (void *state_data)
+{
+
+  Speech_Encode_FrameState *state =
+     (Speech_Encode_FrameState *) state_data;
+
+  if (state_data == NULL){
+        fprintf(stderr, "Speech_Encode_Frame_reset
+                           : invalid parameter\n");
+      return -1;
+  }
+
+  Pre_Process_reset(state->pre_state);
+  cod_amr_reset(state->cod_amr_state);
+
+  setCounter(state->complexityCounter);
+  Init_WMOPS_counter();
+  setCounter(0); // set counter to global counter
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 Speech_Encode_Frame_reset(void *state_data)
+{
+
+    Speech_Encode_FrameState *state =
+        (Speech_Encode_FrameState *) state_data;
+
+    if (state_data == NULL)
+    {
+        /*  fprintf(stderr, "Speech_Encode_Frame_reset
+                             : invalid parameter\n");  */
+        return -1;
+    }
+
+    Pre_Process_reset(state->pre_state);
+    cod_amr_reset(state->cod_amr_state);
+
+    return 0;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: GSMEncodeFrameExit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to a pointer to a structure of type cod_amrState
+
+ Outputs:
+    state points to a NULL address
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function frees the memory used for state memory.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sp_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ Note: Original function name of Speech_Encode_Frame_exit was changed to
+       GSMEncodeFrameExit in the Code section.
+
+void Speech_Encode_Frame_exit (void **state_data)
+{
+
+    Speech_Encode_FrameState **state =
+        (Speech_Encode_FrameState **) state_data;
+
+  if (state == NULL || *state == NULL)
+      return;
+
+  Pre_Process_exit(&(*state)->pre_state);
+  cod_amr_exit(&(*state)->cod_amr_state);
+
+  setCounter((*state)->complexityCounter);
+  WMOPS_output(0);
+  setCounter(0); // set counter to global counter
+
+  // deallocate memory
+  free(*state);
+  *state = NULL;
+
+  return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void GSMEncodeFrameExit(void **state_data)
+{
+
+    Speech_Encode_FrameState **state =
+        (Speech_Encode_FrameState **) state_data;
+
+    if (state == NULL || *state == NULL)
+        return;
+
+    Pre_Process_exit(&(*state)->pre_state);
+    cod_amr_exit(&(*state)->cod_amr_state);
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Speech_Encode_Frame_First
+------------------------------------------------------------------------------
+
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to a structure of type Speech_Encode_FrameState that contains
+            the post filter states
+    new_speech = pointer to buffer of length L_FRAME that contains
+                 the speech input (Word16)
+
+ Outputs:
+    The structure of type Speech_Encode_FrameState pointed to by st is updated.
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function encodes the first frame of speech. It calls the pre-processing
+ filter and the first frame encoder.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sp_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int Speech_Encode_Frame_First (
+    Speech_Encode_FrameState *st,  // i/o : post filter states
+    Word16 *new_speech)            // i   : speech input
+{
+#if !defined(NO13BIT)
+   Word16 i;
+#endif
+
+   setCounter(st->complexityCounter);
+
+#if !defined(NO13BIT)
+  // Delete the 3 LSBs (13-bit input)
+  for (i = 0; i < L_NEXT; i++)
+  {
+     new_speech[i] = new_speech[i] & 0xfff8;
+  }
+#endif
+
+  // filter + downscaling
+  Pre_Process (st->pre_state, new_speech, L_NEXT);
+
+  cod_amr_first(st->cod_amr_state, new_speech);
+
+  Init_WMOPS_counter (); // reset WMOPS counter for the new frame
+
+  return 0;
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void Speech_Encode_Frame_First(
+    Speech_Encode_FrameState *st,  /* i/o : post filter states       */
+    Word16 *new_speech)            /* i   : speech input             */
+{
+#if !defined(NO13BIT)
+    Word16 i;
+#endif
+
+#if !defined(NO13BIT)
+    /* Delete the 3 LSBs (13-bit input) */
+    for (i = 0; i < L_NEXT; i++)
+    {
+        new_speech[i] = new_speech[i] & 0xfff8;
+    }
+#endif
+
+    /* filter + downscaling */
+    Pre_Process(st->pre_state, new_speech, L_NEXT);
+
+    cod_amr_first(st->cod_amr_state, new_speech);
+
+    return;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: cod_amr
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state_data = a void pointer to the post filter states
+    mode = AMR mode of type enum Mode
+    new_speech = pointer to buffer of length L_FRAME that contains
+             the speech input of type Word16
+    serial = pointer to the serial bit stream of type Word16
+    usedMode = pointer to the used mode of type enum Mode
+
+ Outputs:
+    serial -> encoded serial bit stream
+    The value pointed to by usedMode is updated.
+
+ Returns:
+    return_value = 0 (int)
+
+ Global Variables Used:
+    None.
+
+ Local Variables Needed:
+    None.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function is the entry point to the GSM AMR encoder. The following
+ operations are performed to generate one encoded frame: First, the incoming
+ audio samples are passed through the pre-processing filter where they are
+ filtered and downscaled. A call is then made to the main encoder cod_amr().
+ This generates the set of encoded parameters which include the LSP, adaptive
+ codebook, and fixed codebook quantization indices (addresses and gains). The
+ generated parameters are then converted to serial bits.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ sp_enc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+ Note: Original function name of Speech_Encode_Frame was changed to
+       GSMEncodeFrame in the Code section.
+
+int Speech_Encode_Frame (
+    void *state_data,             // i/o : post filter states
+    enum Mode mode,               // i   : speech coder mode
+    Word16 *new_speech,           // i   : speech input
+    Word16 *serial,               // o   : serial bit stream
+    enum Mode *usedMode           // o   : used speech coder mode
+    )
+{
+
+  Speech_Encode_FrameState *st =
+     (Speech_Encode_FrameState *) state_data;
+
+  Word16 prm[MAX_PRM_SIZE];   // Analysis parameters
+  Word16 syn[L_FRAME];        // Buffer for synthesis speech
+  Word16 i;
+
+  setCounter(st->complexityCounter);
+  Reset_WMOPS_counter (); // reset WMOPS counter for the new frame
+  // initialize the serial output frame to zero
+  for (i = 0; i < MAX_SERIAL_SIZE; i++)
+  {
+    serial[i] = 0;
+  }
+#if !defined(NO13BIT)
+  // Delete the 3 LSBs (13-bit input)
+  for (i = 0; i < L_FRAME; i++)
+  {
+     new_speech[i] = new_speech[i] & 0xfff8;
+
+
+  }
+#endif
+
+  // filter + downscaling
+  Pre_Process (st->pre_state, new_speech, L_FRAME);
+
+  // Call the speech encoder
+  cod_amr(st->cod_amr_state, mode, new_speech, prm, usedMode, syn);
+
+  // Parameters to serial bits
+  Prm2bits (*usedMode, prm, &serial[0]);
+
+  fwc();
+  setCounter(0); // set counter to global counter
+
+  return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void GSMEncodeFrame(
+    void *state_data,             /* i/o : post filter states          */
+    enum Mode mode,               /* i   : speech coder mode           */
+    Word16 *new_speech,           /* i   : speech input                */
+    Word16 *serial,               /* o   : serial bit stream           */
+    enum Mode *usedMode           /* o   : used speech coder mode      */
+)
+{
+
+    Speech_Encode_FrameState *st =
+        (Speech_Encode_FrameState *) state_data;
+
+    Word16 prm[MAX_PRM_SIZE];   /* Analysis parameters.                 */
+    Word16 syn[L_FRAME];        /* Buffer for synthesis speech          */
+    Word16 i;
+
+    /* initialize the serial output frame to zero */
+    for (i = 0; i < MAX_SERIAL_SIZE; i++)
+    {
+        serial[i] = 0;
+    }
+#if !defined(NO13BIT)
+    /* Delete the 3 LSBs (13-bit input) */
+    for (i = 0; i < L_FRAME; i++)
+    {
+        new_speech[i] = new_speech[i] & 0xfff8;
+    }
+#endif
+
+    /* filter + downscaling */
+    Pre_Process(st->pre_state, new_speech, L_FRAME);
+
+    /* Call the speech encoder */
+    cod_amr(st->cod_amr_state, mode, new_speech, prm, usedMode, syn);
+
+    /* Parameters to serial bits */
+    Prm2bits(*usedMode, prm, &serial[0], &(st->cod_amr_state->common_amr_tbls));
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.h
new file mode 100644 (file)
index 0000000..ba6abac
--- /dev/null
@@ -0,0 +1,135 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: sp_enc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+       File             : sp_enc.h
+       Purpose          : Encoding of one speech frame
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef sp_enc_h
+#define sp_enc_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "pre_proc.h"
+#include "mode.h"
+#include "cod_amr.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; [Define module specific macros here]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; [Include all pre-processor statements here.]
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; [Declare variables used in this module but defined elsewhere]
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    typedef struct
+    {
+        Pre_ProcessState *pre_state;
+        cod_amrState   *cod_amr_state;
+        Flag dtx;
+    } Speech_Encode_FrameState;
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; [List function prototypes here]
+    ----------------------------------------------------------------------------*/
+    /* initialize one instance of the speech encoder
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to Speech_Encode_Frame in each call.
+       returns 0 on success */
+    Word16 GSMInitEncode(void **state_data,
+                         Flag   dtx,
+                         Word8  *id);
+
+
+    /* reset speech encoder (i.e. set state memory to zero)
+       returns 0 on success */
+    Word16 Speech_Encode_Frame_reset(void *state_data);
+
+    /* de-initialize speech encoder (i.e. free status struct)
+       stores NULL in *s */
+    void GSMEncodeFrameExit(void **state_data);
+
+    void Speech_Encode_Frame_First(
+        Speech_Encode_FrameState *st, /* i/o : post filter states     */
+        Word16 *new_speech);          /* i   : speech input           */
+
+    void GSMEncodeFrame(
+        void *state_data,             /* i/o : encoder states         */
+        enum Mode mode,               /* i   : speech coder mode      */
+        Word16 *new_speech,           /* i   : input speech           */
+        Word16 *serial,               /* o   : serial bit stream      */
+        enum Mode *usedMode           /* o   : used speech coder mode */
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _sp_enc_h_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.cpp
new file mode 100644 (file)
index 0000000..ca827ae
--- /dev/null
@@ -0,0 +1,198 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: spreproc.cpp
+ Functions: subframePreProc
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "spreproc.h"
+#include "typedef.h"
+#include "weight_a.h"
+#include "syn_filt.h"
+#include "residu.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: subframePreProc
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode        -- enum Mode          -- coder mode
+    gamma1      -- const Word16 array -- spectral exp. factor 1
+    gamma1_12k2 -- const Word16 array -- spectral exp. factor 1 for EFR
+    gamma2      -- const Word16 array -- spectral exp. factor 2
+    A           -- Pointer to Word16  -- A(z) unquantized for the 4 subframes
+    Aq          -- Pointer to Word16  -- A(z)   quantized for the 4 subframes
+    speech      -- Pointer to Word16  -- speech segment
+    mem_err     -- Pointer to Word16  -- pointer to error signal
+    mem_w0      -- Pointer to Word16  -- memory of weighting filter
+    zero        -- Pointer to Word16  -- pointer to zero vector
+
+ Outputs:
+    ai_zero -- Word16 array -- history of weighted synth. filter
+    exc     -- Word16 array -- long term prediction residual
+    h1      -- Word16 array -- impulse response
+    xn      -- Word16 array -- target vector for pitch search
+    res2    -- Word16 array -- long term prediction residual
+    error   -- Word16 array -- error of LPC synthesis filter
+
+ Returns:
+    Zero
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ spreproc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void subframePreProc(
+    enum Mode mode,            /* i  : coder mode                            */
+    const Word16 gamma1[],     /* i  : spectral exp. factor 1                */
+    const Word16 gamma1_12k2[],/* i  : spectral exp. factor 1 for EFR        */
+    const Word16 gamma2[],     /* i  : spectral exp. factor 2                */
+    Word16 *A,                 /* i  : A(z) unquantized for the 4 subframes  */
+    Word16 *Aq,                /* i  : A(z)   quantized for the 4 subframes  */
+    Word16 *speech,            /* i  : speech segment                        */
+    Word16 *mem_err,           /* i  : pointer to error signal               */
+    Word16 *mem_w0,            /* i  : memory of weighting filter            */
+    Word16 *zero,              /* i  : pointer to zero vector                */
+    Word16 ai_zero[],          /* o  : history of weighted synth. filter     */
+    Word16 exc[],              /* o  : long term prediction residual         */
+    Word16 h1[],               /* o  : impulse response                      */
+    Word16 xn[],               /* o  : target vector for pitch search        */
+    Word16 res2[],             /* o  : long term prediction residual         */
+    Word16 error[]             /* o  : error of LPC synthesis filter         */
+)
+{
+    Word16 Ap1[MP1];              /* A(z) with spectral expansion         */
+    Word16 Ap2[MP1];              /* A(z) with spectral expansion         */
+    const Word16 *g1;             /* Pointer to correct gammma1 vector    */
+
+    /* mode specific pointer to gamma1 values */
+    if (mode == MR122 || mode == MR102)
+    {
+        g1 = gamma1_12k2;
+    }
+    else
+    {
+        g1 = gamma1;
+    }
+
+    /* Find the weighted LPC coefficients for the weighting filter. */
+    Weight_Ai(A, g1, Ap1);
+    Weight_Ai(A, gamma2, Ap2);
+
+    oscl_memcpy(ai_zero, Ap1, (M + 1)*sizeof(Word16));
+
+
+    Syn_filt(Aq, ai_zero, h1, L_SUBFR, zero, 0);
+    Syn_filt(Ap2, h1, h1, L_SUBFR, zero, 0);
+
+    /*
+     *
+     *          Find the target vector for pitch search:
+     *
+     */
+
+    /* LPC residual */
+    Residu(Aq, speech, res2, L_SUBFR);
+
+    oscl_memcpy(exc, res2, L_SUBFR*sizeof(Word16));
+
+    Syn_filt(Aq, exc, error, L_SUBFR, mem_err, 0);
+
+    Residu(Ap1, error, xn, L_SUBFR);
+
+    /* target signal xn[]*/
+    Syn_filt(Ap2, xn, xn, L_SUBFR, mem_w0, 0);
+
+    return;
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.h
new file mode 100644 (file)
index 0000000..ee283dc
--- /dev/null
@@ -0,0 +1,122 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: spreproc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, spreproc.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef spreproc_h
+#define spreproc_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "cnst.h"
+#include "mode.h"
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    void subframePreProc(
+        enum Mode mode,            /* i  : coder mode                            */
+        const Word16 gamma1[],     /* i  : spectral exp. factor 1                */
+        const Word16 gamma1_12k2[],/* i  : spectral exp. factor 1 for EFR        */
+        const Word16 gamma2[],     /* i  : spectral exp. factor 2                */
+        Word16 *A,                 /* i  : A(z) unquantized for the 4 subframes  */
+        Word16 *Aq,                /* i  : A(z)   quantized for the 4 subframes  */
+        Word16 *speech,            /* i  : speech segment                        */
+        Word16 *mem_err,           /* i  : pointer to error signal               */
+        Word16 *mem_w0,            /* i  : memory of weighting filter            */
+        Word16 *zero,              /* i  : pointer to zero vector                */
+        Word16 ai_zero[],          /* o  : history of weighted synth. filter     */
+        Word16 exc[],              /* o  : long term prediction residual         */
+        Word16 h1[],               /* o  : impulse response                      */
+        Word16 xn[],               /* o  : target vector for pitch search        */
+        Word16 res2[],             /* o  : long term prediction residual         */
+        Word16 error[]             /* o  : error of LPC synthesis filter         */
+    );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* spreproc_h */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.cpp
new file mode 100644 (file)
index 0000000..3e2c234
--- /dev/null
@@ -0,0 +1,277 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: spstproc.cpp
+ Functions: subframePostProc
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+    Subframe post processing
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "spstproc.h"
+#include "syn_filt.h"
+#include "cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: subframePostProc
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+
+ Inputs:
+    speech    -- Pointer to Word16 -- speech segment
+    mode      -- enum Mode         -- coder mode
+    i_subfr   -- Word16 -- Subframe nr
+    gain_pit  -- Word16 -- Pitch gain  Q14
+    gain_code -- Word16 -- Decoded innovation gain
+    Aq        -- Pointer to Word16 -- A(z) quantized for the 4 subframes
+    synth     -- Word16 Array -- Local synthesis
+    xn        -- Word16 Array -- Target vector for pitch search
+    code      -- Word16 Array -- Fixed codebook exitation
+    y1        -- Word16 Array -- Filtered adaptive exitation
+    y2        -- Word16 Array -- Filtered fixed codebook excitation
+    mem_syn   -- Pointer to Word16 -- memory of synthesis filter
+
+ Outputs:
+    mem_syn -- Pointer to Word16 -- memory of synthesis filter
+    mem_err -- Pointer to Word16 -- pointer to error signal
+    mem_w0  -- Pointer to Word16 -- memory of weighting filter
+    exc     -- Pointer to Word16 -- long term prediction residual
+    sharp   -- Pointer to Word16 -- pitch sharpening value
+    pOverflow -- Pointer to Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ spstproc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void subframePostProc(
+    Word16 *speech,   /* i   : speech segment                        */
+    enum Mode mode,   /* i   : coder mode                            */
+    Word16 i_subfr,   /* i   : Subframe nr                           */
+    Word16 gain_pit,  /* i   : Pitch gain                       Q14  */
+    Word16 gain_code, /* i   : Decoded innovation gain               */
+    Word16 *Aq,       /* i   : A(z) quantized for the 4 subframes    */
+    Word16 synth[],   /* i   : Local snthesis                        */
+    Word16 xn[],      /* i   : Target vector for pitch search        */
+    Word16 code[],    /* i   : Fixed codebook exitation              */
+    Word16 y1[],      /* i   : Filtered adaptive exitation           */
+    Word16 y2[],      /* i   : Filtered fixed codebook excitation    */
+    Word16 *mem_syn,  /* i/o : memory of synthesis filter            */
+    Word16 *mem_err,  /* o   : pointer to error signal               */
+    Word16 *mem_w0,   /* o   : memory of weighting filter            */
+    Word16 *exc,      /* o   : long term prediction residual         */
+    Word16 *sharp,    /* o   : pitch sharpening value                */
+    Flag   *pOverflow /* o   : overflow indicator                    */
+)
+{
+    Word16 i;
+    Word16 j;
+    Word16 temp;
+    Word32 L_temp;
+    Word32 L_temp2;
+    Word16 tempShift;
+    Word16 kShift;
+    Word16 pitch_fac;
+    Word16 *p_exc;
+    Word16 *p_code;
+
+    OSCL_UNUSED_ARG(pOverflow);
+
+    if (mode != MR122)
+    {
+        tempShift = 1;
+        kShift = 16 - 2 - 1;
+        pitch_fac = gain_pit;
+    }
+    else
+    {
+        tempShift = 2;
+        kShift = 16 - 4 - 1;
+        pitch_fac = gain_pit >> 1;
+    }
+
+    /*------------------------------------------------------------*
+     * - Update pitch sharpening "sharp" with quantized gain_pit  *
+     *------------------------------------------------------------*/
+
+    if (gain_pit < SHARPMAX)
+    {
+        *sharp = gain_pit;
+    }
+    else
+    {
+        *sharp = SHARPMAX;
+    }
+
+    /*------------------------------------------------------*
+     * - Find the total excitation                          *
+     * - find synthesis speech corresponding to exc[]       *
+     * - update filters memories for finding the target     *
+     *   vector in the next subframe                        *
+     *   (update error[-m..-1] and mem_w_err[])             *
+     *------------------------------------------------------*/
+
+    p_exc  = &exc[ i_subfr];
+    p_code = &code[0];
+
+    for (i = L_SUBFR >> 1; i != 0 ; i--)
+    {
+        /* exc[i] = gain_pit*exc[i] + gain_code*code[i]; */
+
+        /*
+         *                      12k2  others
+         * ---------------------------------
+         * exc                   Q0      Q0
+         * gain_pit              Q14     Q14
+         * pitch_fac             Q13     Q14
+         *    product:           Q14     Q15
+         *
+         * code                  Q12     Q13
+         * gain_code             Q1      Q1
+         *    product            Q14     Q15
+         *    sum                Q14     Q15
+         *
+         * tempShift             2       1
+         *    sum<<tempShift     Q16     Q16
+         * result -> exc         Q0      Q0
+         */
+        L_temp     = ((Word32) * (p_exc++) * pitch_fac) << 1;
+        L_temp2    = ((Word32) * (p_exc--) * pitch_fac) << 1;
+        L_temp    += ((Word32) * (p_code++) * gain_code) << 1;
+        L_temp2   += ((Word32) * (p_code++) * gain_code) << 1;
+        L_temp   <<=  tempShift;
+        L_temp2  <<=  tempShift;
+        *(p_exc++) = (Word16)((L_temp  + 0x08000L) >> 16);
+        *(p_exc++) = (Word16)((L_temp2 + 0x08000L) >> 16);
+
+    }
+
+    Syn_filt(
+        Aq,
+        &exc[i_subfr],
+        &synth[i_subfr],
+        L_SUBFR,
+        mem_syn,
+        1);
+
+    for (i = L_SUBFR - M, j = 0; i < L_SUBFR; i++, j++)
+    {
+        mem_err[j] = speech[i_subfr + i] - synth[i_subfr + i];
+
+        /*
+         *                      12k2  others
+         * ---------------------------------
+         * y1                    Q0      Q0
+         * gain_pit              Q14     Q14
+         *    product            Q15     Q15
+         *    shifted prod.      Q16     Q16
+         * temp                  Q0      Q0
+         *
+         * y2                    Q10     Q12
+         * gain_code             Q1      Q1
+         *    product            Q12     Q14
+         * kshift                 4       2
+         *    shifted prod.      Q16     Q16
+         * k                     Q0      Q0
+         * mem_w0,xn,sum         Q0      Q0
+         */
+
+        L_temp = ((Word32)y1[i] * gain_pit);
+        temp  = (Word16)(L_temp >> 14);
+
+        L_temp = ((Word32)y2[i] * gain_code);
+        temp += (Word16)(L_temp >> kShift);
+
+        mem_w0[j] = xn[i] - temp;
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.h
new file mode 100644 (file)
index 0000000..4c12279
--- /dev/null
@@ -0,0 +1,122 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: spstproc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, spstproc.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef spstproc_h
+#define spstproc_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void subframePostProc(
+        Word16 *speech,   /* i   : speech segment                        */
+        enum Mode mode,   /* i   : coder mode                            */
+        Word16 i_subfr,   /* i   : Subframe nr                           */
+        Word16 gain_pit,  /* i   : Pitch gain                       Q14  */
+        Word16 gain_code, /* i   : Decoded innovation gain               */
+        Word16 *Aq,       /* i   : A(z) quantized for the 4 subframes    */
+        Word16 synth[],   /* i   : Local snthesis                        */
+        Word16 xn[],      /* i   : Target vector for pitch search        */
+        Word16 code[],    /* i   : Fixed codebook exitation              */
+        Word16 y1[],      /* i   : Filtered adaptive exitation           */
+        Word16 y2[],      /* i   : Filtered fixed codebook excitation    */
+        Word16 *mem_syn,  /* i/o : memory of synthesis filter            */
+        Word16 *mem_err,  /* o   : pointer to error signal               */
+        Word16 *mem_w0,   /* o   : memory of weighting filter            */
+        Word16 *exc,      /* o   : long term prediction residual         */
+        Word16 *sharp,    /* o   : pitch sharpening value                */
+        Flag   *pOverflow
+    );
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* spstproc_h */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.cpp
new file mode 100644 (file)
index 0000000..8418c70
--- /dev/null
@@ -0,0 +1,683 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ton_stab.cpp
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "ton_stab.h"
+#include "oper_32b.h"
+#include "cnst.h"
+#include "set_zero.h"
+#include "basic_op.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ton_stab_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to pointer to structure type tonStabState.
+
+ Outputs:
+    None
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function:   ton_stab_init
+  Purpose:    Allocates state memory and initializes state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+  None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ton_stab.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int ton_stab_init (tonStabState **state)
+{
+    tonStabState* s;
+
+    if (state == (tonStabState **) NULL){
+        // fprintf(stderr, "ton_stab_init: invalid parameter\n");
+        return -1;
+    }
+    *state = NULL;
+
+    // allocate memory
+    if ((s= (tonStabState *) malloc(sizeof(tonStabState))) == NULL){
+        // fprintf(stderr, "ton_stab_init: can not malloc state structure\n");
+        return -1;
+    }
+
+    ton_stab_reset(s);
+
+    *state = s;
+
+    return 0;
+}
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 ton_stab_init(tonStabState **state)
+{
+    tonStabState* s;
+
+    if (state == (tonStabState **) NULL)
+    {
+        /* fprintf(stderr, "ton_stab_init: invalid parameter\n"); */
+        return -1;
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (tonStabState *) oscl_malloc(sizeof(tonStabState))) == NULL)
+    {
+        /* fprintf(stderr, "ton_stab_init: can not malloc state structure\n"); */
+        return -1;
+    }
+
+    ton_stab_reset(s);
+
+    *state = s;
+
+    return 0;
+}
+
+/****************************************************************************/
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ton_stab_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st = pointer to pointer to structure type tonStabState.
+
+ Outputs:
+    None
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function:   ton_stab_reset
+  Purpose:    Initializes state memory to zero
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ton_stab.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+int ton_stab_reset (tonStabState *st)
+{
+    if (st == (tonStabState *) NULL){
+        // fprintf(stderr, "ton_stab_init: invalid parameter\n");
+        return -1;
+    }
+
+    // initialize tone stabilizer state
+    st->count = 0;
+    Set_zero(st->gp, N_FRAME);    // Init Gp_Clipping
+
+    return 0;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 ton_stab_reset(tonStabState *st)
+{
+    if (st == (tonStabState *) NULL)
+    {
+        /* fprintf(stderr, "ton_stab_init: invalid parameter\n"); */
+        return -1;
+    }
+
+    /* initialize tone stabilizer state */
+    st->count = 0;
+    /* Init Gp_Clipping */
+    oscl_memset((void *)st->gp,  0, N_FRAME*sizeof(*st->gp));
+
+
+    return 0;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: ton_stab_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to pointer to structure type tonStabState.
+
+ Outputs:
+    None
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function:   ton_stab_exit
+  Purpose:    The memory used for state memory is freed
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ton_stab.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void ton_stab_exit (tonStabState **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    // deallocate memory
+    free(*state);
+    *state = NULL;
+
+    return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void ton_stab_exit(tonStabState **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: check_lsp
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to pointer to structure type tonStabState.
+    lsp   = pointer to unquantized LSPs of type Word16
+
+ Outputs:
+    pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function:  check_lsp()
+  Purpose:   Check the LSP's to detect resonances
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ton_stab.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 check_lsp(tonStabState *st, // i/o : State struct
+                 Word16 *lsp       // i   : unquantized LSP's
+)
+{
+   Word16 i, dist, dist_min1, dist_min2, dist_th;
+
+   // Check for a resonance:
+   // Find minimum distance between lsp[i] and lsp[i+1]
+
+   dist_min1 = MAX_16;
+   for (i = 3; i < M-2; i++)
+   {
+      dist = sub(lsp[i], lsp[i+1]);
+
+      if (sub(dist, dist_min1) < 0)
+      {
+         dist_min1 = dist;
+      }
+   }
+
+   dist_min2 = MAX_16;
+   for (i = 1; i < 3; i++)
+   {
+      dist = sub(lsp[i], lsp[i+1]);
+
+      if (sub(dist, dist_min2) < 0)
+      {
+         dist_min2 = dist;
+      }
+   }
+
+   if (sub(lsp[1], 32000) > 0)
+   {
+      dist_th = 600;
+   }
+   else if (sub(lsp[1], 30500) > 0)
+   {
+      dist_th = 800;
+   }
+   else
+   {
+      dist_th = 1100;
+   }
+
+   if (sub(dist_min1, 1500) < 0 ||
+       sub(dist_min2, dist_th) < 0)
+   {
+      st->count = add(st->count, 1);
+   }
+   else
+   {
+      st->count = 0;
+   }
+
+   // Need 12 consecutive frames to set the flag
+   if (sub(st->count, 12) >= 0)
+   {
+      st->count = 12;
+      return 1;
+   }
+   else
+   {
+      return 0;
+   }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 check_lsp(tonStabState *st, /* i/o : State struct            */
+                 Word16 *lsp,      /* i   : unquantized LSP's       */
+                 Flag  *pOverflow
+                )
+{
+    Word16 i;
+    Word16 dist;
+    Word16 dist_min1;
+    Word16 dist_min2;
+    Word16 dist_th;
+    Word16 *p_lsp   = &lsp[3];
+    Word16 *p_lsp_1 = &lsp[4];
+
+    OSCL_UNUSED_ARG(pOverflow);
+    /* Check for a resonance:                             */
+    /* Find minimum distance between lsp[i] and lsp[i+1]  */
+
+    dist_min1 = MAX_16;
+    for (i = 3; i < M - 2; i++)
+    {
+        dist = *(p_lsp++) - *(p_lsp_1++);
+
+        if (dist < dist_min1)
+        {
+            dist_min1 = dist;
+        }
+    }
+
+    dist_min2 = MAX_16;
+    p_lsp   = &lsp[1];
+    p_lsp_1 = &lsp[2];
+
+    for (i = 1; i < 3; i++)
+    {
+        dist = *(p_lsp++) - *(p_lsp_1++);
+
+        if (dist < dist_min2)
+        {
+            dist_min2 = dist;
+        }
+    }
+
+    if (lsp[1] > 32000)
+    {
+        dist_th = 600;
+    }
+    else if (lsp[1] > 30500)
+    {
+        dist_th = 800;
+    }
+    else
+    {
+        dist_th = 1100;
+    }
+
+    if ((dist_min1 < 1500) || (dist_min2 < dist_th))
+    {
+        st->count++;
+    }
+    else
+    {
+        st->count = 0;
+    }
+
+    /* Need 12 consecutive frames to set the flag */
+    if (st->count >= 12)
+    {
+        st->count = 12;
+        return 1;
+    }
+    else
+    {
+        return 0;
+    }
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: check_gp_clipping
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to pointer to structure type tonStabState.
+    g_pitch = pitch gain of type Word16
+
+ Outputs:
+    pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function:   Check_Gp_Clipping()
+  Purpose:    Verify that the sum of the last (N_FRAME+1) pitch
+              gains is under a certain threshold.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ton_stab.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+Word16 check_gp_clipping(tonStabState *st, // i/o : State struct
+                         Word16 g_pitch    // i   : pitch gain
+)
+{
+   Word16 i, sum;
+
+   sum = shr(g_pitch, 3);          // Division by 8
+   for (i = 0; i < N_FRAME; i++)
+   {
+      sum = add(sum, st->gp[i]);
+   }
+
+   if (sub(sum, GP_CLIP) > 0)
+   {
+      return 1;
+   }
+   else
+   {
+      return 0;
+   }
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 check_gp_clipping(tonStabState *st, /* i/o : State struct            */
+                         Word16 g_pitch,   /* i   : pitch gain              */
+                         Flag   *pOverflow
+                        )
+{
+    Word16 i;
+    Word16 sum;
+
+    sum = shr(g_pitch, 3, pOverflow);        /* Division by 8 */
+    for (i = 0; i < N_FRAME; i++)
+    {
+        sum = add_16(sum, st->gp[i], pOverflow);
+    }
+
+    if (sum > GP_CLIP)
+    {
+        return 1;
+    }
+    else
+    {
+        return 0;
+    }
+}
+
+/****************************************************************************/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: update_gp_clipping
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state = pointer to pointer to structure type tonStabState.
+    g_pitch = pitch gain of type Word16
+
+ Outputs:
+    pOverflow = 1 if there is an overflow else it is zero.
+
+ Returns:
+    None.
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function:  Update_Gp_Clipping()
+  Purpose:   Update past pitch gain memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ ton_stab.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void update_gp_clipping(tonStabState *st, // i/o : State struct
+                        Word16 g_pitch    // i   : pitch gain
+)
+{
+   Copy(&st->gp[1], &st->gp[0], N_FRAME-1);
+   st->gp[N_FRAME-1] = shr(g_pitch, 3);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void update_gp_clipping(tonStabState *st, /* i/o : State struct            */
+                        Word16 g_pitch,   /* i   : pitch gain              */
+                        Flag   *pOverflow
+                       )
+{
+    OSCL_UNUSED_ARG(pOverflow);
+    for (int i = 0; i < N_FRAME - 1; i++)
+    {
+        st->gp[i] = st->gp[i+1];
+    }
+    st->gp[N_FRAME-1] =  g_pitch >> 3;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.h
new file mode 100644 (file)
index 0000000..90e5378
--- /dev/null
@@ -0,0 +1,144 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: ton_stab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+     File             : ton_stab.h
+     Purpose          : Tone stabilization routines
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef TON_STAB_H
+#define TON_STAB_H
+#define ton_stab_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    /* state variable */
+    typedef struct
+    {
+        /* counters */
+        Word16 count;
+        /* gain history Q11 */
+        Word16 gp[N_FRAME];
+    } tonStabState;
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 ton_stab_init(tonStabState **st);
+    /* initialize one instance of the pre processing state.
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to ton_stab in each call.
+       returns 0 on success
+     */
+
+    Word16 ton_stab_reset(tonStabState *st);
+    /* reset of pre processing state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+
+    void ton_stab_exit(tonStabState **st);
+    /* de-initialize pre processing state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    Word16 check_lsp(tonStabState *st, /* i/o : State struct            */
+                     Word16 *lsp,      /* i   : unquantized LSP's       */
+                     Flag   *pOverflow
+                    );
+
+    Word16 check_gp_clipping(tonStabState *st, /* i/o : State struct          */
+                             Word16 g_pitch,   /* i   : pitch gain            */
+                             Flag  *pOverflow
+                            );
+
+    void update_gp_clipping(tonStabState *st, /* i/o : State struct            */
+                            Word16 g_pitch,   /* i   : pitch gain              */
+                            Flag  *pOverflow
+                           );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TON_STAB_H_ */
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.cpp
new file mode 100644 (file)
index 0000000..d949b6c
--- /dev/null
@@ -0,0 +1,2013 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: vad1.cpp
+ Functions:
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "vad.h"
+#include "typedef.h"
+#include "shr.h"
+#include "basic_op.h"
+#include "cnst_vad.h"
+#include "oscl_mem.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: first_filter_stage
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    data -- array of type Word16 -- filter memory
+    in   -- array of type Word16 -- input signal
+
+ Outputs:
+    data -- array of type Word16 -- filter memory
+    out  -- array of type Word16 -- output values, every other
+                                    output is low-pass part and
+                                    other is high-pass part every
+
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Scale input down by one bit. Calculate 5th order
+                half-band lowpass/highpass filter pair with
+                decimation.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void first_filter_stage(
+    Word16 in[],      /* i   : input signal                  */
+    Word16 out[],     /* o   : output values, every other    */
+    /*       output is low-pass part and   */
+    /*       other is high-pass part every */
+    Word16 data[],    /* i/o : filter memory                 */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs   */
+)
+{
+    Word16 temp0;
+    Word16 temp1;
+    Word16 temp2;
+    Word16 temp3;
+    Word16 i;
+    Word16 data0;
+    Word16 data1;
+
+    data0 = data[0];
+    data1 = data[1];
+
+    for (i = 0; i < FRAME_LEN / 4; i++)
+    {
+//        temp0 = mult(COEFF5_1, data0, pOverflow);
+        temp0 = (Word16)(((Word32)COEFF5_1 * data0) >> 15);
+        temp1 = in[4*i+0] >> 2;
+        temp0 = sub(temp1, temp0, pOverflow);
+
+//        temp1 = mult(COEFF5_1, temp0, pOverflow);
+        temp1 = (Word16)(((Word32)COEFF5_1 * temp0) >> 15);
+        temp1 = add_16(data0, temp1, pOverflow);
+
+//        temp3 = mult(COEFF5_2, data1, pOverflow);
+        temp3 = (Word16)(((Word32)COEFF5_2 * data1) >> 15);
+
+        temp2 = in[4*i+1] >> 2;
+
+        temp3 = sub(temp2, temp3, pOverflow);
+
+//        temp2 = mult(COEFF5_2, temp3, pOverflow);
+        temp2 = (Word16)(((Word32)COEFF5_2 * temp3) >> 15);
+
+        temp2 = add_16(data1, temp2, pOverflow);
+
+        out[4*i+0] = add_16(temp1, temp2, pOverflow);
+        out[4*i+1] = sub(temp1, temp2, pOverflow);
+
+//        temp1 = mult(COEFF5_1, temp0, pOverflow);
+        temp1 = (Word16)(((Word32)COEFF5_1 * temp0) >> 15);
+
+        temp2 = in[4*i+2] >> 2;
+        data0 = sub(temp2, temp1, pOverflow);
+
+//        temp1 = mult(COEFF5_1, data0, pOverflow);
+        temp1 = (Word16)(((Word32)COEFF5_1 * data0) >> 15);
+
+        temp1 = add_16(temp0, temp1, pOverflow);
+
+//        data1 = mult(COEFF5_2, temp3, pOverflow);
+        data1 = (Word16)(((Word32)COEFF5_2 * temp3) >> 15);
+        temp2 = in[4*i+3] >> 2;
+        data1 = sub(temp2, data1, pOverflow);
+
+//        temp2 = mult(COEFF5_2, data1, pOverflow);
+        temp2 = (Word16)(((Word32)COEFF5_2 * data1) >> 15);
+        temp2 = add_16(temp3, temp2, pOverflow);
+
+        out[4*i+2] = add_16(temp1, temp2, pOverflow);
+        out[4*i+3] = sub(temp1, temp2, pOverflow);
+    }
+
+    data[0] = data0;
+    data[1] = data1;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: filter5
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    in0 -- array of type Word16 -- input values; output low-pass part
+    in1 -- array of type Word16 -- input values; output high-pass part
+    data -- array of type Word16 -- updated filter memory
+
+ Outputs:
+    in0 -- array of type Word16 -- input values; output low-pass part
+    in1 -- array of type Word16 -- input values; output high-pass part
+    data -- array of type Word16 -- updated filter memory
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Fifth-order half-band lowpass/highpass filter pair with
+                decimation.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void filter5(Word16 *in0,    /* i/o : input values; output low-pass part  */
+                    Word16 *in1,    /* i/o : input values; output high-pass part */
+                    Word16 data[],  /* i/o : updated filter memory               */
+                    Flag  *pOverflow  /* o : Flag set when overflow occurs       */
+                   )
+{
+    Word16 temp0;
+    Word16 temp1;
+    Word16 temp2;
+
+    temp0 = mult(COEFF5_1, data[0], pOverflow);
+    temp0 = sub(*in0, temp0, pOverflow);
+
+    temp1 = mult(COEFF5_1, temp0, pOverflow);
+    temp1 = add_16(data[0], temp1, pOverflow);
+    data[0] = temp0;
+
+    temp0 = mult(COEFF5_2, data[1], pOverflow);
+    temp0 = sub(*in1, temp0, pOverflow);
+
+    temp2 = mult(COEFF5_2, temp0, pOverflow);
+    temp2 = add_16(data[1], temp2, pOverflow);
+
+    data[1] = temp0;
+
+    temp0 = add_16(temp1, temp2, pOverflow);
+    *in0 = shr(temp0, 1, pOverflow);
+
+    temp0 = sub(temp1, temp2, pOverflow);
+    *in1 = shr(temp0, 1, pOverflow);
+}
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: filter3
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+
+ Inputs:
+    in0 -- array of type Word16 -- input values; output low-pass part
+    in1 -- array of type Word16 -- input values; output high-pass part
+    data -- array of type Word16 -- updated filter memory
+
+ Outputs:
+    in0 -- array of type Word16 -- input values; output low-pass part
+    in1 -- array of type Word16 -- input values; output high-pass part
+    data -- array of type Word16 -- updated filter memory
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Third-order half-band lowpass/highpass filter pair with
+                decimation.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void filter3(
+    Word16 *in0,      /* i/o : input values; output low-pass part  */
+    Word16 *in1,      /* i/o : input values; output high-pass part */
+    Word16 *data,     /* i/o : updated filter memory               */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs         */
+)
+{
+    Word16 temp1;
+    Word16 temp2;
+
+    temp1 = mult(COEFF3, *data, pOverflow);
+    temp1 = sub(*in1, temp1, pOverflow);
+
+    temp2 = mult(COEFF3, temp1, pOverflow);
+    temp2 = add_16(*data, temp2, pOverflow);
+
+    *data = temp1;
+
+    temp1 = sub(*in0, temp2, pOverflow);
+
+    *in1 = shr(temp1, 1, pOverflow);
+
+    temp1 = add_16(*in0, temp2, pOverflow);
+
+    *in0 = shr(temp1, 1, pOverflow);
+}
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: level_calculation
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    data -- array of type Word16 -- signal buffer
+    sub_level -- pointer to type Word16 -- level calculated at the end of
+                                           the previous frame
+
+    count1 -- Word16 -- number of samples to be counted
+    count2 -- Word16 -- number of samples to be counted
+    ind_m  -- Word16 -- step size for the index of the data buffer
+    ind_a  -- Word16 -- starting index of the data buffer
+    scale  -- Word16 -- scaling for the level calculation
+
+ Outputs:
+    sub_level -- pointer to tyep Word16 -- level of signal calculated from the
+                                           last (count2 - count1) samples.
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    signal level
+
+ Global Variables Used:
+
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Calculate signal level in a sub-band. Level is calculated
+                by summing absolute values of the input data.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 level_calculation(
+    Word16 data[],     /* i   : signal buffer                                */
+    Word16 *sub_level, /* i   : level calculate at the end of                */
+    /*       the previous frame                           */
+    /* o   : level of signal calculated from the last     */
+    /*       (count2 - count1) samples                    */
+    Word16 count1,     /* i   : number of samples to be counted              */
+    Word16 count2,     /* i   : number of samples to be counted              */
+    Word16 ind_m,      /* i   : step size for the index of the data buffer   */
+    Word16 ind_a,      /* i   : starting index of the data buffer            */
+    Word16 scale,      /* i   : scaling for the level calculation            */
+    Flag  *pOverflow   /* o : Flag set when overflow occurs                  */
+)
+{
+    Word32 l_temp1;
+    Word32 l_temp2;
+    Word16 level;
+    Word16 i;
+
+    l_temp1 = 0L;
+
+    for (i = count1; i < count2; i++)
+    {
+        l_temp1 = L_mac(l_temp1, 1, abs_s(data[ind_m*i+ind_a]), pOverflow);
+    }
+
+    l_temp2 = L_add(l_temp1, L_shl(*sub_level, sub(16, scale, pOverflow), pOverflow), pOverflow);
+    *sub_level = (Word16)(L_shl(l_temp1, scale, pOverflow) >> 16);
+
+    for (i = 0; i < count1; i++)
+    {
+        l_temp2 = L_mac(l_temp2, 1, abs_s(data[ind_m*i+ind_a]), pOverflow);
+    }
+    level = (Word16)(L_shl(l_temp2, scale, pOverflow) >> 16);
+
+    return level;
+}
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: filter_bank
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    in -- array of type Word16 -- input frame
+
+ Outputs:
+    level -- array of type Word16 -- signal levels at each band
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Divides input signal into 9-bands and calculas level of
+                the signal in each band
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void filter_bank(
+    vadState1 *st,    /* i/o : State struct                    */
+    Word16 in[],      /* i   : input frame                     */
+    Word16 level[],   /* 0   : signal levels at each band      */
+    Flag  *pOverflow  /* o   : Flag set when overflow occurs   */
+)
+{
+    Word16 i;
+    Word16 tmp_buf[FRAME_LEN];
+
+    /* calculate the filter bank */
+
+    first_filter_stage(in, tmp_buf, st->a_data5[0], pOverflow);
+
+    for (i = 0; i < FRAME_LEN / 4; i++)
+    {
+        filter5(&tmp_buf[4*i], &tmp_buf[4*i+2], st->a_data5[1], pOverflow);
+        filter5(&tmp_buf[4*i+1], &tmp_buf[4*i+3], st->a_data5[2], pOverflow);
+    }
+    for (i = 0; i < FRAME_LEN / 8; i++)
+    {
+        filter3(&tmp_buf[8*i+0], &tmp_buf[8*i+4], &st->a_data3[0], pOverflow);
+        filter3(&tmp_buf[8*i+2], &tmp_buf[8*i+6], &st->a_data3[1], pOverflow);
+        filter3(&tmp_buf[8*i+3], &tmp_buf[8*i+7], &st->a_data3[4], pOverflow);
+    }
+
+    for (i = 0; i < FRAME_LEN / 16; i++)
+    {
+        filter3(&tmp_buf[16*i+0], &tmp_buf[16*i+8], &st->a_data3[2], pOverflow);
+        filter3(&tmp_buf[16*i+4], &tmp_buf[16*i+12], &st->a_data3[3], pOverflow);
+    }
+
+    /* calculate levels in each frequency band */
+
+    /* 3000 - 4000 Hz*/
+    level[8] = level_calculation(tmp_buf, &st->sub_level[8], FRAME_LEN / 4 - 8,
+                                 FRAME_LEN / 4, 4, 1, 15, pOverflow);
+    /* 2500 - 3000 Hz*/
+    level[7] = level_calculation(tmp_buf, &st->sub_level[7], FRAME_LEN / 8 - 4,
+                                 FRAME_LEN / 8, 8, 7, 16, pOverflow);
+    /* 2000 - 2500 Hz*/
+    level[6] = level_calculation(tmp_buf, &st->sub_level[6], FRAME_LEN / 8 - 4,
+                                 FRAME_LEN / 8, 8, 3, 16, pOverflow);
+    /* 1500 - 2000 Hz*/
+    level[5] = level_calculation(tmp_buf, &st->sub_level[5], FRAME_LEN / 8 - 4,
+                                 FRAME_LEN / 8, 8, 2, 16, pOverflow);
+    /* 1000 - 1500 Hz*/
+    level[4] = level_calculation(tmp_buf, &st->sub_level[4], FRAME_LEN / 8 - 4,
+                                 FRAME_LEN / 8, 8, 6, 16, pOverflow);
+    /* 750 - 1000 Hz*/
+    level[3] = level_calculation(tmp_buf, &st->sub_level[3], FRAME_LEN / 16 - 2,
+                                 FRAME_LEN / 16, 16, 4, 16, pOverflow);
+    /* 500 - 750 Hz*/
+    level[2] = level_calculation(tmp_buf, &st->sub_level[2], FRAME_LEN / 16 - 2,
+                                 FRAME_LEN / 16, 16, 12, 16, pOverflow);
+    /* 250 - 500 Hz*/
+    level[1] = level_calculation(tmp_buf, &st->sub_level[1], FRAME_LEN / 16 - 2,
+                                 FRAME_LEN / 16, 16, 8, 16, pOverflow);
+    /* 0 - 250 Hz*/
+    level[0] = level_calculation(tmp_buf, &st->sub_level[0], FRAME_LEN / 16 - 2,
+                                 FRAME_LEN / 16, 16, 0, 16, pOverflow);
+}
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: update_cntrl
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    level -- array of type Word16 -- sub-band levels of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose    : Control update of the background noise estimate.
+ Inputs     : pitch:      flags for pitch detection
+              stat_count: stationary counter
+              tone:       flags indicating presence of a tone
+              complex:      flags for complex  detection
+              vadreg:     intermediate VAD flags
+ Output     : stat_count: stationary counter
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void update_cntrl(
+    vadState1 *st,   /* i/o : State struct                       */
+    Word16 level[],  /* i   : sub-band levels of the input frame */
+    Flag  *pOverflow /* o   : Flag set when overflow occurs      */
+)
+{
+    Word16 i;
+    Word16 temp;
+    Word16 stat_rat;
+    Word16 exp;
+    Word16 num;
+    Word16 denom;
+    Word16 alpha;
+
+    /* handle highband complex signal input  separately       */
+    /* if ther has been highband correlation for some time    */
+    /* make sure that the VAD update speed is low for a while */
+    if (st->complex_warning != 0)
+    {
+        if (st->stat_count < CAD_MIN_STAT_COUNT)
+        {
+            st->stat_count = CAD_MIN_STAT_COUNT;
+        }
+    }
+    /* NB stat_count is allowed to be decreased by one below again  */
+    /* deadlock in speech is not possible unless the signal is very */
+    /* complex and need a high rate                                 */
+
+    /* if fullband pitch or tone have been detected for a while, initialize stat_count */
+    if (((Word16)(st->pitch & 0x6000) == 0x6000) ||
+            ((Word16)(st->tone & 0x7c00) == 0x7c00))
+    {
+        st->stat_count = STAT_COUNT;
+    }
+    else
+    {
+        /* if 8 last vad-decisions have been "0", reinitialize stat_count */
+        if ((st->vadreg & 0x7f80) == 0)
+        {
+            st->stat_count = STAT_COUNT;
+        }
+        else
+        {
+            stat_rat = 0;
+            for (i = 0; i < COMPLEN; i++)
+            {
+                if (level[i] > st->ave_level[i])
+                {
+                    num = level[i];
+                    denom = st->ave_level[i];
+                }
+                else
+                {
+                    num = st->ave_level[i];
+                    denom = level[i];
+                }
+                /* Limit nimimum value of num and denom to STAT_THR_LEVEL */
+                if (num < STAT_THR_LEVEL)
+                {
+                    num = STAT_THR_LEVEL;
+                }
+                if (denom < STAT_THR_LEVEL)
+                {
+                    denom = STAT_THR_LEVEL;
+                }
+
+                exp = norm_s(denom);
+
+                denom = shl(denom, exp, pOverflow);
+
+                /* stat_rat = num/denom * 64 */
+                temp = shr(num, 1, pOverflow);
+                temp = div_s(temp, denom);
+
+                stat_rat = add_16(stat_rat, shr(temp, sub(8, exp, pOverflow), pOverflow), pOverflow);
+            }
+
+            /* compare stat_rat with a threshold and update stat_count */
+            if (stat_rat > STAT_THR)
+            {
+                st->stat_count = STAT_COUNT;
+            }
+            else
+            {
+                if ((st->vadreg & 0x4000) != 0)
+                {
+                    if (st->stat_count != 0)
+                    {
+                        st->stat_count = sub(st->stat_count, 1, pOverflow);
+                    }
+                }
+            }
+        }
+    }
+
+    /* Update average amplitude estimate for stationarity estimation */
+    alpha = ALPHA4;
+    if (st->stat_count == STAT_COUNT)
+    {
+        alpha = 32767;
+    }
+    else if ((st->vadreg & 0x4000) == 0)
+    {
+        alpha = ALPHA5;
+    }
+
+    for (i = 0; i < COMPLEN; i++)
+    {
+        temp = sub(level[i], st->ave_level[i], pOverflow);
+        temp = mult_r(alpha, temp, pOverflow);
+
+        st->ave_level[i] =
+            add_16(
+                st->ave_level[i],
+                temp,
+                pOverflow);
+    }
+}
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: hangover_addition
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    noise_level -- Word16 -- average level of the noise estimates
+    low_power   -- Word16 -- flag power of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicato
+
+ Returns:
+    VAD_flag indicating final VAD decision (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Function     : hangover_addition
+ Purpose      : Add hangover for complex signal or after speech bursts
+ Inputs       : burst_count:  counter for the length of speech bursts
+                hang_count:   hangover counter
+                vadreg:       intermediate VAD decision
+ Outputs      : burst_count:  counter for the length of speech bursts
+                hang_count:   hangover counter
+ Return value : VAD_flag indicating final VAD decision
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 hangover_addition(
+    vadState1 *st,      /* i/o : State struct                     */
+    Word16 noise_level, /* i   : average level of the noise       */
+    /*       estimates                        */
+    Word16 low_power,   /* i   : flag power of the input frame    */
+    Flag  *pOverflow    /* o   : Flag set when overflow occurs    */
+)
+{
+    Word16 hang_len;
+    Word16 burst_len;
+
+    /*
+       Calculate burst_len and hang_len
+       burst_len: number of consecutive intermediate vad flags with "1"-decision
+                  required for hangover addition
+       hang_len:  length of the hangover
+       */
+
+    if (noise_level > HANG_NOISE_THR)
+    {
+        burst_len = BURST_LEN_HIGH_NOISE;
+        hang_len = HANG_LEN_HIGH_NOISE;
+    }
+    else
+    {
+        burst_len = BURST_LEN_LOW_NOISE;
+        hang_len = HANG_LEN_LOW_NOISE;
+    }
+
+    /* if the input power (pow_sum) is lower than a threshold, clear
+       counters and set VAD_flag to "0"  "fast exit"                 */
+    if (low_power != 0)
+    {
+        st->burst_count = 0;
+        st->hang_count = 0;
+        st->complex_hang_count = 0;
+        st->complex_hang_timer = 0;
+        return 0;
+    }
+
+    if (st->complex_hang_timer > CVAD_HANG_LIMIT)
+    {
+        if (st->complex_hang_count < CVAD_HANG_LENGTH)
+        {
+            st->complex_hang_count = CVAD_HANG_LENGTH;
+        }
+    }
+
+    /* long time very complex signal override VAD output function */
+    if (st->complex_hang_count != 0)
+    {
+        st->burst_count = BURST_LEN_HIGH_NOISE;
+        st->complex_hang_count = sub(st->complex_hang_count, 1, pOverflow);
+        return 1;
+    }
+    else
+    {
+        /* let hp_corr work in from a noise_period indicated by the VAD */
+        if (((st->vadreg & 0x3ff0) == 0) &&
+                (st->corr_hp_fast > CVAD_THRESH_IN_NOISE))
+        {
+            return 1;
+        }
+    }
+
+    /* update the counters (hang_count, burst_count) */
+    if ((st->vadreg & 0x4000) != 0)
+    {
+        st->burst_count = add_16(st->burst_count, 1, pOverflow);
+
+        if (st->burst_count >= burst_len)
+        {
+            st->hang_count = hang_len;
+        }
+        return 1;
+    }
+    else
+    {
+        st->burst_count = 0;
+        if (st->hang_count > 0)
+        {
+            st->hang_count = sub(st->hang_count, 1, pOverflow);
+            return 1;
+        }
+    }
+    return 0;
+}
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: noise_estimate_update
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    level -- array of type Word16 -- sub-band levels of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose    : Update of background noise estimate
+ Inputs     : bckr_est:   background noise estimate
+              pitch:      flags for pitch detection
+              stat_count: stationary counter
+ Outputs    : bckr_est:   background noise estimate
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void noise_estimate_update(
+    vadState1 *st,    /* i/o : State struct                       */
+    Word16 level[],   /* i   : sub-band levels of the input frame */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs        */
+)
+{
+    Word16 i;
+    Word16 alpha_up;
+    Word16 alpha_down;
+    Word16 bckr_add;
+
+    /* Control update of bckr_est[] */
+    update_cntrl(st, level, pOverflow);
+
+    /* Choose update speed */
+    bckr_add = 2;
+
+    if (((0x7800 & st->vadreg) == 0) &&
+            ((st->pitch & 0x7800) == 0)
+            && (st->complex_hang_count == 0))
+    {
+        alpha_up = ALPHA_UP1;
+        alpha_down = ALPHA_DOWN1;
+    }
+    else
+    {
+        if ((st->stat_count == 0)
+                && (st->complex_hang_count == 0))
+        {
+            alpha_up = ALPHA_UP2;
+            alpha_down = ALPHA_DOWN2;
+        }
+        else
+        {
+            alpha_up = 0;
+            alpha_down = ALPHA3;
+            bckr_add = 0;
+        }
+    }
+
+    /* Update noise estimate (bckr_est) */
+    for (i = 0; i < COMPLEN; i++)
+    {
+        Word16 temp;
+
+        temp = sub(st->old_level[i], st->bckr_est[i], pOverflow);
+
+        if (temp < 0)
+        { /* update downwards*/
+            temp = mult_r(alpha_down, temp, pOverflow);
+            temp = add_16(st->bckr_est[i], temp, pOverflow);
+
+            st->bckr_est[i] = add_16(-2, temp, pOverflow);
+
+            /* limit minimum value of the noise estimate to NOISE_MIN */
+            if (st->bckr_est[i] < NOISE_MIN)
+            {
+                st->bckr_est[i] = NOISE_MIN;
+            }
+        }
+        else
+        { /* update upwards */
+            temp = mult_r(alpha_up, temp, pOverflow);
+            temp = add_16(st->bckr_est[i], temp, pOverflow);
+            st->bckr_est[i] = add_16(bckr_add, temp, pOverflow);
+
+            /* limit maximum value of the noise estimate to NOISE_MAX */
+            if (st->bckr_est[i] > NOISE_MAX)
+            {
+                st->bckr_est[i] = NOISE_MAX;
+            }
+        }
+    }
+
+    /* Update signal levels of the previous frame (old_level) */
+    for (i = 0; i < COMPLEN; i++)
+    {
+        st->old_level[i] = level[i];
+    }
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: complex_estimate_adapt
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    low_power -- Word16 -- very low level flag of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Function   : complex_estimate_adapt
+ Purpose    : Update/adapt of complex signal estimate
+ Inputs     : low_power:   low signal power flag
+ Outputs    : st->corr_hp_fast:   long term complex signal estimate
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static void complex_estimate_adapt(
+    vadState1 *st,      /* i/o : VAD state struct                       */
+    Word16 low_power,   /* i   : very low level flag of the input frame */
+    Flag  *pOverflow    /* o : Flag set when overflow occurs            */
+)
+{
+    Word16 alpha;            /* Q15 */
+    Word32 L_tmp;            /* Q31 */
+
+
+    /* adapt speed on own state */
+    if (st->best_corr_hp < st->corr_hp_fast) /* decrease */
+    {
+        if (st->corr_hp_fast < CVAD_THRESH_ADAPT_HIGH)
+        {  /* low state  */
+            alpha = CVAD_ADAPT_FAST;
+        }
+        else
+        {  /* high state */
+            alpha = CVAD_ADAPT_REALLY_FAST;
+        }
+    }
+    else  /* increase */
+    {
+        if (st->corr_hp_fast < CVAD_THRESH_ADAPT_HIGH)
+        {
+            alpha = CVAD_ADAPT_FAST;
+        }
+        else
+        {
+            alpha = CVAD_ADAPT_SLOW;
+        }
+    }
+
+    L_tmp = ((Word32)st->corr_hp_fast << 16);
+    L_tmp = L_msu(L_tmp, alpha, st->corr_hp_fast, pOverflow);
+    L_tmp = L_mac(L_tmp, alpha, st->best_corr_hp, pOverflow);
+    st->corr_hp_fast = pv_round(L_tmp, pOverflow);           /* Q15 */
+
+    if (st->corr_hp_fast < CVAD_MIN_CORR)
+    {
+        st->corr_hp_fast = CVAD_MIN_CORR;
+    }
+
+    if (low_power != 0)
+    {
+        st->corr_hp_fast = CVAD_MIN_CORR;
+    }
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: complex_vad
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    low_power -- Word16 -- flag power of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+
+ Returns:
+    the complex background decision
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : complex background decision
+ Return value : the complex background decision
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 complex_vad(
+    vadState1 *st,    /* i/o : VAD state struct              */
+    Word16 low_power, /* i   : flag power of the input frame */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs   */
+)
+{
+    st->complex_high = shr(st->complex_high, 1, pOverflow);
+    st->complex_low = shr(st->complex_low, 1, pOverflow);
+
+    if (low_power == 0)
+    {
+        if (st->corr_hp_fast > CVAD_THRESH_ADAPT_HIGH)
+        {
+            st->complex_high |= 0x4000;
+        }
+
+        if (st->corr_hp_fast > CVAD_THRESH_ADAPT_LOW)
+        {
+            st->complex_low |= 0x4000;
+        }
+    }
+
+    if (st->corr_hp_fast > CVAD_THRESH_HANG)
+    {
+        st->complex_hang_timer = add_16(st->complex_hang_timer, 1, pOverflow);
+    }
+    else
+    {
+        st->complex_hang_timer =  0;
+    }
+
+    return ((Word16)(st->complex_high & 0x7f80) == 0x7f80 ||
+            (Word16)(st->complex_low & 0x7fff) == 0x7fff);
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad_decision
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    level -- array of type Word16 -- sub-band levels of the input frame
+    pow_sum -- Word32 -- power of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    VAD_flag (Word16)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Calculates VAD_flag
+ Inputs       : bckr_est:    background noise estimate
+                vadreg:      intermediate VAD flags
+ Outputs      : noise_level: average level of the noise estimates
+                vadreg:      intermediate VAD flags
+ Return value : VAD_flag
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+static Word16 vad_decision(
+    vadState1 *st,         /* i/o : State struct                       */
+    Word16 level[COMPLEN], /* i   : sub-band levels of the input frame */
+    Word32 pow_sum,        /* i   : power of the input frame           */
+    Flag  *pOverflow       /* o : Flag set when overflow occurs        */
+)
+{
+    Word16 i;
+    Word16 snr_sum;
+    Word32 L_temp;
+    Word16 vad_thr;
+    Word16 temp;
+    Word16 noise_level;
+    Word16 low_power_flag;
+    Word16 temp1;
+
+    /*
+       Calculate squared sum of the input levels (level)
+       divided by the background noise components (bckr_est).
+       */
+    L_temp = 0;
+
+    for (i = 0; i < COMPLEN; i++)
+    {
+        Word16 exp;
+
+        exp = norm_s(st->bckr_est[i]);
+        temp = shl(st->bckr_est[i], exp, pOverflow);
+        temp = div_s(shr(level[i], 1, pOverflow), temp);
+        temp = shl(temp, sub(exp, UNIRSHFT - 1, pOverflow), pOverflow);
+        L_temp = L_mac(L_temp, temp, temp, pOverflow);
+    }
+
+    snr_sum = (Word16)(L_shl(L_temp, 6, pOverflow) >> 16);
+    snr_sum = mult(snr_sum, INV_COMPLEN, pOverflow);
+
+    /* Calculate average level of estimated background noise */
+    L_temp = 0;
+    for (i = 0; i < COMPLEN; i++)
+    {
+        L_temp = L_add(L_temp, st->bckr_est[i], pOverflow);
+    }
+
+    noise_level = (Word16)(L_shl(L_temp, 13, pOverflow) >> 16);
+
+    /* Calculate VAD threshold */
+    temp1 = sub(noise_level, VAD_P1, pOverflow);
+    temp1 = mult(VAD_SLOPE, temp1, pOverflow);
+    vad_thr = add_16(temp1, VAD_THR_HIGH, pOverflow);
+
+    if (vad_thr < VAD_THR_LOW)
+    {
+        vad_thr = VAD_THR_LOW;
+    }
+
+    /* Shift VAD decision register */
+    st->vadreg = shr(st->vadreg, 1, pOverflow);
+
+    /* Make intermediate VAD decision */
+    if (snr_sum > vad_thr)
+    {
+        st->vadreg |= 0x4000;
+    }
+    /* primary vad decsion made */
+
+    /* check if the input power (pow_sum) is lower than a threshold" */
+    if (L_sub(pow_sum, VAD_POW_LOW, pOverflow) < 0)
+    {
+        low_power_flag = 1;
+    }
+    else
+    {
+        low_power_flag = 0;
+    }
+
+    /* update complex signal estimate st->corr_hp_fast and hangover reset timer using */
+    /* low_power_flag and corr_hp_fast  and various adaptation speeds                 */
+    complex_estimate_adapt(st, low_power_flag, pOverflow);
+
+    /* check multiple thresholds of the st->corr_hp_fast value */
+    st->complex_warning = complex_vad(st, low_power_flag, pOverflow);
+
+    /* Update speech subband vad background noise estimates */
+    noise_estimate_update(st, level, pOverflow);
+
+    /*  Add speech and complex hangover and return speech VAD_flag */
+    /*  long term complex hangover may be added */
+    st->speech_vad_decision = hangover_addition(st, noise_level, low_power_flag, pOverflow);
+
+    return (st->speech_vad_decision);
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad1_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- double pointer to type vadState1 -- pointer to memory to
+                                                 be initialized.
+
+ Outputs:
+    state -- points to initalized area in memory.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Allocates state memory and initializes state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 vad1_init(vadState1 **state)
+{
+    vadState1* s;
+
+    if (state == (vadState1 **) NULL)
+    {
+        return -1;
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (vadState1 *) oscl_malloc(sizeof(vadState1))) == NULL)
+    {
+        return -1;
+    }
+
+    vad1_reset(s);
+
+    *state = s;
+
+    return 0;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad1_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose:    Resets state memory to zero
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 vad1_reset(vadState1 *state)
+{
+    Word16 i;
+    Word16 j;
+
+    if (state == (vadState1 *) NULL)
+    {
+        return -1;
+    }
+
+    /* Initialize pitch detection variables */
+    state->oldlag_count = 0;
+    state->oldlag = 0;
+    state->pitch = 0;
+    state->tone = 0;
+
+    state->complex_high = 0;
+    state->complex_low = 0;
+    state->complex_hang_timer = 0;
+
+    state->vadreg = 0;
+
+    state->stat_count = 0;
+    state->burst_count = 0;
+    state->hang_count = 0;
+    state->complex_hang_count = 0;
+
+    /* initialize memory used by the filter bank */
+    for (i = 0; i < 3; i++)
+    {
+        for (j = 0; j < 2; j++)
+        {
+            state->a_data5[i][j] = 0;
+        }
+    }
+
+    for (i = 0; i < 5; i++)
+    {
+        state->a_data3[i] = 0;
+    }
+
+    /* initialize the rest of the memory */
+    for (i = 0; i < COMPLEN; i++)
+    {
+        state->bckr_est[i] = NOISE_INIT;
+        state->old_level[i] = NOISE_INIT;
+        state->ave_level[i] = NOISE_INIT;
+        state->sub_level[i] = 0;
+    }
+
+    state->best_corr_hp = CVAD_LOWPOW_RESET;
+
+    state->speech_vad_decision = 0;
+    state->complex_warning = 0;
+    state->sp_burst_count = 0;
+
+    state->corr_hp_fast = CVAD_LOWPOW_RESET;
+
+    return 0;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad1_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    The memory used for state memory is freed
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad1_exit(vadState1 **state)
+{
+    if (state == NULL || *state == NULL)
+        return;
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad_complex_detection_update
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    best_corr_hp -- Word16 -- best Corr
+    state -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : update vad->bestCorr_hp  complex signal feature state
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad_complex_detection_update(
+    vadState1 *st,       /* i/o : State struct */
+    Word16 best_corr_hp) /* i   : best Corr    */
+{
+    st->best_corr_hp = best_corr_hp;
+}
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad_tone_detection
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    t0 -- Word32 -- autocorrelation maxima
+    t1 -- Word32 -- energy
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Set tone flag if pitch gain is high. This is used to detect
+                signaling tones and other signals with high pitch gain.
+ Inputs       : tone: flags indicating presence of a tone
+ Outputs      : tone: flags indicating presence of a tone
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad_tone_detection(
+    vadState1 *st,    /* i/o : State struct                       */
+    Word32 t0,        /* i   : autocorrelation maxima             */
+    Word32 t1,        /* i   : energy                             */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs        */
+)
+{
+    Word16 temp;
+    /*
+       if (t0 > TONE_THR * t1)
+       set tone flag
+       */
+    temp = pv_round(t1, pOverflow);
+
+    if ((temp > 0) && (L_msu(t0, temp, TONE_THR, pOverflow) > 0))
+    {
+        st->tone |= 0x4000;
+    }
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad_tone_detection_update
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    one_lag_per_frame -- Word16 -- 1 if one open-loop lag is calculated per
+                                   each frame, otherwise 0
+    st -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Update the tone flag register. Tone flags are shifted right
+                by one bit. This function should be called from the speech
+                encoder before call to Vad_tone_detection() function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad_tone_detection_update(
+    vadState1 *st,              /* i/o : State struct           */
+    Word16 one_lag_per_frame,   /* i   : 1 if one open-loop lag */
+    /*       is calculated per each */
+    /*       frame, otherwise 0     */
+    Flag *pOverflow             /* o   : Flags overflow         */
+)
+{
+    /* Shift tone flags right by one bit */
+    st->tone = shr(st->tone, 1, pOverflow);
+
+    /* If open-loop lag is calculated only once in each frame, do extra update
+       and assume that the other tone flag of the frame is one. */
+    if (one_lag_per_frame != 0)
+    {
+        st->tone = shr(st->tone, 1, pOverflow);
+        st->tone |= 0x2000;
+    }
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad_pitch_detection
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    T_op -- array of type Word16 -- speech encoder open loop lags
+    st -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Test whether signal contains pitch or other periodic
+                component.
+ Return value : Boolean voiced / unvoiced decision in state variable
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad_pitch_detection(
+    vadState1 *st,    /* i/o : State struct                  */
+    Word16 T_op[],    /* i   : speech encoder open loop lags */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs   */
+)
+{
+    Word16 lagcount;
+    Word16 i;
+    Word16 temp;
+
+    lagcount = 0;
+
+    for (i = 0; i < 2; i++)
+    {
+        temp = sub(st->oldlag, T_op[i], pOverflow);
+        temp = abs_s(temp);
+
+        if (temp < LTHRESH)
+        {
+            lagcount += 1;
+        }
+
+        /* Save the current LTP lag */
+        st->oldlag = T_op[i];
+    }
+
+    /* Make pitch decision.
+       Save flag of the pitch detection to the variable pitch.
+       */
+    st->pitch = shr(st->pitch, 1, pOverflow);
+
+    temp =
+        add_16(
+            st->oldlag_count,
+            lagcount,
+            pOverflow);
+
+    if (temp >= NTHRESH)
+    {
+        st->pitch |= 0x4000;
+    }
+
+    /* Update oldlagcount */
+    st->oldlag_count = lagcount;
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad1
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    st -- pointer to type vadState1 --  State struct
+    in_buf -- array of type Word16 -- samples of the input frame
+
+ Outputs:
+    st -- pointer to type vadState1 --  State struct
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    VAD Decision, 1 = speech, 0 = noise
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose      : Main program for Voice Activity Detection (VAD) for AMR
+ Return value : VAD Decision, 1 = speech, 0 = noise
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad1.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 vad1(
+    vadState1 *st,    /* i/o : State struct                       */
+    Word16 in_buf[],  /* i   : samples of the input frame         */
+    Flag  *pOverflow  /* o   : Flag set when overflow occurs      */
+)
+{
+    Word16 level[COMPLEN];
+    Word32 pow_sum;
+    Word16 i;
+
+    /* Calculate power of the input frame. */
+    pow_sum = 0L;
+
+    for (i = 0; i < FRAME_LEN; i++)
+    {
+        pow_sum = L_mac(pow_sum, in_buf[i-LOOKAHEAD], in_buf[i-LOOKAHEAD], pOverflow);
+    }
+
+    /*
+      If input power is very low, clear pitch flag of the current frame
+      */
+    if (L_sub(pow_sum, POW_PITCH_THR, pOverflow) < 0)
+    {
+        st->pitch = st->pitch & 0x3fff;
+    }
+
+    /*
+      If input power is very low, clear complex flag of the "current" frame
+      */
+    if (L_sub(pow_sum, POW_COMPLEX_THR, pOverflow) < 0)
+    {
+        st->complex_low = st->complex_low & 0x3fff;
+    }
+
+    /*
+      Run the filter bank which calculates signal levels at each band
+      */
+    filter_bank(st, in_buf, level, pOverflow);
+
+    return (vad_decision(st, level, pow_sum, pOverflow));
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.h
new file mode 100644 (file)
index 0000000..ab3438f
--- /dev/null
@@ -0,0 +1,185 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: vad1.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions, prototype and structure
+ definitions needed by vad_1.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef vad_1_h
+#define vad_1_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst_vad.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+    /* state variable */
+    typedef struct
+    {
+
+        Word16 bckr_est[COMPLEN];    /* background noise estimate                */
+        Word16 ave_level[COMPLEN];   /* averaged input components for stationary */
+        /*    estimation                            */
+        Word16 old_level[COMPLEN];   /* input levels of the previous frame       */
+        Word16 sub_level[COMPLEN];   /* input levels calculated at the end of
+                                      a frame (lookahead)                   */
+        Word16 a_data5[3][2];        /* memory for the filter bank               */
+        Word16 a_data3[5];           /* memory for the filter bank               */
+
+        Word16 burst_count;          /* counts length of a speech burst          */
+        Word16 hang_count;           /* hangover counter                         */
+        Word16 stat_count;           /* stationary counter                       */
+
+        /* Note that each of the following three variables (vadreg, pitch and tone)
+           holds 15 flags. Each flag reserves 1 bit of the variable. The newest
+           flag is in the bit 15 (assuming that LSB is bit 1 and MSB is bit 16). */
+        Word16 vadreg;               /* flags for intermediate VAD decisions     */
+        Word16 pitch;                /* flags for pitch detection                */
+        Word16 tone;                 /* flags for tone detection                 */
+        Word16 complex_high;         /* flags for complex detection              */
+        Word16 complex_low;          /* flags for complex detection              */
+
+        Word16 oldlag_count, oldlag; /* variables for pitch detection            */
+
+        Word16 complex_hang_count;   /* complex hangover counter, used by VAD    */
+        Word16 complex_hang_timer;   /* hangover initiator, used by CAD          */
+
+        Word16 best_corr_hp;         /* FIP filtered value Q15                   */
+
+        Word16 speech_vad_decision;  /* final decision                           */
+        Word16 complex_warning;      /* complex background warning               */
+
+        Word16 sp_burst_count;       /* counts length of a speech burst incl     */
+        Word16 corr_hp_fast;         /* filtered value                           */
+    } vadState1;
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16 vad1_init(vadState1 **st);
+    /* initialize one instance of the pre processing state.
+       Stores pointer to filter status struct in *st. This pointer has to
+       be passed to vad in each call.
+       returns 0 on success
+     */
+
+    Word16 vad1_reset(vadState1 *st);
+    /* reset of pre processing state (i.e. set state memory to zero)
+       returns 0 on success
+     */
+
+    void vad1_exit(vadState1 **st);
+    /* de-initialize pre processing state (i.e. free status struct)
+       stores NULL in *st
+     */
+
+    void vad_complex_detection_update(vadState1 *st,       /* i/o : State struct     */
+                                      Word16 best_corr_hp /* i   : best Corr Q15    */
+                                     );
+
+    void vad_tone_detection(vadState1 *st,  /* i/o : State struct            */
+                            Word32 t0,     /* i   : autocorrelation maxima  */
+                            Word32 t1,     /* i   : energy                  */
+                            Flag   *pOverflow
+                           );
+
+    void vad_tone_detection_update(
+        vadState1 *st,             /* i/o : State struct              */
+        Word16 one_lag_per_frame,  /* i   : 1 if one open-loop lag is
+                                              calculated per each frame,
+                                              otherwise 0                     */
+        Flag *pOverflow
+    );
+
+    void vad_pitch_detection(vadState1 *st,   /* i/o : State struct                  */
+                             Word16 lags[],  /* i   : speech encoder open loop lags */
+                             Flag   *pOverflow
+                            );
+
+    Word16 vad1(vadState1 *st,   /* i/o : State struct                      */
+                Word16 in_buf[], /* i   : samples of the input frame
+                                inbuf[159] is the very last sample,
+                                incl lookahead                          */
+                Flag *pOverflow
+               );
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _VAD1_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad2.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad2.h
new file mode 100644 (file)
index 0000000..909801f
--- /dev/null
@@ -0,0 +1,186 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: vad2.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions, prototype and structure
+ definitions needed by vad_2.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef vad_2_h
+#define vad_2_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+#define     YES     1
+#define     NO      0
+#define     ON      1
+#define     OFF     0
+#define     TRUE        1
+#define     FALSE       0
+
+#define     FRM_LEN                 80
+#define     DELAY                   24
+#define     FFT_LEN                 128
+
+#define     NUM_CHAN                16
+#define     LO_CHAN                 0
+#define     HI_CHAN                 15
+
+#define     UPDATE_THLD             35
+#define     HYSTER_CNT_THLD         6
+#define     UPDATE_CNT_THLD         50
+
+#define     SHIFT_STATE_0       0       /* channel energy scaled as 22,9 */
+#define     SHIFT_STATE_1       1       /* channel energy scaled as 27,4 */
+
+#define     NOISE_FLOOR_CHAN_0  512     /* 1.0    scaled as 22,9 */
+#define     MIN_CHAN_ENRG_0     32      /* 0.0625 scaled as 22,9 */
+#define     MIN_NOISE_ENRG_0    32      /* 0.0625 scaled as 22,9 */
+#define     INE_NOISE_0     8192        /* 16.0   scaled as 22,9 */
+#define     FRACTIONAL_BITS_0   9       /* used as input to fn10Log10() */
+
+#define     NOISE_FLOOR_CHAN_1  16      /* 1.0    scaled as 27,4 */
+#define     MIN_CHAN_ENRG_1     1       /* 0.0625 scaled as 27,4 */
+#define     MIN_NOISE_ENRG_1    1       /* 0.0625 scaled as 27,4 */
+#define     INE_NOISE_1     256     /* 16.0   scaled as 27,4 */
+#define     FRACTIONAL_BITS_1   4       /* used as input to fn10Log10() */
+
+#define     STATE_1_TO_0_SHIFT_R    (FRACTIONAL_BITS_1-FRACTIONAL_BITS_0)   /* state correction factor */
+#define     STATE_0_TO_1_SHIFT_R    (FRACTIONAL_BITS_0-FRACTIONAL_BITS_1)   /* state correction factor */
+
+#define         HIGH_ALPHA              29491       /* 0.9 scaled as 0,15 */
+#define         LOW_ALPHA               22938       /* 0.7 scaled as 0,15 */
+#define         ALPHA_RANGE             (HIGH_ALPHA - LOW_ALPHA)
+#define         DEV_THLD                7168        /* 28.0 scaled as 7,8 */
+
+#define         PRE_EMP_FAC             (-26214)    /* -0.8 scaled as 0,15 */
+
+#define         CEE_SM_FAC              18022       /* 0.55 scaled as 0,15 */
+#define         ONE_MINUS_CEE_SM_FAC    14746       /* 0.45 scaled as 0,15 */
+
+#define         CNE_SM_FAC              3277        /* 0.1 scaled as 0,15 */
+#define         ONE_MINUS_CNE_SM_FAC    29491       /* 0.9 scaled as 0,15 */
+
+#define         FFT_HEADROOM            2
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    typedef struct
+    {
+        Word16 pre_emp_mem;
+        Word16 update_cnt;
+        Word16 hyster_cnt;
+        Word16 last_update_cnt;
+        Word16 ch_enrg_long_db[NUM_CHAN];   /* scaled as 7,8  */
+
+        Word32 Lframe_cnt;
+        Word32 Lch_enrg[NUM_CHAN];  /* scaled as 22,9 or 27,4 */
+        Word32 Lch_noise[NUM_CHAN]; /* scaled as 22,9 */
+
+        Word16 last_normb_shift;    /* last block norm shift count */
+
+        Word16 tsnr;            /* total signal-to-noise ratio in dB (scaled as 7,8) */
+        Word16 hangover;
+        Word16 burstcount;
+        Word16 fupdate_flag;        /* forced update flag from previous frame */
+        Word16 negSNRvar;       /* Negative SNR variance (scaled as 7,8) */
+        Word16 negSNRbias;      /* sensitivity bias from negative SNR variance (scaled as 15,0) */
+
+        Word16 shift_state;     /* use 22,9 or 27,4 scaling for ch_enrg[] */
+
+        Word32 L_R0;
+        Word32 L_Rmax;
+        Flag   LTP_flag;        /* Use to indicate the the LTP gain is > LTP_THRESH */
+
+    } vadState2;
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+    Word16  vad2(Word16 *farray_ptr, vadState2 *st, Flag *pOverflow);
+    Word16 vad2_init(vadState2 **st);
+    Word16 vad2_reset(vadState2 *st);
+    void    vad2_exit(vadState2 **state);
+
+    void    r_fft(Word16 *farray_ptr, Flag *pOverflow);
+
+    void    LTP_flag_update(vadState2 *st, Word16 mode, Flag *pOverflow);
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _VAD2_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk
new file mode 100644 (file)
index 0000000..21d9ddb
--- /dev/null
@@ -0,0 +1,67 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+       src/agc2_amr_wb.cpp \
+       src/band_pass_6k_7k.cpp \
+       src/dec_acelp_2p_in_64.cpp \
+       src/dec_acelp_4p_in_64.cpp \
+       src/dec_alg_codebook.cpp \
+       src/dec_gain2_amr_wb.cpp \
+       src/decoder_amr_wb.cpp \
+       src/deemphasis_32.cpp \
+       src/dtx_decoder_amr_wb.cpp \
+       src/get_amr_wb_bits.cpp \
+       src/highpass_400hz_at_12k8.cpp \
+       src/highpass_50hz_at_12k8.cpp \
+       src/homing_amr_wb_dec.cpp \
+       src/interpolate_isp.cpp \
+       src/isf_extrapolation.cpp \
+       src/isp_az.cpp \
+       src/isp_isf.cpp \
+       src/lagconceal.cpp \
+       src/low_pass_filt_7k.cpp \
+       src/median5.cpp \
+       src/mime_io.cpp \
+       src/noise_gen_amrwb.cpp \
+       src/normalize_amr_wb.cpp \
+       src/oversamp_12k8_to_16k.cpp \
+       src/phase_dispersion.cpp \
+       src/pit_shrp.cpp \
+       src/pred_lt4.cpp \
+       src/preemph_amrwb_dec.cpp \
+       src/pvamrwb_math_op.cpp \
+       src/pvamrwbdecoder.cpp \
+       src/q_gain2_tab.cpp \
+       src/qisf_ns.cpp \
+       src/qisf_ns_tab.cpp \
+       src/qpisf_2s.cpp \
+       src/qpisf_2s_tab.cpp \
+       src/scale_signal.cpp \
+       src/synthesis_amr_wb.cpp \
+       src/voice_factor.cpp \
+       src/wb_syn_filt.cpp \
+       src/weight_amrwb_lpc.cpp
+
+
+LOCAL_MODULE := libpvamrwbdecoder
+
+LOCAL_CFLAGS :=   $(PV_CFLAGS)
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := 
+
+LOCAL_SHARED_LIBRARIES := 
+
+LOCAL_C_INCLUDES := \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_wb/dec/src \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_wb/dec/include \
+       $(PV_INCLUDES)
+
+LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO)
+
+LOCAL_COPY_HEADERS := \
+       include/decoder_amr_wb.h \
+       include/pvamrwbdecoder_api.h
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/build/make/local.mk b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/build/make/local.mk
new file mode 100644 (file)
index 0000000..7b914eb
--- /dev/null
@@ -0,0 +1,59 @@
+# Get the current local path as the first operation
+LOCAL_PATH := $(call get_makefile_dir)
+
+# Clear out the variables used in the local makefiles
+include $(MK)/clear.mk
+
+TARGET := pvamrwbdecoder
+
+
+OPTIMIZE_FOR_PERFORMANCE_OVER_SIZE := true
+
+SRCDIR := ../../src
+INCSRCDIR := ../../include
+SRCS := agc2_amr_wb.cpp \
+       band_pass_6k_7k.cpp \
+       dec_acelp_2p_in_64.cpp \
+       dec_acelp_4p_in_64.cpp \
+       dec_alg_codebook.cpp \
+       dec_gain2_amr_wb.cpp \
+       decoder_amr_wb.cpp \
+       deemphasis_32.cpp \
+       dtx_decoder_amr_wb.cpp \
+       get_amr_wb_bits.cpp \
+       highpass_400hz_at_12k8.cpp \
+       highpass_50hz_at_12k8.cpp \
+       homing_amr_wb_dec.cpp \
+       interpolate_isp.cpp \
+       isf_extrapolation.cpp \
+       isp_az.cpp \
+       isp_isf.cpp \
+       lagconceal.cpp \
+       low_pass_filt_7k.cpp \
+       median5.cpp \
+       mime_io.cpp \
+       noise_gen_amrwb.cpp \
+       normalize_amr_wb.cpp \
+       oversamp_12k8_to_16k.cpp \
+       phase_dispersion.cpp \
+       pit_shrp.cpp \
+       pred_lt4.cpp \
+       preemph_amrwb_dec.cpp \
+       pvamrwb_math_op.cpp \
+       pvamrwbdecoder.cpp \
+       q_gain2_tab.cpp \
+       qisf_ns.cpp \
+       qisf_ns_tab.cpp \
+       qpisf_2s.cpp \
+       qpisf_2s_tab.cpp \
+       scale_signal.cpp \
+       synthesis_amr_wb.cpp \
+       voice_factor.cpp \
+       wb_syn_filt.cpp \
+       weight_amrwb_lpc.cpp
+
+
+HDRS := decoder_amr_wb.h pvamrwbdecoder_api.h
+
+include $(MK)/library.mk
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/decoder_amr_wb.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/decoder_amr_wb.h
new file mode 100644 (file)
index 0000000..d026c17
--- /dev/null
@@ -0,0 +1,75 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+//////////////////////////////////////////////////////////////////////////////////
+//                                                                              //
+//  File: decoder_amr_wb.h                                                      //
+//                                                                              //
+//////////////////////////////////////////////////////////////////////////////////
+
+#ifndef _DECODER_AMR_WB_H
+#define _DECODER_AMR_WB_H
+
+#include "oscl_base.h"
+#include "pvamrwbdecoder_api.h"
+#include "pvgsmamrdecoderinterface.h"
+
+// CDecoder_AMR_WB
+class CDecoder_AMRInterface;
+class CDecoder_AMR_WB: public CDecoder_AMRInterface
+{
+    public:
+        OSCL_IMPORT_REF void ConstructL();
+        OSCL_IMPORT_REF static CDecoder_AMR_WB *NewL();
+        OSCL_IMPORT_REF virtual ~CDecoder_AMR_WB();
+
+        OSCL_IMPORT_REF virtual int32 StartL(tPVAmrDecoderExternal * pExt,
+                                             bool aAllocateInputBuffer  = false,
+                                             bool aAllocateOutputBuffer = false);
+
+        OSCL_IMPORT_REF virtual int32 ExecuteL(tPVAmrDecoderExternal * pExt);
+
+        OSCL_IMPORT_REF virtual int32 ResetDecoderL(void);
+        OSCL_IMPORT_REF virtual void StopL();
+        OSCL_IMPORT_REF virtual void TerminateDecoderL();
+
+    private:
+        void *st;                   /*   State structure  */
+        void *pt_st;
+        int16 *ScratchMem;
+
+        uint8* iInputBuf;
+        int16* iInputSampleBuf;
+        int16* iOutputBuf;
+
+
+};
+
+
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/pvamrwbdecoder_api.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/pvamrwbdecoder_api.h
new file mode 100644 (file)
index 0000000..24fa429
--- /dev/null
@@ -0,0 +1,148 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Name: pvamrwbdecoder_api.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ Main header file for the Packet Video AMR Wide  Band  decoder library. The
+ constants, structures, and functions defined within this file, along with
+ a basic data types header file, is all that is needed to use and communicate
+ with the library. The internal data structures within the library are
+ purposely hidden.
+
+ ---* Need description of the input buffering. *-------
+
+ ---* Need an example of calling the library here *----
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+  (Normally header files do not have a reference section)
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef _PVAMRWBDECODER_API_H
+#define _PVAMRWBDECODER_API_H
+
+#include    "oscl_base.h"    /* Basic data types used within the lib */
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+#define AMR_WB_PCM_FRAME   320             /* Frame size at 16kHz     */
+
+
+#define NBBITS_7k     132                  /* 6.60k  */
+#define NBBITS_9k     177                  /* 8.85k  */
+#define NBBITS_12k    253                  /* 12.65k */
+#define NBBITS_14k    285                  /* 14.25k */
+#define NBBITS_16k    317                  /* 15.85k */
+#define NBBITS_18k    365                  /* 18.25k */
+#define NBBITS_20k    397                  /* 19.85k */
+#define NBBITS_23k    461                  /* 23.05k */
+#define NBBITS_24k    477                  /* 23.85k */
+
+#define NBBITS_SID    35
+
+#define KAMRWB_NB_BITS_MAX   NBBITS_24k
+#define KAMRWB_NB_BYTES_MAX  ((KAMRWB_NB_BITS_MAX>>3)+1)
+
+#define NUM_OF_MODES  10
+
+
+    static const int16 AMR_WB_COMPRESSED[NUM_OF_MODES] =
+    {
+        NBBITS_7k,
+        NBBITS_9k,
+        NBBITS_12k,
+        NBBITS_14k,
+        NBBITS_16k,
+        NBBITS_18k,
+        NBBITS_20k,
+        NBBITS_23k,
+        NBBITS_24k,
+        NBBITS_SID
+    };
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* PVMP4AUDIODECODER_API_H */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/agc2_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/agc2_amr_wb.cpp
new file mode 100644 (file)
index 0000000..0b01ef0
--- /dev/null
@@ -0,0 +1,182 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: agc2_amr_wb.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 * sig_in,            (i)     : postfilter input signal
+     int16 * sig_out,           (i/o)   : postfilter output signal
+     int16 l_trm                (i)     : subframe size
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Performs adaptive gain control
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwb_math_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void agc2_amr_wb(
+    int16 * sig_in,          /* (i)     : postfilter input signal  */
+    int16 * sig_out,         /* (i/o)   : postfilter output signal */
+    int16 l_trm              /* (i)     : subframe size            */
+)
+{
+
+    int16 i, exp;
+    int16 gain_in, gain_out, g0;
+    int32 s;
+
+    int16 temp;
+
+    /* calculate gain_out with exponent */
+
+    temp = sig_out[0] >> 2;
+    s = fxp_mul_16by16(temp, temp) << 1;
+    for (i = 1; i < l_trm; i++)
+    {
+        temp = sig_out[i] >> 2;
+        s = mac_16by16_to_int32(s, temp, temp);
+    }
+
+
+    if (s == 0)
+    {
+        return;
+    }
+    exp = normalize_amr_wb(s) - 1;
+    gain_out = amr_wb_round(s << exp);
+
+    /* calculate gain_in with exponent */
+
+    temp = sig_in[0] >> 2;
+    s = mul_16by16_to_int32(temp, temp);
+    for (i = 1; i < l_trm; i++)
+    {
+        temp = sig_in[i] >> 2;
+        s = mac_16by16_to_int32(s, temp, temp);
+    }
+
+
+    if (s == 0)
+    {
+        g0 = 0;
+    }
+    else
+    {
+        i = normalize_amr_wb(s);
+        gain_in = amr_wb_round(s << i);
+        exp -= i;
+
+        /*
+         *  g0 = sqrt(gain_in/gain_out)
+         */
+
+        s = div_16by16(gain_out, gain_in);
+        s = shl_int32(s, 7);                   /* s = gain_out / gain_in */
+        s = shr_int32(s, exp);                 /* add exponent */
+
+        s = one_ov_sqrt(s);
+        g0 = amr_wb_round(shl_int32(s, 9));
+    }
+    /* sig_out(n) = gain(n) sig_out(n) */
+
+    for (i = 0; i < l_trm; i++)
+    {
+        sig_out[i] = extract_h(shl_int32(fxp_mul_16by16(sig_out[i], g0), 3));
+
+    }
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/band_pass_6k_7k.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/band_pass_6k_7k.cpp
new file mode 100644 (file)
index 0000000..5d12eab
--- /dev/null
@@ -0,0 +1,232 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: band_pass_6k_7k.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 signal[],             input signal / output is divided by 16
+     int16 lg,                   lenght of signal
+     int16 mem[]                 in/out: memory (size=30)
+     int16 x[]                   scratch mem ( size= 60)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   15th order band pass 6kHz to 7kHz FIR filter.
+
+   frequency:  4kHz   5kHz  5.5kHz  6kHz  6.5kHz 7kHz  7.5kHz  8kHz
+   dB loss:   -60dB  -45dB  -13dB   -3dB   0dB   -3dB  -13dB  -45dB
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+#include "pvamrwbdecoder_cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+#define L_FIR 30
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/* filter coefficients (gain=4.0) */
+
+const int16 fir_6k_7k[L_FIR] =
+{
+    -32,     47,     32,    -27,
+    -369,   1122,  -1421,      0,
+    3798,  -8880,  12349, -10984,
+    3548,   7766, -18001,
+    22118,
+    -18001,   7766,   3548, -10984,
+    12349,  -8880,   3798,      0,
+    -1421,   1122,   -369,    -27,
+    32,     47
+};
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void band_pass_6k_7k_init(int16 mem[])         /* mem[30] */
+{
+    pv_memset((void *)mem, 0, L_FIR*sizeof(*mem));
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+void band_pass_6k_7k(
+    int16 signal[],                      /* input:  signal                  */
+    int16 lg,                            /* input:  length of input         */
+    int16 mem[],                         /* in/out: memory (size=30)        */
+    int16 x[]
+)
+{
+    int16 i, j;
+    int32 L_tmp1;
+    int32 L_tmp2;
+    int32 L_tmp3;
+    int32 L_tmp4;
+
+    int16 *pt_sign = signal;
+
+    pv_memcpy((void *)x, (void *)mem, L_FIR*sizeof(*x));
+
+
+    for (i = 0; i < lg >> 2; i++)
+    {
+
+        x[(i<<2) + L_FIR    ] = *(pt_sign) >> 2;        /* gain of filter = 4 */
+        x[(i<<2) + L_FIR + 1] = *(pt_sign + 1) >> 2;    /* gain of filter = 4 */
+        x[(i<<2) + L_FIR + 2] = *(pt_sign + 2) >> 2;    /* gain of filter = 4 */
+        x[(i<<2) + L_FIR + 3] = *(pt_sign + 3) >> 2;    /* gain of filter = 4 */
+
+        L_tmp1 = 0x00004000;
+        L_tmp2 = 0x00004000;
+        L_tmp3 = 0x00004000;
+        L_tmp4 = 0x00004000;
+
+        L_tmp1 -= ((int32)x[(i<<2)+L_FIR  ] << 5);
+        L_tmp2 -= ((int32)x[(i<<2)+L_FIR+1] << 5);
+        L_tmp3 -= ((int32)x[(i<<2)+L_FIR+2] << 5);
+        L_tmp4 -= ((int32)x[(i<<2)+L_FIR+3] << 5);
+
+        L_tmp1 -= ((int32)x[(i<<2)] << 5);
+        L_tmp2 -= ((int32)x[(i<<2)+1] << 5);
+        L_tmp3 -= ((int32)x[(i<<2)+2] << 5);
+        L_tmp4 -= ((int32)x[(i<<2)+3] << 5);
+
+
+        for (j = 1; j < L_FIR - 1; j += 4)
+        {
+            int16 tmp1 = x[(i<<2)+j  ];
+            int16 tmp2 = x[(i<<2)+j+1];
+            int16 tmp3 = x[(i<<2)+j+2];
+
+            L_tmp1 = fxp_mac_16by16(tmp1, fir_6k_7k[j  ], L_tmp1);
+            L_tmp2 = fxp_mac_16by16(tmp2, fir_6k_7k[j  ], L_tmp2);
+            L_tmp1 = fxp_mac_16by16(tmp2, fir_6k_7k[j+1], L_tmp1);
+            L_tmp2 = fxp_mac_16by16(tmp3, fir_6k_7k[j+1], L_tmp2);
+            L_tmp3 = fxp_mac_16by16(tmp3, fir_6k_7k[j  ], L_tmp3);
+            L_tmp1 = fxp_mac_16by16(tmp3, fir_6k_7k[j+2], L_tmp1);
+
+            tmp1 = x[(i<<2)+j+3];
+            tmp2 = x[(i<<2)+j+4];
+
+            L_tmp2 = fxp_mac_16by16(tmp1, fir_6k_7k[j+2], L_tmp2);
+            L_tmp4 = fxp_mac_16by16(tmp1, fir_6k_7k[j  ], L_tmp4);
+            L_tmp3 = fxp_mac_16by16(tmp1, fir_6k_7k[j+1], L_tmp3);
+            L_tmp1 = fxp_mac_16by16(tmp1, fir_6k_7k[j+3], L_tmp1);
+            L_tmp2 = fxp_mac_16by16(tmp2, fir_6k_7k[j+3], L_tmp2);
+            L_tmp4 = fxp_mac_16by16(tmp2, fir_6k_7k[j+1], L_tmp4);
+            L_tmp3 = fxp_mac_16by16(tmp2, fir_6k_7k[j+2], L_tmp3);
+
+            tmp1 = x[(i<<2)+j+5];
+            tmp2 = x[(i<<2)+j+6];
+
+            L_tmp4 = fxp_mac_16by16(tmp1, fir_6k_7k[j+2], L_tmp4);
+            L_tmp3 = fxp_mac_16by16(tmp1, fir_6k_7k[j+3], L_tmp3);
+            L_tmp4 = fxp_mac_16by16(tmp2, fir_6k_7k[j+3], L_tmp4);
+
+        }
+
+        L_tmp1 = fxp_mac_16by16(x[(i<<2)+j  ], fir_6k_7k[L_FIR-1  ], L_tmp1);
+        L_tmp2 = fxp_mac_16by16(x[(i<<2)+j+1], fir_6k_7k[L_FIR-1  ], L_tmp2);
+        L_tmp3 = fxp_mac_16by16(x[(i<<2)+j+2], fir_6k_7k[L_FIR-1  ], L_tmp3);
+        L_tmp4 = fxp_mac_16by16(x[(i<<2)+j+3], fir_6k_7k[L_FIR-1  ], L_tmp4);
+
+
+        *(pt_sign++) = (int16)(L_tmp1 >> 15);
+        *(pt_sign++) = (int16)(L_tmp2 >> 15);
+        *(pt_sign++) = (int16)(L_tmp3 >> 15);
+        *(pt_sign++) = (int16)(L_tmp4 >> 15);
+
+    }
+
+    pv_memcpy((void *)mem, (void *)(x + lg), L_FIR*sizeof(*mem));
+
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_2p_in_64.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_2p_in_64.cpp
new file mode 100644 (file)
index 0000000..d0b4c48
--- /dev/null
@@ -0,0 +1,149 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_acelp_2p_in_64.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 index,          (i):   12 bits index
+     int16 code[]          (o): Q9 algebraic (fixed) codebook excitation
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   12 bits algebraic codebook decoder.
+   2 tracks x 32 positions per track = 64 samples.
+
+   12 bits --> 2 pulses in a frame of 64 samples.
+
+   All pulses can have two (2) possible amplitudes: +1 or -1.
+   Each pulse can have 32 possible positions.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define L_CODE    64                       /* codevector length  */
+#define NB_TRACK  2                        /* number of track    */
+#define NB_POS    32                       /* number of position */
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void dec_acelp_2p_in_64(
+    int16 index,        /* (i):   12 bits index                          */
+    int16 code[]        /* (o): Q9 algebraic (fixed) codebook excitation */
+)
+{
+    int16 i;
+
+    pv_memset(code, 0, L_CODE*sizeof(*code));
+
+    /* decode the positions and signs of pulses and build the codeword */
+
+    i = (index >> 5) & 0x003E;
+
+    if (((index >> 6) & NB_POS) == 0)
+    {
+        code[i] = 512;
+    }
+    else
+    {
+        code[i] = -512;
+    }
+
+    i = ((index & 0x001F) << 1) + 1;
+
+    if ((index & NB_POS) == 0)
+    {
+        code[i] = 512;
+    }
+    else
+    {
+        code[i] = -512;
+    }
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_4p_in_64.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_4p_in_64.cpp
new file mode 100644 (file)
index 0000000..d02021a
--- /dev/null
@@ -0,0 +1,257 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_acelp_4p_in_64.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 index[],    (i) : index (20): 5+5+5+5 = 20 bits.
+                       (i) : index (36): 9+9+9+9 = 36 bits.
+                       (i) : index (44): 13+9+13+9 = 44 bits.
+                       (i) : index (52): 13+13+13+13 = 52 bits.
+                       (i) : index (64): 2+2+2+2+14+14+14+14 = 64 bits.
+                       (i) : index (72): 10+2+10+2+10+14+10+14 = 72 bits.
+                       (i) : index (88): 11+11+11+11+11+11+11+11 = 88 bits.
+     int16 nbbits,     (i) : 20, 36, 44, 52, 64, 72 or 88 bits
+     int16 code[]      (o) Q9: algebraic (fixed) codebook excitation
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   20, 36, 44, 52, 64, 72, 88 bits algebraic codebook decoder.
+   4 tracks x 16 positions per track = 64 samples.
+
+   20 bits --> 4 pulses in a frame of 64 samples.
+   36 bits --> 8 pulses in a frame of 64 samples.
+   44 bits --> 10 pulses in a frame of 64 samples.
+   52 bits --> 12 pulses in a frame of 64 samples.
+   64 bits --> 16 pulses in a frame of 64 samples.
+   72 bits --> 18 pulses in a frame of 64 samples.
+   88 bits --> 24 pulses in a frame of 64 samples.
+
+   All pulses can have two (2) possible amplitudes: +1 or -1.
+   Each pulse can have sixteen (16) possible positions.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+
+#include "q_pulse.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define L_CODE    64                       /* codevector length  */
+#define NB_TRACK  4                        /* number of track    */
+#define NB_POS    16                       /* number of position */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    void add_pulses(int16 pos[], int16 nb_pulse, int16 track, int16 code[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void dec_acelp_4p_in_64(
+    int16 index[],  /* (i) : index (20): 5+5+5+5 = 20 bits.                 */
+    /* (i) : index (36): 9+9+9+9 = 36 bits.                 */
+    /* (i) : index (44): 13+9+13+9 = 44 bits.               */
+    /* (i) : index (52): 13+13+13+13 = 52 bits.             */
+    /* (i) : index (64): 2+2+2+2+14+14+14+14 = 64 bits.     */
+    /* (i) : index (72): 10+2+10+2+10+14+10+14 = 72 bits.   */
+    /* (i) : index (88): 11+11+11+11+11+11+11+11 = 88 bits. */
+    int16 nbbits,   /* (i) : 20, 36, 44, 52, 64, 72 or 88 bits              */
+    int16 code[]    /* (o) Q9: algebraic (fixed) codebook excitation        */
+)
+{
+    int16 k, pos[6];
+    int32 L_index;
+    pv_memset(code, 0, L_CODE*sizeof(*code));
+
+    /* decode the positions and signs of pulses and build the codeword */
+
+
+    switch (nbbits)
+    {
+        case 20:
+            for (k = 0; k < NB_TRACK; k++)
+            {
+                L_index = index[k];
+                dec_1p_N1(L_index, 4, 0, pos);
+                add_pulses(pos, 1, k, code);
+            }
+            break;
+
+        case  36:
+            for (k = 0; k < NB_TRACK; k++)
+            {
+                L_index = index[k];
+                dec_2p_2N1(L_index, 4, 0, pos);
+                add_pulses(pos, 2, k, code);
+            }
+            break;
+        case 44:
+            for (k = 0; k < NB_TRACK - 2; k++)
+            {
+                L_index = index[k];
+                dec_3p_3N1(L_index, 4, 0, pos);
+                add_pulses(pos, 3, k, code);
+            }
+            for (k = 2; k < NB_TRACK; k++)
+            {
+                L_index = index[k];
+                dec_2p_2N1(L_index, 4, 0, pos);
+                add_pulses(pos, 2, k, code);
+            }
+            break;
+        case 52:
+            for (k = 0; k < NB_TRACK; k++)
+            {
+                L_index = index[k];
+                dec_3p_3N1(L_index, 4, 0, pos);
+                add_pulses(pos, 3, k, code);
+            }
+            break;
+        case 64:
+            for (k = 0; k < NB_TRACK; k++)
+            {
+                L_index = ((int32)index[k] << 14) + index[k + NB_TRACK];
+                dec_4p_4N(L_index, 4, 0, pos);
+                add_pulses(pos, 4, k, code);
+            }
+            break;
+        case 72:
+            for (k = 0; k < NB_TRACK - 2; k++)
+            {
+                L_index = ((int32)index[k] << 10) + index[k + NB_TRACK];
+                dec_5p_5N(L_index, 4, 0, pos);
+                add_pulses(pos, 5, k, code);
+            }
+            for (k = 2; k < NB_TRACK; k++)
+            {
+                L_index = ((int32)index[k] << 14) + index[k + NB_TRACK];
+                dec_4p_4N(L_index, 4, 0, pos);
+                add_pulses(pos, 4, k, code);
+            }
+            break;
+        case 88:
+            for (k = 0; k < NB_TRACK; k++)
+            {
+                L_index = ((int32)index[k] << 11) + index[k + NB_TRACK];
+                dec_6p_6N_2(L_index, 4, 0, pos);
+                add_pulses(pos, 6, k, code);
+            }
+        default:
+            break;
+    }
+
+
+}
+
+
+
+void add_pulses(int16 pos[], int16 nb_pulse, int16 track, int16 code[])
+{
+    int16 i, k;
+
+    for (k = 0; k < nb_pulse; k++)
+    {
+        /* i = ((pos[k] & (NB_POS-1))*NB_TRACK) + track; */
+        i = ((pos[k] & (NB_POS - 1)) << 2) + track;
+
+        if ((pos[k] & NB_POS) == 0)
+        {
+            code[i] +=  512;
+        }
+        else
+        {
+            code[i] -=  512;
+        }
+    }
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_alg_codebook.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_alg_codebook.cpp
new file mode 100644 (file)
index 0000000..76ad69c
--- /dev/null
@@ -0,0 +1,384 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_alg_codebook.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+        decoding of algebraic codebook
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "q_pulse.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+#define NB_POS 16                          /* pos in track, mask for sign bit */
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void dec_1p_N1(int32 index, int16 N, int16 offset, int16 pos[])
+{
+    int16 pos1;
+    int32 mask, i;
+
+    mask = ((1 << N) - 1);
+    /*-------------------------------------------------------*
+     * Decode 1 pulse with N+1 bits:                         *
+     *-------------------------------------------------------*/
+    pos1 = ((index & mask) + offset);
+
+    i = ((index >> N) & 1L);            /* i = ((index >> N) & 1); */
+
+    if (i == 1)
+    {
+        pos1 += NB_POS;
+    }
+    pos[0] = pos1;
+
+}
+
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void dec_2p_2N1(int32 index, int16 N, int16 offset, int16 pos[])
+{
+    int16 pos1, pos2, tmp;
+    int32 mask, i;
+
+    mask = (int32)(sub_int16(shl_int16(1, N), 1)); /* mask = ((1<<N)-1); */
+    /*-------------------------------------------------------*
+     * Decode 2 pulses with 2*N+1 bits:                      *
+     *-------------------------------------------------------*/
+    /* pos1 = (((index >> N) & mask) + offset); */
+    pos1 = (int16)(add_int32((shr_int32(index, N) & mask), (int32)(offset)));
+    tmp = shl_int16(N, 1);
+    i = (index >> tmp) & 1L;         /* i = (index >> (2*N)) & 1; */
+    pos2 = add_int16((int16)(index & mask), offset); /* pos2 = ((index & mask) + offset); */
+
+    if (pos2 < pos1)              /* ((pos2 - pos1) < 0) */
+    {
+        if (i == 1)
+        {                                  /* (i == 1) */
+            pos1 += NB_POS;      /* pos1 += NB_POS; */
+        }
+        else
+        {
+            pos2 += NB_POS;      /* pos2 += NB_POS;  */
+        }
+    }
+    else
+    {
+        if (i == 1)
+        {                                  /* (i == 1) */
+            pos1 += NB_POS;      /* pos1 += NB_POS; */
+            pos2 += NB_POS;      /* pos2 += NB_POS; */
+        }
+    }
+
+    pos[0] = pos1;
+    pos[1] = pos2;
+
+    return;
+}
+
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void dec_3p_3N1(int32 index, int16 N, int16 offset, int16 pos[])
+{
+    int16 j, tmp;
+    int32 mask, idx;
+
+    /*-------------------------------------------------------*
+     * Decode 3 pulses with 3*N+1 bits:                      *
+     *-------------------------------------------------------*/
+    tmp = sub_int16(shl_int16(N, 1), 1);               /* mask = ((1<<((2*N)-1))-1); */
+
+    mask = ((1 << ((2 * N) - 1)) - 1);
+
+    idx = index & mask;
+    j = offset;
+    tmp = (N << 1) - 1;
+
+
+    if (((index >> tmp) & 1L) != 0L)
+    {                                      /* if (((index >> ((2*N)-1)) & 1) == 1){ */
+        j += (1 << (N - 1)); /* j += (1<<(N-1)); */
+    }
+    dec_2p_2N1(idx, (int16)(N - 1), j, pos);
+
+    mask = ((1 << (N + 1)) - 1);
+    tmp = N << 1;                     /* idx = (index >> (2*N)) & mask; */
+    idx = (index >> tmp) & mask;
+
+    dec_1p_N1(idx, N, offset, pos + 2);
+
+    return;
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void dec_4p_4N1(int32 index, int16 N, int16 offset, int16 pos[])
+{
+    int16 j, tmp;
+    int32 mask, idx;
+
+    /*-------------------------------------------------------*
+     * Decode 4 pulses with 4*N+1 bits:                      *
+     *-------------------------------------------------------*/
+    tmp = (N << 1) - 1;
+    mask = (1L << tmp) - 1L;
+    idx = index & mask;
+    j = offset;
+    tmp = (N << 1) - 1;
+
+
+    if (((index >> tmp) & 1L) != 0L)
+    {                                      /* (((index >> ((2*N)-1)) & 1) == 1) */
+        j += (1 << (N - 1)); /* j += (1<<(N-1)); */
+    }
+    dec_2p_2N1(idx, (int16)(N - 1), j, pos);
+
+
+    tmp = (N << 1) + 1;             /* mask = ((1<<((2*N)+1))-1); */
+    mask = (1L << tmp) - 1L;
+    idx = (index >> (N << 1)) & mask;   /* idx = (index >> (2*N)) & mask; */
+    dec_2p_2N1(idx, N, offset, pos + 2);      /* dec_2p_2N1(idx, N, offset, pos+2); */
+
+    return;
+}
+
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void dec_4p_4N(int32 index, int16 N, int16 offset, int16 pos[])
+{
+    int16 j, n_1, tmp;
+
+    /*-------------------------------------------------------*
+     * Decode 4 pulses with 4*N bits:                        *
+     *-------------------------------------------------------*/
+
+    n_1 = N - 1;
+    j = offset + (1 << n_1);          /* j = offset + (1 << n_1); */
+
+    tmp = (N << 2) - 2;
+
+    switch ((index >> tmp) & 3)
+    {                                      /* ((index >> ((4*N)-2)) & 3) */
+        case 0:
+            tmp = (n_1 << 2) + 1;
+
+            if ((index >> tmp) & 1)
+            {                                  /* (((index >> ((4*n_1)+1)) & 1) == 0) */
+                dec_4p_4N1(index, n_1, j, pos);
+            }
+            else
+            {
+                dec_4p_4N1(index, n_1, offset, pos);
+            }
+            break;
+        case 1:
+            tmp = (3 * n_1) + 1; /* dec_1p_N1((index>>((3*n_1)+1)), n_1, offset, pos) */
+            dec_1p_N1(index >> tmp, n_1, offset, pos);
+            dec_3p_3N1(index, n_1, j, pos + 1);
+            break;
+        case 2:
+            tmp = (n_1 << 1) + 1;       /* dec_2p_2N1((index>>((2*n_1)+1)), n_1, offset, pos); */
+            dec_2p_2N1(index >> tmp, n_1, offset, pos);
+            dec_2p_2N1(index, n_1, j, pos + 2);
+            break;
+        case 3:
+            tmp = n_1 + 1;                 /* dec_3p_3N1((index>>(n_1+1)), n_1, offset, pos); */
+            dec_3p_3N1(index >> tmp, n_1, offset, pos);
+            dec_1p_N1(index, n_1, j, pos + 3);
+            break;
+    }
+    return;
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void dec_5p_5N(int32 index, int16 N, int16 offset, int16 pos[])
+{
+    int16 j, n_1, tmp;
+    int32 idx;
+
+    /*-------------------------------------------------------*
+     * Decode 5 pulses with 5*N bits:                        *
+     *-------------------------------------------------------*/
+
+    n_1 = (int16)(N - 1);
+    j = add_int16(offset, shl_int16(1, n_1));          /* j = offset + (1 << n_1); */
+    tmp = (N << 1) + 1;             /* idx = (index >> ((2*N)+1)); */
+    idx = index >> tmp;
+    tmp = (5 * N) - 1;    /* ((5*N)-1)) */
+
+
+    if ((index >> tmp) & 1)    /* ((index >> ((5*N)-1)) & 1)  */
+    {
+        dec_3p_3N1(idx, n_1, j, pos);
+        dec_2p_2N1(index, N, offset, pos + 3);
+    }
+    else
+    {
+        dec_3p_3N1(idx, n_1, offset, pos);
+        dec_2p_2N1(index, N, offset, pos + 3);
+    }
+    return;
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void dec_6p_6N_2(int32 index, int16 N, int16 offset, int16 pos[])
+{
+    int16 j, n_1, offsetA, offsetB;
+
+    n_1 = N - 1;
+    j = offset + (1 << n_1);       /* j = offset + (1 << n_1); */
+
+
+    /* !!  N and n_1 are constants -> it doesn't need to be operated by Basic Operators */
+
+    offsetA = offsetB = j;
+
+    if (((index >> (6*N - 5)) & 1L) == 0)
+    {                                      /* if (((index >> ((6*N)-5)) & 1) == 0) */
+        offsetA = offset;
+    }
+    else
+    {
+        offsetB = offset;
+    }
+
+
+    switch ((index >> (6*N - 4)) & 3)
+    {                                      /* (index >> ((6*N)-4)) & 3 */
+        case 0:
+            dec_5p_5N(index >> N, n_1, offsetA, pos);  /* dec_5p_5N(index>>N, n_1, offsetA, pos); */
+            dec_1p_N1(index, n_1, offsetA, pos + 5);
+            break;
+        case 1:
+            dec_5p_5N(index >> N, n_1, offsetA, pos);  /* dec_5p_5N(index>>N, n_1, offsetA, pos); */
+            dec_1p_N1(index, n_1, offsetB, pos + 5);
+            break;
+        case 2:
+            dec_4p_4N(index >> (2*n_1 + 1), n_1, offsetA, pos); /* dec_4p_4N(index>>((2*n_1)+1 ), n_1, offsetA, pos); */
+            dec_2p_2N1(index, n_1, offsetB, pos + 4);
+            break;
+        case 3:
+            dec_3p_3N1(index >> (3*n_1 + 1), n_1, offset, pos); /* dec_3p_3N1(index>>((3*n_1)+ 1), n_1, offset, pos); */
+            dec_3p_3N1(index, n_1, j, pos + 3);
+            break;
+    }
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_gain2_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_gain2_amr_wb.cpp
new file mode 100644 (file)
index 0000000..927f7ca
--- /dev/null
@@ -0,0 +1,396 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dec_gain2_amr_wb.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 index,                 (i)     : index of quantization.
+     int16 nbits,                 (i)     : number of bits (6 or 7)
+     int16 code[],                (i) Q9  : Innovative vector.
+     int16 L_subfr,               (i)     : Subframe lenght.
+     int16 * gain_pit,            (o) Q14 : Pitch gain.
+     int32 * gain_cod,            (o) Q16 : Code gain.
+     int16 bfi,                   (i)     : bad frame indicator
+     int16 prev_bfi,              (i)     : Previous BF indicator
+     int16 state,                 (i)     : State of BFH
+     int16 unusable_frame,        (i)     : UF indicator
+     int16 vad_hist,              (i)     : number of non-speech frames
+     int16 * mem                  (i/o)   : static memory (4 words)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Decode the pitch and codebook gains
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwb_math_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+
+#include "qisf_ns.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+#define MEAN_ENER    30
+#define PRED_ORDER   4
+
+#define L_LTPHIST 5
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+const int16 pdown_unusable[7] = {32767, 31130, 29491, 24576, 7537, 1638, 328};
+const int16 cdown_unusable[7] = {32767, 16384, 8192, 8192, 8192, 4915, 3277};
+
+const int16 pdown_usable[7] = {32767, 32113, 31457, 24576, 7537, 1638, 328};
+const int16 cdown_usable[7] = {32767, 32113, 32113, 32113, 32113, 32113, 22938};
+
+
+/* MA prediction coeff ={0.5, 0.4, 0.3, 0.2} in Q13 */
+const int16 pred[PRED_ORDER] = {4096, 3277, 2458, 1638};
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+/* output  :static memory (4 words)      */
+void dec_gain2_amr_wb_init(int16 * mem)
+{
+
+    /* 4nd order quantizer energy predictor (init to -14.0 in Q10) */
+    mem[0] = -14336;                          /* past_qua_en[0] */
+    mem[1] = -14336;                          /* past_qua_en[1] */
+    mem[2] = -14336;                          /* past_qua_en[2] */
+    mem[3] = -14336;                          /* past_qua_en[3] */
+    /* 4  *past_gain_pit  */
+    /* 5  *past_gain_code  */
+    /* 6  *prev_gc  */
+    /* next 5  pbuf[]  */
+    /* next 5  gbuf[]  */
+    /* next 5  pbuf2[]  */
+    pv_memset((void *)&mem[4], 0, 18*sizeof(*mem));
+
+    mem[22] = 21845;
+
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void dec_gain2_amr_wb(
+    int16 index,               /* (i)     : index of quantization.      */
+    int16 nbits,               /* (i)     : number of bits (6 or 7)     */
+    int16 code[],              /* (i) Q9  : Innovative vector.          */
+    int16 L_subfr,             /* (i)     : Subframe lenght.            */
+    int16 * gain_pit,          /* (o) Q14 : Pitch gain.                 */
+    int32 * gain_cod,          /* (o) Q16 : Code gain.                  */
+    int16 bfi,                 /* (i)     : bad frame indicator         */
+    int16 prev_bfi,            /* (i)     : Previous BF indicator       */
+    int16 state,               /* (i)     : State of BFH                */
+    int16 unusable_frame,      /* (i)     : UF indicator                */
+    int16 vad_hist,            /* (i)     : number of non-speech frames */
+    int16 * mem                /* (i/o)   : static memory (4 words)     */
+)
+{
+    const int16 *p;
+    int16 *past_gain_pit, *past_gain_code, *past_qua_en, *gbuf, *pbuf, *prev_gc;
+    int16 *pbuf2;
+    int16 i, tmp, exp, frac, gcode0, exp_gcode0, qua_ener, gcode_inov;
+    int16 tmp1, g_code;
+    int16 tmp2;
+    int32 L_tmp;
+
+    past_qua_en = mem;
+    past_gain_pit = mem + 4;
+    past_gain_code = mem + 5;
+    prev_gc = mem + 6;
+    pbuf = mem + 7;
+    gbuf = mem + 12;
+    pbuf2 = mem + 17;
+
+    /*
+     *  Find energy of code and compute:
+     *
+     *    L_tmp = 1.0 / sqrt(energy of code/ L_subfr)
+     */
+
+    L_tmp = Dot_product12(code, code, L_subfr, &exp);
+    exp -= 24;                /* exp: -18 (code in Q9), -6 (/L_subfr) */
+
+    one_ov_sqrt_norm(&L_tmp, &exp);
+
+    gcode_inov = extract_h(shl_int32(L_tmp, exp - 3));  /* g_code_inov in Q12 */
+
+    /*
+     * Case of erasure.
+     */
+
+    if (bfi != 0)
+    {
+        tmp = median5(&pbuf[2]);
+        *past_gain_pit = tmp;
+
+        if (*past_gain_pit > 15565)
+        {
+            *past_gain_pit = 15565;        /* 0.95 in Q14 */
+
+        }
+
+        if (unusable_frame != 0)
+        {
+            *gain_pit = mult_int16(pdown_unusable[state], *past_gain_pit);
+        }
+        else
+        {
+            *gain_pit = mult_int16(pdown_usable[state], *past_gain_pit);
+        }
+        tmp = median5(&gbuf[2]);
+
+        if (vad_hist > 2)
+        {
+            *past_gain_code = tmp;
+        }
+        else
+        {
+
+            if (unusable_frame != 0)
+            {
+                *past_gain_code = mult_int16(cdown_unusable[state], tmp);
+            }
+            else
+            {
+                *past_gain_code = mult_int16(cdown_usable[state], tmp);
+            }
+        }
+
+        /* update table of past quantized energies */
+
+        tmp  = past_qua_en[3];
+        tmp1 = past_qua_en[2];
+        L_tmp  = tmp;
+        L_tmp += tmp1;
+        past_qua_en[3] = tmp;
+        tmp  = past_qua_en[1];
+        tmp1 = past_qua_en[0];
+        L_tmp += tmp;
+        L_tmp += tmp1;
+        past_qua_en[2] = tmp;
+        qua_ener = (int16)(L_tmp >> 3);
+        past_qua_en[1] = tmp1;
+
+
+        qua_ener -= 3072;    /* -3 in Q10 */
+
+        if (qua_ener < -14336)
+        {
+            qua_ener = -14336;                /* -14 in Q10 */
+        }
+
+        past_qua_en[0] = qua_ener;
+
+
+        for (i = 1; i < 5; i++)
+        {
+            gbuf[i - 1] = gbuf[i];
+            pbuf[i - 1] = pbuf[i];
+        }
+        gbuf[4] = *past_gain_code;
+        pbuf[4] = *past_gain_pit;
+
+
+        /* adjust gain according to energy of code */
+        /* past_gain_code(Q3) * gcode_inov(Q12) => Q16 */
+        *gain_cod = mul_16by16_to_int32(*past_gain_code, gcode_inov);
+
+        return;
+    }
+    /*
+     * Compute gcode0
+     *  = Sum(i=0,1) pred[i]*past_qua_en[i] + mean_ener - ener_code
+     */
+
+    L_tmp = L_deposit_h(MEAN_ENER);        /* MEAN_ENER in Q16 */
+    L_tmp = shl_int32(L_tmp, 8);               /* From Q16 to Q24 */
+    L_tmp = mac_16by16_to_int32(L_tmp, pred[0], past_qua_en[0]);      /* Q13*Q10 -> Q24 */
+    L_tmp = mac_16by16_to_int32(L_tmp, pred[1], past_qua_en[1]);      /* Q13*Q10 -> Q24 */
+    L_tmp = mac_16by16_to_int32(L_tmp, pred[2], past_qua_en[2]);      /* Q13*Q10 -> Q24 */
+    L_tmp = mac_16by16_to_int32(L_tmp, pred[3], past_qua_en[3]);      /* Q13*Q10 -> Q24 */
+
+    gcode0 = extract_h(L_tmp);             /* From Q24 to Q8  */
+
+    /*
+     * gcode0 = pow(10.0, gcode0/20)
+     *        = pow(2, 3.321928*gcode0/20)
+     *        = pow(2, 0.166096*gcode0)
+     */
+
+    L_tmp = ((int32)gcode0 * 5443) >> 7;      /* *0.166096 in Q15 -> Q24     */
+
+    int32_to_dpf(L_tmp, &exp_gcode0, &frac);  /* Extract exponant of gcode0  */
+
+    gcode0 = (int16)(power_of_2(14, frac));    /* Put 14 as exponant so that  */
+    /* output of Pow2() will be:   */
+    /* 16384 < Pow2() <= 32767     */
+    exp_gcode0 -= 14;
+
+    /* Read the quantized gains */
+
+    if (nbits == 6)
+    {
+        p = &t_qua_gain6b[index<<1];
+    }
+    else
+    {
+        p = &t_qua_gain7b[index<<1];
+    }
+    *gain_pit = *p++;                         /* selected pitch gain in Q14 */
+    g_code = *p++;                            /* selected code gain in Q11  */
+
+    L_tmp = mul_16by16_to_int32(g_code, gcode0);        /* Q11*Q0 -> Q12 */
+    L_tmp = shl_int32(L_tmp, exp_gcode0 + 4);   /* Q12 -> Q16 */
+
+    *gain_cod = L_tmp;                        /* gain of code in Q16 */
+
+    if (prev_bfi == 1)
+    {
+        L_tmp = mul_16by16_to_int32(*prev_gc, 5120);    /* prev_gc(Q3) * 1.25(Q12) = Q16 */
+        /* if((*gain_cod > ((*prev_gc) * 1.25)) && (*gain_cod > 100.0)) */
+
+        if ((*gain_cod > L_tmp) && (*gain_cod > 6553600))
+        {
+            *gain_cod = L_tmp;
+        }
+    }
+    /* keep past gain code in Q3 for frame erasure (can saturate) */
+    *past_gain_code = amr_wb_round(shl_int32(*gain_cod, 3));
+    *past_gain_pit = *gain_pit;
+
+
+    *prev_gc = *past_gain_code;
+    tmp  = gbuf[1];
+    tmp1 = pbuf[1];
+    tmp2 = pbuf2[1];
+    for (i = 1; i < 5; i++)
+    {
+        gbuf[i - 1]  = tmp;
+        pbuf[i - 1]  = tmp1;
+        pbuf2[i - 1] = tmp2;
+        tmp  = gbuf[i];
+        tmp1 = pbuf[i];
+        tmp2 = pbuf2[i];
+    }
+    gbuf[4] = *past_gain_code;
+    pbuf[4] = *past_gain_pit;
+    pbuf2[4] = *past_gain_pit;
+
+
+    /* adjust gain according to energy of code */
+    int32_to_dpf(*gain_cod, &exp, &frac);
+    L_tmp = mul_32by16(exp, frac, gcode_inov);
+
+    *gain_cod = shl_int32(L_tmp, 3);              /* gcode_inov in Q12 */
+
+
+    past_qua_en[3] = past_qua_en[2];
+    past_qua_en[2] = past_qua_en[1];
+    past_qua_en[1] = past_qua_en[0];
+
+    /*
+     * qua_ener = 20*log10(g_code)
+     *          = 6.0206*log2(g_code)
+     *          = 6.0206*(log2(g_codeQ11) - 11)
+     */
+    L_tmp = (int32)g_code;
+    amrwb_log_2(L_tmp, &exp, &frac);
+    exp -= 11;
+    L_tmp = mul_32by16(exp, frac, 24660);   /* x 6.0206 in Q12 */
+
+    /* update table of past quantized energies */
+
+    past_qua_en[0] = (int16)(L_tmp >> 3); /* result in Q10 */
+
+    return;
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/decoder_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/decoder_amr_wb.cpp
new file mode 100644 (file)
index 0000000..e2c9f47
--- /dev/null
@@ -0,0 +1,383 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+//////////////////////////////////////////////////////////////////////////////////
+//                                                                              //
+//  File: decoder_amr_wb.cpp                                                   //
+//                                                                              //
+//////////////////////////////////////////////////////////////////////////////////
+
+#include "decoder_amr_wb.h"
+#include "pvamrwbdecoder_api.h"
+#include "pvamrwbdecoder.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "dtx.h"
+
+
+// Use default DLL entry point
+#include "oscl_dll.h"
+#include "oscl_error_codes.h"
+#include "oscl_exception.h"
+#include "oscl_mem.h"
+
+
+#define KCAI_CODEC_INIT_FAILURE -1
+
+
+OSCL_DLL_ENTRY_POINT_DEFAULT()
+
+OSCL_EXPORT_REF CDecoder_AMR_WB *CDecoder_AMR_WB::NewL()
+{
+    CDecoder_AMR_WB *dec = new CDecoder_AMR_WB;
+    if (dec == NULL)
+        OSCL_LEAVE(OsclErrNoMemory);
+    else
+        dec->ConstructL();
+    return dec;
+}
+
+OSCL_EXPORT_REF void CDecoder_AMR_WB::ConstructL()
+{
+    st = NULL;
+    pt_st = NULL;
+    ScratchMem = NULL;
+    iInputBuf = NULL;
+    iOutputBuf = NULL;
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_WB
+
+    ~CDecoder_AMR_WB
+
+    Empty decoder destructor.
+
+    Parameters:     none
+
+    Return Values:  none
+
+-----------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF CDecoder_AMR_WB::~CDecoder_AMR_WB()
+{
+    st = NULL;
+    ScratchMem = NULL;
+
+    if (pt_st != NULL)
+    {
+        OSCL_ARRAY_DELETE((uint8*)pt_st);
+        pt_st = NULL;
+    }
+
+    if (iInputBuf)
+    {
+        OSCL_ARRAY_DELETE(iInputBuf);
+        iInputBuf = NULL;
+    }
+
+    if (iOutputBuf)
+    {
+        OSCL_ARRAY_DELETE(iOutputBuf);
+        iOutputBuf = NULL;
+    }
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_WB
+
+    StartL
+
+    Start decoder object. Initialize codec status.
+
+    Parameters:     none
+
+    Return Values:  status
+
+-----------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF int32 CDecoder_AMR_WB::StartL(tPVAmrDecoderExternal * pExt,
+        bool aAllocateInputBuffer,
+        bool aAllocateOutputBuffer)
+{
+
+    /*
+     *  Allocate Input bitstream buffer
+     */
+    if (aAllocateInputBuffer)
+    {
+        iInputBuf = OSCL_ARRAY_NEW(uint8, KAMRWB_NB_BYTES_MAX);
+        if (iInputBuf == NULL)
+        {
+            return KCAI_CODEC_INIT_FAILURE;
+        }
+    }
+    else
+    {
+        iInputBuf = NULL;
+    }
+    pExt->pInputBuffer = iInputBuf;
+
+    iInputSampleBuf = OSCL_ARRAY_NEW(int16, KAMRWB_NB_BITS_MAX);
+    if (iInputSampleBuf == NULL)
+    {
+        return KCAI_CODEC_INIT_FAILURE;
+    }
+    pExt->pInputSampleBuffer = iInputSampleBuf;
+
+    /*
+     *  Allocate Output PCM buffer
+     */
+    if (aAllocateOutputBuffer)
+    {
+        iOutputBuf = OSCL_ARRAY_NEW(int16, AMR_WB_PCM_FRAME);
+
+        if (iOutputBuf == NULL)
+        {
+            return KCAI_CODEC_INIT_FAILURE;
+        }
+    }
+    else
+    {
+        iOutputBuf = NULL;
+    }
+    pExt->pOutputBuffer = iOutputBuf;
+
+    pExt->samplingRate = 16000;
+    pExt->desiredChannels = 1;
+
+    pExt->reset_flag = 0;
+    pExt->reset_flag_old = 1;
+    pExt->mode_old = 0;
+    pExt->rx_state.prev_ft = RX_SPEECH_GOOD;
+    pExt->rx_state.prev_mode = 0;
+
+
+    int32 memreq = pvDecoder_AmrWbMemRequirements();
+
+    pt_st = OSCL_ARRAY_NEW(uint8, memreq);
+
+    if (pt_st == 0)
+    {
+        return(KCAI_CODEC_INIT_FAILURE);
+    }
+
+    pvDecoder_AmrWb_Init(&st, pt_st, &ScratchMem);
+
+    return 0;
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_WB
+
+    ExecuteL
+
+    Execute decoder object. Read one encoded speech frame from the input
+    stream,  decode it and write the decoded frame to output stream.
+
+    Parameters:
+
+    Return Values:  status
+
+
+-----------------------------------------------------------------------------
+*/
+
+
+OSCL_EXPORT_REF int32 CDecoder_AMR_WB::ExecuteL(tPVAmrDecoderExternal * pExt)
+{
+
+    if (pExt->input_format == MIME_IETF)  /* MIME/storage file format */
+    {
+        mime_unsorting(pExt->pInputBuffer,
+                       pExt->pInputSampleBuffer,
+                       &pExt->frame_type,
+                       &pExt->mode,
+                       pExt->quality,
+                       &pExt->rx_state);
+    }
+
+
+    if ((pExt->frame_type == RX_NO_DATA) | (pExt->frame_type == RX_SPEECH_LOST))
+    {
+        pExt->mode = pExt->mode_old;
+        pExt->reset_flag = 0;
+    }
+    else
+    {
+        pExt->mode_old = pExt->mode;
+
+        /* if homed: check if this frame is another homing frame */
+        if (pExt->reset_flag_old == 1)
+        {
+            /* only check until end of first subframe */
+            pExt->reset_flag = pvDecoder_AmrWb_homing_frame_test_first(pExt->pInputSampleBuffer,
+                               pExt->mode);
+        }
+    }
+
+    /* produce encoder homing frame if homed & input=decoder homing frame */
+    if ((pExt->reset_flag != 0) && (pExt->reset_flag_old != 0))
+    {
+        /* set homing sequence ( no need to decode anything */
+
+        for (int16 i = 0; i < AMR_WB_PCM_FRAME; i++)
+        {
+            pExt->pOutputBuffer[i] = EHF_MASK;
+        }
+    }
+    else
+    {
+        pExt->status = pvDecoder_AmrWb(pExt->mode,
+                                       pExt->pInputSampleBuffer,
+                                       pExt->pOutputBuffer,
+                                       &pExt->frameLength,
+                                       st,
+                                       pExt->frame_type,
+                                       ScratchMem);
+    }
+
+    for (int16 i = 0; i < AMR_WB_PCM_FRAME; i++)   /* Delete the 2 LSBs (14-bit output) */
+    {
+        pExt->pOutputBuffer[i] &= 0xfffC;
+    }
+
+
+    /* if not homed: check whether current frame is a homing frame */
+    if (pExt->reset_flag_old == 0)
+    {
+        /* check whole frame */
+        pExt->reset_flag = pvDecoder_AmrWb_homing_frame_test(pExt->pInputSampleBuffer,
+                           pExt->mode);
+    }
+    /* reset decoder if current frame is a homing frame */
+    if (pExt->reset_flag != 0)
+    {
+        pvDecoder_AmrWb_Reset(st, 1);;
+    }
+    pExt->reset_flag_old = pExt->reset_flag;
+
+    return pExt->status;
+
+}
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_WB
+
+    StopL
+
+    Stop decoder object.
+
+    Parameters:     none
+
+    Return Values:  none
+
+-----------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF void CDecoder_AMR_WB::StopL()
+{
+}
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_WB
+
+    ResetDecoderL
+
+    Stop decoder object. Reset decoder.
+
+    Parameters:     none
+
+    Return Values:  status
+
+-----------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF int32 CDecoder_AMR_WB::ResetDecoderL()
+{
+    pvDecoder_AmrWb_Reset(st, 1);
+    return 0;
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDecoder_AMR_WB
+
+    TerminateDecoderL
+
+    Stop decoder object. close decoder.
+
+    Parameters:     none
+
+    Return Values:  none
+
+-----------------------------------------------------------------------------
+*/
+OSCL_EXPORT_REF void CDecoder_AMR_WB::TerminateDecoderL()
+{
+    st = NULL;
+    ScratchMem = NULL;
+
+    if (pt_st != NULL)
+    {
+        OSCL_ARRAY_DELETE((uint8*)pt_st);
+        pt_st = NULL;
+    }
+
+    if (iInputBuf)
+    {
+        OSCL_ARRAY_DELETE(iInputBuf);
+        iInputBuf = NULL;
+    }
+
+    if (iOutputBuf)
+    {
+        OSCL_ARRAY_DELETE(iOutputBuf);
+        iOutputBuf = NULL;
+    }
+
+    if (iInputSampleBuf != NULL)
+    {
+        OSCL_ARRAY_DELETE(iInputSampleBuf);
+        iInputSampleBuf = NULL;
+    }
+
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/deemphasis_32.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/deemphasis_32.cpp
new file mode 100644 (file)
index 0000000..38cd619
--- /dev/null
@@ -0,0 +1,158 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: deemphasis_32.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 x_hi[],               (i)     : input signal (bit31..16)
+     int16 x_lo[],               (i)     : input signal (bit15..4)
+     int16 y[],                  (o)     : output signal (x16)
+     int16 mu,                   (i) Q15 : deemphasis factor
+     int16 L,                    (i)     : vector size
+     int16 * mem                 (i/o)   : memory (y[-1])
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    32-bits filtering through 1/(1-mu z^-1)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+    Deemphasis H(z) = 1/(1 - 0.68z^(-1))   where mu = 0.67999 in Q15
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwb_math_op.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void deemphasis_32(
+    int16 x_hi[],                        /* (i)     : input signal (bit31..16) */
+    int16 x_lo[],                        /* (i)     : input signal (bit15..4)  */
+    int16 y[],                           /* (o)     : output signal (x16)      */
+    int16 mu,                            /* (i) Q15 : deemphasis factor        */
+    int16 L,                             /* (i)     : vector size              */
+    int16 * mem                          /* (i/o)   : memory (y[-1])           */
+)
+{
+    int16 i;
+    int32 L_tmp;
+    int16 lo, hi;
+
+    L_tmp  = ((int32)x_hi[0]) << 16;
+    L_tmp += ((int32)x_lo[0]) << 4;
+    L_tmp  = shl_int32(L_tmp, 3);
+
+    L_tmp = fxp_mac_16by16(*mem, mu, L_tmp),
+
+            L_tmp = shl_int32(L_tmp, 1);               /* saturation can occur here */
+    y[0] = amr_wb_round(L_tmp);
+
+    lo = x_lo[1];
+    hi = x_hi[1];
+    for (i = 1; i < L - 1; i++)
+    {
+        L_tmp  = ((int32)hi) << 16;
+        L_tmp += ((int32)lo) << 4;
+        L_tmp  = shl_int32(L_tmp, 3);
+        L_tmp  = fxp_mac_16by16(y[i - 1], mu, L_tmp),
+                 L_tmp  = shl_int32(L_tmp, 1);           /* saturation can occur here */
+        y[i]   = amr_wb_round(L_tmp);
+        lo     = x_lo[i+1];
+        hi     = x_hi[i+1];
+    }
+    L_tmp  = ((int32)hi) << 16;
+    L_tmp += ((int32)lo) << 4;
+    L_tmp  = shl_int32(L_tmp, 3);
+    L_tmp  = fxp_mac_16by16(y[i - 1], mu, L_tmp),
+             L_tmp  = shl_int32(L_tmp, 1);           /* saturation can occur here */
+    y[i]   = amr_wb_round(L_tmp);
+
+    *mem = y[L - 1];
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx.h
new file mode 100644 (file)
index 0000000..a87bf1c
--- /dev/null
@@ -0,0 +1,236 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./cpp/include/dtx.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+    Static memory, constants and frametypes for the DTX
+------------------------------------------------------------------------------
+*/
+#ifndef DTX_H
+#define DTX_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES AND SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+#define DTX_MAX_EMPTY_THRESH 50
+#define DTX_HIST_SIZE 8
+#define DTX_HIST_SIZE_MIN_ONE 7
+#define DTX_ELAPSED_FRAMES_THRESH (24 + 7 -1)
+#define DTX_HANG_CONST 7                   /* yields eight frames of SP HANGOVER  */
+#define INV_MED_THRESH 14564
+#define ISF_GAP  128                       /* 50 */
+#define ONE_MINUS_ISF_GAP 16384 - ISF_GAP
+
+#define ISF_GAP   128
+#define ISF_DITH_GAP   448
+#define ISF_FACTOR_LOW 256
+#define ISF_FACTOR_STEP 2
+
+#define GAIN_THR 180
+#define GAIN_FACTOR 75
+
+    typedef struct
+    {
+        int16 isf_hist[M * DTX_HIST_SIZE];
+        int16 log_en_hist[DTX_HIST_SIZE];
+        int16 hist_ptr;
+        int16 log_en_index;
+        int16 cng_seed;
+
+        /* DTX handler stuff */
+        int16 dtxHangoverCount;
+        int16 decAnaElapsedCount;
+        int32 D[28];
+        int32 sumD[DTX_HIST_SIZE];
+    } dtx_encState;
+
+#define SPEECH 0
+#define DTX 1
+#define DTX_MUTE 2
+
+#define TX_SPEECH 0
+#define TX_SID_FIRST 1
+#define TX_SID_UPDATE 2
+#define TX_NO_DATA 3
+
+#define RX_SPEECH_GOOD 0
+#define RX_SPEECH_PROBABLY_DEGRADED 1
+#define RX_SPEECH_LOST 2
+#define RX_SPEECH_BAD 3
+#define RX_SID_FIRST 4
+#define RX_SID_UPDATE 5
+#define RX_SID_BAD 6
+#define RX_NO_DATA 7
+
+    /*****************************************************************************
+     *
+     * DEFINITION OF DATA TYPES
+     *****************************************************************************/
+
+    typedef struct
+    {
+        int16 since_last_sid;
+        int16 true_sid_period_inv;
+        int16 log_en;
+        int16 old_log_en;
+        int16 level;
+        int16 isf[M];
+        int16 isf_old[M];
+        int16 cng_seed;
+
+        int16 isf_hist[M * DTX_HIST_SIZE];
+        int16 log_en_hist[DTX_HIST_SIZE];
+        int16 hist_ptr;
+
+        int16 dtxHangoverCount;
+        int16 decAnaElapsedCount;
+
+        int16 sid_frame;
+        int16 valid_data;
+        int16 dtxHangoverAdded;
+
+        int16 dtxGlobalState;                 /* contains previous state */
+        /* updated in main decoder */
+
+        int16 data_updated;                   /* marker to know if CNI data is ever renewed */
+
+        int16 dither_seed;
+        int16 CN_dith;
+
+    } dtx_decState;
+
+    int16 dtx_enc_init(dtx_encState ** st, int16 isf_init[]);
+    int16 dtx_enc_reset(dtx_encState * st, int16 isf_init[]);
+    void dtx_enc_exit(dtx_encState ** st);
+
+    int16 dtx_enc(
+        dtx_encState * st,                    /* i/o : State struct                                         */
+        int16 isf[M],                        /* o   : CN ISF vector                                        */
+        int16 * exc2,                        /* o   : CN excitation                                        */
+        int16 ** prms
+    );
+
+    int16 dtx_buffer(
+        dtx_encState * st,                    /* i/o : State struct                    */
+        int16 isf_new[],                     /* i   : isf vector                      */
+        int32 enr,                           /* i   : residual energy (in L_FRAME)    */
+        int16 codec_mode
+    );
+
+    void tx_dtx_handler(dtx_encState * st,     /* i/o : State struct           */
+                        int16 vad_flag,                      /* i   : vad decision           */
+                        int16 * usedMode                     /* i/o : mode changed or not    */
+                       );
+
+    void Qisf_ns(
+        int16 * isf1,                        /* input : ISF in the frequency domain (0..0.5) */
+        int16 * isf_q,                       /* output: quantized ISF                        */
+        int16 * indice                       /* output: quantization indices                 */
+    );
+
+
+    int16 dtx_dec_amr_wb_reset(dtx_decState * st, const int16 isf_init[]);
+
+    int16 dtx_dec_amr_wb(
+        dtx_decState * st,                    /* i/o : State struct                                          */
+        int16 * exc2,                        /* o   : CN excitation                                          */
+        int16 new_state,                     /* i   : New DTX state                                          */
+        int16 isf[],                         /* o   : CN ISF vector                                          */
+        int16 ** prms
+    );
+
+    void dtx_dec_amr_wb_activity_update(
+        dtx_decState * st,
+        int16 isf[],
+        int16 exc[]);
+
+
+    int16 rx_amr_wb_dtx_handler(
+        dtx_decState * st,                    /* i/o : State struct     */
+        int16 frame_type                     /* i   : Frame type       */
+    );
+
+    void Disf_ns(
+        int16 * indice,                      /* input:  quantization indices                  */
+        int16 * isf_q                        /* input : ISF in the frequency domain (0..0.5)  */
+    );
+
+    void aver_isf_history(
+        int16 isf_old[],
+        int16 indices[],
+        int32 isf_aver[]
+    );
+    void find_frame_indices(
+        int16 isf_old_tx[],
+        int16 indices[],
+        dtx_encState * st
+    );
+
+    int16 dithering_control(
+        dtx_encState * st
+    );
+    void CN_dithering(
+        int16 isf[M],
+        int32 * L_log_en_int,
+        int16 * dither_seed
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /*  DTX_H  */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx_decoder_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx_decoder_amr_wb.cpp
new file mode 100644 (file)
index 0000000..125b87a
--- /dev/null
@@ -0,0 +1,976 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: dtx_decoder_amr_wb.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    DTX functions
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwb_math_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"  /* prototype of functions    */
+#include "get_amr_wb_bits.h"
+#include "dtx.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+/*
+ * Function    : dtx_dec_amr_wb_reset
+ */
+int16 dtx_dec_amr_wb_reset(dtx_decState * st, const int16 isf_init[])
+{
+    int16 i;
+
+
+    if (st == (dtx_decState *) NULL)
+    {
+        /* dtx_dec_amr_wb_reset invalid parameter */
+        return (-1);
+    }
+    st->since_last_sid = 0;
+    st->true_sid_period_inv = (1 << 13);      /* 0.25 in Q15 */
+
+    st->log_en = 3500;
+    st->old_log_en = 3500;
+    /* low level noise for better performance in  DTX handover cases */
+
+    st->cng_seed = RANDOM_INITSEED;
+
+    st->hist_ptr = 0;
+
+    /* Init isf_hist[] and decoder log frame energy */
+    pv_memcpy((void *)st->isf, (void *)isf_init, M*sizeof(*isf_init));
+
+    pv_memcpy((void *)st->isf_old, (void *)isf_init, M*sizeof(*isf_init));
+
+    for (i = 0; i < DTX_HIST_SIZE; i++)
+    {
+        pv_memcpy((void *)&st->isf_hist[i * M], (void *)isf_init, M*sizeof(*isf_init));
+        st->log_en_hist[i] = st->log_en;
+    }
+
+    st->dtxHangoverCount = DTX_HANG_CONST;
+    st->decAnaElapsedCount = 32767;
+
+    st->sid_frame = 0;
+    st->valid_data = 0;
+    st->dtxHangoverAdded = 0;
+
+    st->dtxGlobalState = SPEECH;
+    st->data_updated = 0;
+
+    st->dither_seed = RANDOM_INITSEED;
+    st->CN_dith = 0;
+
+    return 0;
+}
+
+
+/*
+     Table of new SPD synthesis states
+
+                           |     previous SPD_synthesis_state
+     Incoming              |
+     frame_type            | SPEECH       | DTX           | DTX_MUTE
+     ---------------------------------------------------------------
+     RX_SPEECH_GOOD ,      |              |               |
+     RX_SPEECH_PR_DEGRADED | SPEECH       | SPEECH        | SPEECH
+     ----------------------------------------------------------------
+     RX_SPEECH_BAD,        | SPEECH       | DTX           | DTX_MUTE
+     ----------------------------------------------------------------
+     RX_SID_FIRST,         | DTX          | DTX/(DTX_MUTE)| DTX_MUTE
+     ----------------------------------------------------------------
+     RX_SID_UPDATE,        | DTX          | DTX           | DTX
+     ----------------------------------------------------------------
+     RX_SID_BAD,           | DTX          | DTX/(DTX_MUTE)| DTX_MUTE
+     ----------------------------------------------------------------
+     RX_NO_DATA,           | SPEECH       | DTX/(DTX_MUTE)| DTX_MUTE
+     RX_SPARE              |(class2 garb.)|               |
+     ----------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*
+ * Function    : dtx_dec_amr_wb
+ */
+int16 dtx_dec_amr_wb(
+    dtx_decState * st,                    /* i/o : State struct         */
+    int16 * exc2,                        /* o   : CN excitation        */
+    int16 new_state,                     /* i   : New DTX state        */
+    int16 isf[],                         /* o   : CN ISF vector        */
+    int16 ** prms
+)
+{
+    int16 log_en_index;
+    int16 ind[7];
+    int16 i, j;
+    int16 int_fac;
+    int16 gain;
+
+    int32 L_isf[M], L_log_en_int, level32, ener32;
+    int16 ptr;
+    int16 tmp_int_length;
+    int16 tmp, exp, exp0, log_en_int_e, log_en_int_m, level;
+
+    /* This function is called if synthesis state is not SPEECH the globally passed  inputs to this function
+     * are st->sid_frame st->valid_data st->dtxHangoverAdded new_state  (SPEECH, DTX, DTX_MUTE) */
+
+    if ((st->dtxHangoverAdded != 0) &&
+            (st->sid_frame != 0))
+    {
+        /* sid_first after dtx hangover period */
+        /* or sid_upd after dtxhangover        */
+
+        /* consider  twice the last frame */
+        ptr = st->hist_ptr + 1;
+
+        if (ptr == DTX_HIST_SIZE)
+            ptr = 0;
+
+        pv_memcpy((void *)&st->isf_hist[ptr * M], (void *)&st->isf_hist[st->hist_ptr * M], M*sizeof(*st->isf_hist));
+
+        st->log_en_hist[ptr] = st->log_en_hist[st->hist_ptr];
+
+        /* compute mean log energy and isf from decoded signal (SID_FIRST) */
+        st->log_en = 0;
+        for (i = 0; i < M; i++)
+        {
+            L_isf[i] = 0;
+        }
+
+        /* average energy and isf */
+        for (i = 0; i < DTX_HIST_SIZE; i++)
+        {
+            /* Division by DTX_HIST_SIZE = 8 has been done in dtx_buffer log_en is in Q10 */
+            st->log_en = add_int16(st->log_en, st->log_en_hist[i]);
+
+            for (j = 0; j < M; j++)
+            {
+                L_isf[j] = add_int32(L_isf[j], (int32)(st->isf_hist[i * M + j]));
+            }
+        }
+
+        /* st->log_en in Q9 */
+        st->log_en >>=  1;
+
+        /* Add 2 in Q9, in order to have only positive values for Pow2 */
+        /* this value is subtracted back after Pow2 function */
+        st->log_en += 1024;
+
+        if (st->log_en < 0)
+            st->log_en = 0;
+
+        for (j = 0; j < M; j++)
+        {
+            st->isf[j] = (int16)(L_isf[j] >> 3);  /* divide by 8 */
+        }
+
+    }
+
+    if (st->sid_frame != 0)
+    {
+        /* Set old SID parameters, always shift */
+        /* even if there is no new valid_data   */
+
+        pv_memcpy((void *)st->isf_old, (void *)st->isf, M*sizeof(*st->isf));
+
+        st->old_log_en = st->log_en;
+
+        if (st->valid_data != 0)           /* new data available (no CRC) */
+        {
+            /* st->true_sid_period_inv = 1.0f/st->since_last_sid; */
+            /* Compute interpolation factor, since the division only works * for values of since_last_sid <
+             * 32 we have to limit the      * interpolation to 32 frames                                  */
+            tmp_int_length = st->since_last_sid;
+
+
+            if (tmp_int_length > 32)
+            {
+                tmp_int_length = 32;
+            }
+
+            if (tmp_int_length >= 2)
+            {
+                st->true_sid_period_inv = div_16by16(1 << 10, shl_int16(tmp_int_length, 10));
+            }
+            else
+            {
+                st->true_sid_period_inv = 1 << 14;      /* 0.5 it Q15 */
+            }
+
+            ind[0] = Serial_parm(6, prms);
+            ind[1] = Serial_parm(6, prms);
+            ind[2] = Serial_parm(6, prms);
+            ind[3] = Serial_parm(5, prms);
+            ind[4] = Serial_parm(5, prms);
+
+            Disf_ns(ind, st->isf);
+
+            log_en_index = Serial_parm(6, prms);
+
+            /* read background noise stationarity information */
+            st->CN_dith = Serial_parm_1bit(prms);
+
+            /* st->log_en = (float)log_en_index / 2.625 - 2.0;  */
+            /* log2(E) in Q9 (log2(E) lies in between -2:22) */
+            st->log_en = shl_int16(log_en_index, 15 - 6);
+
+            /* Divide by 2.625  */
+            st->log_en = mult_int16(st->log_en, 12483);
+            /* Subtract 2 in Q9 is done later, after Pow2 function  */
+
+            /* no interpolation at startup after coder reset        */
+            /* or when SID_UPD has been received right after SPEECH */
+
+            if ((st->data_updated == 0) || (st->dtxGlobalState == SPEECH))
+            {
+                pv_memcpy((void *)st->isf_old, (void *)st->isf, M*sizeof(*st->isf));
+
+                st->old_log_en = st->log_en;
+            }
+        }                                  /* endif valid_data */
+    }                                      /* endif sid_frame */
+
+
+    if ((st->sid_frame != 0) && (st->valid_data != 0))
+    {
+        st->since_last_sid = 0;
+    }
+    /* Interpolate SID info */
+    int_fac = shl_int16(st->since_last_sid, 10); /* Q10 */
+    int_fac = mult_int16(int_fac, st->true_sid_period_inv);   /* Q10 * Q15 -> Q10 */
+
+    /* Maximize to 1.0 in Q10 */
+
+    if (int_fac > 1024)
+    {
+        int_fac = 1024;
+    }
+    int_fac = shl_int16(int_fac, 4);             /* Q10 -> Q14 */
+
+    L_log_en_int = mul_16by16_to_int32(int_fac, st->log_en); /* Q14 * Q9 -> Q24 */
+
+    for (i = 0; i < M; i++)
+    {
+        isf[i] = mult_int16(int_fac, st->isf[i]);/* Q14 * Q15 -> Q14 */
+    }
+
+    int_fac = 16384 - int_fac;         /* 1-k in Q14 */
+
+    /* ( Q14 * Q9 -> Q24 ) + Q24 -> Q24 */
+    L_log_en_int = mac_16by16_to_int32(L_log_en_int, int_fac, st->old_log_en);
+
+    for (i = 0; i < M; i++)
+    {
+        /* Q14 + (Q14 * Q15 -> Q14) -> Q14 */
+        isf[i] = add_int16(isf[i], mult_int16(int_fac, st->isf_old[i]));
+        isf[i] = shl_int16(isf[i], 1);           /* Q14 -> Q15 */
+    }
+
+    /* If background noise is non-stationary, insert comfort noise dithering */
+    if (st->CN_dith != 0)
+    {
+        CN_dithering(isf, &L_log_en_int, &st->dither_seed);
+    }
+    /* L_log_en_int corresponds to log2(E)+2 in Q24, i.e log2(gain)+1 in Q25 */
+    /* Q25 -> Q16 */
+    L_log_en_int >>= 9;
+
+    /* Find integer part  */
+    log_en_int_e = extract_h(L_log_en_int);
+
+    /* Find fractional part */
+    log_en_int_m = (int16)(sub_int32(L_log_en_int, L_deposit_h(log_en_int_e)) >> 1);
+
+    /* Subtract 2 from L_log_en_int in Q9, i.e divide the gain by 2 (energy by 4) */
+    /* Add 16 in order to have the result of pow2 in Q16 */
+    log_en_int_e += 15;
+
+    /* level = (float)( pow( 2.0f, log_en ) );  */
+    level32 = power_of_2(log_en_int_e, log_en_int_m); /* Q16 */
+
+    exp0 = normalize_amr_wb(level32);
+    level32 <<= exp0;        /* level in Q31 */
+    exp0 = 15 - exp0;
+    level = (int16)(level32 >> 16);          /* level in Q15 */
+
+    /* generate white noise vector */
+    for (i = 0; i < L_FRAME; i++)
+    {
+        exc2[i] = noise_gen_amrwb(&(st->cng_seed)) >> 4;
+    }
+
+    /* gain = level / sqrt(ener) * sqrt(L_FRAME) */
+
+    /* energy of generated excitation */
+    ener32 = Dot_product12(exc2, exc2, L_FRAME, &exp);
+
+    one_ov_sqrt_norm(&ener32, &exp);
+
+    gain = extract_h(ener32);
+
+    gain = mult_int16(level, gain);              /* gain in Q15 */
+
+    exp += exp0;
+
+    /* Multiply by sqrt(L_FRAME)=16, i.e. shift left by 4 */
+    exp += 4;
+
+    for (i = 0; i < L_FRAME; i++)
+    {
+        tmp = mult_int16(exc2[i], gain);         /* Q0 * Q15 */
+        exc2[i] = shl_int16(tmp, exp);
+    }
+
+
+    if (new_state == DTX_MUTE)
+    {
+        /* mute comfort noise as it has been quite a long time since last SID update  was performed                            */
+
+        tmp_int_length = st->since_last_sid;
+
+        if (tmp_int_length > 32)
+        {
+            tmp_int_length = 32;
+        }
+
+        st->true_sid_period_inv = div_16by16(1 << 10, shl_int16(tmp_int_length, 10));
+
+        st->since_last_sid = 0;
+        st->old_log_en = st->log_en;
+        /* subtract 1/8 in Q9 (energy), i.e -3/8 dB */
+        st->log_en -= 64;
+    }
+    /* reset interpolation length timer if data has been updated.        */
+
+    if ((st->sid_frame != 0) &&
+            ((st->valid_data != 0) ||
+             ((st->valid_data == 0) && (st->dtxHangoverAdded) != 0)))
+    {
+        st->since_last_sid = 0;
+        st->data_updated = 1;
+    }
+    return 0;
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void dtx_dec_amr_wb_activity_update(
+    dtx_decState * st,
+    int16 isf[],
+    int16 exc[])
+{
+    int16 i;
+
+    int32 L_frame_en;
+    int16 log_en_e, log_en_m, log_en;
+
+
+    st->hist_ptr++;
+
+    if (st->hist_ptr == DTX_HIST_SIZE)
+    {
+        st->hist_ptr = 0;
+    }
+    pv_memcpy((void *)&st->isf_hist[st->hist_ptr * M], (void *)isf, M*sizeof(*isf));
+
+
+    /* compute log energy based on excitation frame energy in Q0 */
+    L_frame_en = 0;
+    for (i = 0; i < L_FRAME; i++)
+    {
+        L_frame_en = mac_16by16_to_int32(L_frame_en, exc[i], exc[i]);
+    }
+    L_frame_en >>= 1;
+
+    /* log_en = (float)log10(L_frame_en/(float)L_FRAME)/(float)log10(2.0f); */
+    amrwb_log_2(L_frame_en, &log_en_e, &log_en_m);
+
+    /* convert exponent and mantissa to int16 Q7. Q7 is used to simplify averaging in dtx_enc */
+    log_en = shl_int16(log_en_e, 7);             /* Q7 */
+    log_en += log_en_m >> 8;
+
+    /* Divide by L_FRAME = 256, i.e subtract 8 in Q7 = 1024 */
+    log_en -= 1024;
+
+    /* insert into log energy buffer */
+    st->log_en_hist[st->hist_ptr] = log_en;
+
+    return;
+}
+
+
+/*
+     Table of new SPD synthesis states
+
+                           |     previous SPD_synthesis_state
+     Incoming              |
+     frame_type            | SPEECH       | DTX           | DTX_MUTE
+     ---------------------------------------------------------------
+     RX_SPEECH_GOOD ,      |              |               |
+     RX_SPEECH_PR_DEGRADED | SPEECH       | SPEECH        | SPEECH
+     ----------------------------------------------------------------
+     RX_SPEECH_BAD,        | SPEECH       | DTX           | DTX_MUTE
+     ----------------------------------------------------------------
+     RX_SID_FIRST,         | DTX          | DTX/(DTX_MUTE)| DTX_MUTE
+     ----------------------------------------------------------------
+     RX_SID_UPDATE,        | DTX          | DTX           | DTX
+     ----------------------------------------------------------------
+     RX_SID_BAD,           | DTX          | DTX/(DTX_MUTE)| DTX_MUTE
+     ----------------------------------------------------------------
+     RX_NO_DATA,           | SPEECH       | DTX/(DTX_MUTE)| DTX_MUTE
+     RX_SPARE              |(class2 garb.)|               |
+     ----------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+int16 rx_amr_wb_dtx_handler(
+    dtx_decState * st,                    /* i/o : State struct     */
+    int16 frame_type                     /* i   : Frame type       */
+)
+{
+    int16 newState;
+    int16 encState;
+
+    /* DTX if SID frame or previously in DTX{_MUTE} and (NO_RX OR BAD_SPEECH) */
+
+
+
+    if ((frame_type == RX_SID_FIRST)  ||
+            (frame_type == RX_SID_UPDATE) ||
+            (frame_type == RX_SID_BAD)    ||
+            (((st->dtxGlobalState == DTX) ||
+              (st->dtxGlobalState == DTX_MUTE)) &&
+             ((frame_type == RX_NO_DATA)    ||
+              (frame_type == RX_SPEECH_BAD) ||
+              (frame_type == RX_SPEECH_LOST))))
+    {
+        newState = DTX;
+
+        /* stay in mute for these input types */
+
+        if ((st->dtxGlobalState == DTX_MUTE) &&
+                ((frame_type == RX_SID_BAD) ||
+                 (frame_type == RX_SID_FIRST) ||
+                 (frame_type == RX_SPEECH_LOST) ||
+                 (frame_type == RX_NO_DATA)))
+        {
+            newState = DTX_MUTE;
+        }
+        /* evaluate if noise parameters are too old                     */
+        /* since_last_sid is reset when CN parameters have been updated */
+        st->since_last_sid = add_int16(st->since_last_sid, 1);
+
+        /* no update of sid parameters in DTX for a long while */
+
+        if (st->since_last_sid > DTX_MAX_EMPTY_THRESH)
+        {
+            newState = DTX_MUTE;
+        }
+    }
+    else
+    {
+        newState = SPEECH;
+        st->since_last_sid = 0;
+    }
+
+    /* reset the decAnaElapsed Counter when receiving CNI data the first time, to robustify counter missmatch
+     * after handover this might delay the bwd CNI analysis in the new decoder slightly. */
+
+    if ((st->data_updated == 0) &&
+            (frame_type == RX_SID_UPDATE))
+    {
+        st->decAnaElapsedCount = 0;
+    }
+    /* update the SPE-SPD DTX hangover synchronization */
+    /* to know when SPE has added dtx hangover         */
+    st->decAnaElapsedCount = add_int16(st->decAnaElapsedCount, 1);
+    st->dtxHangoverAdded = 0;
+
+
+    if ((frame_type == RX_SID_FIRST) ||
+            (frame_type == RX_SID_UPDATE) ||
+            (frame_type == RX_SID_BAD) ||
+            (frame_type == RX_NO_DATA))
+    {
+        encState = DTX;
+    }
+    else
+    {
+        encState = SPEECH;
+    }
+
+
+    if (encState == SPEECH)
+    {
+        st->dtxHangoverCount = DTX_HANG_CONST;
+    }
+    else
+    {
+
+        if (st->decAnaElapsedCount > DTX_ELAPSED_FRAMES_THRESH)
+        {
+            st->dtxHangoverAdded = 1;
+            st->decAnaElapsedCount = 0;
+            st->dtxHangoverCount = 0;
+        }
+        else if (st->dtxHangoverCount == 0)
+        {
+            st->decAnaElapsedCount = 0;
+        }
+        else
+        {
+            st->dtxHangoverCount--;
+        }
+    }
+
+    if (newState != SPEECH)
+    {
+        /* DTX or DTX_MUTE CN data is not in a first SID, first SIDs are marked as SID_BAD but will do
+         * backwards analysis if a hangover period has been added according to the state machine above */
+
+        st->sid_frame = 0;
+        st->valid_data = 0;
+
+
+        if (frame_type == RX_SID_FIRST)
+        {
+            st->sid_frame = 1;
+        }
+        else if (frame_type == RX_SID_UPDATE)
+        {
+            st->sid_frame = 1;
+            st->valid_data = 1;
+        }
+        else if (frame_type == RX_SID_BAD)
+        {
+            st->sid_frame = 1;
+            st->dtxHangoverAdded = 0;      /* use old data */
+        }
+    }
+    return newState;
+    /* newState is used by both SPEECH AND DTX synthesis routines */
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void aver_isf_history(
+    int16 isf_old[],
+    int16 indices[],
+    int32 isf_aver[]
+)
+{
+    int16 i, j, k;
+    int16 isf_tmp[2 * M];
+    int32 L_tmp;
+
+    /* Memorize in isf_tmp[][] the ISF vectors to be replaced by */
+    /* the median ISF vector prior to the averaging               */
+    for (k = 0; k < 2; k++)
+    {
+
+        if (indices[k] + 1 != 0)
+        {
+            for (i = 0; i < M; i++)
+            {
+                isf_tmp[k * M + i] = isf_old[indices[k] * M + i];
+                isf_old[indices[k] * M + i] = isf_old[indices[2] * M + i];
+            }
+        }
+    }
+
+    /* Perform the ISF averaging */
+    for (j = 0; j < M; j++)
+    {
+        L_tmp = 0;
+
+        for (i = 0; i < DTX_HIST_SIZE; i++)
+        {
+            L_tmp = add_int32(L_tmp, (int32)(isf_old[i * M + j]));
+        }
+        isf_aver[j] = L_tmp;
+    }
+
+    /* Retrieve from isf_tmp[][] the ISF vectors saved prior to averaging */
+    for (k = 0; k < 2; k++)
+    {
+
+        if (indices[k] + 1 != 0)
+        {
+            for (i = 0; i < M; i++)
+            {
+                isf_old[indices[k] * M + i] = isf_tmp[k * M + i];
+            }
+        }
+    }
+
+    return;
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void find_frame_indices(
+    int16 isf_old_tx[],
+    int16 indices[],
+    dtx_encState * st
+)
+{
+    int32 L_tmp, summin, summax, summax2nd;
+    int16 i, j, tmp;
+    int16 ptr;
+
+    /* Remove the effect of the oldest frame from the column */
+    /* sum sumD[0..DTX_HIST_SIZE-1]. sumD[DTX_HIST_SIZE] is    */
+    /* not updated since it will be removed later.           */
+
+    tmp = DTX_HIST_SIZE_MIN_ONE;
+    j = -1;
+    for (i = 0; i < DTX_HIST_SIZE_MIN_ONE; i++)
+    {
+        j += tmp;
+        st->sumD[i] = sub_int32(st->sumD[i], st->D[j]);
+        tmp--;
+    }
+
+    /* Shift the column sum sumD. The element sumD[DTX_HIST_SIZE-1]    */
+    /* corresponding to the oldest frame is removed. The sum of     */
+    /* the distances between the latest isf and other isfs, */
+    /* i.e. the element sumD[0], will be computed during this call. */
+    /* Hence this element is initialized to zero.                   */
+
+    for (i = DTX_HIST_SIZE_MIN_ONE; i > 0; i--)
+    {
+        st->sumD[i] = st->sumD[i - 1];
+    }
+    st->sumD[0] = 0;
+
+    /* Remove the oldest frame from the distance matrix.           */
+    /* Note that the distance matrix is replaced by a one-         */
+    /* dimensional array to save static memory.                    */
+
+    tmp = 0;
+    for (i = 27; i >= 12; i -= tmp)
+    {
+        tmp++;
+        for (j = tmp; j > 0; j--)
+        {
+            st->D[i - j + 1] = st->D[i - j - tmp];
+        }
+    }
+
+    /* Compute the first column of the distance matrix D            */
+    /* (squared Euclidean distances from isf1[] to isf_old_tx[][]). */
+
+    ptr = st->hist_ptr;
+    for (i = 1; i < DTX_HIST_SIZE; i++)
+    {
+        /* Compute the distance between the latest isf and the other isfs. */
+        ptr--;
+
+        if (ptr < 0)
+        {
+            ptr = DTX_HIST_SIZE_MIN_ONE;
+        }
+        L_tmp = 0;
+        for (j = 0; j < M; j++)
+        {
+            tmp = sub_int16(isf_old_tx[st->hist_ptr * M + j], isf_old_tx[ptr * M + j]);
+            L_tmp = mac_16by16_to_int32(L_tmp, tmp, tmp);
+        }
+        st->D[i - 1] = L_tmp;
+
+        /* Update also the column sums. */
+        st->sumD[0] = add_int32(st->sumD[0], st->D[i - 1]);
+        st->sumD[i] = add_int32(st->sumD[i], st->D[i - 1]);
+    }
+
+    /* Find the minimum and maximum distances */
+    summax = st->sumD[0];
+    summin = st->sumD[0];
+    indices[0] = 0;
+    indices[2] = 0;
+    for (i = 1; i < DTX_HIST_SIZE; i++)
+    {
+
+        if (st->sumD[i] > summax)
+        {
+            indices[0] = i;
+            summax = st->sumD[i];
+        }
+
+        if (st->sumD[i] < summin)
+        {
+            indices[2] = i;
+            summin = st->sumD[i];
+        }
+    }
+
+    /* Find the second largest distance */
+    summax2nd = -2147483647L;
+    indices[1] = -1;
+    for (i = 0; i < DTX_HIST_SIZE; i++)
+    {
+
+        if ((st->sumD[i] > summax2nd) && (i != indices[0]))
+        {
+            indices[1] = i;
+            summax2nd = st->sumD[i];
+        }
+    }
+
+    for (i = 0; i < 3; i++)
+    {
+        indices[i] = sub_int16(st->hist_ptr, indices[i]);
+
+        if (indices[i] < 0)
+        {
+            indices[i] = add_int16(indices[i], DTX_HIST_SIZE);
+        }
+    }
+
+    /* If maximum distance/MED_THRESH is smaller than minimum distance */
+    /* then the median ISF vector replacement is not performed         */
+    tmp = normalize_amr_wb(summax);
+    summax <<= tmp;
+    summin <<= tmp;
+    L_tmp = mul_16by16_to_int32(amr_wb_round(summax), INV_MED_THRESH);
+
+    if (L_tmp <= summin)
+    {
+        indices[0] = -1;
+    }
+    /* If second largest distance/MED_THRESH is smaller than     */
+    /* minimum distance then the median ISF vector replacement is    */
+    /* not performed                                                 */
+    summax2nd = shl_int32(summax2nd, tmp);
+    L_tmp = mul_16by16_to_int32(amr_wb_round(summax2nd), INV_MED_THRESH);
+
+    if (L_tmp <= summin)
+    {
+        indices[1] = -1;
+    }
+    return;
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+int16 dithering_control(dtx_encState * st)
+{
+    int16 i, tmp, mean, CN_dith, gain_diff;
+    int32 ISF_diff;
+
+    /* determine how stationary the spectrum of background noise is */
+    ISF_diff = 0;
+    for (i = 0; i < 8; i++)
+    {
+        ISF_diff = add_int32(ISF_diff, st->sumD[i]);
+    }
+    if ((ISF_diff >> 26) > 0)
+    {
+        CN_dith = 1;
+    }
+    else
+    {
+        CN_dith = 0;
+    }
+
+    /* determine how stationary the energy of background noise is */
+    mean = 0;
+    for (i = 0; i < DTX_HIST_SIZE; i++)
+    {
+        mean = add_int16(mean, st->log_en_hist[i]);
+    }
+    mean >>= 3;
+    gain_diff = 0;
+    for (i = 0; i < DTX_HIST_SIZE; i++)
+    {
+        tmp = sub_int16(st->log_en_hist[i], mean);
+        tmp = tmp - (tmp < 0);
+
+        gain_diff += tmp ^(tmp >> 15);    /*  tmp ^sign(tmp)  */;
+    }
+    if (gain_diff > GAIN_THR)
+    {
+        CN_dith = 1;
+    }
+    return CN_dith;
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void CN_dithering(
+    int16 isf[M],
+    int32 * L_log_en_int,
+    int16 * dither_seed
+)
+{
+    int16 temp, temp1, i, dither_fac, rand_dith;
+    int16 rand_dith2;
+
+    /* Insert comfort noise dithering for energy parameter */
+    rand_dith = noise_gen_amrwb(dither_seed) >> 1;
+    rand_dith2 = noise_gen_amrwb(dither_seed) >> 1;
+    rand_dith += rand_dith2;
+    *L_log_en_int = add_int32(*L_log_en_int, mul_16by16_to_int32(rand_dith, GAIN_FACTOR));
+
+    if (*L_log_en_int < 0)
+    {
+        *L_log_en_int = 0;
+    }
+    /* Insert comfort noise dithering for spectral parameters (ISF-vector) */
+    dither_fac = ISF_FACTOR_LOW;
+
+    rand_dith = noise_gen_amrwb(dither_seed) >> 1;
+    rand_dith2 = noise_gen_amrwb(dither_seed) >> 1;
+    rand_dith +=  rand_dith2;
+    temp = add_int16(isf[0], mult_int16_r(rand_dith, dither_fac));
+
+    /* Make sure that isf[0] will not get negative values */
+    if (temp < ISF_GAP)
+    {
+        isf[0] = ISF_GAP;
+    }
+    else
+    {
+        isf[0] = temp;
+    }
+
+    for (i = 1; i < M - 1; i++)
+    {
+        dither_fac = add_int16(dither_fac, ISF_FACTOR_STEP);
+
+        rand_dith = noise_gen_amrwb(dither_seed) >> 1;
+        rand_dith2 = noise_gen_amrwb(dither_seed) >> 1;
+        rand_dith +=  rand_dith2;
+        temp = add_int16(isf[i], mult_int16_r(rand_dith, dither_fac));
+        temp1 = sub_int16(temp, isf[i - 1]);
+
+        /* Make sure that isf spacing remains at least ISF_DITH_GAP Hz */
+        if (temp1 < ISF_DITH_GAP)
+        {
+            isf[i] = isf[i - 1] + ISF_DITH_GAP;
+        }
+        else
+        {
+            isf[i] = temp;
+        }
+    }
+
+    /* Make sure that isf[M-2] will not get values above 16384 */
+    if (isf[M - 2] > 16384)
+    {
+        isf[M - 2] = 16384;
+    }
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/e_pv_amrwbdec.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/e_pv_amrwbdec.h
new file mode 100644 (file)
index 0000000..bd766e1
--- /dev/null
@@ -0,0 +1,126 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: e_pv_amrwbdec.h
+
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef E_PV_AMRWBDEC_H
+#define E_PV_AMRWBDEC_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pvamrwbdecoder_cnst.h"             /* coder constant parameters */
+#include "dtx.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; ENUMERATED TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; STRUCTURES TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+
+typedef struct
+{
+    int16 old_exc[PIT_MAX + L_INTERPOL];  /* old excitation vector */
+    int16 ispold[M];                      /* old isp (immittance spectral pairs)*/
+    int16 isfold[M];                      /* old isf (frequency domain) */
+    int16 isf_buf[L_MEANBUF * M];         /* isf buffer(frequency domain) */
+    int16 past_isfq[M];                   /* past isf quantizer */
+    int16 tilt_code;                      /* tilt of code */
+    int16 Q_old;                          /* old scaling factor */
+    int16 Qsubfr[4];                      /* old maximum scaling factor */
+    int32 L_gc_thres;                     /* threshold for noise enhancer */
+    int16 mem_syn_hi[M];                  /* modified synthesis memory (MSB) */
+    int16 mem_syn_lo[M];                  /* modified synthesis memory (LSB) */
+    int16 mem_deemph;                     /* speech deemph filter memory */
+    int16 mem_sig_out[6];                 /* hp50 filter memory for synthesis */
+    int16 mem_oversamp[2 * L_FILT];       /* synthesis oversampled filter memory */
+    int16 mem_syn_hf[M16k];               /* HF synthesis memory */
+    int16 mem_hf[2 * L_FILT16k];          /* HF band-pass filter memory */
+    int16 mem_hf2[2 * L_FILT16k];         /* HF band-pass filter memory */
+    int16 mem_hf3[2 * L_FILT16k];         /* HF band-pass filter memory */
+    int16 seed;                           /* random memory for frame erasure */
+    int16 seed2;                          /* random memory for HF generation */
+    int16 old_T0;                         /* old pitch lag */
+    int16 old_T0_frac;                    /* old pitch fraction lag */
+    int16 lag_hist[5];
+    int16 dec_gain[23];                   /* gain decoder memory */
+    int16 seed3;                          /* random memory for lag concealment */
+    int16 disp_mem[8];                    /* phase dispersion memory */
+    int16 mem_hp400[6];                   /* hp400 filter memory for synthesis */
+
+    int16 prev_bfi;
+    int16 state;
+    int16 first_frame;
+    dtx_decState dtx_decSt;
+    int16 vad_hist;
+
+} Decoder_State;
+
+typedef struct
+{
+    Decoder_State state;
+    int16 ScratchMem[L_SUBFR + L_SUBFR16k + ((L_SUBFR + M + M16k +1)<<1) + \
+                     (2*L_FRAME + 1) + PIT_MAX + L_INTERPOL + NB_SUBFR*(M+1) \
+                     + 3*(M+L_SUBFR) + M16k];
+} PV_AmrWbDec;
+
+
+/*----------------------------------------------------------------------------
+; END
+----------------------------------------------------------------------------*/
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.cpp
new file mode 100644 (file)
index 0000000..d9842fc
--- /dev/null
@@ -0,0 +1,155 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: get_amr_wb_bits.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 no_of_bits,        input : number of bits
+     int16 ** prms            bitstream pointer
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Returns no_of_bits from serial bit stream
+    Serial_parm -> convert serial stream to parameters
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "get_amr_wb_bits.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+int16 Serial_parm(                        /* Return the parameter    */
+    int16 no_of_bits,                    /* input : number of bits  */
+    int16 ** prms
+)
+{
+    int16 value = 0;
+
+    for (int16 i = no_of_bits >> 1; i != 0; i--)
+    {
+        value <<= 2;
+
+        if (*((*prms)++) == BIT_1)
+        {
+            value |= 2;
+        }
+
+        if (*((*prms)++) == BIT_1)
+        {
+            value |= 1;
+        }
+
+    }
+
+    if (no_of_bits&1)
+    {
+        value <<= 1;
+
+        if (*((*prms)++) == BIT_1)
+        {
+            value |= 1;
+        }
+
+    }
+
+    return (value);
+}
+
+
+int16 Serial_parm_1bit(int16 ** prms)                 /* Return the parameter    */
+{
+    int16 value = 0;
+
+    if (*((*prms)++) == BIT_1)
+    {
+        value = 1;
+    }
+    return (value);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.h
new file mode 100644 (file)
index 0000000..48e43db
--- /dev/null
@@ -0,0 +1,60 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*--------------------------------------------------------------------------*
+ *                       get_amr_wb_bits.h                                  *
+ *--------------------------------------------------------------------------*
+ *       Number of bits for different modes                                 *
+ *--------------------------------------------------------------------------*/
+
+#ifndef GET_AMR_WB_BITS_H
+#define GET_AMR_WB_BITS_H
+
+
+#include "pv_amr_wb_type_defs.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+    int16 Serial_parm(                        /* Return the parameter    */
+        int16 no_of_bits,                    /* input : number of bits  */
+        int16 ** prms
+    );
+
+    int16 Serial_parm_1bit(                        /* Return the parameter    */
+        int16 ** prms
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_400hz_at_12k8.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_400hz_at_12k8.cpp
new file mode 100644 (file)
index 0000000..d10a20d
--- /dev/null
@@ -0,0 +1,193 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: highpass_400Hz_at_12k8.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 signal[],             input signal / output is divided by 16
+     int16 lg,                   lenght of signal
+     int16 mem[]                 filter memory [6]
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   2nd order high pass filter with cut off frequency at 400 Hz.
+   Designed with cheby2 function in MATLAB.
+   Optimized for fixed-point to get the following frequency response:
+
+    frequency:     0Hz   100Hz  200Hz  300Hz  400Hz  630Hz  1.5kHz  3kHz
+    dB loss:     -infdB  -30dB  -20dB  -10dB  -3dB   +6dB    +1dB    0dB
+
+   Algorithm:
+
+    y[i] = b[0]*x[i] + b[1]*x[i-1] + b[2]*x[i-2]
+                     + a[1]*y[i-1] + a[2]*y[i-2];
+
+    int16 b[3] = {3660, -7320,  3660};       in Q12
+    int16 a[3] = {4096,  7320, -3540};       in Q12
+
+    float -->   b[3] = {0.893554687, -1.787109375,  0.893554687};
+                a[3] = {1.000000000,  1.787109375, -0.864257812};
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwb_math_op.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+/* Initialization of static values */
+
+void highpass_400Hz_at_12k8_init(int16 mem[])
+{
+    pv_memset((void *)mem, 0, 6*sizeof(*mem));
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void highpass_400Hz_at_12k8(
+    int16 signal[],                      /* input signal / output is divided by 16 */
+    int16 lg,                            /* lenght of signal    */
+    int16 mem[]                          /* filter memory [6]   */
+)
+{
+    int16 i, x2;
+    int16 y2_hi, y2_lo, y1_hi, y1_lo, x0, x1;
+    int32 L_tmp1;
+    int32 L_tmp2;
+
+    y2_hi = mem[0];
+    y2_lo = mem[1];
+    y1_hi = mem[2];
+    y1_lo = mem[3];
+    x0    = mem[4];
+    x1    = mem[5];
+
+    for (i = 0; i < lg; i++)
+    {
+
+        /* y[i] = b[0]*x[i] + b[1]*x[i-1] + b[0]*x[i-2]  */
+        /* + a[0]*y[i-1] + a[1] * y[i-2];  */
+
+        L_tmp1 = fxp_mac_16by16(y1_lo, 29280, 8192L);
+        L_tmp2 = fxp_mul_16by16(y1_hi, 29280);
+        L_tmp1 = fxp_mac_16by16(y2_lo, -14160, L_tmp1);
+        L_tmp2 = fxp_mac_16by16(y2_hi, -14160, L_tmp2);
+        x2 = x1;
+        x1 = x0;
+        x0 = signal[i];
+        L_tmp2 = fxp_mac_16by16(x2, 915, L_tmp2);
+        L_tmp2 = fxp_mac_16by16(x1, -1830, L_tmp2);
+        L_tmp2 = fxp_mac_16by16(x0, 915, L_tmp2);
+
+        L_tmp1 = (L_tmp1 >> 13) + (L_tmp2 << 2);  /* coeff Q12 --> Q13 */
+
+        y2_hi = y1_hi;
+        y2_lo = y1_lo;
+        /* signal is divided by 16 to avoid overflow in energy computation */
+        signal[i] = (int16)((L_tmp1 + 0x00008000) >> 16);
+
+        y1_hi = (int16)(L_tmp1 >> 16);
+        y1_lo = (int16)((L_tmp1 - (y1_hi << 16)) >> 1);
+
+
+    }
+
+
+    mem[0] = y2_hi;
+    mem[1] = y2_lo;
+    mem[2] = y1_hi;
+    mem[3] = y1_lo;
+    mem[4] = x0;
+    mem[5] = x1;
+
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_50hz_at_12k8.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_50hz_at_12k8.cpp
new file mode 100644 (file)
index 0000000..f78f5b4
--- /dev/null
@@ -0,0 +1,197 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: highpass_50Hz_at_12k8.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 signal[],             input signal / output is divided by 16
+     int16 lg,                   lenght of signal
+     int16 mem[]                 filter memory [6]
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   2nd order high pass filter with cut off frequency at 31 Hz.
+   Designed with cheby2 function in MATLAB.
+   Optimized for fixed-point to get the following frequency response:
+
+    frequency:     0Hz    14Hz  24Hz   31Hz   37Hz   41Hz   47Hz
+    dB loss:     -infdB  -15dB  -6dB   -3dB  -1.5dB  -1dB  -0.5dB
+
+  Algorithm:
+
+    y[i] = b[0]*x[i] + b[1]*x[i-1] + b[2]*x[i-2]
+                     + a[1]*y[i-1] + a[2]*y[i-2];
+
+    int16 b[3] = {4053, -8106, 4053};         in Q12
+    int16 a[3] = {8192, 16211, -8021};        in Q12
+
+    float -->   b[3] = {0.989501953, -1.979003906,  0.989501953};
+                a[3] = {1.000000000,  1.978881836, -0.979125977};
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwb_math_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void highpass_50Hz_at_12k8_init(int16 mem[])
+{
+    pv_memset((void *)mem, 0, 6*sizeof(*mem));
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void highpass_50Hz_at_12k8(
+    int16 signal[],                      /* input/output signal */
+    int16 lg,                            /* lenght of signal    */
+    int16 mem[]                          /* filter memory [6]   */
+)
+{
+    int16 i, x2;
+    int16 y2_hi, y2_lo, y1_hi, y1_lo, x0, x1;
+    int32 L_tmp1;
+    int32 L_tmp2;
+    int16 *pt_sign = signal;
+
+    y2_hi = mem[0];
+    y2_lo = mem[1];
+    y1_hi = mem[2];
+    y1_lo = mem[3];
+    x0    = mem[4];
+    x1    = mem[5];
+
+
+    for (i = lg; i != 0; i--)
+    {
+
+        /* y[i] = b[0]*x[i] + b[1]*x[i-1] + b[0]*x[i-2]  */
+        /* + a[0]*y[i-1] + a[1] * y[i-2];  */
+
+        L_tmp1 = fxp_mac_16by16(y1_lo, 16211, 8192L);
+        L_tmp1 = fxp_mac_16by16(y2_lo, -8021, L_tmp1);
+        L_tmp2 = fxp_mul_16by16(y1_hi, 32422);
+        L_tmp2 = fxp_mac_16by16(y2_hi, -16042, L_tmp2);
+
+        x2 = x1;
+        x1 = x0;
+        x0 = *pt_sign;
+        L_tmp2 = fxp_mac_16by16(x2,  8106, L_tmp2);
+        L_tmp2 = fxp_mac_16by16(x1, -16212, L_tmp2);
+        L_tmp2 = fxp_mac_16by16(x0,  8106, L_tmp2);
+
+
+        L_tmp1 = ((L_tmp1 >> 14) + L_tmp2) << 2;
+
+        y2_hi = y1_hi;
+        y2_lo = y1_lo;
+        y1_hi = (int16)(L_tmp1 >> 16);
+        y1_lo = (int16)((L_tmp1 - (y1_hi << 16)) >> 1);
+
+        /* coeff Q14 --> Q15 with saturation */
+        *(pt_sign++) = amr_wb_shl1_round(L_tmp1);
+
+    }
+
+
+    mem[0] = y2_hi;
+    mem[1] = y2_lo;
+    mem[2] = y1_hi;
+    mem[3] = y1_lo;
+    mem[4] = x0;
+    mem[5] = x1;
+
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/homing_amr_wb_dec.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/homing_amr_wb_dec.cpp
new file mode 100644 (file)
index 0000000..987b700
--- /dev/null
@@ -0,0 +1,362 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: homing_amr_wb_dec.cpp
+
+------------------------------------------------------------------------------
+
+
+
+INPUT AND OUTPUT DEFINITIONS
+
+Input
+    int16 input_frame[],            16-bit input frame
+    int16 mode                      16-bit mode
+    int16 nparms                    16-bit number of parameters
+Returns
+    Int16 i             number of leading zeros on x
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Performs the homing routines
+
+    int16 dhf_test(int16 input_frame[], int16 mode, int16 nparms)
+    int16 decoder_homing_frame_test(int16 input_frame[], int16 mode)
+    int16 decoder_homing_frame_test_first(int16 input_frame[], int16 mode)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "get_amr_wb_bits.h"
+#include "pvamrwbdecoder_api.h"
+#include "pvamrwbdecoder.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define DHF_PARMS_MAX 32 /* homing frame pattern             */
+#define NUM_OF_SPMODES 9
+
+#define PRML 15
+#define PRMN_7k NBBITS_7k/PRML + 1
+#define PRMN_9k NBBITS_9k/PRML + 1
+#define PRMN_12k NBBITS_12k/PRML + 1
+#define PRMN_14k NBBITS_14k/PRML + 1
+#define PRMN_16k NBBITS_16k/PRML + 1
+#define PRMN_18k NBBITS_18k/PRML + 1
+#define PRMN_20k NBBITS_20k/PRML + 1
+#define PRMN_23k NBBITS_23k/PRML + 1
+#define PRMN_24k NBBITS_24k/PRML + 1
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    int16 dhf_test(int16 input_frame[], int32 mode, int16 nparms);
+
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+static const int16 prmnofsf[NUM_OF_SPMODES] =
+{
+    63,  81, 100,
+    108, 116, 128,
+    136, 152, 156
+};
+
+
+const int16 dfh_M7k[PRMN_7k] =
+{
+    3168, 29954, 29213, 16121,
+    64, 13440, 30624, 16430,
+    19008
+};
+
+const int16 dfh_M9k[PRMN_9k] =
+{
+    3168, 31665,  9943, 9123,
+    15599,  4358, 20248, 2048,
+    17040, 27787, 16816, 13888
+};
+
+const int16 dfh_M12k[PRMN_12k] =
+{
+    3168, 31665,  9943,  9128,
+    3647,  8129, 30930, 27926,
+    18880, 12319,   496,  1042,
+    4061, 20446, 25629, 28069,
+    13948
+};
+
+const int16 dfh_M14k[PRMN_14k] =
+{
+    3168, 31665,  9943,  9131,
+    24815,   655, 26616, 26764,
+    7238, 19136,  6144,    88,
+    4158, 25733, 30567, 30494,
+    221, 20321, 17823
+};
+
+const int16 dfh_M16k[PRMN_16k] =
+{
+    3168, 31665,  9943,  9131,
+    24815,   700,  3824,  7271,
+    26400,  9528,  6594, 26112,
+    108,  2068, 12867, 16317,
+    23035, 24632,  7528,  1752,
+    6759, 24576
+};
+
+const int16 dfh_M18k[PRMN_18k] =
+{
+    3168, 31665,  9943,  9135,
+    14787, 14423, 30477, 24927,
+    25345, 30154,   916,  5728,
+    18978,  2048,   528, 16449,
+    2436,  3581, 23527, 29479,
+    8237, 16810, 27091, 19052,
+    0
+};
+
+const int16 dfh_M20k[PRMN_20k] =
+{
+    3168, 31665,  9943,  9129,
+    8637, 31807, 24646,   736,
+    28643,  2977,  2566, 25564,
+    12930, 13960,  2048,   834,
+    3270,  4100, 26920, 16237,
+    31227, 17667, 15059, 20589,
+    30249, 29123, 0
+};
+
+const int16 dfh_M23k[PRMN_23k] =
+{
+    3168, 31665,  9943,  9132,
+    16748,  3202, 28179, 16317,
+    30590, 15857, 19960,  8818,
+    21711, 21538,  4260, 16690,
+    20224,  3666,  4194,  9497,
+    16320, 15388,  5755, 31551,
+    14080,  3574, 15932,    50,
+    23392, 26053, 31216
+};
+
+const int16 dfh_M24k[PRMN_24k] =
+{
+    3168, 31665,  9943,  9134,
+    24776,  5857, 18475, 28535,
+    29662, 14321, 16725,  4396,
+    29353, 10003, 17068, 20504,
+    720,     0,  8465, 12581,
+    28863, 24774,  9709, 26043,
+    7941, 27649, 13965, 15236,
+    18026, 22047, 16681,  3968
+};
+
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+int16 dhf_test(int16 input_frame[], int32 mode, int16 nparms)
+{
+    int16 i, j, tmp, shift;
+    int16 param[DHF_PARMS_MAX];
+    int16 *prms;
+
+    /* overall table with the parameters of the
+    decoder homing frames for all modes */
+
+    const int16 *dhf[] =
+    {
+        dfh_M7k,
+        dfh_M9k,
+        dfh_M12k,
+        dfh_M14k,
+        dfh_M16k,
+        dfh_M18k,
+        dfh_M20k,
+        dfh_M23k,
+        dfh_M24k,
+        dfh_M24k
+    };
+
+    prms = input_frame;
+    j = 0;
+    i = 0;
+
+    if (mode != MRDTX)
+    {
+        if (mode != MODE_24k)
+        {
+            /* convert the received serial bits */
+            tmp = nparms - 15;
+            while (tmp > j)
+            {
+                param[i] = Serial_parm(15, &prms);
+                j += 15;
+                i++;
+            }
+            tmp = nparms - j;
+            param[i] = Serial_parm(tmp, &prms);
+            shift = 15 - tmp;
+            param[i] = shl_int16(param[i], shift);
+        }
+        else
+        {
+            /*If mode is 23.85Kbit/s, remove high band energy bits */
+            for (i = 0; i < 10; i++)
+            {
+                param[i] = Serial_parm(15, &prms);
+            }
+            param[10] = Serial_parm(15, &prms) & 0x61FF;
+
+            for (i = 11; i < 17; i++)
+            {
+                param[i] = Serial_parm(15, &prms);
+            }
+            param[17] = Serial_parm(15, &prms) & 0xE0FF;
+
+            for (i = 18; i < 24; i++)
+            {
+                param[i] = Serial_parm(15, &prms);
+            }
+            param[24] = Serial_parm(15, &prms) & 0x7F0F;
+
+            for (i = 25; i < 31; i++)
+            {
+                param[i] = Serial_parm(15, &prms);
+            }
+
+            tmp = Serial_parm(8, &prms);
+            param[31] = shl_int16(tmp, 7);
+            shift = 0;
+        }
+
+        /* check if the parameters matches the parameters of the corresponding decoder homing frame */
+        tmp = i;
+        j = 0;
+        for (i = 0; i < tmp; i++)
+        {
+            j = (param[i] ^ dhf[mode][i]);
+            if (j)
+            {
+                break;
+            }
+        }
+        tmp = 0x7fff;
+        tmp >>= shift;
+        tmp = shl_int16(tmp, shift);
+        tmp = (dhf[mode][i] & tmp);
+        tmp = (param[i] ^ tmp);
+        j = (int16)(j | tmp);
+
+    }
+    else
+    {
+        j = 1;
+    }
+
+    return (!j);
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+int16 pvDecoder_AmrWb_homing_frame_test(int16 input_frame[], int16 mode)
+{
+    /* perform test for COMPLETE parameter frame */
+    return dhf_test(input_frame, mode, AMR_WB_COMPRESSED[mode]);
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+int16 pvDecoder_AmrWb_homing_frame_test_first(int16 input_frame[], int16 mode)
+{
+    /* perform test for FIRST SUBFRAME of parameter frame ONLY */
+    return dhf_test(input_frame, mode, prmnofsf[mode]);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/interpolate_isp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/interpolate_isp.cpp
new file mode 100644 (file)
index 0000000..08046c6
--- /dev/null
@@ -0,0 +1,138 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: interpolate_isp.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 isp_old[],         input : isps from past frame
+     int16 isp_new[],         input : isps from present frame
+     const int16 frac[],      input : fraction for 3 first subfr (Q15)
+     int16 Az[]               output: LP coefficients in 4 subframes
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Interpolation of the LP parameters in 4 subframes
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+#define MP1 (M+1)
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void interpolate_isp(
+    int16 isp_old[],       /* input : isps from past frame              */
+    int16 isp_new[],       /* input : isps from present frame           */
+    const int16 frac[],    /* input : fraction for 3 first subfr (Q15)  */
+    int16 Az[]             /* output: LP coefficients in 4 subframes    */
+)
+{
+    int16 i, k, fac_old, fac_new;
+    int16 isp[M];
+    int32 L_tmp;
+
+    for (k = 0; k < 3; k++)
+    {
+        fac_new = frac[k];
+        fac_old = add_int16(sub_int16(32767, fac_new), 1);  /* 1.0 - fac_new */
+
+        for (i = 0; i < M; i++)
+        {
+            L_tmp = mul_16by16_to_int32(isp_old[i], fac_old);
+            L_tmp = mac_16by16_to_int32(L_tmp, isp_new[i], fac_new);
+            isp[i] = amr_wb_round(L_tmp);
+        }
+        Isp_Az(isp, Az, M, 0);
+        Az += MP1;
+    }
+
+    /* 4th subframe: isp_new (frac=1.0) */
+
+    Isp_Az(isp_new, Az, M, 0);
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isf_extrapolation.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isf_extrapolation.cpp
new file mode 100644 (file)
index 0000000..b421e87
--- /dev/null
@@ -0,0 +1,266 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: isf_extrapolation.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+    int16 HfIsf[]    (i/o)  isf vector
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Conversion of 16th-order 12.8kHz ISF vector
+    into 20th-order 16kHz ISF vector
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+#include "pvamrwb_math_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define INV_LENGTH 2731                    /* 1/12 */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+void isf_extrapolation(int16 HfIsf[])
+{
+    int16 IsfDiff[M - 2];
+    int32 IsfCorr[3];
+    int32 L_tmp;
+    int16 coeff, mean, tmp, tmp2, tmp3;
+    int16 exp, exp2, hi, lo;
+    int16 i, MaxCorr;
+
+    HfIsf[M16k - 1] = HfIsf[M - 1];
+
+    /* Difference vector */
+    for (i = 1; i < (M - 1); i++)
+    {
+        IsfDiff[i - 1] = sub_int16(HfIsf[i], HfIsf[i - 1]);
+    }
+    L_tmp = 0;
+
+    /* Mean of difference vector */
+    for (i = 3; i < (M - 1); i++)
+    {
+        L_tmp = mac_16by16_to_int32(L_tmp, IsfDiff[i - 1], INV_LENGTH);
+
+    }
+    mean = amr_wb_round(L_tmp);
+
+    IsfCorr[0] = 0;
+
+    tmp = 0;
+    for (i = 0; i < (M - 2); i++)
+    {
+        if (IsfDiff[i] > tmp)
+        {
+            tmp = IsfDiff[i];
+        }
+    }
+    exp = norm_s(tmp);
+    for (i = 0; i < (M - 2); i++)
+    {
+        IsfDiff[i] = shl_int16(IsfDiff[i], exp);
+    }
+    mean = shl_int16(mean, exp);
+    for (i = 7; i < (M - 2); i++)
+    {
+        tmp2 = sub_int16(IsfDiff[i], mean);
+        tmp3 = sub_int16(IsfDiff[i - 2], mean);
+        L_tmp = mul_16by16_to_int32(tmp2, tmp3);
+        int32_to_dpf(L_tmp, &hi, &lo);
+        L_tmp = mpy_dpf_32(hi, lo, hi, lo);
+        IsfCorr[0] = add_int32(IsfCorr[0], L_tmp);
+    }
+    IsfCorr[1] = 0;
+    for (i = 7; i < (M - 2); i++)
+    {
+        tmp2 = sub_int16(IsfDiff[i], mean);
+        tmp3 = sub_int16(IsfDiff[i - 3], mean);
+        L_tmp = mul_16by16_to_int32(tmp2, tmp3);
+        int32_to_dpf(L_tmp, &hi, &lo);
+        L_tmp = mpy_dpf_32(hi, lo, hi, lo);
+        IsfCorr[1] = add_int32(IsfCorr[1], L_tmp);
+    }
+    IsfCorr[2] = 0;
+    for (i = 7; i < (M - 2); i++)
+    {
+        tmp2 = sub_int16(IsfDiff[i], mean);
+        tmp3 = sub_int16(IsfDiff[i - 4], mean);
+        L_tmp = mul_16by16_to_int32(tmp2, tmp3);
+        int32_to_dpf(L_tmp, &hi, &lo);
+        L_tmp = mpy_dpf_32(hi, lo, hi, lo);
+        IsfCorr[2] = add_int32(IsfCorr[2], L_tmp);
+    }
+
+    if (IsfCorr[0] > IsfCorr[1])
+    {
+        MaxCorr = 0;
+    }
+    else
+    {
+        MaxCorr = 1;
+    }
+
+
+    if (IsfCorr[2] > IsfCorr[MaxCorr])
+    {
+        MaxCorr = 2;
+    }
+
+    MaxCorr++;             /* Maximum correlation of difference vector */
+
+    for (i = M - 1; i < (M16k - 1); i++)
+    {
+        tmp = sub_int16(HfIsf[i - 1 - MaxCorr], HfIsf[i - 2 - MaxCorr]);
+        HfIsf[i] = add_int16(HfIsf[i - 1], tmp);
+    }
+
+    /* tmp=7965+(HfIsf[2]-HfIsf[3]-HfIsf[4])/6; */
+    tmp = add_int16(HfIsf[4], HfIsf[3]);
+    tmp = sub_int16(HfIsf[2], tmp);
+    tmp = mult_int16(tmp, 5461);
+    tmp += 20390;
+
+
+    if (tmp > 19456)
+    {                                      /* Maximum value of ISF should be at most 7600 Hz */
+        tmp = 19456;
+    }
+    tmp = sub_int16(tmp, HfIsf[M - 2]);
+    tmp2 = sub_int16(HfIsf[M16k - 2], HfIsf[M - 2]);
+
+    exp2 = norm_s(tmp2);
+    exp = norm_s(tmp);
+    exp--;
+    tmp <<= exp;
+    tmp2 <<= exp2;
+    coeff = div_16by16(tmp, tmp2);              /* Coefficient for stretching the ISF vector */
+    exp = exp2 - exp;
+
+    for (i = M - 1; i < (M16k - 1); i++)
+    {
+        tmp = mult_int16(sub_int16(HfIsf[i], HfIsf[i - 1]), coeff);
+        IsfDiff[i - (M - 1)] = shl_int16(tmp, exp);
+    }
+
+    for (i = M; i < (M16k - 1); i++)
+    {
+        /* The difference between ISF(n) and ISF(n-2) should be at least 500 Hz */
+        tmp = IsfDiff[i - (M - 1)] + IsfDiff[i - M] - 1280;
+
+        if (tmp < 0)
+        {
+
+            if (IsfDiff[i - (M - 1)] > IsfDiff[i - M])
+            {
+                IsfDiff[i - M] = 1280 - IsfDiff[i - (M - 1)];
+            }
+            else
+            {
+                IsfDiff[i - (M - 1)] = 1280 - IsfDiff[i - M];
+            }
+        }
+    }
+
+    for (i = M - 1; i < (M16k - 1); i++)
+    {
+        HfIsf[i] = add_int16(HfIsf[i - 1], IsfDiff[i - (M - 1)]);
+    }
+
+    for (i = 0; i < (M16k - 1); i++)
+    {
+        HfIsf[i] = mult_int16(HfIsf[i], 26214);  /* Scale the ISF vector correctly for 16000 kHz */
+    }
+
+    Isf_isp(HfIsf, HfIsf, M16k);
+
+    return;
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_az.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_az.cpp
new file mode 100644 (file)
index 0000000..e353f31
--- /dev/null
@@ -0,0 +1,391 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: isp_az.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 isp[],              (i) Q15 : Immittance spectral pairs
+     int16 a[],                (o) Q12 : predictor coefficients (order=M)
+     int16 m,                  (i)     : order
+     int16 adaptive_scaling    (i) 0   : adaptive scaling disabled
+                                   1   : adaptive scaling enabled
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Compute the LPC coefficients from isp (order=M)
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+#include "pvamrwb_math_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define NC (M/2)
+#define NC16k (M16k/2)
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    void Get_isp_pol(int16 * isp, int32 * f, int16 n);
+    void Get_isp_pol_16kHz(int16 * isp, int32 * f, int16 n);
+
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void Isp_Az(
+    int16 isp[],            /* (i) Q15 : Immittance spectral pairs         */
+    int16 a[],              /* (o) Q12 : predictor coefficients (order=M)  */
+    int16 m,                /* (i)     : order                     */
+    int16 adaptive_scaling  /* (i) 0   : adaptive scaling disabled */
+    /*     1   : adaptive scaling enabled  */
+)
+{
+    int16 i, j;
+    int32 f1[NC16k + 1], f2[NC16k];
+    int16 nc;
+    int32 t0;
+    int32 t1;
+    int16 q, q_sug;
+    int32 tmax;
+
+    nc = m >> 1;
+
+
+    if (nc > 8)
+    {
+        Get_isp_pol_16kHz(&isp[0], f1, nc);
+        for (i = 0; i <= nc; i++)
+        {
+            f1[i] = shl_int32(f1[i], 2);
+        }
+        Get_isp_pol_16kHz(&isp[1], f2, nc - 1);
+        for (i = 0; i <= nc - 1; i++)
+        {
+            f2[i] = shl_int32(f2[i], 2);
+        }
+    }
+    else
+    {
+        Get_isp_pol(&isp[0], f1, nc);
+        Get_isp_pol(&isp[1], f2, nc - 1);
+    }
+
+    /*
+     *  Multiply F2(z) by (1 - z^-2)
+     */
+
+    for (i = nc - 1; i > 1; i--)
+    {
+        f2[i] -= f2[i - 2];      /* f2[i] -= f2[i-2]; */
+    }
+
+    /*
+     *  Scale F1(z) by (1+isp[m-1])  and  F2(z) by (1-isp[m-1])
+     */
+
+    for (i = 0; i < nc; i++)
+    {
+        /* f1[i] *= (1.0 + isp[M-1]); */
+
+        /* f2[i] *= (1.0 - isp[M-1]); */
+        t0 = f1[i];
+        t1 = f2[i];
+        t0 = fxp_mul32_by_16b(t0, isp[m - 1]) << 1;
+        t1 = fxp_mul32_by_16b(t1, isp[m - 1]) << 1;
+        f1[i] += t0;
+        f2[i] -= t1;
+
+    }
+
+    /*
+     *  A(z) = (F1(z)+F2(z))/2
+     *  F1(z) is symmetric and F2(z) is antisymmetric
+     */
+
+    /* a[0] = 1.0; */
+    a[0] = 4096;
+    tmax = 1;
+    j = m - 1;
+    for (i = 1;  i < nc; i++)
+    {
+        /* a[i] = 0.5*(f1[i] + f2[i]); */
+
+        t0 = add_int32(f1[i], f2[i]);          /* f1[i] + f2[i]             */
+        /* compute t1 = abs(t0) */
+        t1 = t0 - (t0 < 0);
+        t1 = t1 ^(t1 >> 31);  /* t1 = t1 ^sign(t1) */
+
+        tmax |= t1;
+        /* from Q23 to Q12 and * 0.5 */
+        a[i] = (int16)((t0 >> 12) + ((t0 >> 11) & 1));
+
+
+        /* a[j] = 0.5*(f1[i] - f2[i]); */
+
+        t0 = sub_int32(f1[i], f2[i]);          /* f1[i] - f2[i]             */
+        /* compute t1 = abs(t0) */
+        t1 = t0 - (t0 < 0);
+        t1 = t1 ^(t1 >> 31);  /* t1 = t1 ^sign(t1) */
+
+        tmax |= t1;
+
+        /* from Q23 to Q12 and * 0.5 */
+        a[j--] = (int16)((t0 >> 12) + ((t0 >> 11) & 1));
+
+    }
+
+    /* rescale data if overflow has occured and reprocess the loop */
+
+
+    if (adaptive_scaling == 1)
+    {
+        q = 4 - normalize_amr_wb(tmax);        /* adaptive scaling enabled */
+    }
+    else
+    {
+        q = 0;                   /* adaptive scaling disabled */
+    }
+
+
+    if (q > 0)
+    {
+        q_sug = 12 + q;
+        for (i = 1, j = m - 1; i < nc; i++, j--)
+        {
+            /* a[i] = 0.5*(f1[i] + f2[i]); */
+
+            t0 = add_int32(f1[i], f2[i]);          /* f1[i] + f2[i]             */
+            /* from Q23 to Q12 and * 0.5 */
+            a[i] = (int16)((t0 >> q_sug) + ((t0 >> (q_sug - 1)) & 1));
+
+
+            /* a[j] = 0.5*(f1[i] - f2[i]); */
+
+            t0 = sub_int32(f1[i], f2[i]);          /* f1[i] - f2[i]             */
+            /* from Q23 to Q12 and * 0.5 */
+            a[j] = (int16)((t0 >> q_sug) + ((t0 >> (q_sug - 1)) & 1));
+
+        }
+        a[0] >>=  q;
+    }
+    else
+    {
+        q_sug = 12;
+        q     = 0;
+    }
+
+    /* a[NC] = 0.5*f1[NC]*(1.0 + isp[M-1]); */
+    t0 = (int32)(((int64)f1[nc] * isp[m - 1]) >> 16) << 1;
+    t0 = add_int32(f1[nc], t0);
+
+    /* from Q23 to Q12 and * 0.5 */
+    a[nc] = (int16)((t0 >> q_sug) + ((t0 >> (q_sug - 1)) & 1));
+    a[m] = shr_rnd(isp[m - 1], (3 + q));           /* from Q15 to Q12          */
+
+    /* a[m] = isp[m-1]; */
+
+
+    return;
+}
+
+
+
+/*
+Get_isp_pol
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+   isp[]   : isp vector (cosine domaine)         in Q15
+   f[]     : the coefficients of F1 or F2        in Q23
+   n       : == NC for F1(z); == NC-1 for F2(z)
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Find the polynomial F1(z) or F2(z) from the ISPs.
+  This is performed by expanding the product polynomials:
+
+  F1(z) =   product   ( 1 - 2 isp_i z^-1 + z^-2 )
+          i=0,2,4,6,8
+  F2(z) =   product   ( 1 - 2 isp_i z^-1 + z^-2 )
+          i=1,3,5,7
+
+  where isp_i are the ISPs in the cosine domain.
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+void Get_isp_pol(int16 * isp, int32 * f, int16 n)
+{
+    int16 i, j;
+    int32 t0;
+
+
+    /* All computation in Q23 */
+
+    f[0] = 0x00800000;                        /* f[0] = 1.0;        in Q23  */
+    f[1] = -isp[0] << 9;                      /* f[1] = -2.0*isp[0] in Q23  */
+
+    f += 2;                                   /* Advance f pointer          */
+    isp += 2;                                 /* Advance isp pointer        */
+
+    for (i = 2; i <= n; i++)
+    {
+        *f = f[-2];
+
+        for (j = 1; j < i; j++)
+        {
+
+            t0 = fxp_mul32_by_16b(f[-1], *isp);
+            t0 = shl_int32(t0, 2);
+
+            *f -= t0;                      /* *f -= t0            */
+            *(f) += f[-2];                 /* *f += f[-2]         */
+            f--;
+
+
+        }
+        *f -= *isp << 9;
+
+        f += i;                            /* Advance f pointer   */
+        isp += 2;                          /* Advance isp pointer */
+    }
+}
+
+void Get_isp_pol_16kHz(int16 * isp, int32 * f, int16 n)
+{
+    int16 i, j;
+    int32 t0;
+
+    /* All computation in Q23 */
+
+    f[0] = 0x00200000;                        /* f[0] = 0.25;        in Q23  */
+
+    f[1] = -isp[0] << 7;                      /* f[1] = -0.5*isp[0] in Q23  */
+
+    f += 2;                                   /* Advance f pointer          */
+    isp += 2;                                 /* Advance isp pointer        */
+
+    for (i = 2; i <= n; i++)
+    {
+        *f = f[-2];
+
+        for (j = 1; j < i; j++, f--)
+        {
+            t0 = fxp_mul32_by_16b(f[-1], *isp);
+            t0 = shl_int32(t0, 2);
+
+            *f -= t0;                      /* *f -= t0            */
+            *f += f[-2];                   /* *f += f[-2]         */
+        }
+        *f -= *isp << 7;
+        f += i;                            /* Advance f pointer   */
+        isp += 2;                          /* Advance isp pointer */
+    }
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_isf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_isf.cpp
new file mode 100644 (file)
index 0000000..8cc13b5
--- /dev/null
@@ -0,0 +1,167 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: isp_isf.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 isf[],       (i) Q15 : isf[m] normalized (range: 0.0<=val<=0.5)
+     int16 isp[],       (o) Q15 : isp[m] (range: -1<=val<1)
+     int16 m            (i)     : LPC order
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+     Isf_isp   Transformation isf to isp
+
+   The transformation from isf[i] to isp[i] is
+   approximated by a look-up table and interpolation.
+
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/* Look-up table for transformations */
+
+/* table of cos(x) in Q15 */
+
+static const int16 table[129] =
+{
+    32767,
+    32758,  32729,  32679,  32610,  32522,  32413,  32286,  32138,
+    31972,  31786,  31581,  31357,  31114,  30853,  30572,  30274,
+    29957,  29622,  29269,  28899,  28511,  28106,  27684,  27246,
+    26791,  26320,  25833,  25330,  24812,  24279,  23732,  23170,
+    22595,  22006,  21403,  20788,  20160,  19520,  18868,  18205,
+    17531,  16846,  16151,  15447,  14733,  14010,  13279,  12540,
+    11793,  11039,  10279,   9512,   8740,   7962,   7180,   6393,
+    5602,   4808,   4011,   3212,   2411,   1608,    804,      0,
+    -804,  -1608,  -2411,  -3212,  -4011,  -4808,  -5602,  -6393,
+    -7180,  -7962,  -8740,  -9512, -10279, -11039, -11793, -12540,
+    -13279, -14010, -14733, -15447, -16151, -16846, -17531, -18205,
+    -18868, -19520, -20160, -20788, -21403, -22006, -22595, -23170,
+    -23732, -24279, -24812, -25330, -25833, -26320, -26791, -27246,
+    -27684, -28106, -28511, -28899, -29269, -29622, -29957, -30274,
+    -30572, -30853, -31114, -31357, -31581, -31786, -31972, -32138,
+    -32286, -32413, -32522, -32610, -32679, -32729, -32758, -32768
+};
+
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+void Isf_isp(
+    int16 isf[],     /* (i) Q15 : isf[m] normalized (range: 0.0<=val<=0.5) */
+    int16 isp[],     /* (o) Q15 : isp[m] (range: -1<=val<1)                */
+    int16 m          /* (i)     : LPC order                                */
+)
+{
+    int16 i, ind, offset;
+    int32 L_tmp;
+
+    for (i = 0; i < m - 1; i++)
+    {
+        isp[i] = isf[i];
+    }
+    isp[m - 1] = shl_int16(isf[m - 1], 1);
+
+    for (i = 0; i < m; i++)
+    {
+        ind = isp[i] >> 7;            /* ind    = b7-b15 of isf[i] */
+        offset = (isp[i] & 0x007f);       /* offset = b0-b6  of isf[i] */
+
+        /* isp[i] = table[ind]+ ((table[ind+1]-table[ind])*offset) / 128 */
+
+        L_tmp = mul_16by16_to_int32(table[ind + 1] - table[ind], offset);
+        isp[i] = add_int16(table[ind], (int16)(L_tmp >> 8));
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/lagconceal.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/lagconceal.cpp
new file mode 100644 (file)
index 0000000..e409474
--- /dev/null
@@ -0,0 +1,356 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: lagconceal.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 gain_hist[],                     (i)  : Gain history
+     int16 lag_hist[],                      (i)  : Subframe size
+     int16 * T0,                            (i/o): current lag
+     int16 * old_T0,                        (i/o): previous lag
+     int16 * seed,
+     int16 unusable_frame
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Concealment of LTP lags during bad frames
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define L_LTPHIST 5
+#define ONE_PER_3 10923
+#define ONE_PER_LTPHIST 6554
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+void insertion_sort(int16 array[], int16 n);
+void insert(int16 array[], int16 num, int16 x);
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+void Init_Lagconc(int16 lag_hist[])
+{
+    int16 i;
+
+    for (i = 0; i < L_LTPHIST; i++)
+    {
+        lag_hist[i] = 64;
+    }
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void lagconceal(
+    int16 gain_hist[],                   /* (i) : Gain history     */
+    int16 lag_hist[],                    /* (i) : Subframe size    */
+    int16 * T0,
+    int16 * old_T0,
+    int16 * seed,
+    int16 unusable_frame
+)
+{
+    int16 maxLag, minLag, lastLag, lagDif, meanLag = 0;
+    int16 lag_hist2[L_LTPHIST] = {0};
+    int16 i, tmp, tmp2;
+    int16 minGain, lastGain, secLastGain;
+    int16 D, D2;
+
+    /* Is lag index such that it can be aplied directly or does it has to be subtituted */
+
+    lastGain = gain_hist[4];
+    secLastGain = gain_hist[3];
+
+    lastLag = lag_hist[0];
+
+    /******* SMALLEST history lag *******/
+    minLag = lag_hist[0];
+    /*******  BIGGEST history lag *******/
+    maxLag = lag_hist[0];
+    for (i = 1; i < L_LTPHIST; i++)
+    {
+        if (lag_hist[i] < minLag)
+        {
+            minLag = lag_hist[i];
+        }
+        if (lag_hist[i] > maxLag)
+        {
+            maxLag = lag_hist[i];
+        }
+    }
+    /***********SMALLEST history gain***********/
+    minGain = gain_hist[0];
+    for (i = 1; i < L_LTPHIST; i++)
+    {
+
+        if (gain_hist[i] < minGain)
+        {
+            minGain = gain_hist[i];
+        }
+    }
+    /***Difference between MAX and MIN lag**/
+    lagDif = sub_int16(maxLag, minLag);
+
+
+    if (unusable_frame != 0)
+    {
+        /* LTP-lag for RX_SPEECH_LOST */
+        /**********Recognition of the LTP-history*********/
+
+        if ((minGain > 8192) && (lagDif < 10))
+        {
+            *T0 = *old_T0;
+        }
+        else if (lastGain > 8192 && secLastGain > 8192)
+        {
+            *T0 = lag_hist[0];
+        }
+        else
+        {
+            /********SORT************/
+            /* The sorting of the lag history */
+            for (i = 0; i < L_LTPHIST; i++)
+            {
+                lag_hist2[i] = lag_hist[i];
+            }
+            insertion_sort(lag_hist2, 5);
+
+            /* Lag is weighted towards bigger lags */
+            /* and random variation is added */
+            lagDif = sub_int16(lag_hist2[4], lag_hist2[2]);
+
+
+            if (lagDif > 40)
+            {
+                lagDif = 40;
+            }
+
+            D = noise_gen_amrwb(seed);              /* D={-1, ...,1} */
+            /* D2={-lagDif/2..lagDif/2} */
+            tmp = lagDif >> 1;
+            D2 = mult_int16(tmp, D);
+            tmp = add_int16(add_int16(lag_hist2[2], lag_hist2[3]), lag_hist2[4]);
+            *T0 = add_int16(mult_int16(tmp, ONE_PER_3), D2);
+        }
+        /* New lag is not allowed to be bigger or smaller than last lag values */
+
+        if (*T0 > maxLag)
+        {
+            *T0 = maxLag;
+        }
+
+        if (*T0 < minLag)
+        {
+            *T0 = minLag;
+        }
+    }
+    else
+    {
+        /* LTP-lag for RX_BAD_FRAME */
+
+        /***********MEAN lag**************/
+        meanLag = 0;
+        for (i = 0; i < L_LTPHIST; i++)
+        {
+            meanLag = add_int16(meanLag, lag_hist[i]);
+        }
+        meanLag = mult_int16(meanLag, ONE_PER_LTPHIST);
+
+        tmp  = *T0 - maxLag;
+        tmp2 = *T0 - lastLag;
+
+        if ((lagDif < 10) && (*T0 > (minLag - 5)) && (tmp < 5))
+        {
+            *T0 = *T0;
+        }
+        else if ((lastGain > 8192) && (secLastGain > 8192) && ((tmp2 + 10) > 0 && tmp2 < 10))
+        {
+            *T0 = *T0;
+        }
+        else if ((minGain < 6554) && (lastGain == minGain) && (*T0 > minLag && *T0 < maxLag))
+        {
+            *T0 = *T0;
+        }
+        else if ((lagDif < 70) && (*T0 > minLag) && (*T0 < maxLag))
+        {
+            *T0 = *T0;
+        }
+        else if ((*T0 > meanLag) && (*T0 < maxLag))
+        {
+            *T0 = *T0;
+        }
+        else
+        {
+
+
+            if ((minGain > 8192) & (lagDif < 10))
+            {
+                *T0 = lag_hist[0];
+            }
+            else if ((lastGain > 8192) && (secLastGain > 8192))
+            {
+                *T0 = lag_hist[0];
+            }
+            else
+            {
+                /********SORT************/
+                /* The sorting of the lag history */
+                for (i = 0; i < L_LTPHIST; i++)
+                {
+                    lag_hist2[i] = lag_hist[i];
+                }
+                insertion_sort(lag_hist2, 5);
+
+                /* Lag is weighted towards bigger lags */
+                /* and random variation is added */
+                lagDif = sub_int16(lag_hist2[4], lag_hist2[2]);
+
+                if (lagDif > 40)
+                {
+                    lagDif = 40;
+                }
+
+                D = noise_gen_amrwb(seed);          /* D={-1,.., 1} */
+                /* D2={-lagDif/2..lagDif/2} */
+                tmp = lagDif >> 1;
+                D2 = mult_int16(tmp, D);
+                tmp = add_int16(add_int16(lag_hist2[2], lag_hist2[3]), lag_hist2[4]);
+                *T0 = add_int16(mult_int16(tmp, ONE_PER_3), D2);
+            }
+            /* New lag is not allowed to be bigger or smaller than last lag values */
+
+            if (*T0 > maxLag)
+            {
+                *T0 = maxLag;
+            }
+
+            if (*T0 < minLag)
+            {
+                *T0 = minLag;
+            }
+        }
+    }
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void insertion_sort(int16 array[], int16 n)
+{
+    int16 i;
+
+    for (i = 0; i < n; i++)
+    {
+        insert(array, i, array[i]);
+    }
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void insert(int16 array[], int16 n, int16 x)
+{
+    int16 i;
+
+    for (i = (n - 1); i >= 0; i--)
+    {
+
+        if (x < array[i])
+        {
+            array[i + 1] = array[i];
+        }
+        else
+        {
+            break;
+        }
+    }
+    array[i + 1] = x;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/low_pass_filt_7k.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/low_pass_filt_7k.cpp
new file mode 100644 (file)
index 0000000..bb21cd9
--- /dev/null
@@ -0,0 +1,212 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: low_pass_filt_7k.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 signal[],             input signal / output is divided by 16
+     int16 lg,                   lenght of signal
+     int16 mem[]                 in/out: memory (size=30)
+     int16 x[]                   scratch mem ( size= 60)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+        15th order high pass 7kHz FIR filter
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define L_FIR 30
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+const int16 fir_7k[L_FIR+1] =
+{
+    -21, 47, -89, 146, -203,
+    229, -177, 0, 335, -839,
+    1485, -2211, 2931, -3542, 3953,
+    28682, 3953, -3542, 2931, -2211,
+    1485, -839, 335, 0, -177,
+    229, -203, 146, -89, 47,
+    -21
+};
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+void low_pass_filt_7k_init(int16 mem[])            /* mem[30] */
+{
+    pv_memset((void *)mem, 0, (L_FIR)*sizeof(*mem));
+
+    return;
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+void low_pass_filt_7k(
+    int16 signal[],                      /* input:  signal                  */
+    int16 lg,                            /* input:  length of input         */
+    int16 mem[],                         /* in/out: memory (size=30)        */
+    int16 x[]
+)
+{
+    int16 i, j;
+    int32 L_tmp1;
+    int32 L_tmp2;
+    int32 L_tmp3;
+    int32 L_tmp4;
+
+    pv_memcpy((void *)x, (void *)mem, (L_FIR)*sizeof(*x));
+
+    for (i = 0; i < lg >> 2; i++)
+    {
+        x[(i<<2) + L_FIR    ] = signal[(i<<2)];
+        x[(i<<2) + L_FIR + 1] = signal[(i<<2)+1];
+        x[(i<<2) + L_FIR + 2] = signal[(i<<2)+2];
+        x[(i<<2) + L_FIR + 3] = signal[(i<<2)+3];
+
+        L_tmp1 = fxp_mac_16by16(x[(i<<2)] + signal[(i<<2)], fir_7k[0], 0x00004000);
+        L_tmp2 = fxp_mac_16by16(x[(i<<2)+1] + signal[(i<<2)+1], fir_7k[0], 0x00004000);
+        L_tmp3 = fxp_mac_16by16(x[(i<<2)+2] + signal[(i<<2)+2], fir_7k[0], 0x00004000);
+        L_tmp4 = fxp_mac_16by16(x[(i<<2)+3] + signal[(i<<2)+3], fir_7k[0], 0x00004000);
+
+        for (j = 1; j < L_FIR - 1; j += 4)
+        {
+
+
+            int16 tmp1 = x[(i<<2)+j  ];
+            int16 tmp2 = x[(i<<2)+j+1];
+            int16 tmp3 = x[(i<<2)+j+2];
+
+            L_tmp1 = fxp_mac_16by16(tmp1, fir_7k[j  ], L_tmp1);
+            L_tmp2 = fxp_mac_16by16(tmp2, fir_7k[j  ], L_tmp2);
+            L_tmp1 = fxp_mac_16by16(tmp2, fir_7k[j+1], L_tmp1);
+            L_tmp2 = fxp_mac_16by16(tmp3, fir_7k[j+1], L_tmp2);
+            L_tmp3 = fxp_mac_16by16(tmp3, fir_7k[j  ], L_tmp3);
+            L_tmp1 = fxp_mac_16by16(tmp3, fir_7k[j+2], L_tmp1);
+
+            tmp1 = x[(i<<2)+j+3];
+            tmp2 = x[(i<<2)+j+4];
+
+            L_tmp2 = fxp_mac_16by16(tmp1, fir_7k[j+2], L_tmp2);
+            L_tmp4 = fxp_mac_16by16(tmp1, fir_7k[j  ], L_tmp4);
+            L_tmp3 = fxp_mac_16by16(tmp1, fir_7k[j+1], L_tmp3);
+            L_tmp1 = fxp_mac_16by16(tmp1, fir_7k[j+3], L_tmp1);
+            L_tmp2 = fxp_mac_16by16(tmp2, fir_7k[j+3], L_tmp2);
+            L_tmp4 = fxp_mac_16by16(tmp2, fir_7k[j+1], L_tmp4);
+            L_tmp3 = fxp_mac_16by16(tmp2, fir_7k[j+2], L_tmp3);
+
+            tmp1 = x[(i<<2)+j+5];
+            tmp2 = x[(i<<2)+j+6];
+
+            L_tmp4 = fxp_mac_16by16(tmp1, fir_7k[j+2], L_tmp4);
+            L_tmp3 = fxp_mac_16by16(tmp1, fir_7k[j+3], L_tmp3);
+            L_tmp4 = fxp_mac_16by16(tmp2, fir_7k[j+3], L_tmp4);
+
+        }
+
+        L_tmp1 = fxp_mac_16by16(x[(i<<2)+j  ], fir_7k[j  ], L_tmp1);
+        L_tmp2 = fxp_mac_16by16(x[(i<<2)+j+1], fir_7k[j  ], L_tmp2);
+        L_tmp3 = fxp_mac_16by16(x[(i<<2)+j+2], fir_7k[j  ], L_tmp3);
+        L_tmp4 = fxp_mac_16by16(x[(i<<2)+j+3], fir_7k[j  ], L_tmp4);
+
+        signal[(i<<2)] = (int16)(L_tmp1 >> 15);
+        signal[(i<<2)+1] = (int16)(L_tmp2 >> 15);
+        signal[(i<<2)+2] = (int16)(L_tmp3 >> 15);
+        signal[(i<<2)+3] = (int16)(L_tmp4 >> 15);
+
+    }
+
+    pv_memcpy((void *)mem, (void *)(x + lg), (L_FIR)*sizeof(*mem));
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/median5.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/median5.cpp
new file mode 100644 (file)
index 0000000..32d10af
--- /dev/null
@@ -0,0 +1,172 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: median5.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+   INPUT
+       X[-2:2]   16-bit integers.
+
+   RETURN VALUE
+       The median of {X[-2], X[-1],..., X[2]}.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+      Returns the median of the set {X[-2], X[-1],..., X[2]},
+      whose elements are 16-bit integers.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+#include "pvamrwb_math_op.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+int16 median5(int16 x[])
+{
+    int16 x1, x2, x3, x4, x5;
+    int16 tmp;
+
+    x1 = x[-2];
+    x2 = x[-1];
+    x3 = x[0];
+    x4 = x[1];
+    x5 = x[2];
+
+
+
+    if (x2 < x1)
+    {
+        tmp = x1;
+        x1 = x2;
+        x2 = tmp;
+    }
+    if (x3 < x1)
+    {
+        tmp = x1;
+        x1 = x3;
+        x3 = tmp;
+    }
+    if (x4 < x1)
+    {
+        tmp = x1;
+        x1 = x4;
+        x4 = tmp;
+    }
+    if (x5 < x1)
+    {
+        x5 = x1;
+    }
+    if (x3 < x2)
+    {
+        tmp = x2;
+        x2 = x3;
+        x3 = tmp;
+    }
+    if (x4 < x2)
+    {
+        tmp = x2;
+        x2 = x4;
+        x4 = tmp;
+    }
+    if (x5 < x2)
+    {
+        x5 = x2;
+    }
+    if (x4 < x3)
+    {
+        x3 = x4;
+    }
+    if (x5 < x3)
+    {
+        x3 = x5;
+    }
+    return (x3);
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.cpp
new file mode 100644 (file)
index 0000000..beac1bb
--- /dev/null
@@ -0,0 +1,721 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+ Pathname: ./src/mime_io.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    [input_variable_name] = [description of the input to module, its type
+                 definition, and length (when applicable)]
+
+ Local Stores/Buffers/Pointers Needed:
+    [local_store_name] = [description of the local store, its type
+                  definition, and length (when applicable)]
+    [local_buffer_name] = [description of the local buffer, its type
+                   definition, and length (when applicable)]
+    [local_ptr_name] = [description of the local pointer, its type
+                definition, and length (when applicable)]
+
+ Global Stores/Buffers/Pointers Needed:
+    [global_store_name] = [description of the global store, its type
+                   definition, and length (when applicable)]
+    [global_buffer_name] = [description of the global buffer, its type
+                definition, and length (when applicable)]
+    [global_ptr_name] = [description of the global pointer, its type
+                 definition, and length (when applicable)]
+
+ Outputs:
+    [return_variable_name] = [description of data/pointer returned
+                  by module, its type definition, and length
+                  (when applicable)]
+
+ Pointers and Buffers Modified:
+    [variable_bfr_ptr] points to the [describe where the
+      variable_bfr_ptr points to, its type definition, and length
+      (when applicable)]
+    [variable_bfr] contents are [describe the new contents of
+      variable_bfr]
+
+ Local Stores Modified:
+    [local_store_name] = [describe new contents, its type
+                  definition, and length (when applicable)]
+
+ Global Stores Modified:
+    [global_store_name] = [describe new contents, its type
+                   definition, and length (when applicable)]
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ [Describe what the module does by using the variable names
+ listed in the Input and Output Definitions Section above.]
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ [List requirements to be satisfied by this module.]
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ [List all references used in designing this module.]
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+ ------------------------------------------------------------------------------
+ RESOURCES USED
+
+ STACK USAGE:
+
+ DATA MEMORY USED: x words
+
+ PROGRAM MEMORY USED: x words
+
+ CLOCK CYCLES:
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_api.h"
+#include "pvamrwbdecoder.h"
+#include "pvamrwbdecoder_mem_funcs.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "dtx.h"
+#include "mime_io.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+#define MRSID 9
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+const uint8 toc_byte[16] = {0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C, 0x34, 0x3C,
+                            0x44, 0x4C, 0x54, 0x5C, 0x64, 0x6C, 0x74, 0x7C
+                           };
+
+/* number of speech bits for all modes */
+const int16 unpacked_size[16] =
+{
+    132,  177, 253, 285,
+    317,  365, 397, 461,
+    477,   35,   0,   0,
+    0,    0,   0,   0
+};
+
+/* size of packed frame for each mode, excluding TOC byte */
+const int16 packed_size[16] = {17, 23, 32, 36, 40, 46, 50, 58,
+                               60,  5,  0,  0,  0,  0,  0,  0
+                              };
+
+/* number of unused speech bits in packed format for each mode */
+const int16 unused_size[16] = {4, 7, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0};
+
+/* sorting tables for all modes */
+
+const int16 sort_660[132] =
+{
+    0,   5,   6,   7,  61,  84, 107, 130,  62,  85,
+    8,   4,  37,  38,  39,  40,  58,  81, 104, 127,
+    60,  83, 106, 129, 108, 131, 128,  41,  42,  80,
+    126,   1,   3,  57, 103,  82, 105,  59,   2,  63,
+    109, 110,  86,  19,  22,  23,  64,  87,  18,  20,
+    21,  17,  13,  88,  43,  89,  65, 111,  14,  24,
+    25,  26,  27,  28,  15,  16,  44,  90,  66, 112,
+    9,  11,  10,  12,  67, 113,  29,  30,  31,  32,
+    34,  33,  35,  36,  45,  51,  68,  74,  91,  97,
+    114, 120,  46,  69,  92, 115,  52,  75,  98, 121,
+    47,  70,  93, 116,  53,  76,  99, 122,  48,  71,
+    94, 117,  54,  77, 100, 123,  49,  72,  95, 118,
+    55,  78, 101, 124,  50,  73,  96, 119,  56,  79,
+    102, 125
+};
+
+const int16 sort_885[177] =
+{
+    0,   4,   6,   7,   5,   3,  47,  48,  49, 112,
+    113, 114,  75, 106, 140, 171,  80, 111, 145, 176,
+    77, 108, 142, 173,  78, 109, 143, 174,  79, 110,
+    144, 175,  76, 107, 141, 172,  50, 115,  51,   2,
+    1,  81, 116, 146,  19,  21,  12,  17,  18,  20,
+    16,  25,  13,  10,  14,  24,  23,  22,  26,   8,
+    15,  52, 117,  31,  82, 147,   9,  33,  11,  83,
+    148,  53, 118,  28,  27,  84, 149,  34,  35,  29,
+    46,  32,  30,  54, 119,  37,  36,  39,  38,  40,
+    85, 150,  41,  42,  43,  44,  45,  55,  60,  65,
+    70,  86,  91,  96, 101, 120, 125, 130, 135, 151,
+    156, 161, 166,  56,  87, 121, 152,  61,  92, 126,
+    157,  66,  97, 131, 162,  71, 102, 136, 167,  57,
+    88, 122, 153,  62,  93, 127, 158,  67,  98, 132,
+    163,  72, 103, 137, 168,  58,  89, 123, 154,  63,
+    94, 128, 159,  68,  99, 133, 164,  73, 104, 138,
+    169,  59,  90, 124, 155,  64,  95, 129, 160,  69,
+    100, 134, 165,  74, 105, 139, 170
+};
+
+const int16 sort_1265[253] =
+{
+    0,   4,   6,  93, 143, 196, 246,   7,   5,   3,
+    47,  48,  49,  50,  51, 150, 151, 152, 153, 154,
+    94, 144, 197, 247,  99, 149, 202, 252,  96, 146,
+    199, 249,  97, 147, 200, 250, 100, 203,  98, 148,
+    201, 251,  95, 145, 198, 248,  52,   2,   1, 101,
+    204, 155,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+    156,  31, 102, 205,   9,  33,  11, 103, 206,  54,
+    157,  28,  27, 104, 207,  34,  35,  29,  46,  32,
+    30,  55, 158,  37,  36,  39,  38,  40, 105, 208,
+    41,  42,  43,  44,  45,  56, 106, 159, 209,  57,
+    66,  75,  84, 107, 116, 125, 134, 160, 169, 178,
+    187, 210, 219, 228, 237,  58, 108, 161, 211,  62,
+    112, 165, 215,  67, 117, 170, 220,  71, 121, 174,
+    224,  76, 126, 179, 229,  80, 130, 183, 233,  85,
+    135, 188, 238,  89, 139, 192, 242,  59, 109, 162,
+    212,  63, 113, 166, 216,  68, 118, 171, 221,  72,
+    122, 175, 225,  77, 127, 180, 230,  81, 131, 184,
+    234,  86, 136, 189, 239,  90, 140, 193, 243,  60,
+    110, 163, 213,  64, 114, 167, 217,  69, 119, 172,
+    222,  73, 123, 176, 226,  78, 128, 181, 231,  82,
+    132, 185, 235,  87, 137, 190, 240,  91, 141, 194,
+    244,  61, 111, 164, 214,  65, 115, 168, 218,  70,
+    120, 173, 223,  74, 124, 177, 227,  79, 129, 182,
+    232,  83, 133, 186, 236,  88, 138, 191, 241,  92,
+    142, 195, 245
+};
+
+const int16 sort_1425[285] =
+{
+    0,   4,   6, 101, 159, 220, 278,   7,   5,   3,
+    47,  48,  49,  50,  51, 166, 167, 168, 169, 170,
+    102, 160, 221, 279, 107, 165, 226, 284, 104, 162,
+    223, 281, 105, 163, 224, 282, 108, 227, 106, 164,
+    225, 283, 103, 161, 222, 280,  52,   2,   1, 109,
+    228, 171,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+    172,  31, 110, 229,   9,  33,  11, 111, 230,  54,
+    173,  28,  27, 112, 231,  34,  35,  29,  46,  32,
+    30,  55, 174,  37,  36,  39,  38,  40, 113, 232,
+    41,  42,  43,  44,  45,  56, 114, 175, 233,  62,
+    120, 181, 239,  75, 133, 194, 252,  57, 115, 176,
+    234,  63, 121, 182, 240,  70, 128, 189, 247,  76,
+    134, 195, 253,  83, 141, 202, 260,  92, 150, 211,
+    269,  84, 142, 203, 261,  93, 151, 212, 270,  85,
+    143, 204, 262,  94, 152, 213, 271,  86, 144, 205,
+    263,  95, 153, 214, 272,  64, 122, 183, 241,  77,
+    135, 196, 254,  65, 123, 184, 242,  78, 136, 197,
+    255,  87, 145, 206, 264,  96, 154, 215, 273,  58,
+    116, 177, 235,  66, 124, 185, 243,  71, 129, 190,
+    248,  79, 137, 198, 256,  88, 146, 207, 265,  97,
+    155, 216, 274,  59, 117, 178, 236,  67, 125, 186,
+    244,  72, 130, 191, 249,  80, 138, 199, 257,  89,
+    147, 208, 266,  98, 156, 217, 275,  60, 118, 179,
+    237,  68, 126, 187, 245,  73, 131, 192, 250,  81,
+    139, 200, 258,  90, 148, 209, 267,  99, 157, 218,
+    276,  61, 119, 180, 238,  69, 127, 188, 246,  74,
+    132, 193, 251,  82, 140, 201, 259,  91, 149, 210,
+    268, 100, 158, 219, 277
+};
+
+const int16 sort_1585[317] =
+{
+    0,   4,   6, 109, 175, 244, 310,   7,   5,   3,
+    47,  48,  49,  50,  51, 182, 183, 184, 185, 186,
+    110, 176, 245, 311, 115, 181, 250, 316, 112, 178,
+    247, 313, 113, 179, 248, 314, 116, 251, 114, 180,
+    249, 315, 111, 177, 246, 312,  52,   2,   1, 117,
+    252, 187,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+    188,  31, 118, 253,   9,  33,  11, 119, 254,  54,
+    189,  28,  27, 120, 255,  34,  35,  29,  46,  32,
+    30,  55, 190,  37,  36,  39,  38,  40, 121, 256,
+    41,  42,  43,  44,  45,  56, 122, 191, 257,  63,
+    129, 198, 264,  76, 142, 211, 277,  89, 155, 224,
+    290, 102, 168, 237, 303,  57, 123, 192, 258,  70,
+    136, 205, 271,  83, 149, 218, 284,  96, 162, 231,
+    297,  62, 128, 197, 263,  75, 141, 210, 276,  88,
+    154, 223, 289, 101, 167, 236, 302,  58, 124, 193,
+    259,  71, 137, 206, 272,  84, 150, 219, 285,  97,
+    163, 232, 298,  59, 125, 194, 260,  64, 130, 199,
+    265,  67, 133, 202, 268,  72, 138, 207, 273,  77,
+    143, 212, 278,  80, 146, 215, 281,  85, 151, 220,
+    286,  90, 156, 225, 291,  93, 159, 228, 294,  98,
+    164, 233, 299, 103, 169, 238, 304, 106, 172, 241,
+    307,  60, 126, 195, 261,  65, 131, 200, 266,  68,
+    134, 203, 269,  73, 139, 208, 274,  78, 144, 213,
+    279,  81, 147, 216, 282,  86, 152, 221, 287,  91,
+    157, 226, 292,  94, 160, 229, 295,  99, 165, 234,
+    300, 104, 170, 239, 305, 107, 173, 242, 308,  61,
+    127, 196, 262,  66, 132, 201, 267,  69, 135, 204,
+    270,  74, 140, 209, 275,  79, 145, 214, 280,  82,
+    148, 217, 283,  87, 153, 222, 288,  92, 158, 227,
+    293,  95, 161, 230, 296, 100, 166, 235, 301, 105,
+    171, 240, 306, 108, 174, 243, 309
+};
+
+const int16 sort_1825[365] =
+{
+    0,   4,   6, 121, 199, 280, 358,   7,   5,   3,
+    47,  48,  49,  50,  51, 206, 207, 208, 209, 210,
+    122, 200, 281, 359, 127, 205, 286, 364, 124, 202,
+    283, 361, 125, 203, 284, 362, 128, 287, 126, 204,
+    285, 363, 123, 201, 282, 360,  52,   2,   1, 129,
+    288, 211,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+    212,  31, 130, 289,   9,  33,  11, 131, 290,  54,
+    213,  28,  27, 132, 291,  34,  35,  29,  46,  32,
+    30,  55, 214,  37,  36,  39,  38,  40, 133, 292,
+    41,  42,  43,  44,  45,  56, 134, 215, 293, 198,
+    299, 136, 120, 138,  60, 279,  58,  62, 357, 139,
+    140, 295, 156,  57, 219, 297,  63, 217, 137, 170,
+    300, 222,  64, 106,  61,  78, 294,  92, 142, 141,
+    135, 221, 296, 301, 343,  59, 298, 184, 329, 315,
+    220, 216, 265, 251, 218, 237, 352, 223, 157,  86,
+    171,  87, 164, 351, 111, 302,  65, 178, 115, 323,
+    72, 192, 101, 179,  93,  73, 193, 151, 337, 309,
+    143, 274,  69, 324, 165, 150,  97, 338, 110, 310,
+    330, 273,  68, 107, 175, 245, 114,  79, 113, 189,
+    246, 259, 174,  71, 185,  96, 344, 100, 322,  83,
+    334, 316, 333, 252, 161, 348, 147,  82, 269, 232,
+    260, 308, 353, 347, 163, 231, 306, 320, 188, 270,
+    146, 177, 266, 350, 256,  85, 149, 116, 191, 160,
+    238, 258, 336, 305, 255,  88, 224,  99, 339, 230,
+    228, 227, 272, 242, 241, 319, 233, 311, 102,  74,
+    180, 275,  66, 194, 152, 325, 172, 247, 244, 261,
+    117, 158, 166, 354,  75, 144, 108, 312,  94, 186,
+    303,  80, 234,  89, 195, 112, 340, 181, 345, 317,
+    326, 276, 239, 167, 118, 313,  70, 355, 327, 253,
+    190, 176, 271, 104,  98, 153, 103,  90,  76, 267,
+    277, 248, 225, 262, 182,  84, 154, 235, 335, 168,
+    331, 196, 341, 249, 162, 307, 148, 349, 263, 321,
+    257, 243, 229, 356, 159, 119,  67, 187, 173, 145,
+    240,  77, 304, 332, 314, 342, 109, 254,  81, 278,
+    105,  91, 346, 318, 183, 250, 197, 328,  95, 155,
+    169, 268, 226, 236, 264
+};
+
+const int16 sort_1985[397] =
+{
+    0,   4,   6, 129, 215, 304, 390,   7,   5,   3,
+    47,  48,  49,  50,  51, 222, 223, 224, 225, 226,
+    130, 216, 305, 391, 135, 221, 310, 396, 132, 218,
+    307, 393, 133, 219, 308, 394, 136, 311, 134, 220,
+    309, 395, 131, 217, 306, 392,  52,   2,   1, 137,
+    312, 227,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+    228,  31, 138, 313,   9,  33,  11, 139, 314,  54,
+    229,  28,  27, 140, 315,  34,  35,  29,  46,  32,
+    30,  55, 230,  37,  36,  39,  38,  40, 141, 316,
+    41,  42,  43,  44,  45,  56, 142, 231, 317,  63,
+    73,  92, 340,  82, 324, 149, 353, 159, 334, 165,
+    338, 178, 163, 254,  77, 168, 257, 153, 343,  57,
+    248, 238,  79, 252, 166,  67,  80, 201, 101, 267,
+    143, 164, 341, 255, 339, 187, 376, 318,  78, 328,
+    362, 115, 232, 242, 253, 290, 276,  62,  58, 158,
+    68,  93, 179, 319, 148, 169, 154,  72, 385, 329,
+    333, 344, 102,  83, 144, 233, 323, 124, 243, 192,
+    354, 237,  64, 247, 202, 209, 150, 116, 335, 268,
+    239, 299, 188, 196, 298,  94, 195, 258, 123, 363,
+    384, 109, 325, 371, 170, 370,  84, 110, 295, 180,
+    74, 210, 191, 106, 291, 205, 367, 381, 377, 206,
+    355, 122, 119, 120, 383, 160, 105, 108, 277, 380,
+    294, 284, 285, 345, 208, 269, 249, 366, 386, 300,
+    297, 259, 125, 369, 197,  97, 194, 286, 211, 281,
+    280, 183, 372,  87, 155, 283,  59, 348, 327, 184,
+    76, 111, 330, 203, 349,  69,  98, 152, 145, 189,
+    66, 320, 337, 173, 358, 251, 198, 174, 263, 262,
+    126, 241, 193,  88, 388, 117,  95, 387, 112, 359,
+    287, 244, 103, 272, 301, 171, 162, 234, 273, 127,
+    373, 181, 292,  85, 378, 302, 121, 107, 364, 346,
+    356, 212, 278, 213,  65, 382, 288, 207, 113, 175,
+    99, 296, 374, 368, 199, 260, 185, 336, 331, 161,
+    270, 264, 250, 240,  75, 350, 151,  60,  89, 321,
+    156, 274, 360, 326,  70, 282, 167, 146, 352,  81,
+    91, 389, 266, 245, 177, 235, 190, 256, 204, 342,
+    128, 118, 303, 104, 379, 182, 114, 375, 200,  96,
+    293, 172, 214, 365, 279,  86, 289, 351, 347, 357,
+    261, 186, 176, 271,  90, 100, 147, 322, 275, 361,
+    71, 332,  61, 265, 157, 246, 236
+};
+
+const int16 sort_2305[461] =
+{
+    0,   4,   6, 145, 247, 352, 454,   7,   5,   3,
+    47,  48,  49,  50,  51, 254, 255, 256, 257, 258,
+    146, 248, 353, 455, 151, 253, 358, 460, 148, 250,
+    355, 457, 149, 251, 356, 458, 152, 359, 150, 252,
+    357, 459, 147, 249, 354, 456,  52,   2,   1, 153,
+    360, 259,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+    260,  31, 154, 361,   9,  33,  11, 155, 362,  54,
+    261,  28,  27, 156, 363,  34,  35,  29,  46,  32,
+    30,  55, 262,  37,  36,  39,  38,  40, 157, 364,
+    41,  42,  43,  44,  45,  56, 158, 263, 365, 181,
+    192, 170,  79,  57, 399,  90, 159, 297, 377, 366,
+    275,  68, 183, 388, 286, 194, 299, 92 ,  70, 182,
+    401, 172,  59,  91,  58, 400, 368, 161,  81, 160,
+    264, 171,  80, 389, 390, 378, 379, 193, 298,  69,
+    266, 265, 367, 277, 288, 276, 287, 184,  60, 195,
+    82,  93,  71, 369, 402, 173, 162, 444, 300, 391,
+    98,  76, 278,  61, 267, 374, 135, 411, 167, 102,
+    380, 200,  87, 178,  65,  94, 204, 124,  72, 342,
+    189, 305, 381, 396, 433, 301, 226, 407, 289, 237,
+    113, 215, 185, 128, 309, 403, 116, 320, 196, 331,
+    370, 422, 174,  64, 392,  83, 425, 219, 134, 188,
+    432, 112, 427, 139, 279, 163, 436, 208, 447, 218,
+    236, 229,  97, 294, 385, 230, 166, 268, 177, 443,
+    225, 426, 101, 272, 138, 127, 290, 117, 347, 199,
+    414,  95, 140, 240, 410, 395, 209, 129, 283, 346,
+    105, 241, 437,  86, 308, 448, 203, 345, 186, 107,
+    220, 415, 334, 319, 106, 313, 118, 123,  73, 207,
+    421, 214, 384, 373, 438,  62, 371, 341,  75, 449,
+    168, 323, 164, 242, 416, 324, 304, 197, 335, 404,
+    271,  63, 191, 325,  96, 169, 231, 280, 312, 187,
+    406,  84, 201, 100,  67, 382, 175, 336, 202, 330,
+    269, 393, 376, 383, 293, 307, 409, 179, 285, 314,
+    302, 372, 398, 190, 180,  89,  99, 103, 232,  78,
+    88,  77, 136, 387, 165, 198, 394, 125, 176, 428,
+    74, 375, 238, 227,  66, 273, 282, 141, 306, 412,
+    114,  85, 130, 348, 119, 291, 296, 386, 233, 397,
+    303, 405, 284, 445, 423, 221, 210, 205, 450, 108,
+    274, 434, 216, 343, 337, 142, 243, 321, 408, 451,
+    310, 292, 120, 109, 281, 439, 270, 429, 332, 295,
+    418, 211, 315, 222, 326, 131, 430, 244, 327, 349,
+    417, 316, 143, 338, 440, 234, 110, 212, 452, 245,
+    121, 419, 350, 223, 132, 441, 328, 413, 317, 339,
+    126, 104, 137, 446, 344, 239, 435, 115, 333, 206,
+    322, 217, 228, 424, 453, 311, 351, 111, 442, 224,
+    213, 122, 431, 340, 235, 246, 133, 144, 420, 329,
+    318
+};
+
+const int16 sort_2385[477] =
+{
+    0,   4,   6, 145, 251, 360, 466,   7,   5,   3,
+    47,  48,  49,  50,  51, 262, 263, 264, 265, 266,
+    146, 252, 361, 467, 151, 257, 366, 472, 148, 254,
+    363, 469, 149, 255, 364, 470, 156, 371, 150, 256,
+    365, 471, 147, 253, 362, 468,  52,   2,   1, 157,
+    372, 267,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+    268,  31, 152, 153, 154, 155, 258, 259, 260, 261,
+    367, 368, 369, 370, 473, 474, 475, 476, 158, 373,
+    9,  33,  11, 159, 374,  54, 269,  28,  27, 160,
+    375,  34,  35,  29,  46,  32,  30,  55, 270, 37,
+    36,  39,  38,  40, 161, 376,  41,  42,  43,  44,
+    45,  56, 162, 271, 377, 185, 196, 174,  79,  57,
+    411,  90, 163, 305, 389, 378, 283,  68, 187, 400,
+    294, 198, 307,  92,  70, 186, 413, 176,  59,  91,
+    58, 412, 380, 165,  81, 164, 272, 175,  80, 401,
+    402, 390, 391, 197, 306,  69, 274, 273, 379, 285,
+    296, 284, 295, 188,  60, 199,  82,  93,  71, 381,
+    414, 177, 166, 456, 308, 403,  98,  76, 286,  61,
+    275, 386, 135, 423, 171, 102, 392, 204,  87, 182,
+    65,  94, 208, 124,  72, 350, 193, 313, 393, 408,
+    445, 309, 230, 419, 297, 241, 113, 219, 189, 128,
+    317, 415, 116, 328, 200, 339, 382, 434, 178,  64,
+    404,  83, 437, 223, 134, 192, 444, 112, 439, 139,
+    287, 167, 448, 212, 459, 222, 240, 233,  97, 302,
+    397, 234, 170, 276, 181, 455, 229, 438, 101, 280,
+    138, 127, 298, 117, 355, 203, 426,  95, 140, 244,
+    422, 407, 213, 129, 291, 354, 105, 245, 449,  86,
+    316, 460, 207, 353, 190, 107, 224, 427, 342, 327,
+    106, 321, 118, 123,  73, 211, 433, 218, 396, 385,
+    450,  62, 383, 349,  75, 461, 172, 331, 168, 246,
+    428, 332, 312, 201, 343, 416, 279,  63, 195, 333,
+    96, 173, 235, 288, 320, 191, 418,  84, 205, 100,
+    67, 394, 179, 344, 206, 338, 277, 405, 388, 395,
+    301, 315, 421, 183, 293, 322, 310, 384, 410, 194,
+    184,  89,  99, 103, 236,  78,  88,  77, 136, 399,
+    169, 202, 406, 125, 180, 440,  74, 387, 242, 231,
+    66, 281, 290, 141, 314, 424, 114,  85, 130, 356,
+    119, 299, 304, 398, 237, 409, 311, 417, 292, 457,
+    435, 225, 214, 209, 462, 108, 282, 446, 220, 351,
+    345, 142, 247, 329, 420, 463, 318, 300, 120, 109,
+    289, 451, 278, 441, 340, 303, 430, 215, 323, 226,
+    334, 131, 442, 248, 335, 357, 429, 324, 143, 346,
+    452, 238, 110, 216, 464, 249, 121, 431, 358, 227,
+    132, 453, 336, 425, 325, 347, 126, 104, 137, 458,
+    352, 243, 447, 115, 341, 210, 330, 221, 232, 436,
+    465, 319, 359, 111, 454, 228, 217, 122, 443, 348,
+    239, 250, 133, 144, 432, 337, 326
+};
+
+const int16 sort_SID[35] =
+{
+    0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
+    10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+    20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+    30, 31, 32, 33, 34
+};
+
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void mime_unsorting(uint8 unsorted_bits[],
+                    int16 sorted_bits_into_int16[],
+                    int16 * frame_type,
+                    int16 * mode,
+                    uint8 quality,
+                    RX_State *st)
+{
+
+    int16 i;
+    int16 j;
+    uint8 temp = 0;
+    uint8 *unsorted_bits_ptr = (uint8*)unsorted_bits;
+
+    /* pointer table for bit sorting tables */
+    const int16 *AmrWbSortingTables[16] =
+    {
+        sort_660,   sort_885, sort_1265, sort_1425,
+        sort_1585,  sort_1825, sort_1985, sort_2305,
+        sort_2385,   sort_SID,      NULL,      NULL,
+        NULL,       NULL,      NULL,      NULL
+    };
+
+    const int16 * pt_AmrWbSortingTables  = AmrWbSortingTables[*mode];
+
+    /* clear compressed speech bit buffer */
+    pv_memset(sorted_bits_into_int16,
+              0,
+              unpacked_size[*mode]*sizeof(*sorted_bits_into_int16));
+
+    /* unpack and unsort speech or SID bits */
+
+
+    for (i = unpacked_size[*mode] >> 3; i != 0; i--)
+    {
+        temp = *(unsorted_bits_ptr++);
+
+        for (j = 2; j != 0; j--)
+        {
+            switch (temp & 0xf0)
+            {
+                case 0xf0:
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    break;
+                case 0xe0:
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables++;
+                    break;
+                case 0xd0:
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables++;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    break;
+                case 0xc0:
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables += 2;
+                    break;
+                case 0xb0:
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables++;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    break;
+                case 0xa0:
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables++;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables++;
+                    break;
+                case 0x90:
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables += 2;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    break;
+                case 0x80:
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables += 3;
+                    break;
+                case 0x70:
+                    pt_AmrWbSortingTables++;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    break;
+                case 0x60:
+                    pt_AmrWbSortingTables++;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables++;
+                    break;
+                case 0x50:
+                    pt_AmrWbSortingTables++;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables++;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    break;
+                case 0x40:
+                    pt_AmrWbSortingTables++;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables += 2;
+                    break;
+                case 0x30:
+                    pt_AmrWbSortingTables += 2;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    break;
+                case 0x20:
+                    pt_AmrWbSortingTables += 2;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    pt_AmrWbSortingTables++;
+                    break;
+                case 0x10:
+                    pt_AmrWbSortingTables += 3;
+                    sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+                    break;
+                default:
+                    pt_AmrWbSortingTables += 4;
+                    break;
+            }
+            temp <<= 4;
+        }
+    }
+
+    if (unpacked_size[*mode] % 4)
+    {
+        temp <<= 1;
+
+        if (temp & 0x80)
+        {
+            sorted_bits_into_int16[*(pt_AmrWbSortingTables++)] = BIT_1;
+        }
+    }
+
+    /* set frame type */
+    switch (*mode)
+    {
+        case MODE_7k:
+        case MODE_9k:
+        case MODE_12k:
+        case MODE_14k:
+        case MODE_16k:
+        case MODE_18k:
+        case MODE_20k:
+        case MODE_23k:
+        case MODE_24k:
+            if (quality)
+            {
+                *frame_type = RX_SPEECH_GOOD;
+            }
+            else
+            {
+                *frame_type = RX_SPEECH_BAD;
+            }
+            break;
+
+        case MRSID:
+            if (quality)
+            {
+                if (temp & 0x80)
+                {
+                    *frame_type = RX_SID_UPDATE;
+                }
+                else
+                {
+                    *frame_type = RX_SID_FIRST;
+                }
+            }
+            else
+            {
+                *frame_type = RX_SID_BAD;
+            }
+
+            /* set mode index */
+            *mode = st->prev_mode;
+            break;
+        case 14:        /* SPEECH_LOST */
+            *frame_type = RX_SPEECH_LOST;
+            *mode = st->prev_mode;
+            break;
+        case 15:        /* NO_DATA */
+            *frame_type = RX_NO_DATA;
+            *mode = st->prev_mode;
+            break;
+        default:        /* replace frame with unused mode index by NO_DATA frame */
+            *frame_type = RX_NO_DATA;
+            *mode = st->prev_mode;
+            break;
+    }
+
+    st->prev_mode = *mode;
+
+}
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.h
new file mode 100644 (file)
index 0000000..9c040bc
--- /dev/null
@@ -0,0 +1,118 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./cpp/include/mime_io.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef MIME_IO_H
+#define MIME_IO_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+----------------------------------------------------------------------------*/
+
+
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+----------------------------------------------------------------------------*/
+extern const uint8 toc_byte[16];
+
+/* number of speech bits for all modes */
+extern const int16 unpacked_size[16];
+
+/* size of packed frame for each mode, excluding TOC byte */
+extern const int16 packed_size[16];
+
+/* number of unused speech bits in packed format for each mode */
+extern const int16 unused_size[16];
+
+/* sorting tables for all modes */
+
+extern const int16 sort_660[132];
+
+extern const int16 sort_885[177];
+
+extern const int16 sort_1265[253];
+
+extern const int16 sort_1425[285];
+
+extern const int16 sort_1585[317];
+
+extern const int16 sort_1825[365];
+
+extern const int16 sort_1985[397];
+
+extern const int16 sort_2305[461];
+
+extern const int16 sort_2385[477];
+
+extern const int16 sort_SID[35];
+
+
+/*----------------------------------------------------------------------------
+; SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
+#endif  /* MIME_IO_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/noise_gen_amrwb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/noise_gen_amrwb.cpp
new file mode 100644 (file)
index 0000000..2c3f210
--- /dev/null
@@ -0,0 +1,110 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: noise_gen_amrwb.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+    int16 * seed          seed for the random ng
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Signed 16 bits random generator
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+int16 noise_gen_amrwb(int16 * seed)
+{
+    /*  int16 seed = 21845; */
+    *seed = (int16)fxp_mac_16by16(*seed, 31821, 13849L);
+
+    return (*seed);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.cpp
new file mode 100644 (file)
index 0000000..bdca939
--- /dev/null
@@ -0,0 +1,173 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: normalize_amr_wb.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+Input
+    Int32 x             32-bit integer non-zero input
+Returns
+    Int16 i             number of leading zeros on x
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Returns number of leading zeros on the non-zero input
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "normalize_amr_wb.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+#if ((PV_CPU_ARCH_VERSION >=5) && ((PV_COMPILER == EPV_ARM_RVCT) || (PV_COMPILER == EPV_ARM_GNUC)))
+/* function is inlined in header file */
+
+
+#else
+
+int16 normalize_amr_wb(int32 x)
+{
+    /*----------------------------------------------------------------------------
+    ; Define all local variables
+    ----------------------------------------------------------------------------*/
+    int16 i;
+
+
+    if (x > 0x0FFFFFFF)
+    {
+        i = 0;  /* most likely case */
+    }
+    else if (x > 0x00FFFFFF)
+    {
+        i = 3;  /* second most likely case */
+    }
+    else if (x > 0x0000FFFF)
+    {
+        i  = x > 0x000FFFFF ?  7 :  11;
+    }
+    else
+    {
+        if (x > 0x000000FF)
+        {
+            i  = x > 0x00000FFF ?  15 :  19;
+        }
+        else
+        {
+            i  = x > 0x0000000F ?  23 :  27;
+        }
+    }
+
+
+    x <<= i;
+
+    switch (x & 0x78000000)
+    {
+        case 0x08000000:
+            i += 3;
+            break;
+
+        case 0x18000000:
+        case 0x10000000:
+            i += 2;
+            break;
+        case 0x28000000:
+        case 0x20000000:
+        case 0x38000000:
+        case 0x30000000:
+            i++;
+
+        default:
+            ;
+    }
+
+    return i;
+
+}
+
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h
new file mode 100644 (file)
index 0000000..73ccb71
--- /dev/null
@@ -0,0 +1,99 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./c/include/normalize_amr_wb.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef NORMALIZE_AMR_WB_H
+#define NORMALIZE_AMR_WB_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES AND SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))
+
+
+__inline int16 normalize_amr_wb(int32 x)
+{
+    register int32 y;
+    register int32 ra = x;
+
+
+    asm volatile(
+        "clz %0, %1\n\t"
+        "sub %0, %0, #1"
+    : "=&r*i"(y)
+                : "r"(ra));
+    return (y);
+
+}
+
+#else
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    int16 normalize_amr_wb(int32 x);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
+#endif  /* PV_NORMALIZE_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/oversamp_12k8_to_16k.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/oversamp_12k8_to_16k.cpp
new file mode 100644 (file)
index 0000000..8e4534b
--- /dev/null
@@ -0,0 +1,334 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: oversamp_12k8_to_16k.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 signal[],             input signal / output is divided by 16
+     int16 lg,                   lenght of signal
+     int16 mem[]                 in/out: memory (size=30)
+     int16 x[]                   scratch mem ( size= 60)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Oversamp_16k : oversampling from 12.8kHz to 16kHz.
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+#include "pvamrwbdecoder_cnst.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+#define FAC4   4
+#define FAC5   5
+#define INV_FAC5   6554                    /* 1/5 in Q15 */
+#define DOWN_FAC  26215                    /* 4/5 in Q15 */
+#define UP_FAC    20480                    /* 5/4 in Q14 */
+#define NB_COEF_DOWN  15
+#define NB_COEF_UP    12
+#define N_LOOP_COEF_UP    4
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+    /* Local functions */
+
+    void AmrWbUp_samp(
+        int16 * sig_d,                       /* input:  signal to oversampling  */
+        int16 * sig_u,                       /* output: oversampled signal      */
+        int16 L_frame                        /* input:  length of output        */
+    );
+
+
+    int16 AmrWbInterpol(                      /* return result of interpolation */
+        int16 * x,                           /* input vector                   */
+        const int16 * fir,                   /* filter coefficient             */
+        int16 nb_coef                        /* number of coefficients         */
+    );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+
+/* 1/5 resolution interpolation filter  (in Q14)  */
+/* -1.5dB @ 6kHz,    -6dB @ 6.4kHz, -10dB @ 6.6kHz,
+    -20dB @ 6.9kHz, -25dB @ 7kHz,   -55dB @ 8kHz  */
+
+
+const int16 fir_up[4][24] =
+{
+
+    {
+        -1,        12,       -33,       68,       -119,       191,
+        -291,       430,      -634,       963,     -1616,      3792,
+        15317,     -2496,      1288,      -809,       542,      -369,
+        247,      -160,        96,       -52,        23,        -6,
+    },
+    {
+        -4,        24,       -62,       124,      -213,       338,
+        -510,       752,     -1111,      1708,     -2974,      8219,
+        12368,     -3432,      1881,     -1204,       812,      -552,
+        368,      -235,       139,       -73,        30,        -7,
+    },
+    {
+        -7,        30,       -73,       139,      -235,       368,
+        -552,       812,     -1204,      1881,     -3432,     12368,
+        8219,     -2974,      1708,     -1111,       752,      -510,
+        338,      -213,       124,       -62,        24,        -4,
+    },
+    {
+        -6,        23,       -52,        96,      -160,       247,
+        -369,       542,      -809,      1288,     -2496,     15317,
+        3792,     -1616,       963,      -634,       430,      -291,
+        191,      -119,        68,       -33,        12,        -1,
+    }
+};
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+/* output: memory (2*NB_COEF_UP) set to zeros  */
+void oversamp_12k8_to_16k_init(int16 mem[])
+{
+    pv_memset((void *)mem, 0, (2*NB_COEF_UP)*sizeof(*mem));
+
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void oversamp_12k8_to_16k(
+    int16 sig12k8[],                     /* input:  signal to oversampling  */
+    int16 lg,                            /* input:  length of input         */
+    int16 sig16k[],                      /* output: oversampled signal      */
+    int16 mem[],                         /* in/out: memory (2*NB_COEF_UP)   */
+    int16 signal[]
+)
+{
+    int16 lg_up;
+
+    pv_memcpy((void *)signal,
+              (void *)mem,
+              (2*NB_COEF_UP)*sizeof(*mem));
+
+    pv_memcpy((void *)(signal + (2*NB_COEF_UP)),
+              (void *)sig12k8,
+              lg*sizeof(*sig12k8));
+
+    lg_up = lg + (lg >> 2); /* 5/4 of lg */
+
+    AmrWbUp_samp(signal + NB_COEF_UP, sig16k, lg_up);
+
+    pv_memcpy((void *)mem,
+              (void *)(signal + lg),
+              (2*NB_COEF_UP)*sizeof(*signal));
+
+    return;
+}
+
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+void AmrWbUp_samp(
+    int16 * sig_d,                       /* input:  signal to oversampling  */
+    int16 * sig_u,                       /* output: oversampled signal      */
+    int16 L_frame                        /* input:  length of output        */
+)
+{
+
+    int32 i;
+    int16 frac;
+    int16 * pt_sig_u = sig_u;
+
+    frac = 1;
+    for (int16 j = 0; j < L_frame; j++)
+    {
+        i = ((int32)j * INV_FAC5) >> 13;       /* integer part = pos * 1/5 */
+
+        frac--;
+        if (frac)
+        {
+            *(pt_sig_u++) = AmrWbInterpol(&sig_d[i],
+                                          fir_up[(FAC5-1) - frac],
+                                          N_LOOP_COEF_UP);
+        }
+        else
+        {
+            *(pt_sig_u++) = sig_d[i+12 - NB_COEF_UP ];
+            frac = FAC5;
+        }
+    }
+
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+/* Fractional interpolation of signal at position (frac/resol) */
+
+
+int16 AmrWbInterpol(                      /* return result of interpolation */
+    int16 * x,                           /* input vector                   */
+    const int16 *fir,                    /* filter coefficient             */
+    int16 nb_coef                        /* number of coefficients         */
+)
+{
+    int32 L_sum;
+    const int16 *pt_fir = fir;
+
+    int16 tmp1, tmp2, tmp3, tmp4;
+    int16 *pt_x = x - nb_coef - (nb_coef << 1) + 1;
+
+
+    tmp1 = *(pt_x++);
+    tmp2 = *(pt_x++);
+    tmp3 = *(pt_x++);
+    tmp4 = *(pt_x++);
+    L_sum = fxp_mac_16by16(tmp1, *(pt_fir++), 0x00002000L);
+    L_sum = fxp_mac_16by16(tmp2, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp3, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp4, *(pt_fir++), L_sum);
+    tmp1 = *(pt_x++);
+    tmp2 = *(pt_x++);
+    tmp3 = *(pt_x++);
+    tmp4 = *(pt_x++);
+    L_sum = fxp_mac_16by16(tmp1, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp2, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp3, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp4, *(pt_fir++), L_sum);
+    tmp1 = *(pt_x++);
+    tmp2 = *(pt_x++);
+    tmp3 = *(pt_x++);
+    tmp4 = *(pt_x++);
+    L_sum = fxp_mac_16by16(tmp1, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp2, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp3, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp4, *(pt_fir++), L_sum);
+    tmp1 = *(pt_x++);
+    tmp2 = *(pt_x++);
+    tmp3 = *(pt_x++);
+    tmp4 = *(pt_x++);
+    L_sum = fxp_mac_16by16(tmp1, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp2, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp3, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp4, *(pt_fir++), L_sum);
+    tmp1 = *(pt_x++);
+    tmp2 = *(pt_x++);
+    tmp3 = *(pt_x++);
+    tmp4 = *(pt_x++);
+    L_sum = fxp_mac_16by16(tmp1, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp2, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp3, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp4, *(pt_fir++), L_sum);
+    tmp1 = *(pt_x++);
+    tmp2 = *(pt_x++);
+    tmp3 = *(pt_x++);
+    tmp4 = *(pt_x++);
+    L_sum = fxp_mac_16by16(tmp1, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp2, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp3, *(pt_fir++), L_sum);
+    L_sum = fxp_mac_16by16(tmp4, *(pt_fir++), L_sum);
+
+
+    L_sum = shl_int32(L_sum, 2);               /* saturation can occur here */
+
+    return ((int16)(L_sum >> 16));
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/phase_dispersion.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/phase_dispersion.cpp
new file mode 100644 (file)
index 0000000..55229db
--- /dev/null
@@ -0,0 +1,253 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: phase_dispersion.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 gain_code,               (i) Q0  : gain of code
+     int16 gain_pit,                (i) Q14 : gain of pitch
+     int16 code[],                  (i/o)   : code vector
+     int16 mode,                    (i)     : level, 0=hi, 1=lo, 2=off
+     int16 disp_mem[],              (i/o)   : static memory (size = 8)
+     int16 ScratchMem[]
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    post-processing to enhance noise in low bit rate.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_mem_funcs.h"
+#include "pvamrwbdecoder_acelp.h"
+#include "pvamrwb_math_op.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define pitch_0_9  14746                   /* 0.9 in Q14 */
+#define pitch_0_6  9830                    /* 0.6 in Q14 */
+#define L_SUBFR 64
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+/* impulse response with phase dispersion */
+
+/* 2.0 - 6.4 kHz phase dispersion */
+static const int16 ph_imp_low[L_SUBFR] =
+{
+    20182,  9693,  3270, -3437, 2864, -5240,  1589, -1357,
+    600,  3893, -1497,  -698, 1203, -5249,  1199,  5371,
+    -1488,  -705, -2887,  1976,  898,   721, -3876,  4227,
+    -5112,  6400, -1032, -4725, 4093, -4352,  3205,  2130,
+    -1996, -1835,  2648, -1786, -406,   573,  2484, -3608,
+    3139, -1363, -2566,  3808, -639, -2051,  -541,  2376,
+    3932, -6262,  1432, -3601, 4889,   370,   567, -1163,
+    -2854,  1914,    39, -2418, 3454,  2975, -4021,  3431
+};
+
+/* 3.2 - 6.4 kHz phase dispersion */
+static const int16 ph_imp_mid[L_SUBFR] =
+{
+    24098, 10460, -5263,  -763,  2048,  -927,  1753, -3323,
+    2212,   652, -2146,  2487, -3539,  4109, -2107,  -374,
+    -626,  4270, -5485,  2235,  1858, -2769,   744,  1140,
+    -763, -1615,  4060, -4574,  2982, -1163,   731, -1098,
+    803,   167,  -714,   606,  -560,   639,    43, -1766,
+    3228, -2782,   665,   763,   233, -2002,  1291,  1871,
+    -3470,  1032,  2710, -4040,  3624, -4214,  5292, -4270,
+    1563,   108,  -580,  1642, -2458,   957,  544,   2540
+};
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void phase_dispersion(
+    int16 gain_code,             /* (i) Q0  : gain of code             */
+    int16 gain_pit,              /* (i) Q14 : gain of pitch            */
+    int16 code[],                /* (i/o)   : code vector              */
+    int16 mode,                  /* (i)     : level, 0=hi, 1=lo, 2=off */
+    int16 disp_mem[],            /* (i/o)   : static memory (size = 8) */
+    int16 ScratchMem[]
+)
+{
+    int16 i, j, state;
+    int16 *prev_gain_pit, *prev_gain_code, *prev_state;
+    int16 *code2 = ScratchMem;
+
+    prev_state = disp_mem;
+    prev_gain_code = disp_mem + 1;
+    prev_gain_pit = disp_mem + 2;
+
+    pv_memset((void *)code2, 0, (2*L_SUBFR)*sizeof(*code2));
+
+
+    if (gain_pit < pitch_0_6)
+    {
+        state = 0;
+    }
+    else if (gain_pit < pitch_0_9)
+    {
+        state = 1;
+    }
+    else
+    {
+        state = 2;
+    }
+
+    for (i = 5; i > 0; i--)
+    {
+        prev_gain_pit[i] = prev_gain_pit[i - 1];
+    }
+    prev_gain_pit[0] = gain_pit;
+
+    if (sub_int16(gain_code, *prev_gain_code) > shl_int16(*prev_gain_code, 1))
+    {
+        /* onset */
+        if (state < 2)
+        {
+            state++;
+        }
+    }
+    else
+    {
+        j = 0;
+        for (i = 0; i < 6; i++)
+        {
+            if (prev_gain_pit[i] < pitch_0_6)
+            {
+                j++;
+            }
+        }
+
+        if (j > 2)
+        {
+            state = 0;
+        }
+        if (state > *prev_state + 1)
+        {
+            state--;
+        }
+    }
+
+    *prev_gain_code = gain_code;
+    *prev_state = state;
+
+    /* circular convolution */
+
+    state += mode;              /* level of dispersion */
+
+    if (state == 0)
+    {
+        for (i = 0; i < L_SUBFR; i++)
+        {
+            if (code[i] != 0)
+            {
+                for (j = 0; j < L_SUBFR; j++)
+                {
+                    code2[i + j] = add_int16(code2[i + j], mult_int16_r(code[i], ph_imp_low[j]));
+                }
+            }
+        }
+    }
+    else if (state == 1)
+    {
+        for (i = 0; i < L_SUBFR; i++)
+        {
+            if (code[i] != 0)
+            {
+                for (j = 0; j < L_SUBFR; j++)
+                {
+                    code2[i + j] = add_int16(code2[i + j], mult_int16_r(code[i], ph_imp_mid[j]));
+                }
+            }
+        }
+    }
+    if (state < 2)
+    {
+        for (i = 0; i < L_SUBFR; i++)
+        {
+            code[i] = add_int16(code2[i], code2[i + L_SUBFR]);
+        }
+    }
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pit_shrp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pit_shrp.cpp
new file mode 100644 (file)
index 0000000..abdef81
--- /dev/null
@@ -0,0 +1,124 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pit_shrp.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 * x,           in/out: impulse response (or algebraic code)
+     int16 pit_lag,       input : pitch lag
+     int16 sharp,         input : pitch sharpening factor (Q15)
+     int16 L_subfr        input : subframe size
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Performs Pitch sharpening routine
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void Pit_shrp(
+    int16 * x,         /* in/out: impulse response (or algebraic code) */
+    int16 pit_lag,     /* input : pitch lag                            */
+    int16 sharp,       /* input : pitch sharpening factor (Q15)        */
+    int16 L_subfr      /* input : subframe size                        */
+)
+{
+    int16 i;
+    int32 L_tmp;
+
+    for (i = pit_lag; i < L_subfr; i++)
+    {
+        L_tmp = mac_16by16_to_int32((int32)x[i] << 16, x[i - pit_lag], sharp);
+        x[i] = amr_wb_round(L_tmp);
+
+    }
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pred_lt4.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pred_lt4.cpp
new file mode 100644 (file)
index 0000000..ab4ab21
--- /dev/null
@@ -0,0 +1,259 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pred_lt4.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 signal[],             input signal / output is divided by 16
+     int16 lg,                   lenght of signal
+     int16 mem[]                 in/out: memory (size=30)
+     int16 x[]                   scratch mem ( size= 60)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   Compute the result of long term prediction with fractionnal
+   interpolation of resolution 1/4.
+
+   On return exc[0..L_subfr-1] contains the interpolated signal
+     (adaptive codebook excitation)
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+#define UP_SAMP      4
+#define L_INTERPOL2  16
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/* 1/4 resolution interpolation filter (-3 dB at 0.856*fs/2) in Q14 */
+
+
+const int16 inter4_2[UP_SAMP][ 2*L_INTERPOL2] =
+{
+    {
+        0,       -2,        4,       -2,      -10,       38,
+        -88,      165,     -275,      424,     -619,      871,
+        -1207,     1699,    -2598,     5531,    14031,    -2147,
+        780,     -249,      -16,      153,     -213,      226,
+        -209,      175,     -133,       91,      -55,       28,
+        -10,        2
+    },
+    {
+        1,       -7,       19,      -33,       47,      -52,
+        43,       -9,      -60,      175,     -355,      626,
+        -1044,     1749,    -3267,    10359,    10359,    -3267,
+        1749,    -1044,      626,     -355,      175,      -60,
+        -9,       43,      -52,       47,      -33,       19,
+        -7,        1
+    },
+    {
+        2,      -10,       28,      -55,       91,     -133,
+        175,     -209,      226,     -213,      153,      -16,
+        -249,      780,    -2147,    14031,     5531,    -2598,
+        1699,    -1207,      871,     -619,      424,     -275,
+        165,      -88,       38,      -10,       -2,        4,
+        -2,        0
+    },
+    {
+        1,       -7,       22,      -49,       92,     -153,
+        231,     -325,      431,     -544,      656,     -762,
+        853,     -923,      968,    15401,      968,     -923,
+        853,     -762,      656,     -544,      431,     -325,
+        231,     -153,       92,      -49,       22,       -7,
+        1,        0
+    }
+};
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void Pred_lt4(
+    int16 exc[],                         /* in/out: excitation buffer */
+    int16 T0,                            /* input : integer pitch lag */
+    int16 frac,                          /* input : fraction of lag   */
+    int16 L_subfr                        /* input : subframe size     */
+)
+{
+    int16 i, j, *pt_exc;
+    int32 L_sum1;
+    int32 L_sum2;
+    int32 L_sum3;
+    int32 L_sum4;
+    pt_exc = &exc[-T0];
+
+    const int16 *pt_inter4_2;
+
+    frac = -frac;
+
+    if (frac < 0)
+    {
+        frac += UP_SAMP;
+        pt_exc--;
+
+    }
+    pt_exc -= (L_INTERPOL2 - 1);
+
+    pt_inter4_2 = inter4_2[UP_SAMP-1 - frac];
+
+    for (j = 0; j < (L_subfr >> 2); j++)
+    {
+
+        L_sum1 = 0x00002000;  /* pre-roundig */
+        L_sum2 = 0x00002000;
+        L_sum3 = 0x00002000;
+        L_sum4 = 0x00002000;
+
+        for (i = 0; i < L_INTERPOL2 << 1; i += 4)
+        {
+            int16 tmp1 = pt_exc[i  ];
+            int16 tmp2 = pt_exc[i+1];
+            int16 tmp3 = pt_exc[i+2];
+
+
+            L_sum1 = fxp_mac_16by16(tmp1, pt_inter4_2[i  ], L_sum1);
+            L_sum2 = fxp_mac_16by16(tmp2, pt_inter4_2[i  ], L_sum2);
+            L_sum1 = fxp_mac_16by16(tmp2, pt_inter4_2[i+1], L_sum1);
+            L_sum2 = fxp_mac_16by16(tmp3, pt_inter4_2[i+1], L_sum2);
+            L_sum3 = fxp_mac_16by16(tmp3, pt_inter4_2[i  ], L_sum3);
+            L_sum1 = fxp_mac_16by16(tmp3, pt_inter4_2[i+2], L_sum1);
+
+            tmp1 = pt_exc[i+3];
+            tmp2 = pt_exc[i+4];
+
+            L_sum4 = fxp_mac_16by16(tmp1, pt_inter4_2[i  ], L_sum4);
+            L_sum3 = fxp_mac_16by16(tmp1, pt_inter4_2[i+1], L_sum3);
+            L_sum2 = fxp_mac_16by16(tmp1, pt_inter4_2[i+2], L_sum2);
+            L_sum1 = fxp_mac_16by16(tmp1, pt_inter4_2[i+3], L_sum1);
+            L_sum4 = fxp_mac_16by16(tmp2, pt_inter4_2[i+1], L_sum4);
+            L_sum2 = fxp_mac_16by16(tmp2, pt_inter4_2[i+3], L_sum2);
+            L_sum3 = fxp_mac_16by16(tmp2, pt_inter4_2[i+2], L_sum3);
+
+            tmp1 = pt_exc[i+5];
+            tmp2 = pt_exc[i+6];
+
+            L_sum4 = fxp_mac_16by16(tmp1, pt_inter4_2[i+2], L_sum4);
+            L_sum3 = fxp_mac_16by16(tmp1, pt_inter4_2[i+3], L_sum3);
+            L_sum4 = fxp_mac_16by16(tmp2, pt_inter4_2[i+3], L_sum4);
+
+        }
+
+
+
+        exc[(j<<2)] = (int16)(L_sum1 >> 14);
+        exc[(j<<2)+1] = (int16)(L_sum2 >> 14);
+        exc[(j<<2)+2] = (int16)(L_sum3 >> 14);
+        exc[(j<<2)+3] = (int16)(L_sum4 >> 14);
+
+        pt_exc += 4;
+
+    }
+
+    if (L_subfr&1)
+    {
+        L_sum1 = 0x00002000;
+
+        for (i = 0; i < 2*L_INTERPOL2; i += 4)
+        {
+            int16 tmp1 = pt_exc[i  ];
+            int16 tmp2 = pt_exc[i+1];
+            L_sum1 = fxp_mac_16by16(tmp1, pt_inter4_2[i  ], L_sum1);
+            L_sum1 = fxp_mac_16by16(tmp2, pt_inter4_2[i+1], L_sum1);
+            tmp1 = pt_exc[i+2];
+            tmp2 = pt_exc[i+3];
+            L_sum1 = fxp_mac_16by16(tmp1, pt_inter4_2[i+2], L_sum1);
+            L_sum1 = fxp_mac_16by16(tmp2, pt_inter4_2[i+3], L_sum1);
+
+        }
+
+        exc[(j<<2)] = (int16)((L_sum1) >> 14);
+
+    }
+
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/preemph_amrwb_dec.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/preemph_amrwb_dec.cpp
new file mode 100644 (file)
index 0000000..78359e2
--- /dev/null
@@ -0,0 +1,122 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: preemph_amrwb_dec.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 x[],         (i/o)   : input signal overwritten by the output
+     int16 mu,          (i) Q15 : preemphasis coefficient
+     int16 lg           (i)     : lenght of filtering
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Preemphasis: filtering through 1 - g z^-1
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+void preemph_amrwb_dec(
+    int16 x[],         /* (i/o)   : input signal overwritten by the output */
+    int16 mu,          /* (i) Q15 : preemphasis coefficient                */
+    int16 lg           /* (i)     : lenght of filtering                    */
+)
+{
+    int16 i;
+    int32 L_tmp;
+
+    for (i = lg - 1; i != 0; i--)
+    {
+        L_tmp = msu_16by16_from_int32((int32)x[i] << 16, x[i - 1], mu);
+        x[i] = amr_wb_round(L_tmp);
+    }
+
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pv_amr_wb_type_defs.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pv_amr_wb_type_defs.h
new file mode 100644 (file)
index 0000000..4653b59
--- /dev/null
@@ -0,0 +1,177 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./cpp/include/pv_amr_wb_type_defs.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file was derived from a number of standards bodies. The type
+ definitions below were created from some of the best practices observed
+ in the standards bodies.
+
+ This file is dependent on limits.h for defining the bit widths. In an
+ ANSI C environment limits.h is expected to always be present and contain
+ the following definitions:
+
+     SCHAR_MIN
+     SCHAR_MAX
+     UCHAR_MAX
+
+     INT_MAX
+     INT_MIN
+     UINT_MAX
+
+     SHRT_MIN
+     SHRT_MAX
+     USHRT_MAX
+
+     LONG_MIN
+     LONG_MAX
+     ULONG_MAX
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef PV_AMR_WB_TYPE_DEFS_H
+#define PV_AMR_WB_TYPE_DEFS_H
+
+#include    "oscl_base.h"
+
+
+#ifndef Word8
+typedef int8        Word8;
+#endif
+
+#ifndef UWord8
+typedef uint8       UWord8;
+#endif
+
+/*----------------------------------------------------------------------------
+; Define generic signed and unsigned int
+----------------------------------------------------------------------------*/
+#ifndef Int
+typedef signed int  Int;
+#endif
+
+#ifndef UInt
+typedef unsigned int    UInt;
+#endif
+
+
+/*----------------------------------------------------------------------------
+; Define 16 bit signed and unsigned words
+----------------------------------------------------------------------------*/
+
+#ifndef INT16_MIN
+#define INT16_MIN   (-32768)
+#endif
+
+#ifndef INT16_MAX
+#define INT16_MAX   32767
+#endif
+
+/*----------------------------------------------------------------------------
+; Define 32 bit signed and unsigned words
+----------------------------------------------------------------------------*/
+
+
+
+#ifndef INT32_MIN
+#define INT32_MIN   (-2147483647 - 1)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX   2147483647
+#endif
+
+
+#ifndef UINT32_MIN
+#define UINT32_MIN  0
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX  0xffffffff
+#endif
+
+
+#ifndef INT_MAX
+#define INT_MAX  INT32_MAX      /*  for 32 bit  */
+#endif
+
+/*----------------------------------------------------------------------------
+; Define 64 bit signed and unsigned words
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; Define boolean type
+----------------------------------------------------------------------------*/
+
+#ifndef Flag
+typedef Int Flag;
+#endif
+
+#ifndef Bool
+typedef Int     Bool;
+#endif
+#ifndef FALSE
+#define FALSE       0
+#endif
+
+#ifndef TRUE
+#define TRUE        1
+#endif
+
+#ifndef OFF
+#define OFF     0
+#endif
+#ifndef ON
+#define ON      1
+#endif
+
+#ifndef NO
+#define NO      0
+#endif
+#ifndef YES
+#define YES     1
+#endif
+
+#ifndef SUCCESS
+#define SUCCESS     0
+#endif
+
+#ifndef  NULL
+#define  NULL       0
+#endif
+
+
+#endif  /* PV_AMR_WB_TYPE_DEFS_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.cpp
new file mode 100644 (file)
index 0000000..d1ec790
--- /dev/null
@@ -0,0 +1,627 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*___________________________________________________________________________
+
+    This file contains mathematic operations in fixed point.
+
+    mult_int16_r()     : Same as mult_int16 with rounding
+    shr_rnd()          : Same as shr(var1,var2) but with rounding
+    div_16by16()       : fractional integer division
+    one_ov_sqrt()      : Compute 1/sqrt(L_x)
+    one_ov_sqrt_norm() : Compute 1/sqrt(x)
+    power_of_2()       : power of 2
+    Dot_product12()    : Compute scalar product of <x[],y[]> using accumulator
+    Isqrt()            : inverse square root (16 bits precision).
+    amrwb_log_2()      : log2 (16 bits precision).
+
+    These operations are not standard double precision operations.
+    They are used where low complexity is important and the full 32 bits
+    precision is not necessary. For example, the function Div_32() has a
+    24 bits precision which is enough for our purposes.
+
+    In this file, the values use theses representations:
+
+    int32 L_32     : standard signed 32 bits format
+    int16 hi, lo   : L_32 = hi<<16 + lo<<1  (DPF - Double Precision Format)
+    int32 frac, int16 exp : L_32 = frac << exp-31  (normalised format)
+    int16 int, frac        : L_32 = int.frac        (fractional format)
+ ----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwb_math_op.h"
+
+
+/*----------------------------------------------------------------------------
+
+     Function Name : mult_int16_r
+
+     Purpose :
+
+     Same as mult_int16 with rounding, i.e.:
+       mult_int16_r(var1,var2) = extract_l(L_shr(((var1 * var2) + 16384),15)) and
+       mult_int16_r(-32768,-32768) = 32767.
+
+     Complexity weight : 2
+
+     Inputs :
+
+      var1
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+      var2
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+     Outputs :
+
+      none
+
+     Return Value :
+
+      var_out
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0xffff 8000 <= var_out <= 0x0000 7fff.
+ ----------------------------------------------------------------------------*/
+
+int16 mult_int16_r(int16 var1, int16 var2)
+{
+    int32 L_product_arr;
+
+    L_product_arr = (int32) var1 * (int32) var2;      /* product */
+    L_product_arr += (int32) 0x00004000L;      /* round */
+    L_product_arr >>= 15;       /* shift */
+    if ((L_product_arr >> 15) != (L_product_arr >> 31))
+    {
+        L_product_arr = (L_product_arr >> 31) ^ MAX_16;
+    }
+
+    return ((int16)L_product_arr);
+}
+
+
+
+/*----------------------------------------------------------------------------
+
+     Function Name : shr_rnd
+
+     Purpose :
+
+     Same as shr(var1,var2) but with rounding. Saturate the result in case of|
+     underflows or overflows :
+      - If var2 is greater than zero :
+            if (sub(shl_int16(shr(var1,var2),1),shr(var1,sub(var2,1))))
+            is equal to zero
+                       then
+                       shr_rnd(var1,var2) = shr(var1,var2)
+                       else
+                       shr_rnd(var1,var2) = add_int16(shr(var1,var2),1)
+      - If var2 is less than or equal to zero :
+                       shr_rnd(var1,var2) = shr(var1,var2).
+
+     Complexity weight : 2
+
+     Inputs :
+
+      var1
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+      var2
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0x0000 0000 <= var2 <= 0x0000 7fff.
+
+     Outputs :
+
+      none
+
+     Return Value :
+
+      var_out
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0xffff 8000 <= var_out <= 0x0000 7fff.
+ ----------------------------------------------------------------------------*/
+
+int16 shr_rnd(int16 var1, int16 var2)
+{
+    int16 var_out;
+
+    var_out = (int16)(var1 >> (var2 & 0xf));
+    if (var2)
+    {
+        if ((var1 & ((int16) 1 << (var2 - 1))) != 0)
+        {
+            var_out++;
+        }
+    }
+    return (var_out);
+}
+
+
+/*----------------------------------------------------------------------------
+
+     Function Name : div_16by16
+
+     Purpose :
+
+     Produces a result which is the fractional integer division of var1  by
+     var2; var1 and var2 must be positive and var2 must be greater or equal
+     to var1; the result is positive (leading bit equal to 0) and truncated
+     to 16 bits.
+     If var1 = var2 then div(var1,var2) = 32767.
+
+     Complexity weight : 18
+
+     Inputs :
+
+      var1
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0x0000 0000 <= var1 <= var2 and var2 != 0.
+
+      var2
+               16 bit short signed integer (int16) whose value falls in the
+               range : var1 <= var2 <= 0x0000 7fff and var2 != 0.
+
+     Outputs :
+
+      none
+
+     Return Value :
+
+      var_out
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0x0000 0000 <= var_out <= 0x0000 7fff.
+               It's a Q15 value (point between b15 and b14).
+ ----------------------------------------------------------------------------*/
+
+int16 div_16by16(int16 var1, int16 var2)
+{
+
+    int16 var_out = 0;
+    register int16 iteration;
+    int32 L_num;
+    int32 L_denom;
+    int32 L_denom_by_2;
+    int32 L_denom_by_4;
+
+    if ((var1 > var2) || (var1 < 0))
+    {
+        return 0; // used to exit(0);
+    }
+    if (var1)
+    {
+        if (var1 != var2)
+        {
+
+            L_num = (int32) var1;
+            L_denom = (int32) var2;
+            L_denom_by_2 = (L_denom << 1);
+            L_denom_by_4 = (L_denom << 2);
+            for (iteration = 5; iteration > 0; iteration--)
+            {
+                var_out <<= 3;
+                L_num   <<= 3;
+
+                if (L_num >= L_denom_by_4)
+                {
+                    L_num -= L_denom_by_4;
+                    var_out |= 4;
+                }
+
+                if (L_num >= L_denom_by_2)
+                {
+                    L_num -= L_denom_by_2;
+                    var_out |=  2;
+                }
+
+                if (L_num >= (L_denom))
+                {
+                    L_num -= (L_denom);
+                    var_out |=  1;
+                }
+
+            }
+        }
+        else
+        {
+            var_out = MAX_16;
+        }
+    }
+
+    return (var_out);
+
+}
+
+
+
+/*----------------------------------------------------------------------------
+
+     Function Name : one_ov_sqrt
+
+         Compute 1/sqrt(L_x).
+         if L_x is negative or zero, result is 1 (7fffffff).
+
+  Algorithm:
+
+     1- Normalization of L_x.
+     2- call Isqrt_n(L_x, exponant)
+     3- L_y = L_x << exponant
+ ----------------------------------------------------------------------------*/
+int32 one_ov_sqrt(     /* (o) Q31 : output value (range: 0<=val<1)         */
+    int32 L_x         /* (i) Q0  : input value  (range: 0<=val<=7fffffff) */
+)
+{
+    int16 exp;
+    int32 L_y;
+
+    exp = normalize_amr_wb(L_x);
+    L_x <<= exp;                 /* L_x is normalized */
+    exp = 31 - exp;
+
+    one_ov_sqrt_norm(&L_x, &exp);
+
+    L_y = shl_int32(L_x, exp);                 /* denormalization   */
+
+    return (L_y);
+}
+
+/*----------------------------------------------------------------------------
+
+     Function Name : one_ov_sqrt_norm
+
+         Compute 1/sqrt(value).
+         if value is negative or zero, result is 1 (frac=7fffffff, exp=0).
+
+  Algorithm:
+
+     The function 1/sqrt(value) is approximated by a table and linear
+     interpolation.
+
+     1- If exponant is odd then shift fraction right once.
+     2- exponant = -((exponant-1)>>1)
+     3- i = bit25-b30 of fraction, 16 <= i <= 63 ->because of normalization.
+     4- a = bit10-b24
+     5- i -=16
+     6- fraction = table[i]<<16 - (table[i] - table[i+1]) * a * 2
+ ----------------------------------------------------------------------------*/
+static const int16 table_isqrt[49] =
+{
+    32767, 31790, 30894, 30070, 29309, 28602, 27945, 27330, 26755, 26214,
+    25705, 25225, 24770, 24339, 23930, 23541, 23170, 22817, 22479, 22155,
+    21845, 21548, 21263, 20988, 20724, 20470, 20225, 19988, 19760, 19539,
+    19326, 19119, 18919, 18725, 18536, 18354, 18176, 18004, 17837, 17674,
+    17515, 17361, 17211, 17064, 16921, 16782, 16646, 16514, 16384
+};
+
+void one_ov_sqrt_norm(
+    int32 * frac,                        /* (i/o) Q31: normalized value (1.0 < frac <= 0.5) */
+    int16 * exp                          /* (i/o)    : exponent (value = frac x 2^exponent) */
+)
+{
+    int16 i, a, tmp;
+
+
+    if (*frac <= (int32) 0)
+    {
+        *exp = 0;
+        *frac = 0x7fffffffL;
+        return;
+    }
+
+    if ((*exp & 1) == 1)  /* If exponant odd -> shift right */
+        *frac >>= 1;
+
+    *exp = negate_int16((*exp -  1) >> 1);
+
+    *frac >>= 9;
+    i = extract_h(*frac);                  /* Extract b25-b31 */
+    *frac >>= 1;
+    a = (int16)(*frac);                  /* Extract b10-b24 */
+    a = (int16)(a & (int16) 0x7fff);
+
+    i -= 16;
+
+    *frac = L_deposit_h(table_isqrt[i]);   /* table[i] << 16         */
+    tmp = table_isqrt[i] - table_isqrt[i + 1];      /* table[i] - table[i+1]) */
+
+    *frac = msu_16by16_from_int32(*frac, tmp, a);          /* frac -=  tmp*a*2       */
+
+    return;
+}
+
+/*----------------------------------------------------------------------------
+
+     Function Name : power_2()
+
+       L_x = pow(2.0, exponant.fraction)         (exponant = interger part)
+           = pow(2.0, 0.fraction) << exponant
+
+  Algorithm:
+
+     The function power_2(L_x) is approximated by a table and linear
+     interpolation.
+
+     1- i = bit10-b15 of fraction,   0 <= i <= 31
+     2- a = bit0-b9   of fraction
+     3- L_x = table[i]<<16 - (table[i] - table[i+1]) * a * 2
+     4- L_x = L_x >> (30-exponant)     (with rounding)
+ ----------------------------------------------------------------------------*/
+const int16 table_pow2[33] =
+{
+    16384, 16743, 17109, 17484, 17867, 18258, 18658, 19066, 19484, 19911,
+    20347, 20792, 21247, 21713, 22188, 22674, 23170, 23678, 24196, 24726,
+    25268, 25821, 26386, 26964, 27554, 28158, 28774, 29405, 30048, 30706,
+    31379, 32066, 32767
+};
+
+int32 power_of_2(                         /* (o) Q0  : result       (range: 0<=val<=0x7fffffff) */
+    int16 exponant,                      /* (i) Q0  : Integer part.      (range: 0<=val<=30)   */
+    int16 fraction                       /* (i) Q15 : Fractionnal part.  (range: 0.0<=val<1.0) */
+)
+{
+    int16 exp, i, a, tmp;
+    int32 L_x;
+
+    L_x = fraction << 5;          /* L_x = fraction<<6           */
+    i = (fraction >> 10);                  /* Extract b10-b16 of fraction */
+    a = (int16)(L_x);                    /* Extract b0-b9   of fraction */
+    a = (int16)(a & (int16) 0x7fff);
+
+    L_x = ((int32)table_pow2[i]) << 15;    /* table[i] << 16        */
+    tmp = table_pow2[i] - table_pow2[i + 1];        /* table[i] - table[i+1] */
+    L_x -= ((int32)tmp * a);             /* L_x -= tmp*a*2        */
+
+    exp = 29 - exponant ;
+
+    if (exp)
+    {
+        L_x = ((L_x >> exp) + ((L_x >> (exp - 1)) & 1));
+    }
+
+    return (L_x);
+}
+
+/*----------------------------------------------------------------------------
+ *
+ *   Function Name : Dot_product12()
+ *
+ *       Compute scalar product of <x[],y[]> using accumulator.
+ *
+ *       The result is normalized (in Q31) with exponent (0..30).
+ *
+ *  Algorithm:
+ *
+ *       dot_product = sum(x[i]*y[i])     i=0..N-1
+ ----------------------------------------------------------------------------*/
+
+int32 Dot_product12(   /* (o) Q31: normalized result (1 < val <= -1) */
+    int16 x[],        /* (i) 12bits: x vector                       */
+    int16 y[],        /* (i) 12bits: y vector                       */
+    int16 lg,         /* (i)    : vector length                     */
+    int16 * exp       /* (o)    : exponent of result (0..+30)       */
+)
+{
+    int16 i, sft;
+    int32 L_sum;
+    int16 *pt_x = x;
+    int16 *pt_y = y;
+
+    L_sum = 1L;
+
+
+    for (i = lg >> 3; i != 0; i--)
+    {
+        L_sum = mac_16by16_to_int32(L_sum, *(pt_x++), *(pt_y++));
+        L_sum = mac_16by16_to_int32(L_sum, *(pt_x++), *(pt_y++));
+        L_sum = mac_16by16_to_int32(L_sum, *(pt_x++), *(pt_y++));
+        L_sum = mac_16by16_to_int32(L_sum, *(pt_x++), *(pt_y++));
+        L_sum = mac_16by16_to_int32(L_sum, *(pt_x++), *(pt_y++));
+        L_sum = mac_16by16_to_int32(L_sum, *(pt_x++), *(pt_y++));
+        L_sum = mac_16by16_to_int32(L_sum, *(pt_x++), *(pt_y++));
+        L_sum = mac_16by16_to_int32(L_sum, *(pt_x++), *(pt_y++));
+    }
+
+    /* Normalize acc in Q31 */
+
+    sft = normalize_amr_wb(L_sum);
+    L_sum <<= sft;
+
+    *exp = 30 - sft;                    /* exponent = 0..30 */
+
+    return (L_sum);
+}
+
+/* Table for Log2() */
+const int16 Log2_norm_table[33] =
+{
+    0, 1455, 2866, 4236, 5568, 6863, 8124, 9352, 10549, 11716,
+    12855, 13967, 15054, 16117, 17156, 18172, 19167, 20142, 21097, 22033,
+    22951, 23852, 24735, 25603, 26455, 27291, 28113, 28922, 29716, 30497,
+    31266, 32023, 32767
+};
+
+/*----------------------------------------------------------------------------
+ *
+ *   FUNCTION:   Lg2_normalized()
+ *
+ *   PURPOSE:   Computes log2(L_x, exp),  where   L_x is positive and
+ *              normalized, and exp is the normalisation exponent
+ *              If L_x is negative or zero, the result is 0.
+ *
+ *   DESCRIPTION:
+ *        The function Log2(L_x) is approximated by a table and linear
+ *        interpolation. The following steps are used to compute Log2(L_x)
+ *
+ *           1- exponent = 30-norm_exponent
+ *           2- i = bit25-b31 of L_x;  32<=i<=63  (because of normalization).
+ *           3- a = bit10-b24
+ *           4- i -=32
+ *           5- fraction = table[i]<<16 - (table[i] - table[i+1]) * a * 2
+ *
+----------------------------------------------------------------------------*/
+void Lg2_normalized(
+    int32 L_x,         /* (i) : input value (normalized)                    */
+    int16 exp,         /* (i) : norm_l (L_x)                                */
+    int16 *exponent,   /* (o) : Integer part of Log2.   (range: 0<=val<=30) */
+    int16 *fraction    /* (o) : Fractional part of Log2. (range: 0<=val<1)  */
+)
+{
+    int16 i, a, tmp;
+    int32 L_y;
+
+    if (L_x <= (int32) 0)
+    {
+        *exponent = 0;
+        *fraction = 0;;
+        return;
+    }
+
+    *exponent = 30 - exp;
+
+    L_x >>= 9;
+    i = extract_h(L_x);                 /* Extract b25-b31 */
+    L_x >>= 1;
+    a = (int16)(L_x);                 /* Extract b10-b24 of fraction */
+    a &= 0x7fff;
+
+    i -= 32;
+
+    L_y = L_deposit_h(Log2_norm_table[i]);             /* table[i] << 16        */
+    tmp = Log2_norm_table[i] - Log2_norm_table[i + 1]; /* table[i] - table[i+1] */
+    L_y = msu_16by16_from_int32(L_y, tmp, a);           /* L_y -= tmp*a*2        */
+
+    *fraction = extract_h(L_y);
+
+    return;
+}
+
+
+
+/*----------------------------------------------------------------------------
+ *
+ *   FUNCTION:   amrwb_log_2()
+ *
+ *   PURPOSE:   Computes log2(L_x),  where   L_x is positive.
+ *              If L_x is negative or zero, the result is 0.
+ *
+ *   DESCRIPTION:
+ *        normalizes L_x and then calls Lg2_normalized().
+ *
+ ----------------------------------------------------------------------------*/
+void amrwb_log_2(
+    int32 L_x,         /* (i) : input value                                 */
+    int16 *exponent,   /* (o) : Integer part of Log2.   (range: 0<=val<=30) */
+    int16 *fraction    /* (o) : Fractional part of Log2. (range: 0<=val<1) */
+)
+{
+    int16 exp;
+
+    exp = normalize_amr_wb(L_x);
+    Lg2_normalized(shl_int32(L_x, exp), exp, exponent, fraction);
+}
+
+
+/*****************************************************************************
+ *
+ *  These operations are not standard double precision operations.           *
+ *  They are used where single precision is not enough but the full 32 bits  *
+ *  precision is not necessary. For example, the function Div_32() has a     *
+ *  24 bits precision which is enough for our purposes.                      *
+ *                                                                           *
+ *  The double precision numbers use a special representation:               *
+ *                                                                           *
+ *     L_32 = hi<<16 + lo<<1                                                 *
+ *                                                                           *
+ *  L_32 is a 32 bit integer.                                                *
+ *  hi and lo are 16 bit signed integers.                                    *
+ *  As the low part also contains the sign, this allows fast multiplication. *
+ *                                                                           *
+ *      0x8000 0000 <= L_32 <= 0x7fff fffe.                                  *
+ *                                                                           *
+ *  We will use DPF (Double Precision Format )in this file to specify        *
+ *  this special format.                                                     *
+ *****************************************************************************
+*/
+
+
+/*----------------------------------------------------------------------------
+ *
+ *  Function int32_to_dpf()
+ *
+ *  Extract from a 32 bit integer two 16 bit DPF.
+ *
+ *  Arguments:
+ *
+ *   L_32      : 32 bit integer.
+ *               0x8000 0000 <= L_32 <= 0x7fff ffff.
+ *   hi        : b16 to b31 of L_32
+ *   lo        : (L_32 - hi<<16)>>1
+ *
+ ----------------------------------------------------------------------------*/
+
+void int32_to_dpf(int32 L_32, int16 *hi, int16 *lo)
+{
+    *hi = (int16)(L_32 >> 16);
+    *lo = (int16)((L_32 - (*hi << 16)) >> 1);
+    return;
+}
+
+
+/*----------------------------------------------------------------------------
+ * Function mpy_dpf_32()
+ *
+ *   Multiply two 32 bit integers (DPF). The result is divided by 2**31
+ *
+ *   L_32 = (hi1*hi2)<<1 + ( (hi1*lo2)>>15 + (lo1*hi2)>>15 )<<1
+ *
+ *   This operation can also be viewed as the multiplication of two Q31
+ *   number and the result is also in Q31.
+ *
+ * Arguments:
+ *
+ *  hi1         hi part of first number
+ *  lo1         lo part of first number
+ *  hi2         hi part of second number
+ *  lo2         lo part of second number
+ *
+ ----------------------------------------------------------------------------*/
+
+int32 mpy_dpf_32(int16 hi1, int16 lo1, int16 hi2, int16 lo2)
+{
+    int32 L_32;
+
+    L_32 = mul_16by16_to_int32(hi1, hi2);
+    L_32 = mac_16by16_to_int32(L_32, mult_int16(hi1, lo2), 1);
+    L_32 = mac_16by16_to_int32(L_32, mult_int16(lo1, hi2), 1);
+
+    return (L_32);
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.h
new file mode 100644 (file)
index 0000000..e84ce90
--- /dev/null
@@ -0,0 +1,126 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./src/pvamrwb_math_op.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef PVAMRWB_MATH_OP_H
+#define PVAMRWB_MATH_OP_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+
+/*----------------------------------------------------------------------------
+; DEFINES
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+    int32 one_ov_sqrt(      /* (o) Q31 : output value (range: 0<=val<1)         */
+        int32 L_x          /* (i) Q0  : input value  (range: 0<=val<=7fffffff) */
+    );
+    void one_ov_sqrt_norm(
+        int32 * frac,      /* (i/o) Q31: normalized value (1.0 < frac <= 0.5) */
+        int16 * exp        /* (i/o)    : exponent (value = frac x 2^exponent) */
+    );
+    int32 power_of_2(       /* (o) Q0  : result       (range: 0<=val<=0x7fffffff) */
+        int16 exponant,    /* (i) Q0  : Integer part.      (range: 0<=val<=30)   */
+        int16 fraction     /* (i) Q15 : Fractionnal part.  (range: 0.0<=val<1.0) */
+    );
+    int32 Dot_product12(    /* (o) Q31: normalized result (1 < val <= -1) */
+        int16 x[],         /* (i) 12bits: x vector                       */
+        int16 y[],         /* (i) 12bits: y vector                       */
+        int16 lg,          /* (i)    : vector length                     */
+        int16 * exp        /* (o)    : exponent of result (0..+30)       */
+    );
+
+
+    void amrwb_log_2(
+        int32 L_x,        /* (i) : input value                                 */
+        int16 *exponent,  /* (o) : Integer part of Log2.   (range: 0<=val<=30) */
+        int16 *fraction   /* (o) : Fractional part of Log2. (range: 0<=val<1)*/
+    );
+
+    void Lg2_normalized(
+        int32 L_x,         /* (i) : input value (normalized)                    */
+        int16 exp,         /* (i) : norm_l (L_x)                                */
+        int16 *exponent,   /* (o) : Integer part of Log2.   (range: 0<=val<=30) */
+        int16 *fraction    /* (o) : Fractional part of Log2. (range: 0<=val<1)  */
+    );
+
+
+    int16 mult_int16_r(int16 var1, int16 var2);          /* Mult with round, 2 */
+    int16 shr_rnd(int16 var1, int16 var2);         /* Shift right with round, 2  */
+
+    int16 div_16by16(int16 var1, int16 var2);       /* Short division,       18  */
+
+
+    void int32_to_dpf(int32 L_32, int16 *hi, int16 *lo);
+    int32 mpy_dpf_32(int16 hi1, int16 lo1, int16 hi2, int16 lo2);
+
+
+#define norm_s( x)    (normalize_amr_wb(  x) - 16)
+
+
+#define extract_h( x)    (int16)(x>>16)
+#define L_deposit_h( x)    (int32)(x<<16)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /*  PVAMRWB_MATH_OP_H */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.cpp
new file mode 100644 (file)
index 0000000..85edaa1
--- /dev/null
@@ -0,0 +1,1141 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pvamrwbdecoder.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 mode,                      input : used mode
+     int16 prms[],                    input : parameter vector
+     int16 synth16k[],                output: synthesis speech
+     int16 * frame_length,            output:  lenght of the frame
+     void *spd_state,                 i/o   : State structure
+     int16 frame_type,                input : received frame type
+     int16 ScratchMem[]
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   Performs the main decoder routine AMR WB ACELP coding algorithm with 20 ms
+   speech frames for wideband speech signals.
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_mem_funcs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+#include "e_pv_amrwbdec.h"
+#include "get_amr_wb_bits.h"
+#include "pvamrwb_math_op.h"
+#include "pvamrwbdecoder_api.h"
+#include "pvamrwbdecoder.h"
+#include "synthesis_amr_wb.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/* LPC interpolation coef {0.45, 0.8, 0.96, 1.0}; in Q15 */
+static const int16 interpol_frac[NB_SUBFR] = {14746, 26214, 31457, 32767};
+
+
+/* isp tables for initialization */
+
+static const int16 isp_init[M] =
+{
+    32138, 30274, 27246, 23170, 18205, 12540, 6393, 0,
+    -6393, -12540, -18205, -23170, -27246, -30274, -32138, 1475
+};
+
+static const int16 isf_init[M] =
+{
+    1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192,
+    9216, 10240, 11264, 12288, 13312, 14336, 15360, 3840
+};
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ FUNCTION DESCRIPTION   pvDecoder_AmrWb_Init
+
+   Initialization of variables for the decoder section.
+
+----------------------------------------------------------------------------*/
+
+
+
+
+void pvDecoder_AmrWb_Init(void **spd_state, void *pt_st, int16 **ScratchMem)
+{
+    /* Decoder states */
+    Decoder_State *st = &(((PV_AmrWbDec *)pt_st)->state);
+
+    *ScratchMem = ((PV_AmrWbDec *)pt_st)->ScratchMem;
+    /*
+     *  Init dtx decoding
+     */
+    dtx_dec_amr_wb_reset(&(st->dtx_decSt), isf_init);
+
+    pvDecoder_AmrWb_Reset((void *) st, 1);
+
+    *spd_state = (void *) st;
+
+    return;
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void pvDecoder_AmrWb_Reset(void *st, int16 reset_all)
+{
+    int16 i;
+
+    Decoder_State *dec_state;
+
+    dec_state = (Decoder_State *) st;
+
+    pv_memset((void *)dec_state->old_exc,
+              0,
+              (PIT_MAX + L_INTERPOL)*sizeof(*dec_state->old_exc));
+
+    pv_memset((void *)dec_state->past_isfq,
+              0,
+              M*sizeof(*dec_state->past_isfq));
+
+
+    dec_state->old_T0_frac = 0;               /* old pitch value = 64.0 */
+    dec_state->old_T0 = 64;
+    dec_state->first_frame = 1;
+    dec_state->L_gc_thres = 0;
+    dec_state->tilt_code = 0;
+
+    pv_memset((void *)dec_state->disp_mem,
+              0,
+              8*sizeof(*dec_state->disp_mem));
+
+
+    /* scaling memories for excitation */
+    dec_state->Q_old = Q_MAX;
+    dec_state->Qsubfr[3] = Q_MAX;
+    dec_state->Qsubfr[2] = Q_MAX;
+    dec_state->Qsubfr[1] = Q_MAX;
+    dec_state->Qsubfr[0] = Q_MAX;
+
+    if (reset_all != 0)
+    {
+        /* routines initialization */
+
+        dec_gain2_amr_wb_init(dec_state->dec_gain);
+        oversamp_12k8_to_16k_init(dec_state->mem_oversamp);
+        band_pass_6k_7k_init(dec_state->mem_hf);
+        low_pass_filt_7k_init(dec_state->mem_hf3);
+        highpass_50Hz_at_12k8_init(dec_state->mem_sig_out);
+        highpass_400Hz_at_12k8_init(dec_state->mem_hp400);
+        Init_Lagconc(dec_state->lag_hist);
+
+        /* isp initialization */
+
+        pv_memcpy((void *)dec_state->ispold, (void *)isp_init, M*sizeof(*isp_init));
+
+        pv_memcpy((void *)dec_state->isfold, (void *)isf_init, M*sizeof(*isf_init));
+        for (i = 0; i < L_MEANBUF; i++)
+        {
+            pv_memcpy((void *)&dec_state->isf_buf[i * M],
+                      (void *)isf_init,
+                      M*sizeof(*isf_init));
+        }
+        /* variable initialization */
+
+        dec_state->mem_deemph = 0;
+
+        dec_state->seed  = 21845;              /* init random with 21845 */
+        dec_state->seed2 = 21845;
+        dec_state->seed3 = 21845;
+
+        dec_state->state = 0;
+        dec_state->prev_bfi = 0;
+
+        /* Static vectors to zero */
+
+        pv_memset((void *)dec_state->mem_syn_hf,
+                  0,
+                  M16k*sizeof(*dec_state->mem_syn_hf));
+
+        pv_memset((void *)dec_state->mem_syn_hi,
+                  0,
+                  M*sizeof(*dec_state->mem_syn_hi));
+
+        pv_memset((void *)dec_state->mem_syn_lo,
+                  0,
+                  M*sizeof(*dec_state->mem_syn_lo));
+
+
+        dtx_dec_amr_wb_reset(&(dec_state->dtx_decSt), isf_init);
+        dec_state->vad_hist = 0;
+
+    }
+    return;
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+int32 pvDecoder_AmrWbMemRequirements()
+{
+    return(sizeof(PV_AmrWbDec));
+}
+
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+/*              Main decoder routine.                                       */
+
+int32 pvDecoder_AmrWb(
+    int16 mode,              /* input : used mode                     */
+    int16 prms[],            /* input : parameter vector              */
+    int16 synth16k[],        /* output: synthesis speech              */
+    int16 * frame_length,    /* output:  lenght of the frame          */
+    void *spd_state,         /* i/o   : State structure               */
+    int16 frame_type,        /* input : received frame type           */
+    int16 ScratchMem[]
+)
+{
+
+    /* Decoder states */
+    Decoder_State *st;
+
+    int16 *ScratchMem2 = &ScratchMem[ L_SUBFR + L_SUBFR16k + ((L_SUBFR + M + M16k +1)<<1)];
+
+
+    /* Excitation vector */
+
+
+    int16 *old_exc = ScratchMem2;
+
+    int16 *Aq = &old_exc[(L_FRAME + 1) + PIT_MAX + L_INTERPOL];/* A(z)   quantized for the 4 subframes */
+
+    int16 *ispnew  = &Aq[NB_SUBFR * (M + 1)];/* immittance spectral pairs at 4nd sfr */
+    int16 *isf     = &ispnew[M];             /* ISF (frequency domain) at 4nd sfr    */
+    int16 *isf_tmp = &isf[M];
+    int16 *code    = &isf_tmp[M];             /* algebraic codevector                 */
+    int16 *excp    = &code[L_SUBFR];
+    int16 *exc2    = &excp[L_SUBFR];         /* excitation vector                    */
+    int16 *HfIsf   = &exc2[L_FRAME];
+
+
+    int16 *exc;
+
+    /* LPC coefficients */
+
+    int16 *p_Aq;                          /* ptr to A(z) for the 4 subframes      */
+
+
+
+    int16 fac, stab_fac, voice_fac, Q_new = 0;
+    int32 L_tmp, L_gain_code;
+
+    /* Scalars */
+
+    int16 i, j, i_subfr, index, ind[8], tmp;
+    int32 max;
+    int16 T0, T0_frac, pit_flag, T0_max, select, T0_min = 0;
+    int16 gain_pit, gain_code;
+    int16 newDTXState, bfi, unusable_frame, nb_bits;
+    int16 vad_flag;
+    int16 pit_sharp;
+
+    int16 corr_gain = 0;
+
+    st = (Decoder_State *) spd_state;
+
+    /* mode verification */
+
+    nb_bits = AMR_WB_COMPRESSED[mode];
+
+    *frame_length = AMR_WB_PCM_FRAME;
+
+    /* find the new  DTX state  SPEECH OR DTX */
+    newDTXState = rx_amr_wb_dtx_handler(&(st->dtx_decSt), frame_type);
+
+
+    if (newDTXState != SPEECH)
+    {
+        dtx_dec_amr_wb(&(st->dtx_decSt), exc2, newDTXState, isf, &prms);
+    }
+    /* SPEECH action state machine  */
+
+    if ((frame_type == RX_SPEECH_BAD) ||
+            (frame_type == RX_SPEECH_PROBABLY_DEGRADED))
+    {
+        /* bfi for all index, bits are not usable */
+        bfi = 1;
+        unusable_frame = 0;
+    }
+    else if ((frame_type == RX_NO_DATA) ||
+             (frame_type == RX_SPEECH_LOST))
+    {
+        /* bfi only for lsf, gains and pitch period */
+        bfi = 1;
+        unusable_frame = 1;
+    }
+    else
+    {
+        bfi = 0;
+        unusable_frame = 0;
+    }
+
+    if (bfi != 0)
+    {
+        st->state += 1;
+
+        if (st->state > 6)
+        {
+            st->state = 6;
+        }
+    }
+    else
+    {
+        st->state >>=  1;
+    }
+
+    /* If this frame is the first speech frame after CNI period,
+     * set the BFH state machine to an appropriate state depending
+     * on whether there was DTX muting before start of speech or not
+     * If there was DTX muting, the first speech frame is muted.
+     * If there was no DTX muting, the first speech frame is not
+     * muted. The BFH state machine starts from state 5, however, to
+     * keep the audible noise resulting from a SID frame which is
+     * erroneously interpreted as a good speech frame as small as
+     * possible (the decoder output in this case is quickly muted)
+     */
+
+    if (st->dtx_decSt.dtxGlobalState == DTX)
+    {
+        st->state = 5;
+        st->prev_bfi = 0;
+    }
+    else if (st->dtx_decSt.dtxGlobalState == DTX_MUTE)
+    {
+        st->state = 5;
+        st->prev_bfi = 1;
+    }
+
+    if (newDTXState == SPEECH)
+    {
+        vad_flag = Serial_parm_1bit(&prms);
+
+        if (bfi == 0)
+        {
+            if (vad_flag == 0)
+            {
+                st->vad_hist = add_int16(st->vad_hist, 1);
+            }
+            else
+            {
+                st->vad_hist = 0;
+            }
+        }
+    }
+    /*
+     *  DTX-CNG
+     */
+
+    if (newDTXState != SPEECH)     /* CNG mode */
+    {
+        /* increase slightly energy of noise below 200 Hz */
+
+        /* Convert ISFs to the cosine domain */
+        Isf_isp(isf, ispnew, M);
+
+        Isp_Az(ispnew, Aq, M, 1);
+
+        pv_memcpy((void *)isf_tmp, (void *)st->isfold, M*sizeof(*isf_tmp));
+
+
+        for (i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
+        {
+            j = i_subfr >> 6;
+
+            for (i = 0; i < M; i++)
+            {
+                L_tmp = mul_16by16_to_int32(isf_tmp[i], sub_int16(32767, interpol_frac[j]));
+                L_tmp = mac_16by16_to_int32(L_tmp, isf[i], interpol_frac[j]);
+                HfIsf[i] = amr_wb_round(L_tmp);
+            }
+
+            synthesis_amr_wb(Aq,
+                             &exc2[i_subfr],
+                             0,
+                             &synth16k[i_subfr *5/4],
+                             (short) 1,
+                             HfIsf,
+                             nb_bits,
+                             newDTXState,
+                             st,
+                             bfi,
+                             ScratchMem);
+        }
+
+        /* reset speech coder memories */
+        pvDecoder_AmrWb_Reset(st, 0);
+
+        pv_memcpy((void *)st->isfold, (void *)isf, M*sizeof(*isf));
+
+        st->prev_bfi = bfi;
+        st->dtx_decSt.dtxGlobalState = newDTXState;
+
+        return 0;
+    }
+    /*
+     *  ACELP
+     */
+
+    /* copy coder memory state into working space (internal memory for DSP) */
+
+    pv_memcpy((void *)old_exc, (void *)st->old_exc, (PIT_MAX + L_INTERPOL)*sizeof(*old_exc));
+
+    exc = old_exc + PIT_MAX + L_INTERPOL;
+
+    /* Decode the ISFs */
+
+    if (nb_bits > NBBITS_7k)        /* all rates but 6.6 Kbps */
+    {
+        ind[0] = Serial_parm(8, &prms);     /* index of 1st ISP subvector */
+        ind[1] = Serial_parm(8, &prms);     /* index of 2nd ISP subvector */
+        ind[2] = Serial_parm(6, &prms);     /* index of 3rd ISP subvector */
+        ind[3] = Serial_parm(7, &prms);     /* index of 4th ISP subvector */
+        ind[4] = Serial_parm(7, &prms);     /* index of 5th ISP subvector */
+        ind[5] = Serial_parm(5, &prms);     /* index of 6th ISP subvector */
+        ind[6] = Serial_parm(5, &prms);     /* index of 7th ISP subvector */
+
+        Dpisf_2s_46b(ind, isf, st->past_isfq, st->isfold, st->isf_buf, bfi, 1);
+    }
+    else
+    {
+        ind[0] = Serial_parm(8, &prms);
+        ind[1] = Serial_parm(8, &prms);
+        ind[2] = Serial_parm(14, &prms);
+        ind[3] = ind[2] & 0x007F;
+        ind[2] >>= 7;
+        ind[4] = Serial_parm(6, &prms);
+
+        Dpisf_2s_36b(ind, isf, st->past_isfq, st->isfold, st->isf_buf, bfi, 1);
+    }
+
+    /* Convert ISFs to the cosine domain */
+
+    Isf_isp(isf, ispnew, M);
+
+    if (st->first_frame != 0)
+    {
+        st->first_frame = 0;
+        pv_memcpy((void *)st->ispold, (void *)ispnew, M*sizeof(*ispnew));
+
+    }
+    /* Find the interpolated ISPs and convert to a[] for all subframes */
+    interpolate_isp(st->ispold, ispnew, interpol_frac, Aq);
+
+    /* update ispold[] for the next frame */
+    pv_memcpy((void *)st->ispold, (void *)ispnew, M*sizeof(*ispnew));
+
+    /* Check stability on isf : distance between old isf and current isf */
+
+    L_tmp = 0;
+    for (i = 0; i < M - 1; i++)
+    {
+        tmp = sub_int16(isf[i], st->isfold[i]);
+        L_tmp = mac_16by16_to_int32(L_tmp, tmp, tmp);
+    }
+    tmp = extract_h(shl_int32(L_tmp, 8));
+    tmp = mult_int16(tmp, 26214);                /* tmp = L_tmp*0.8/256 */
+
+    tmp = 20480 - tmp;                 /* 1.25 - tmp */
+    stab_fac = shl_int16(tmp, 1);                /* Q14 -> Q15 with saturation */
+
+    if (stab_fac < 0)
+    {
+        stab_fac = 0;
+    }
+    pv_memcpy((void *)isf_tmp, (void *)st->isfold, M*sizeof(*isf_tmp));
+
+    pv_memcpy((void *)st->isfold, (void *)isf, M*sizeof(*isf));
+
+    /*
+     *          Loop for every subframe in the analysis frame
+     *
+     * The subframe size is L_SUBFR and the loop is repeated L_FRAME/L_SUBFR
+     *  times
+     *     - decode the pitch delay and filter mode
+     *     - decode algebraic code
+     *     - decode pitch and codebook gains
+     *     - find voicing factor and tilt of code for next subframe.
+     *     - find the excitation and compute synthesis speech
+     */
+
+    p_Aq = Aq;                                /* pointer to interpolated LPC parameters */
+
+
+    /*
+     *   Sub process next 3 subframes
+     */
+
+
+    for (i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
+    {
+        pit_flag = i_subfr;
+
+
+        if ((i_subfr == 2*L_SUBFR) && (nb_bits > NBBITS_7k))
+        {
+            pit_flag = 0;        /* set to 0 for 3rd subframe, <=> is not 6.6 kbps */
+        }
+        /*-------------------------------------------------*
+         * - Decode pitch lag                              *
+         * Lag indeces received also in case of BFI,       *
+         * so that the parameter pointer stays in sync.    *
+         *-------------------------------------------------*/
+
+        if (pit_flag == 0)
+        {
+
+            if (nb_bits <= NBBITS_9k)
+            {
+                index = Serial_parm(8, &prms);
+
+                if (index < (PIT_FR1_8b - PIT_MIN) * 2)
+                {
+                    T0 = PIT_MIN + (index >> 1);
+                    T0_frac = sub_int16(index, shl_int16(sub_int16(T0, PIT_MIN), 1));
+                    T0_frac = shl_int16(T0_frac, 1);
+                }
+                else
+                {
+                    T0 = add_int16(index, PIT_FR1_8b - ((PIT_FR1_8b - PIT_MIN) * 2));
+                    T0_frac = 0;
+                }
+            }
+            else
+            {
+                index = Serial_parm(9, &prms);
+
+                if (index < (PIT_FR2 - PIT_MIN) * 4)
+                {
+                    T0 = PIT_MIN + (index >> 2);
+                    T0_frac = sub_int16(index, shl_int16(sub_int16(T0, PIT_MIN), 2));
+                }
+                else if (index < (((PIT_FR2 - PIT_MIN) << 2) + ((PIT_FR1_9b - PIT_FR2) << 1)))
+                {
+                    index -= (PIT_FR2 - PIT_MIN) << 2;
+                    T0 = PIT_FR2 + (index >> 1);
+                    T0_frac = sub_int16(index, shl_int16(sub_int16(T0, PIT_FR2), 1));
+                    T0_frac = shl_int16(T0_frac, 1);
+                }
+                else
+                {
+                    T0 = add_int16(index, (PIT_FR1_9b - ((PIT_FR2 - PIT_MIN) * 4) - ((PIT_FR1_9b - PIT_FR2) * 2)));
+                    T0_frac = 0;
+                }
+            }
+
+            /* find T0_min and T0_max for subframe 2 and 4 */
+
+            T0_min = T0 - 8;
+
+            if (T0_min < PIT_MIN)
+            {
+                T0_min = PIT_MIN;
+            }
+            T0_max = T0_min + 15;
+
+            if (T0_max > PIT_MAX)
+            {
+                T0_max = PIT_MAX;
+                T0_min = PIT_MAX - 15;
+            }
+        }
+        else
+        {                                  /* if subframe 2 or 4 */
+
+            if (nb_bits <= NBBITS_9k)
+            {
+                index = Serial_parm(5, &prms);
+
+                T0 = T0_min + (index >> 1);
+                T0_frac = sub_int16(index, shl_int16(T0 - T0_min, 1));
+                T0_frac = shl_int16(T0_frac, 1);
+            }
+            else
+            {
+                index = Serial_parm(6, &prms);
+
+                T0 = T0_min + (index >> 2);
+                T0_frac = sub_int16(index, shl_int16(T0 - T0_min, 2));
+            }
+        }
+
+        /* check BFI after pitch lag decoding */
+
+        if (bfi != 0)                      /* if frame erasure */
+        {
+            lagconceal(&(st->dec_gain[17]), st->lag_hist, &T0, &(st->old_T0), &(st->seed3), unusable_frame);
+            T0_frac = 0;
+        }
+        /*
+         *  Find the pitch gain, the interpolation filter
+         *  and the adaptive codebook vector.
+         */
+
+        Pred_lt4(&exc[i_subfr], T0, T0_frac, L_SUBFR + 1);
+
+
+        if (unusable_frame)
+        {
+            select = 1;
+        }
+        else
+        {
+
+            if (nb_bits <= NBBITS_9k)
+            {
+                select = 0;
+            }
+            else
+            {
+                select = Serial_parm_1bit(&prms);
+            }
+        }
+
+
+        if (select == 0)
+        {
+            /* find pitch excitation with lp filter */
+            for (i = 0; i < L_SUBFR; i++)
+            {
+                L_tmp  = ((int32) exc[i-1+i_subfr] + exc[i+1+i_subfr]);
+                L_tmp *= 5898;
+                L_tmp += ((int32) exc[i+i_subfr] * 20972);
+
+                code[i] = amr_wb_round(L_tmp << 1);
+            }
+            pv_memcpy((void *)&exc[i_subfr], (void *)code, L_SUBFR*sizeof(*code));
+
+        }
+        /*
+         * Decode innovative codebook.
+         * Add the fixed-gain pitch contribution to code[].
+         */
+
+        if (unusable_frame != 0)
+        {
+            /* the innovative code doesn't need to be scaled (see Q_gain2) */
+            for (i = 0; i < L_SUBFR; i++)
+            {
+                code[i] = noise_gen_amrwb(&(st->seed)) >> 3;
+            }
+        }
+        else if (nb_bits <= NBBITS_7k)
+        {
+            ind[0] = Serial_parm(12, &prms);
+            dec_acelp_2p_in_64(ind[0], code);
+        }
+        else if (nb_bits <= NBBITS_9k)
+        {
+            for (i = 0; i < 4; i++)
+            {
+                ind[i] = Serial_parm(5, &prms);
+            }
+            dec_acelp_4p_in_64(ind, 20, code);
+        }
+        else if (nb_bits <= NBBITS_12k)
+        {
+            for (i = 0; i < 4; i++)
+            {
+                ind[i] = Serial_parm(9, &prms);
+            }
+            dec_acelp_4p_in_64(ind, 36, code);
+        }
+        else if (nb_bits <= NBBITS_14k)
+        {
+            ind[0] = Serial_parm(13, &prms);
+            ind[1] = Serial_parm(13, &prms);
+            ind[2] = Serial_parm(9, &prms);
+            ind[3] = Serial_parm(9, &prms);
+            dec_acelp_4p_in_64(ind, 44, code);
+        }
+        else if (nb_bits <= NBBITS_16k)
+        {
+            for (i = 0; i < 4; i++)
+            {
+                ind[i] = Serial_parm(13, &prms);
+            }
+            dec_acelp_4p_in_64(ind, 52, code);
+        }
+        else if (nb_bits <= NBBITS_18k)
+        {
+            for (i = 0; i < 4; i++)
+            {
+                ind[i] = Serial_parm(2, &prms);
+            }
+            for (i = 4; i < 8; i++)
+            {
+                ind[i] = Serial_parm(14, &prms);
+            }
+            dec_acelp_4p_in_64(ind, 64, code);
+        }
+        else if (nb_bits <= NBBITS_20k)
+        {
+            ind[0] = Serial_parm(10, &prms);
+            ind[1] = Serial_parm(10, &prms);
+            ind[2] = Serial_parm(2, &prms);
+            ind[3] = Serial_parm(2, &prms);
+            ind[4] = Serial_parm(10, &prms);
+            ind[5] = Serial_parm(10, &prms);
+            ind[6] = Serial_parm(14, &prms);
+            ind[7] = Serial_parm(14, &prms);
+            dec_acelp_4p_in_64(ind, 72, code);
+        }
+        else
+        {
+            for (i = 0; i < 8; i++)
+            {
+                ind[i] = Serial_parm(11, &prms);
+            }
+
+            dec_acelp_4p_in_64(ind, 88, code);
+        }
+
+        preemph_amrwb_dec(code, st->tilt_code, L_SUBFR);
+
+        tmp = T0;
+
+        if (T0_frac > 2)
+        {
+            tmp++;
+        }
+        Pit_shrp(code, tmp, PIT_SHARP, L_SUBFR);
+
+        /*
+         *  Decode codebooks gains.
+         */
+
+        if (nb_bits <= NBBITS_9k)
+        {
+            index = Serial_parm(6, &prms); /* codebook gain index */
+
+            dec_gain2_amr_wb(index,
+                             6,
+                             code,
+                             L_SUBFR,
+                             &gain_pit,
+                             &L_gain_code,
+                             bfi,
+                             st->prev_bfi,
+                             st->state,
+                             unusable_frame,
+                             st->vad_hist,
+                             st->dec_gain);
+        }
+        else
+        {
+            index = Serial_parm(7, &prms); /* codebook gain index */
+
+            dec_gain2_amr_wb(index,
+                             7,
+                             code,
+                             L_SUBFR,
+                             &gain_pit,
+                             &L_gain_code,
+                             bfi,
+                             st->prev_bfi,
+                             st->state,
+                             unusable_frame,
+                             st->vad_hist,
+                             st->dec_gain);
+        }
+
+        /* find best scaling to perform on excitation (Q_new) */
+
+        tmp = st->Qsubfr[0];
+        for (i = 1; i < 4; i++)
+        {
+            if (st->Qsubfr[i] < tmp)
+            {
+                tmp = st->Qsubfr[i];
+            }
+        }
+
+        /* limit scaling (Q_new) to Q_MAX: see pv_amr_wb_cnst.h and syn_filt_32() */
+
+        if (tmp > Q_MAX)
+        {
+            tmp = Q_MAX;
+        }
+        Q_new = 0;
+        L_tmp = L_gain_code;                  /* L_gain_code in Q16 */
+
+
+        while ((L_tmp < 0x08000000L) && (Q_new < tmp))
+        {
+            L_tmp <<= 1;
+            Q_new += 1;
+
+        }
+        gain_code = amr_wb_round(L_tmp);          /* scaled gain_code with Qnew */
+
+        scale_signal(exc + i_subfr - (PIT_MAX + L_INTERPOL),
+                     PIT_MAX + L_INTERPOL + L_SUBFR,
+                     (int16)(Q_new - st->Q_old));
+
+        st->Q_old = Q_new;
+
+
+        /*
+         * Update parameters for the next subframe.
+         * - tilt of code: 0.0 (unvoiced) to 0.5 (voiced)
+         */
+
+
+        if (bfi == 0)
+        {
+            /* LTP-Lag history update */
+            for (i = 4; i > 0; i--)
+            {
+                st->lag_hist[i] = st->lag_hist[i - 1];
+            }
+            st->lag_hist[0] = T0;
+
+            st->old_T0 = T0;
+            st->old_T0_frac = 0;              /* Remove fraction in case of BFI */
+        }
+        /* find voice factor in Q15 (1=voiced, -1=unvoiced) */
+
+        /*
+         * Scale down by 1/8
+         */
+        for (i = L_SUBFR - 1; i >= 0; i--)
+        {
+            exc2[i] = (exc[i_subfr + i] + (0x0004 * (exc[i_subfr + i] != MAX_16))) >> 3;
+        }
+
+
+        /* post processing of excitation elements */
+
+        if (nb_bits <= NBBITS_9k)
+        {
+            pit_sharp = shl_int16(gain_pit, 1);
+
+            if (pit_sharp > 16384)
+            {
+                for (i = 0; i < L_SUBFR; i++)
+                {
+                    tmp = mult_int16(exc2[i], pit_sharp);
+                    L_tmp = mul_16by16_to_int32(tmp, gain_pit);
+                    L_tmp >>= 1;
+                    excp[i] = amr_wb_round(L_tmp);
+                }
+            }
+        }
+        else
+        {
+            pit_sharp = 0;
+        }
+
+        voice_fac = voice_factor(exc2, -3, gain_pit, code, gain_code, L_SUBFR);
+
+        /* tilt of code for next subframe: 0.5=voiced, 0=unvoiced */
+
+        st->tilt_code = (voice_fac >> 2) + 8192;
+
+        /*
+         * - Find the total excitation.
+         * - Find synthesis speech corresponding to exc[].
+         * - Find maximum value of excitation for next scaling
+         */
+
+        pv_memcpy((void *)exc2, (void *)&exc[i_subfr], L_SUBFR*sizeof(*exc2));
+        max = 1;
+
+        for (i = 0; i < L_SUBFR; i++)
+        {
+            L_tmp = mul_16by16_to_int32(code[i], gain_code);
+            L_tmp = shl_int32(L_tmp, 5);
+            L_tmp = mac_16by16_to_int32(L_tmp, exc[i + i_subfr], gain_pit);
+            L_tmp = shl_int32(L_tmp, 1);
+            tmp = amr_wb_round(L_tmp);
+            exc[i + i_subfr] = tmp;
+            tmp = tmp - (tmp < 0);
+            max |= tmp ^(tmp >> 15);  /* |= tmp ^sign(tmp) */
+        }
+
+
+        /* tmp = scaling possible according to max value of excitation */
+        tmp = add_int16(norm_s(max), Q_new) - 1;
+
+        st->Qsubfr[3] = st->Qsubfr[2];
+        st->Qsubfr[2] = st->Qsubfr[1];
+        st->Qsubfr[1] = st->Qsubfr[0];
+        st->Qsubfr[0] = tmp;
+
+        /*
+         * phase dispersion to enhance noise in low bit rate
+         */
+
+
+        if (nb_bits <= NBBITS_7k)
+        {
+            j = 0;      /* high dispersion for rate <= 7.5 kbit/s */
+        }
+        else if (nb_bits <= NBBITS_9k)
+        {
+            j = 1;      /* low dispersion for rate <= 9.6 kbit/s */
+        }
+        else
+        {
+            j = 2;      /* no dispersion for rate > 9.6 kbit/s */
+        }
+
+        /* L_gain_code in Q16 */
+
+        phase_dispersion((int16)(L_gain_code >> 16),
+                         gain_pit,
+                         code,
+                         j,
+                         st->disp_mem,
+                         ScratchMem);
+
+        /*
+         * noise enhancer
+         * - Enhance excitation on noise. (modify gain of code)
+         *   If signal is noisy and LPC filter is stable, move gain
+         *   of code 1.5 dB toward gain of code threshold.
+         *   This decrease by 3 dB noise energy variation.
+         */
+
+        tmp = 16384 - (voice_fac >> 1);  /* 1=unvoiced, 0=voiced */
+        fac = mult_int16(stab_fac, tmp);
+
+        L_tmp = L_gain_code;
+
+        if (L_tmp < st->L_gc_thres)
+        {
+            L_tmp += fxp_mul32_by_16b(L_gain_code, 6226) << 1;
+
+            if (L_tmp > st->L_gc_thres)
+            {
+                L_tmp = st->L_gc_thres;
+            }
+        }
+        else
+        {
+            L_tmp = fxp_mul32_by_16b(L_gain_code, 27536) << 1;
+
+            if (L_tmp < st->L_gc_thres)
+            {
+                L_tmp = st->L_gc_thres;
+            }
+        }
+        st->L_gc_thres = L_tmp;
+
+        L_gain_code = fxp_mul32_by_16b(L_gain_code, (32767 - fac)) << 1;
+
+
+        L_gain_code = add_int32(L_gain_code, fxp_mul32_by_16b(L_tmp, fac) << 1);
+
+        /*
+         * pitch enhancer
+         * - Enhance excitation on voice. (HP filtering of code)
+         *   On voiced signal, filtering of code by a smooth fir HP
+         *   filter to decrease energy of code in low frequency.
+         */
+
+        tmp = (voice_fac >> 3) + 4096;/* 0.25=voiced, 0=unvoiced */
+
+        /* build excitation */
+
+        gain_code = amr_wb_round(shl_int32(L_gain_code, Q_new));
+
+        L_tmp = (int32)(code[0] << 16);
+        L_tmp = msu_16by16_from_int32(L_tmp, code[1], tmp);
+        L_tmp = mul_16by16_to_int32(amr_wb_round(L_tmp), gain_code);
+        L_tmp = shl_int32(L_tmp, 5);
+        L_tmp = mac_16by16_to_int32(L_tmp, exc2[0], gain_pit);
+        L_tmp = shl_int32(L_tmp, 1);       /* saturation can occur here */
+        exc2[0] = amr_wb_round(L_tmp);
+
+
+        for (i = 1; i < L_SUBFR - 1; i++)
+        {
+            L_tmp = (int32)(code[i] << 16);
+            L_tmp = msu_16by16_from_int32(L_tmp, (code[i + 1] + code[i - 1]), tmp);
+            L_tmp = mul_16by16_to_int32(amr_wb_round(L_tmp), gain_code);
+            L_tmp = shl_int32(L_tmp, 5);
+            L_tmp = mac_16by16_to_int32(L_tmp, exc2[i], gain_pit);
+            L_tmp = shl_int32(L_tmp, 1);       /* saturation can occur here */
+            exc2[i] = amr_wb_round(L_tmp);
+        }
+
+        L_tmp = (int32)(code[L_SUBFR - 1] << 16);
+        L_tmp = msu_16by16_from_int32(L_tmp, code[L_SUBFR - 2], tmp);
+        L_tmp = mul_16by16_to_int32(amr_wb_round(L_tmp), gain_code);
+        L_tmp = shl_int32(L_tmp, 5);
+        L_tmp = mac_16by16_to_int32(L_tmp, exc2[L_SUBFR - 1], gain_pit);
+        L_tmp = shl_int32(L_tmp, 1);       /* saturation can occur here */
+        exc2[L_SUBFR - 1] = amr_wb_round(L_tmp);
+
+
+
+        if (nb_bits <= NBBITS_9k)
+        {
+            if (pit_sharp > 16384)
+            {
+                for (i = 0; i < L_SUBFR; i++)
+                {
+                    excp[i] = add_int16(excp[i], exc2[i]);
+                }
+                agc2_amr_wb(exc2, excp, L_SUBFR);
+                pv_memcpy((void *)exc2, (void *)excp, L_SUBFR*sizeof(*exc2));
+
+            }
+        }
+        if (nb_bits <= NBBITS_7k)
+        {
+            j = i_subfr >> 6;
+            for (i = 0; i < M; i++)
+            {
+                L_tmp = mul_16by16_to_int32(isf_tmp[i], sub_int16(32767, interpol_frac[j]));
+                L_tmp = mac_16by16_to_int32(L_tmp, isf[i], interpol_frac[j]);
+                HfIsf[i] = amr_wb_round(L_tmp);
+            }
+        }
+        else
+        {
+            pv_memset((void *)st->mem_syn_hf,
+                      0,
+                      (M16k - M)*sizeof(*st->mem_syn_hf));
+        }
+
+        if (nb_bits >= NBBITS_24k)
+        {
+            corr_gain = Serial_parm(4, &prms);
+        }
+        else
+        {
+            corr_gain = 0;
+        }
+
+        synthesis_amr_wb(p_Aq,
+                         exc2,
+                         Q_new,
+                         &synth16k[i_subfr + (i_subfr>>2)],
+                         corr_gain,
+                         HfIsf,
+                         nb_bits,
+                         newDTXState,
+                         st,
+                         bfi,
+                         ScratchMem);
+
+        p_Aq += (M + 1);                   /* interpolated LPC parameters for next subframe */
+    }
+
+    /*
+     *   Update signal for next frame.
+     *   -> save past of exc[]
+     *   -> save pitch parameters
+     */
+
+    pv_memcpy((void *)st->old_exc,
+              (void *)&old_exc[L_FRAME],
+              (PIT_MAX + L_INTERPOL)*sizeof(*old_exc));
+
+    scale_signal(exc, L_FRAME, (int16)(-Q_new));
+
+    dtx_dec_amr_wb_activity_update(&(st->dtx_decSt), isf, exc);
+
+    st->dtx_decSt.dtxGlobalState = newDTXState;
+
+    st->prev_bfi = bfi;
+
+    return 0;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.h
new file mode 100644 (file)
index 0000000..d017d06
--- /dev/null
@@ -0,0 +1,146 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Name: pvamrwbdecoder.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ Main header file for the Packet Video AMR Wide  Band  decoder library. The
+ constants, structures, and functions defined within this file, along with
+ a basic data types header file, is all that is needed to use and communicate
+ with the library. The internal data structures within the library are
+ purposely hidden.
+
+ ---* Need description of the input buffering. *-------
+
+ ---* Need an example of calling the library here *----
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+  (Normally header files do not have a reference section)
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef _PVAMRWBDECODER_H
+#define _PVAMRWBDECODER_H
+
+#include    "oscl_base.h"    /* Basic data types used within the lib */
+#include    "pvamrwbdecoder_api.h"
+#include    "pvgsmamrdecoderinterface.h"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*----------------------------------------------------------------------------
+    ; MACROS
+    ; Define module specific macros here
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; DEFINES
+    ; Include all pre-processor statements here.
+    ----------------------------------------------------------------------------*/
+
+
+
+    /*----------------------------------------------------------------------------
+    ; EXTERNAL VARIABLES REFERENCES
+    ; Declare variables used in this module but defined elsewhere
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; SIMPLE TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; ENUMERATED TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; STRUCTURES TYPEDEF'S
+    ----------------------------------------------------------------------------*/
+
+    /*----------------------------------------------------------------------------
+    ; GLOBAL FUNCTION DEFINITIONS
+    ; Function Prototype declaration
+    ----------------------------------------------------------------------------*/
+
+    void pvDecoder_AmrWb_Init(void **spd_state, void *st, int16 ** ScratchMem);
+
+    int32 pvDecoder_AmrWb(
+        int16 mode,                          /* input : used mode             */
+        int16 prms[],                        /* input : parameter vector      */
+        int16 synth16k[],                    /* output: synthesis speech      */
+        int16 * frame_length,                /* output:  lenght of the frame  */
+        void *spd_state,                     /* i/o   : State structure       */
+        int16 frame_type,                    /* input : received frame type   */
+        int16 ScratchMem[]
+    );
+
+    void pvDecoder_AmrWb_Reset(void *st, int16 reset_all);
+
+    int16 pvDecoder_AmrWb_homing_frame_test(int16 input_frame[], int16 mode);
+
+    int16 pvDecoder_AmrWb_homing_frame_test_first(int16 input_frame[], int16 mode);
+
+    int32 pvDecoder_AmrWbMemRequirements();
+
+    void mime_unsorting(uint8 packet[],
+                        int16 compressed_data[],
+                        int16 *frame_type,
+                        int16 *mode,
+                        uint8 q,
+                        RX_State *st);
+
+
+    /*----------------------------------------------------------------------------
+    ; END
+    ----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* PVMP4AUDIODECODER_API_H */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_acelp.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_acelp.h
new file mode 100644 (file)
index 0000000..52001ad
--- /dev/null
@@ -0,0 +1,323 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./cpp/include/pvamrwbdecoder_acelp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef PVAMRWBDECODER_ACELP_H
+#define PVAMRWBDECODER_ACELP_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_mem_funcs.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /*-----------------------------------------------------------------*
+     *                        LPC prototypes                           *
+     *-----------------------------------------------------------------*/
+
+    void isf_extrapolation(int16 HfIsf[]);
+
+    void Init_Lagconc(int16 lag_hist[]);
+    void lagconceal(
+        int16 gain_hist[],                   /* (i) : Gain history     */
+        int16 lag_hist[],                    /* (i) : Subframe size         */
+        int16 * T0,
+        int16 * old_T0,
+        int16 * seed,
+        int16 unusable_frame
+    );
+
+    void agc2_amr_wb(
+        int16 * sig_in,                      /* input : postfilter input signal  */
+        int16 * sig_out,                     /* in/out: postfilter output signal */
+        int16 l_trm                          /* input : subframe size            */
+    );
+
+    void low_pass_filt_7k_init(int16 mem[]);
+    void low_pass_filt_7k(
+        int16 signal[],                      /* input:  signal                  */
+        int16 lg,                            /* input:  length of input         */
+        int16 mem[],                         /* in/out: memory (size=30)        */
+        int16 x[]
+    );
+
+    int16 median5(int16 x[]);
+
+    void Isp_Az(
+        int16 isp[],                         /* (i) Q15 : Immittance spectral pairs            */
+        int16 a[],                           /* (o) Q12 : predictor coefficients (order = M)   */
+        int16 m,
+        int16 adaptive_scaling               /* (i) 0   : adaptive scaling disabled */
+        /*     1   : adaptive scaling enabled  */
+    );
+    void Isf_isp(
+        int16 isf[],                         /* (i) Q15 : isf[m] normalized (range: 0.0<=val<=0.5) */
+        int16 isp[],                         /* (o) Q15 : isp[m] (range: -1<=val<1)                */
+        int16 m                              /* (i)     : LPC order                                */
+    );
+    void interpolate_isp(
+        int16 isp_old[],                     /* input : isps from past frame              */
+        int16 isp_new[],                     /* input : isps from present frame           */
+        const int16 frac[],                  /* input : fraction for 3 first subfr (Q15)  */
+        int16 Az[]                           /* output: LP coefficients in 4 subframes    */
+    );
+    void weight_amrwb_lpc(
+        int16 a[],                           /* (i) Q12 : a[m+1]  LPC coefficients             */
+        int16 ap[],                          /* (o) Q12 : Spectral expanded LPC coefficients   */
+        int16 gamma,                         /* (i) Q15 : Spectral expansion factor.           */
+        int16 m                              /* (i)     : LPC order.                           */
+    );
+
+
+    /*-----------------------------------------------------------------*
+     *                        isf quantizers                           *
+     *-----------------------------------------------------------------*/
+
+    void Disf_ns(
+        int16 * indice,                      /* input:  quantization indices                  */
+        int16 * isf_q                        /* input : ISF in the frequency domain (0..0.5)  */
+    );
+
+    void Dpisf_2s_46b(
+        int16 * indice,                      /* input:  quantization indices                       */
+        int16 * isf_q,                       /* output: quantized ISF in frequency domain (0..0.5) */
+        int16 * past_isfq,                   /* i/0   : past ISF quantizer                    */
+        int16 * isfold,                      /* input : past quantized ISF                    */
+        int16 * isf_buf,                     /* input : isf buffer                                                        */
+        int16 bfi,                           /* input : Bad frame indicator                   */
+        int16 enc_dec
+    );
+    void Dpisf_2s_36b(
+        int16 * indice,                      /* input:  quantization indices                       */
+        int16 * isf_q,                       /* output: quantized ISF in frequency domain (0..0.5) */
+        int16 * past_isfq,                   /* i/0   : past ISF quantizer                    */
+        int16 * isfold,                      /* input : past quantized ISF                    */
+        int16 * isf_buf,                     /* input : isf buffer                                                        */
+        int16 bfi,                           /* input : Bad frame indicator                   */
+        int16 enc_dec
+    );
+
+
+    void Reorder_isf(
+        int16 * isf,                         /* (i/o) Q15: ISF in the frequency domain (0..0.5) */
+        int16 min_dist,                      /* (i) Q15  : minimum distance to keep             */
+        int16 n                              /* (i)      : number of ISF                        */
+    );
+
+    /*-----------------------------------------------------------------*
+     *                       filter prototypes                         *
+     *-----------------------------------------------------------------*/
+
+    void oversamp_12k8_to_16k_init(
+        int16 mem[]                          /* output: memory (2*NB_COEF_UP) set to zeros  */
+    );
+    void oversamp_12k8_to_16k(
+        int16 sig12k8[],                     /* input:  signal to oversampling  */
+        int16 lg,                            /* input:  length of input         */
+        int16 sig16k[],                      /* output: oversampled signal      */
+        int16 mem[],                         /* in/out: memory (2*NB_COEF_UP)   */
+        int16 signal[]
+    );
+
+    void highpass_50Hz_at_12k8_init(int16 mem[]);
+    void highpass_50Hz_at_12k8(
+        int16 signal[],                      /* input/output signal */
+        int16 lg,                            /* lenght of signal    */
+        int16 mem[]                          /* filter memory [6]   */
+    );
+    void highpass_400Hz_at_12k8_init(int16 mem[]);
+    void highpass_400Hz_at_12k8(
+        int16 signal[],                      /* input/output signal */
+        int16 lg,                            /* lenght of signal    */
+        int16 mem[]                          /* filter memory [6]   */
+    );
+
+    void band_pass_6k_7k_init(int16 mem[]);
+    void band_pass_6k_7k(
+        int16 signal[],                      /* input:  signal                  */
+        int16 lg,                            /* input:  length of input         */
+        int16 mem[],                         /* in/out: memory (size=30)        */
+        int16 x[]
+    );
+
+
+    void preemph_amrwb_dec(
+        int16 x[],                           /* (i/o)   : input signal overwritten by the output */
+        int16 mu,                            /* (i) Q15 : preemphasis coefficient                */
+        int16 lg                             /* (i)     : lenght of filtering                    */
+    );
+
+    void deemphasis_32(
+        int16 x_hi[],                        /* (i)     : input signal (bit31..16) */
+        int16 x_lo[],                        /* (i)     : input signal (bit15..4)  */
+        int16 y[],                           /* (o)     : output signal (x16)      */
+        int16 mu,                            /* (i) Q15 : deemphasis factor        */
+        int16 L,                             /* (i)     : vector size              */
+        int16 * mem                          /* (i/o)   : memory (y[-1])           */
+    );
+
+
+    void wb_syn_filt(
+        int16 a[],                           /* (i) Q12 : a[m+1] prediction coefficients           */
+        int16 m,                             /* (i)     : order of LP filter                       */
+        int16 x[],                           /* (i)     : input signal                             */
+        int16 y[],                           /* (o)     : output signal                            */
+        int16 lg,                            /* (i)     : size of filtering                        */
+        int16 mem[],                         /* (i/o)   : memory associated with this filtering.   */
+        int16 update,                        /* (i)     : 0=no update, 1=update of memory.         */
+        int16 y_buf[]
+    );
+    void Syn_filt_32(
+        int16 a[],                           /* (i) Q12 : a[m+1] prediction coefficients */
+        int16 m,                             /* (i)     : order of LP filter             */
+        int16 exc[],                         /* (i) Qnew: excitation (exc[i] >> Qnew)    */
+        int16 Qnew,                          /* (i)     : exc scaling = 0(min) to 8(max) */
+        int16 sig_hi[],                      /* (o) /16 : synthesis high                 */
+        int16 sig_lo[],                      /* (o) /16 : synthesis low                  */
+        int16 lg                             /* (i)     : size of filtering              */
+    );
+
+    /*-----------------------------------------------------------------*
+     *                       pitch prototypes                          *
+     *-----------------------------------------------------------------*/
+
+
+    void Pred_lt4(
+        int16 exc[],                         /* in/out: excitation buffer */
+        int16 T0,                            /* input : integer pitch lag */
+        int16 frac,                          /* input : fraction of lag   */
+        int16 L_subfr                        /* input : subframe size     */
+    );
+
+    /*-----------------------------------------------------------------*
+     *                       gain prototypes                           *
+     *-----------------------------------------------------------------*/
+
+
+    void dec_gain2_amr_wb_init(
+        int16 * mem                          /* output  : memory (4 words)      */
+    );
+    void dec_gain2_amr_wb(
+        int16 index,                         /* (i)     :index of quantization.       */
+        int16 nbits,                         /* (i)     : number of bits (6 or 7)     */
+        int16 code[],                        /* (i) Q9  :Innovative vector.           */
+        int16 L_subfr,                       /* (i)     :Subframe lenght.             */
+        int16 * gain_pit,                    /* (o) Q14 :Pitch gain.                  */
+        int32 * gain_cod,                    /* (o) Q16 :Code gain.                   */
+        int16 bfi,                           /* (i)     :bad frame indicator          */
+        int16 prev_bfi,                      /* (i) : Previous BF indicator      */
+        int16 state,                         /* (i) : State of BFH               */
+        int16 unusable_frame,                /* (i) : UF indicator            */
+        int16 vad_hist,                      /* (i)         :number of non-speech frames  */
+        int16 * mem                          /* (i/o)   : memory (4 words)      */
+    );
+
+    /*-----------------------------------------------------------------*
+     *                       acelp prototypes                          *
+     *-----------------------------------------------------------------*/
+
+    void dec_acelp_2p_in_64(
+        int16 index,                         /* (i) :    12 bits index                                  */
+        int16 code[]                         /* (o) :Q9  algebraic (fixed) codebook excitation          */
+    );
+
+    void dec_acelp_4p_in_64(
+        int16 index[],                       /* (i) : index (20): 5+5+5+5 = 20 bits.                 */
+        /* (i) : index (36): 9+9+9+9 = 36 bits.                 */
+        /* (i) : index (44): 13+9+13+9 = 44 bits.               */
+        /* (i) : index (52): 13+13+13+13 = 52 bits.             */
+        /* (i) : index (64): 2+2+2+2+14+14+14+14 = 64 bits.     */
+        /* (i) : index (72): 10+2+10+2+10+14+10+14 = 72 bits.   */
+        /* (i) : index (88): 11+11+11+11+11+11+11+11 = 88 bits. */
+        int16 nbbits,                        /* (i) : 20, 36, 44, 52, 64, 72 or 88 bits              */
+        int16 code[]                         /* (o) Q9: algebraic (fixed) codebook excitation        */
+    );
+    void Pit_shrp(
+        int16 * x,                           /* in/out: impulse response (or algebraic code) */
+        int16 pit_lag,                       /* input : pitch lag                            */
+        int16 sharp,                         /* input : pitch sharpening factor (Q15)        */
+        int16 L_subfr                        /* input : subframe size                        */
+    );
+
+
+    /*-----------------------------------------------------------------*
+     *                        others prototypes                        *
+     *-----------------------------------------------------------------*/
+
+    int16 voice_factor(                       /* (o) Q15 : factor (-1=unvoiced to 1=voiced) */
+        int16 exc[],                         /* (i) Q_exc: pitch excitation                */
+        int16 Q_exc,                         /* (i)     : exc format                       */
+        int16 gain_pit,                      /* (i) Q14 : gain of pitch                    */
+        int16 code[],                        /* (i) Q9  : Fixed codebook excitation        */
+        int16 gain_code,                     /* (i) Q0  : gain of code                     */
+        int16 L_subfr                        /* (i)     : subframe length                  */
+    );
+
+    void scale_signal(
+        int16 x[],                           /* (i/o) : signal to scale               */
+        int16 lg,                            /* (i)   : size of x[]                   */
+        int16 exp                            /* (i)   : exponent: x = round(x << exp) */
+    );
+
+    int16 noise_gen_amrwb(int16 * seed);
+
+
+    void phase_dispersion(
+        int16 gain_code,                     /* (i) Q0  : gain of code             */
+        int16 gain_pit,                      /* (i) Q14 : gain of pitch            */
+        int16 code[],                        /* (i/o)   : code vector              */
+        int16 mode,                          /* (i)     : level, 0=hi, 1=lo, 2=off */
+        int16 disp_mem[],                    /* (i/o)   :  memory (size = 8) */
+        int16 ScratchMem[]
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* ACELP_H */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op.h
new file mode 100644 (file)
index 0000000..86f70b3
--- /dev/null
@@ -0,0 +1,239 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./src/pvamrwbdecoder_basic_op.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+
+#ifndef PVAMRWBDECODER_BASIC_OP_H
+#define PVAMRWBDECODER_BASIC_OP_H
+
+
+#include "normalize_amr_wb.h"
+
+
+#define MAX_32 (int32)0x7fffffffL
+#define MIN_32 (int32)0x80000000L
+
+#define MAX_16 (int16)+32767    /* 0x7fff */
+#define MIN_16 (int16)-32768    /* 0x8000 */
+
+
+
+
+/*----------------------------------------------------------------------------
+     Function Name : negate_int16
+
+     Negate var1 with saturation, saturate in the case where input is -32768:
+                  negate(var1) = sub(0,var1).
+
+     Inputs :
+      var1
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0x8000 <= var1 <= 0x7fff.
+
+     Outputs :
+      none
+
+     Return Value :
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0x8000 <= var_out <= 0x7fff.
+ ----------------------------------------------------------------------------*/
+
+static inline  int16 negate_int16(int16 var1)
+{
+    return (((var1 == MIN_16) ? MAX_16 : -var1));
+}
+
+
+/*----------------------------------------------------------------------------
+
+     Function Name : shl_int16
+
+     Arithmetically shift the 16 bit input var1 left var2 positions.Zero fill
+     the var2 LSB of the result. If var2 is negative, arithmetically shift
+     var1 right by -var2 with sign extension. Saturate the result in case of
+     underflows or overflows.
+
+     Inputs :
+      var1
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0x8000 <= var1 <= 0x7fff.
+
+      var2
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0x8000 <= var1 <= 0x7fff.
+
+     Return Value :
+      var_out
+               16 bit short signed integer (int16) whose value falls in the
+               range : 0x8000 <= var_out <= 0x7fff.
+ ----------------------------------------------------------------------------*/
+
+static inline  int16 shl_int16(int16 var1, int16 var2)
+{
+    int16 var_out;
+
+    if (var2 < 0)
+    {
+        var2 = (-var2) & (0xf);
+        var_out = var1 >> var2;
+    }
+    else
+    {
+        var2 &= 0xf;
+        var_out = var1 << var2;
+        if (var_out >> var2 != var1)
+        {
+            var_out = (var1 >> 15) ^ MAX_16;
+        }
+    }
+    return (var_out);
+}
+
+
+/*----------------------------------------------------------------------------
+
+     Function Name : shl_int32
+
+     Arithmetically shift the 32 bit input L_var1 left var2 positions. Zero
+     fill the var2 LSB of the result. If var2 is negative, arithmetically
+     shift L_var1 right by -var2 with sign extension. Saturate the result in
+     case of underflows or overflows.
+
+     Inputs :
+      L_var1   32 bit long signed integer (int32) whose value falls in the
+               range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+      var2
+               16 bit short signed integer (int16) whose value falls in the
+               range :  8000 <= var2 <= 7fff.
+     Return Value :
+               32 bit long signed integer (int32) whose value falls in the
+               range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+ ----------------------------------------------------------------------------*/
+
+static inline  int32 shl_int32(int32 L_var1, int16 var2)
+{
+    int32 L_var_out;
+
+    if (var2 > 0)
+    {
+        L_var_out = L_var1 << var2;
+        if (L_var_out >> var2 != L_var1)
+        {
+            L_var_out = (L_var1 >> 31) ^ MAX_32;
+        }
+    }
+    else
+    {
+        var2 = (-var2) & (0xf);
+        L_var_out = L_var1 >> var2;
+    }
+
+    return (L_var_out);
+}
+
+
+/*----------------------------------------------------------------------------
+
+     Function Name : shr_int32
+
+     Arithmetically shift the 32 bit input L_var1 right var2 positions with
+     sign extension. If var2 is negative, arithmetically shift L_var1 left
+     by -var2 and zero fill the -var2 LSB of the result. Saturate the result
+     in case of underflows or overflows.
+
+     Inputs :
+      L_var1   32 bit long signed integer (int32) whose value falls in the
+               range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+      var2
+               16 bit short signed integer (int16) whose value falls in the
+               range :  8000 <= var2 <= 7fff.
+     Return Value :
+               32 bit long signed integer (int32) whose value falls in the
+               range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+ ----------------------------------------------------------------------------*/
+
+static inline  int32 shr_int32(int32 L_var1, int16 var2)
+{
+    int32 L_var_out;
+
+    if (var2 >= 0)
+    {
+        L_var_out = L_var1 >> (var2 & 0x1f);
+    }
+    else
+    {
+        var2 = (int16)(-var2);
+        var2 &= 0x1f;
+        L_var_out = L_var1 << var2;
+        if (L_var_out >> var2 != L_var1)
+        {
+            L_var_out = (L_var1 >> 31) ^ MAX_32;
+        }
+
+    }
+    return (L_var_out);
+}
+
+
+
+
+
+
+#if   ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))
+
+#include "pvamrwbdecoder_basic_op_gcc_armv5.h"
+
+#else
+
+#ifndef C_EQUIVALENT
+#define C_EQUIVALENT        // default to C_EQUIVALENT
+#endif
+
+#include "pvamrwbdecoder_basic_op_cequivalent.h"
+
+#endif
+
+
+#endif   /*  PVAMRWBDECODER_BASIC_OP_H  */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_cequivalent.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_cequivalent.h
new file mode 100644 (file)
index 0000000..8b9faaa
--- /dev/null
@@ -0,0 +1,538 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./src/pvamrwbdecoder_basic_op_cequivalent.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+#ifndef PVAMRWBDECODER_BASIC_OP_CEQUIVALENT_H
+#define PVAMRWBDECODER_BASIC_OP_CEQUIVALENT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+#include "normalize_amr_wb.h"
+
+#if defined(C_EQUIVALENT)
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : add_int16
+
+         Purpose :
+
+          Performs the addition (var1+var2) with overflow control and saturation;
+          the 16 bit result is set at +32767 when overflow occurs or at -32768
+          when underflow occurs.
+
+         Inputs :
+          var1
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+          var2
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+         Outputs :
+          none
+
+         Return Value :
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var_out <= 0x0000 7fff.
+
+     ----------------------------------------------------------------------------*/
+    static inline int16 add_int16(int16 var1, int16 var2)
+    {
+        int32 L_sum;
+
+        L_sum = (int32) var1 + var2;
+        if ((L_sum >> 15) != (L_sum >> 31))
+        {
+            L_sum = (L_sum >> 31) ^ MAX_16;
+        }
+        return ((int16)(L_sum));
+    }
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : sub_int16
+
+          Performs the subtraction (var1+var2) with overflow control and satu-
+          ration; the 16 bit result is set at +32767 when overflow occurs or at
+          -32768 when underflow occurs.
+
+         Inputs :
+
+          var1
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+          var2
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+         Outputs :
+          none
+
+         Return Value :
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var_out <= 0x0000 7fff.
+
+     ----------------------------------------------------------------------------*/
+    static inline int16 sub_int16(int16 var1, int16 var2)
+    {
+        int32 L_diff;
+
+        L_diff = (int32) var1 - var2;
+        if ((L_diff >> 15) != (L_diff >> 31))
+        {
+            L_diff = (L_diff >> 31) ^ MAX_16;
+        }
+        return ((int16)(L_diff));
+    }
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : mult_int16
+
+          Performs the multiplication of var1 by var2 and gives a 16 bit result
+          which is scaled i.e.:
+                   mult_int16(var1,var2) = extract_l(L_shr((var1 times var2),15)) and
+                   mult_int16(-32768,-32768) = 32767.
+
+         Inputs :
+          var1
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+          var2
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+
+         Return Value :
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var_out <= 0x0000 7fff.
+
+     ----------------------------------------------------------------------------*/
+
+    static inline int16 mult_int16(int16 var1, int16 var2)
+    {
+        int32 L_product;
+
+        L_product = ((int32) var1 * (int32) var2) >> 15;
+
+        if ((L_product >> 15) != (L_product >> 31))
+        {
+            L_product = (L_product >> 31) ^ MAX_16;
+        }
+
+        return ((int16)L_product);
+    }
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : add_int32
+
+         32 bits addition of the two 32 bits variables (L_var1+L_var2) with
+         overflow control and saturation; the result is set at +2147483647 when
+         overflow occurs or at -2147483648 when underflow occurs.
+
+         Inputs :
+
+          L_var1   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+
+          L_var2   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+
+
+         Return Value :
+          L_var_out
+                   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+     ----------------------------------------------------------------------------*/
+
+
+    static inline int32 add_int32(int32 L_var1, int32 L_var2)
+    {
+        int32 L_var_out;
+
+        L_var_out = L_var1 + L_var2;
+
+        if (((L_var1 ^ L_var2) & MIN_32) == 0)  /* same sign ? */
+        {
+            if ((L_var_out ^ L_var1) & MIN_32)  /* addition matches sign ? */
+            {
+                L_var_out = (L_var1 >> 31) ^ MAX_32;
+            }
+        }
+        return (L_var_out);
+    }
+
+
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : sub_int32
+
+         32 bits subtraction of the two 32 bits variables (L_var1-L_var2) with
+         overflow control and saturation; the result is set at +2147483647 when
+         overflow occurs or at -2147483648 when underflow occurs.
+
+         Inputs :
+
+          L_var1   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+
+          L_var2   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+
+
+         Return Value :
+          L_var_out
+                   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+     ----------------------------------------------------------------------------*/
+
+
+    static inline int32 sub_int32(int32 L_var1, int32 L_var2)
+    {
+        int32 L_var_out;
+
+        L_var_out = L_var1 - L_var2;
+
+        if (((L_var1 ^ L_var2) & MIN_32) != 0)  /* different sign ? */
+        {
+            if ((L_var_out ^ L_var1) & MIN_32)  /* difference matches sign ? */
+            {
+                L_var_out = (L_var1 >> 31) ^ MAX_32;
+            }
+        }
+        return (L_var_out);
+    }
+
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : mac_16by16_to_int32
+
+         Multiply var1 by var2 and shift the result left by 1. Add the 32 bit
+         result to L_var3 with saturation, return a 32 bit result:
+              L_mac(L_var3,var1,var2) = L_add(L_var3,L_mult(var1,var2)).
+
+         Inputs :
+
+          L_var3   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+
+          var1
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+          var2
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+
+         Return Value :
+                   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+     ----------------------------------------------------------------------------*/
+
+
+    static inline   int32 mac_16by16_to_int32(int32 L_var3, int16 var1, int16 var2)
+    {
+        int32 L_var_out;
+        int32 L_mul;
+
+        L_mul  = ((int32) var1 * (int32) var2);
+
+        if (L_mul != 0x40000000)
+        {
+            L_mul <<= 1;
+        }
+        else
+        {
+            L_mul = MAX_32;     /* saturation */
+        }
+
+        L_var_out = L_var3 + L_mul;
+
+        if (((L_mul ^ L_var3) & MIN_32) == 0)  /* same sign ? */
+        {
+            if ((L_var_out ^ L_var3) & MIN_32)  /* addition matches sign ? */
+            {
+                L_var_out = (L_var3 >> 31) ^ MAX_32;
+            }
+        }
+
+        return (L_var_out);
+    }
+
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : msu_16by16_from_int32
+
+         Multiply var1 by var2 and shift the result left by 1. Subtract the 32 bit
+         result to L_var3 with saturation, return a 32 bit result:
+              L_msu(L_var3,var1,var2) = L_sub(L_var3,L_mult(var1,var2)).
+
+         Inputs :
+
+          L_var3   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+
+          var1
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+          var2
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+
+         Return Value :
+                   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+     ----------------------------------------------------------------------------*/
+
+    static inline int32 msu_16by16_from_int32(int32 L_var3, int16 var1, int16 var2)
+    {
+        int32 L_var_out;
+        int32 L_mul;
+
+        L_mul  = ((int32) var1 * (int32) var2);
+
+        if (L_mul != 0x40000000)
+        {
+            L_mul <<= 1;
+        }
+        else
+        {
+            L_mul = MAX_32;     /* saturation */
+        }
+
+        L_var_out = L_var3 - L_mul;
+
+        if (((L_mul ^ L_var3) & MIN_32) != 0)  /* different sign ? */
+        {
+            if ((L_var_out ^ L_var3) & MIN_32)  /* difference matches sign ? */
+            {
+                L_var_out = (L_var3 >> 31) ^ MAX_32;
+            }
+        }
+
+        return (L_var_out);
+    }
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : mul_16by16_to_int32
+
+         mul_16by16_to_int32 is the 32 bit result of the multiplication of var1
+         times var2 with one shift left i.e.:
+              L_mult(var1,var2) = L_shl((var1 times var2),1) and
+              L_mult(-32768,-32768) = 2147483647.
+
+         Inputs :
+          var1
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+          var2
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+         Return Value :
+                   32 bit long signed integer (int32) whose value falls in the
+                   range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+     ----------------------------------------------------------------------------*/
+
+
+    static inline int32 mul_16by16_to_int32(int16 var1, int16 var2)
+    {
+        int32 L_mul;
+
+        L_mul  = ((int32) var1 * (int32) var2);
+
+        if (L_mul != 0x40000000)
+        {
+            L_mul <<= 1;
+        }
+        else
+        {
+            L_mul = MAX_32;     /* saturation */
+        }
+
+        return (L_mul);
+
+    }
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : amr_wb_round
+
+         Round the lower 16 bits of the 32 bit input number into the MS 16 bits
+         with saturation. Shift the resulting bits right by 16 and return the 16
+         bit number:
+                     round(L_var1) = extract_h(L_add(L_var1,32768))
+
+         Inputs :
+          L_var1
+                   32 bit long signed integer (int32 ) whose value falls in the
+                   range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+         Return Value :
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var_out <= 0x0000 7fff.
+
+     ----------------------------------------------------------------------------*/
+    static inline int16 amr_wb_round(int32 L_var1)
+    {
+        if (L_var1 != MAX_32)
+        {
+            L_var1 +=  0x00008000L;
+        }
+        return ((int16)(L_var1 >> 16));
+    }
+
+
+    /*----------------------------------------------------------------------------
+
+         Function Name : amr_wb_shl1_round
+
+         Shift the 32 bit input number to the left by 1, round up the result and
+         shift down by 16
+                     amr_wb_shl1_round(L_var1) = round(L_shl(L_var1,1))
+
+         Inputs :
+          L_var1
+                   32 bit long signed integer (int32 ) whose value falls in the
+                   range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+         Return Value :
+                   16 bit short signed integer (int16) whose value falls in the
+                   range : 0xffff 8000 <= var_out <= 0x0000 7fff.
+
+     ----------------------------------------------------------------------------*/
+    static inline int16 amr_wb_shl1_round(int32 L_var1)
+    {
+        int16 var_out;
+
+        if ((L_var1 << 1) >> 1 == L_var1)
+        {
+            var_out = (int16)((L_var1 + 0x00004000) >> 15);
+        }
+        else
+        {
+            var_out = (int16)(((L_var1 >> 31) ^ MAX_32) >> 16);
+        }
+
+        return (var_out);
+    }
+
+    /*----------------------------------------------------------------------------
+             Function Name : mul_32by16
+
+             Multiply a 16 bit integer by a 32 bit (DPF). The result is divided
+             by 2^15
+
+                    L_32 = (hi1*lo2)<<1 + ((lo1*lo2)>>15)<<1
+
+             Inputs :
+
+             hi          hi part of 32 bit number.
+             lo          lo part of 32 bit number.
+             n           16 bit number.
+
+         ----------------------------------------------------------------------------*/
+
+
+    static inline  int32 mul_32by16(int16 hi, int16 lo, int16 n)
+    {
+        return (((((int32)hi*n)) + ((((int32)lo*n) >> 15))) << 1);
+    }
+
+    static inline   int32 fxp_mac_16by16(int16 var1,  int16 var2, int32 L_add)
+    {
+
+        L_add += (int32)var1 * var2;
+
+        return L_add;
+    }
+
+    static inline   int32 fxp_mul_16by16(int16 var1, const int16 var2)
+    {
+        int32 L_mul = (int32)var1 * var2;
+
+        return L_mul;
+    }
+
+    static inline   int32 fxp_mul32_by_16b(int32 L_var1, const int32 L_var2)
+    {
+        int32 L_mul = (int32)(((int64)L_var1 * (L_var2 << 16)) >> 32);
+
+        return L_mul;
+    }
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#endif   /*  PVAMRWBDECODER_BASIC_OP_CEQUIVALENT_H  */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h
new file mode 100644 (file)
index 0000000..c2c9f36
--- /dev/null
@@ -0,0 +1,311 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./src/pvamrwbdecoder_basic_op_gcc_armv5.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef PVAMRWBDECODER_BASIC_OP_GCC_ARMV5_H
+#define PVAMRWBDECODER_BASIC_OP_GCC_ARMV5_H
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+    static inline int16 sub_int16(int16 var1, int16 var2)
+    {
+        register int32 L_var_out;
+        register int32 L_var_aux;
+        register int32 ra = (int32)var1;
+        register int32 rb = (int32)var2;
+
+        asm volatile(
+            "mov  %0, %2, lsl #16\n"
+            "mov  %1, %3, lsl #16\n"
+            "qsub %0, %0, %1\n"
+            "mov  %0, %0, asr #16"
+    : "=&r*i"(L_var_out),
+            "=&r*i"(L_var_aux)
+                    : "r"(ra),
+                    "r"(rb));
+
+        return (int16)L_var_out;
+
+    }
+
+    static inline int16 add_int16(int16 var1, int16 var2)
+{
+        register int32 L_var_out;
+        register int32 L_var_aux;
+        register int32 ra = (int32)var1;
+        register int32 rb = (int32)var2;
+
+        asm volatile(
+            "mov  %0, %2, lsl #16\n"
+            "mov  %1, %3, lsl #16\n"
+            "qadd %0, %0, %1\n"
+            "mov  %0, %0, asr #16"
+    : "=&r*i"(L_var_out),
+            "=&r*i"(L_var_aux)
+                    : "r"(ra),
+                    "r"(rb));
+
+        return (int16)L_var_out;
+
+    }
+
+    static inline  int32 mul_32by16(int16 hi, int16 lo, int16 n)
+{
+        register int32 H_32;
+        register int32 L_32;
+        register int32 ra = (int32)hi;
+        register int32 rb = (int32)lo;
+        register int32 rc = (int32)n;
+
+
+        asm volatile(
+            "smulbb %0, %2, %4\n"
+            "smulbb %1, %3, %4\n"
+            "add    %0, %0, %1, asr #15\n"
+            "qadd   %0, %0, %0"
+    : "=&r*i"(H_32),
+            "=&r*i"(L_32)
+                    : "r"(ra),
+                    "r"(rb),
+                    "r"(rc));
+
+        return H_32;
+    }
+
+
+    static inline int32 sub_int32(int32 L_var1, int32 L_var2)
+{
+        register int32 L_var_out;
+        register int32 ra = L_var1;
+        register int32 rb = L_var2;
+
+        asm volatile(
+            "qsub %0, %1, %2"
+    : "=&r*i"(L_var_out)
+                    : "r"(ra),
+                    "r"(rb));
+
+        return L_var_out;
+    }
+
+    static inline int32 add_int32(int32 L_var1, int32 L_var2)
+{
+        register int32 L_var_out;
+        register int32 ra = L_var1;
+        register int32 rb = L_var2;
+
+        asm volatile(
+            "qadd %0, %1, %2"
+    : "=&r*i"(L_var_out)
+                    : "r"(ra),
+                    "r"(rb));
+
+        return L_var_out;
+    }
+
+    static inline int32 msu_16by16_from_int32(int32 L_var3, int16 var1, int16 var2)
+{
+        register int32 L_var_out;
+        register int32 ra = (int32)var1;
+        register int32 rb = (int32)var2;
+        register int32 rc = L_var3;
+
+        asm volatile(
+            "smulbb %0, %1, %2\n"
+            "qdsub %0, %3, %0"
+    : "=&r*i"(L_var_out)
+                    : "r"(ra),
+                    "r"(rb),
+                    "r"(rc));
+
+        return L_var_out;
+    }
+
+
+    static inline int32 mac_16by16_to_int32(int32 L_var3, int16 var1, int16 var2)
+{
+        register int32 L_var_out;
+        register int32 ra = (int32)var1;
+        register int32 rb = (int32)var2;
+        register int32 rc = L_var3;
+
+        asm volatile(
+            "smulbb %0, %1, %2\n"
+            "qdadd %0, %3, %0"
+    : "=&r*i"(L_var_out)
+                    : "r"(ra),
+                    "r"(rb),
+                    "r"(rc));
+
+        return L_var_out;
+    }
+
+
+    static inline  int32 mul_16by16_to_int32(int16 var1, int16 var2)
+{
+        register int32 L_var_out;
+        register int32 ra = (int32)var1;
+        register int32 rb = (int32)var2;
+
+        asm volatile(
+            "smulbb %0, %1, %2\n"
+            "qadd %0, %0, %0"
+    : "=&r*i"(L_var_out)
+                    : "r"(ra),
+                    "r"(rb));
+
+        return L_var_out;
+    }
+
+
+    static inline int16 mult_int16(int16 var1, int16 var2)
+{
+        register int32 L_var_out;
+        register int32 ra = (int32)var1;
+        register int32 rb = (int32)var2;
+
+        asm volatile(
+            "smulbb %0, %1, %2\n"
+            "mov %0, %0, asr #15"
+    : "=&r*i"(L_var_out)
+                    : "r"(ra),
+                    "r"(rb));
+
+        return (int16)L_var_out;
+    }
+
+    static inline int16 amr_wb_round(int32 L_var1)
+{
+        register int32 L_var_out;
+        register int32 ra = (int32)L_var1;
+        register int32 rb = (int32)0x00008000L;
+
+        asm volatile(
+            "qadd %0, %1, %2\n"
+            "mov %0, %0, asr #16"
+    : "=&r*i"(L_var_out)
+                    : "r"(ra),
+                    "r"(rb));
+        return (int16)L_var_out;
+    }
+
+    static inline int16 amr_wb_shl1_round(int32 L_var1)
+{
+        register int32 L_var_out;
+        register int32 ra = (int32)L_var1;
+        register int32 rb = (int32)0x00008000L;
+
+        asm volatile(
+            "qadd %0, %1, %1\n"
+            "qadd %0, %0, %2\n"
+            "mov %0, %0, asr #16"
+    : "=&r*i"(L_var_out)
+                    : "r"(ra),
+                    "r"(rb));
+        return (int16)L_var_out;
+    }
+
+
+    static inline int32 fxp_mac_16by16(const int16 L_var1, const int16 L_var2, int32 L_add)
+{
+        register int32 tmp;
+        register int32 ra = (int32)L_var1;
+        register int32 rb = (int32)L_var2;
+        register int32 rc = (int32)L_add;
+
+        asm volatile(
+            "smlabb %0, %1, %2, %3"
+    : "=&r*i"(tmp)
+                    : "r"(ra),
+                    "r"(rb),
+                    "r"(rc));
+        return (tmp);
+    }
+
+    static inline int32 fxp_mul_16by16bb(int16 L_var1, const int16 L_var2)
+{
+        register int32 tmp;
+        register int32 ra = (int32)L_var1;
+        register int32 rb = (int32)L_var2;
+
+        asm volatile(
+            "smulbb %0, %1, %2"
+    : "=&r*i"(tmp)
+                    : "r"(ra),
+                    "r"(rb));
+        return (tmp);
+    }
+
+
+#define fxp_mul_16by16(a, b)  fxp_mul_16by16bb(  a, b)
+
+
+    static inline int32 fxp_mul32_by_16(int32 L_var1, const int32 L_var2)
+{
+        register int32 tmp;
+        register int32 ra = (int32)L_var1;
+        register int32 rb = (int32)L_var2;
+
+        asm volatile(
+            "smulwb %0, %1, %2"
+    : "=&r*i"(tmp)
+                    : "r"(ra),
+                    "r"(rb));
+        return (tmp);
+    }
+
+#define fxp_mul32_by_16b( a, b)   fxp_mul32_by_16( a, b)
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
+#endif   /*  PVAMRWBDECODER_BASIC_OP_GCC_ARMV5_H  */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_cnst.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_cnst.h
new file mode 100644 (file)
index 0000000..16b5127
--- /dev/null
@@ -0,0 +1,134 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+ Name: pvamrwbdecoder_cnst.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ Main header file for the Packet Video AMR Wide  Band  decoder library. The
+ constants, structures, and functions defined within this file, along with
+ a basic data types header file, is all that is needed to use and communicate
+ with the library. The internal data structures within the library are
+ purposely hidden.
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+  (Normally header files do not have a reference section)
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+
+#ifndef PVAMRWBDECODER_CNST_H
+#define PVAMRWBDECODER_CNST_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here.
+----------------------------------------------------------------------------*/
+
+#define L_FRAME      256                   /* Frame size                                 */
+#define L_SUBFR16k   80                    /* Subframe size at 16kHz                     */
+
+#define L_SUBFR      64                    /* Subframe size                              */
+#define NB_SUBFR     4                     /* Number of subframe per frame               */
+
+#define L_NEXT       64                    /* Overhead in LP analysis                    */
+#define L_WINDOW     384                   /* window size in LP analysis                 */
+#define L_TOTAL      384                   /* Total size of speech buffer.               */
+#define M            16                    /* Order of LP filter                         */
+#define M16k             20
+
+#define L_FILT16k    15                    /* Delay of down-sampling filter              */
+#define L_FILT       12                    /* Delay of up-sampling filter                */
+
+#define GP_CLIP      15565                 /* Pitch gain clipping = 0.95 Q14             */
+#define PIT_SHARP    27853                 /* pitch sharpening factor = 0.85 Q15         */
+
+#define PIT_MIN      34                    /* Minimum pitch lag with resolution 1/4      */
+#define PIT_FR2      128                   /* Minimum pitch lag with resolution 1/2      */
+#define PIT_FR1_9b   160                   /* Minimum pitch lag with resolution 1        */
+#define PIT_FR1_8b   92                    /* Minimum pitch lag with resolution 1        */
+#define PIT_MAX      231                   /* Maximum pitch lag                          */
+#define L_INTERPOL   (16+1)                /* Length of filter for interpolation         */
+
+#define OPL_DECIM    2                     /* Decimation in open-loop pitch analysis     */
+
+#define PREEMPH_FAC  22282                 /* preemphasis factor (0.68 in Q15)           */
+#define GAMMA1       30147                 /* Weighting factor (numerator) (0.92 in Q15) */
+#define TILT_FAC     22282                 /* tilt factor (denominator) (0.68 in Q15)    */
+
+#define Q_MAX        8                     /* scaling max for signal (see syn_filt_32)   */
+
+#define RANDOM_INITSEED  21845             /* own random init value                      */
+
+#define L_MEANBUF        3
+#define ONE_PER_MEANBUF 10923
+
+#define MODE_7k       0
+#define MODE_9k       1
+#define MODE_12k      2
+#define MODE_14k      3
+#define MODE_16k      4
+#define MODE_18k      5
+#define MODE_20k      6
+#define MODE_23k      7
+#define MODE_24k      8
+#define MRDTX         9
+//#define NUM_OF_MODES  10                   /* see bits.h for bits definition             */
+
+#define EHF_MASK (int16)0x0008            /* homing frame pattern                       */
+
+#define BIT_0     (int16)-127
+#define BIT_1     (int16)127
+#define BIT_0_ITU (int16)0x007F
+#define BIT_1_ITU (int16)0x0081
+
+/*----------------------------------------------------------------------------
+; END
+----------------------------------------------------------------------------*/
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_mem_funcs.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_mem_funcs.h
new file mode 100644 (file)
index 0000000..42e7491
--- /dev/null
@@ -0,0 +1,58 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: pvamrwbdecoder_mem_funcs.h
+
+
+----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+
+#ifndef PVAMRWBDECODER_MEM_FUNCS_H
+#define PVAMRWBDECODER_MEM_FUNCS_H
+
+
+#include "oscl_mem.h"
+
+
+
+#define pv_memset(to, c, n)         oscl_memset(to, c, n)
+
+
+#define pv_memcpy(to, from, n)      oscl_memcpy(to, from, n)
+#define pv_memmove(to, from, n)     oscl_memmove(to, from, n)
+#define pv_memcmp(p, q, n)          oscl_memcmp(p, q, n)
+
+
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_gain2_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_gain2_tab.cpp
new file mode 100644 (file)
index 0000000..92c235f
--- /dev/null
@@ -0,0 +1,244 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+#include "qisf_ns.h"
+
+
+/*
+ * Tables for function q_gain2()
+ *
+ *  g_pitch(Q14),  g_code(Q11)
+ *
+ * pitch gain are ordered in table to reduce complexity
+ * during quantization of gains.
+ */
+
+
+
+
+const int16 t_qua_gain6b[NB_QUA_GAIN6B*2] =
+{
+    1566,  1332,
+    1577,  3557,
+    3071,  6490,
+    4193, 10163,
+    4496,  2534,
+    5019,  4488,
+    5586, 15614,
+    5725,  1422,
+    6453,   580,
+    6724,  6831,
+    7657,  3527,
+    8072,  2099,
+    8232,  5319,
+    8827,  8775,
+    9740,  2868,
+    9856,  1465,
+    10087, 12488,
+    10241,  4453,
+    10859,  6618,
+    11321,  3587,
+    11417,  1800,
+    11643,  2428,
+    11718,   988,
+    12312,  5093,
+    12523,  8413,
+    12574, 26214,
+    12601,  3396,
+    13172,  1623,
+    13285,  2423,
+    13418,  6087,
+    13459, 12810,
+    13656,  3607,
+    14111,  4521,
+    14144,  1229,
+    14425,  1871,
+    14431,  7234,
+    14445,  2834,
+    14628, 10036,
+    14860, 17496,
+    15161,  3629,
+    15209,  5819,
+    15299,  2256,
+    15518,  4722,
+    15663,  1060,
+    15759,  7972,
+    15939, 11964,
+    16020,  2996,
+    16086,  1707,
+    16521,  4254,
+    16576,  6224,
+    16894,  2380,
+    16906,   681,
+    17213,  8406,
+    17610,  3418,
+    17895,  5269,
+    18168, 11748,
+    18230,  1575,
+    18607, 32767,
+    18728, 21684,
+    19137,  2543,
+    19422,  6577,
+    19446,  4097,
+    19450,  9056,
+    20371, 14885
+};
+
+const int16 t_qua_gain7b[NB_QUA_GAIN7B*2] =
+{
+    204,   441,
+    464,  1977,
+    869,  1077,
+    1072,  3062,
+    1281,  4759,
+    1647,  1539,
+    1845,  7020,
+    1853,   634,
+    1995,  2336,
+    2351, 15400,
+    2661,  1165,
+    2702,  3900,
+    2710, 10133,
+    3195,  1752,
+    3498,  2624,
+    3663,   849,
+    3984,  5697,
+    4214,  3399,
+    4415,  1304,
+    4695,  2056,
+    5376,  4558,
+    5386,   676,
+    5518, 23554,
+    5567,  7794,
+    5644,  3061,
+    5672,  1513,
+    5957,  2338,
+    6533,  1060,
+    6804,  5998,
+    6820,  1767,
+    6937,  3837,
+    7277,   414,
+    7305,  2665,
+    7466, 11304,
+    7942,   794,
+    8007,  1982,
+    8007,  1366,
+    8326,  3105,
+    8336,  4810,
+    8708,  7954,
+    8989,  2279,
+    9031,  1055,
+    9247,  3568,
+    9283,  1631,
+    9654,  6311,
+    9811,  2605,
+    10120,   683,
+    10143,  4179,
+    10245,  1946,
+    10335,  1218,
+    10468,  9960,
+    10651,  3000,
+    10951,  1530,
+    10969,  5290,
+    11203,  2305,
+    11325,  3562,
+    11771,  6754,
+    11839,  1849,
+    11941,  4495,
+    11954,  1298,
+    11975, 15223,
+    11977,   883,
+    11986,  2842,
+    12438,  2141,
+    12593,  3665,
+    12636,  8367,
+    12658,  1594,
+    12886,  2628,
+    12984,  4942,
+    13146,  1115,
+    13224,   524,
+    13341,  3163,
+    13399,  1923,
+    13549,  5961,
+    13606,  1401,
+    13655,  2399,
+    13782,  3909,
+    13868, 10923,
+    14226,  1723,
+    14232,  2939,
+    14278,  7528,
+    14439,  4598,
+    14451,   984,
+    14458,  2265,
+    14792,  1403,
+    14818,  3445,
+    14899,  5709,
+    15017, 15362,
+    15048,  1946,
+    15069,  2655,
+    15405,  9591,
+    15405,  4079,
+    15570,  7183,
+    15687,  2286,
+    15691,  1624,
+    15699,  3068,
+    15772,  5149,
+    15868,  1205,
+    15970,   696,
+    16249,  3584,
+    16338,  1917,
+    16424,  2560,
+    16483,  4438,
+    16529,  6410,
+    16620, 11966,
+    16839,  8780,
+    17030,  3050,
+    17033, 18325,
+    17092,  1568,
+    17123,  5197,
+    17351,  2113,
+    17374,   980,
+    17566, 26214,
+    17609,  3912,
+    17639, 32767,
+    18151,  7871,
+    18197,  2516,
+    18202,  5649,
+    18679,  3283,
+    18930,  1370,
+    19271, 13757,
+    19317,  4120,
+    19460,  1973,
+    19654, 10018,
+    19764,  6792,
+    19912,  5135,
+    20040,  2841,
+    21234, 19833
+};
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_pulse.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_pulse.h
new file mode 100644 (file)
index 0000000..172a6f9
--- /dev/null
@@ -0,0 +1,73 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./cpp/include/q_pulse.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+  Coding and decoding of algebraic codebook
+------------------------------------------------------------------------------
+*/
+
+#ifndef Q_PULSE_H
+#define Q_PULSE_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+    void dec_1p_N1(int32 index, int16 N, int16 offset, int16 pos[]);
+    void dec_2p_2N1(int32 index, int16 N, int16 offset, int16 pos[]);
+    void dec_3p_3N1(int32 index, int16 N, int16 offset, int16 pos[]);
+    void dec_4p_4N1(int32 index, int16 N, int16 offset, int16 pos[]);
+    void dec_4p_4N(int32 index, int16 N, int16 offset, int16 pos[]);
+    void dec_5p_5N(int32 index, int16 N, int16 offset, int16 pos[]);
+    void dec_6p_6N_2(int32 index, int16 N, int16 offset, int16 pos[]);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* Q_PULSE_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.cpp
new file mode 100644 (file)
index 0000000..10483e8
--- /dev/null
@@ -0,0 +1,137 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: qisf_ns.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 indice[] : indices of the selected codebook entries
+     int16 isf[]    : quantized ISFs (in frequency domain)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   Coding/Decoding of ISF parameters for background noise.
+
+   The ISF vector is quantized using VQ with split-by-5
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+#include "qisf_ns.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void Disf_ns(
+    int16 * indice,   /* input:  quantization indices               */
+    int16 * isf_q     /* input: ISF in the frequency domain (0..0.5)*/
+)
+{
+    int16 i;
+
+    isf_q[0] = dico1_isf_noise[(indice[0] << 1)];
+    isf_q[1] = dico1_isf_noise[(indice[0] << 1) + 1];
+
+    for (i = 0; i < 3; i++)
+    {
+        isf_q[i + 2] = dico2_isf_noise[(indice[1] << 1) + indice[1] + i];
+        isf_q[i + 5] = dico3_isf_noise[(indice[2] << 1) + indice[2] + i];
+    }
+
+    for (i = 0; i < 4; i++)
+    {
+        isf_q[i +  8] = dico4_isf_noise[(indice[3] << 2) + i];
+        isf_q[i + 12] = dico5_isf_noise[(indice[4] << 2) + i];
+    }
+
+    for (i = 0; i < ORDER; i++)
+    {
+        isf_q[i] = add_int16(isf_q[i], mean_isf_noise[i]);
+    }
+
+    Reorder_isf(isf_q, ISF_GAP, ORDER);
+
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.h
new file mode 100644 (file)
index 0000000..eddf1f5
--- /dev/null
@@ -0,0 +1,107 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./cpp/include/qisf_ns.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef QISF_NS_H
+#define QISF_NS_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+
+/*----------------------------------------------------------------------------
+; DEFINES
+----------------------------------------------------------------------------*/
+
+
+#define ORDER   16            /* order of linear prediction filter */
+#define ISF_GAP 128
+
+#define SIZE_BK_NOISE1  64
+#define SIZE_BK_NOISE2  64
+#define SIZE_BK_NOISE3  64
+#define SIZE_BK_NOISE4  32
+#define SIZE_BK_NOISE5  32
+
+#define NB_QUA_GAIN6B  64     /* Number of quantization level */
+#define NB_QUA_GAIN7B  128    /* Number of quantization level */
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+----------------------------------------------------------------------------*/
+extern const int16 mean_isf_noise[ORDER];
+extern const int16 dico1_isf_noise[SIZE_BK_NOISE1*2];
+extern const int16 dico2_isf_noise[SIZE_BK_NOISE2*3];
+extern const int16 dico3_isf_noise[SIZE_BK_NOISE3*3];
+extern const int16 dico4_isf_noise[SIZE_BK_NOISE4*4];
+extern const int16 dico5_isf_noise[SIZE_BK_NOISE5*4];
+
+extern const int16 t_qua_gain6b[NB_QUA_GAIN6B*2];
+extern const int16 t_qua_gain7b[NB_QUA_GAIN7B*2];
+
+/*----------------------------------------------------------------------------
+; SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
+#endif  /* QISF_NS_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns_tab.cpp
new file mode 100644 (file)
index 0000000..e5630e8
--- /dev/null
@@ -0,0 +1,367 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ *                         qisf_ns_tab.cpp
+ *
+ * Quantization tables for split by 5 VQ of ISFs for a background
+ * noise database
+ * Version whith no prediction
+ */
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "qisf_ns.h"
+
+
+/* means of ISFs */
+const int16 mean_isf_noise[ORDER] =
+{
+
+    478,  1100,  2213,  3267,  4219,  5222,  6198,  7240,
+    8229,  9153, 10098, 11108, 12144, 13184, 14165,  3803
+};
+
+
+/* 28 bits */
+/*
+ *  isf codebooks:  split-by-5 VQ
+ *
+ *  codebook   vector dimension    number of vectors
+ *  ~~~~~~~~   ~~~~~~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~
+ *     1            2                  64
+ *     2            3                  64
+ *     3            3                  64
+ *     4            4                  32
+ *     5            4                  32
+ */
+
+/*
+ * 1st split:   isf0 to isf1
+ */
+
+
+const int16 dico1_isf_noise[SIZE_BK_NOISE1*2] =
+{
+
+    -269,  -673,
+    -222,  -537,
+    -233,  -430,
+    -138,  -451,
+    -212,  -331,
+    -192,  -241,
+    -87,  -231,
+    -191,  -128,
+    -70,  -106,
+    -164,    -6,
+    74,  -179,
+    27,   -33,
+    -102,    74,
+    -162,   115,
+    -94,   172,
+    -6,   130,
+    -143,   234,
+    14,   218,
+    -65,   270,
+    88,   182,
+    -124,   341,
+    -44,   381,
+    38,   335,
+    117,   274,
+    -112,   454,
+    74,   431,
+    -5,   488,
+    175,   384,
+    -83,   561,
+    122,   529,
+    21,   601,
+    229,   481,
+    231,   303,
+    226,   608,
+    300,   372,
+    210,   187,
+    306,   265,
+    328,   473,
+    382,   331,
+    371,   132,
+    139,    58,
+    365,    21,
+    250,   -82,
+    443,   218,
+    483,   110,
+    426,   415,
+    579,   222,
+    518,   333,
+    573,   448,
+    455,   529,
+    685,   329,
+    332,   580,
+    595,   593,
+    468,   645,
+    762,   517,
+    326,   709,
+    485,   793,
+    130,   684,
+    671,   737,
+    354,   876,
+    88,   806,
+    -65,   706,
+    -35,  1016,
+    266,  1123
+};
+
+
+/*
+ * 2nd split:   isf2 to isf4
+ */
+
+const int16 dico2_isf_noise[SIZE_BK_NOISE2*3] =
+{
+
+    -824,  -884,  -949,
+    -805,  -456,  -418,
+    -442,  -438,  -541,
+    -217,  -578,  -793,
+    -168,  -444,  -582,
+    -287,  -492,  -274,
+    -552,  -297,  -300,
+    -163,  -333,  -358,
+    -370,  -232,  -232,
+    -175,  -358,  -159,
+    -381,   -21,  -357,
+    -184,  -159,  -162,
+    -53,  -191,  -280,
+    18,  -267,  -215,
+    -138,    61,  -283,
+    71,   -95,  -294,
+    13,  -156,  -546,
+    0,   -83,   -79,
+    44,    97,  -316,
+    178,   -52,  -213,
+    222,  -261,  -422,
+    237,  -118,   -44,
+    141,   145,  -132,
+    363,    81,  -287,
+    213,    65,    34,
+    -107,    94,    -5,
+    91,   -29,   126,
+    -355,    51,   -41,
+    -219,   -76,   145,
+    -63,   100,   244,
+    -719,    44,    27,
+    -572,  -124,   155,
+    -423,   133,   315,
+    -917,    71,   224,
+    -268,   318,   131,
+    -93,  -190,   420,
+    -97,   122,   491,
+    -79,   317,   355,
+    130,   100,   325,
+    86,  -293,   210,
+    133,   258,   161,
+    176,   -73,   465,
+    195,   300,   384,
+    348,    22,   221,
+    376,   183,   409,
+    377,   286,   202,
+    242,   213,   659,
+    257,   565,   248,
+    344,   408,   -76,
+    405,   440,   509,
+    612,   385,   379,
+    536,   607,   216,
+    -56,   582,   192,
+    100,   517,   567,
+    -365,   448,   445,
+    728,   347,    10,
+    505,   357,   759,
+    636,   582,   658,
+    335,   517,   852,
+    378,   809,   572,
+    -195,   878,   829,
+    529,   707,   987,
+    918,   726,   392,
+    1250,   997,  1063
+};
+
+/*
+ * 3rd split:   isf5 to isf7
+ */
+
+const int16 dico3_isf_noise[SIZE_BK_NOISE3*3] =
+{
+
+    -805,  -838,  -774,
+    -522,  -627,  -828,
+    -477,  -486,  -603,
+    -295,  -481,  -634,
+    -366,  -384,  -393,
+    -186,  -414,  -396,
+    -237,  -394,  -106,
+    -252,  -202,  -275,
+    -61,  -177,  -442,
+    -84,  -198,  -199,
+    -179,  -125,   -31,
+    -72,   -47,  -163,
+    -298,  -220,   215,
+    -64,  -168,   251,
+    -133,   156,   -59,
+    -30,    -2,   127,
+    54,    66,   -61,
+    -233,    21,   251,
+    209,   -50,    32,
+    33,   194,   136,
+    -117,   -18,   475,
+    202,    46,   309,
+    256,   185,    53,
+    35,   200,   390,
+    200,   263,   242,
+    -216,   302,   294,
+    128,   358,     0,
+    19,   431,   287,
+    224,   447,   280,
+    367,   165,   213,
+    397,   314,   319,
+    383,   379,    75,
+    277,   325,   462,
+    394,   505,   334,
+    251,    98,  -213,
+    450,   153,   448,
+    565,   226,    76,
+    470,   383,   502,
+    635,   390,   278,
+    237,   135,   620,
+    342,   401,   649,
+    331,   551,   518,
+    130,   418,   592,
+    531,   306,   737,
+    729,   389,   580,
+    497,   557,   699,
+    296,   383,   874,
+    283,   624,   759,
+    126,   622,   476,
+    559,   595,   472,
+    382,   770,   616,
+    719,   613,   745,
+    540,   639,   928,
+    517,   826,   801,
+    684,   811,   604,
+    752,   786,   857,
+    933,   661,   350,
+    694,   450,  1061,
+    562,   911,  1051,
+    824,   813,  1104,
+    758,  1047,   882,
+    1140,   917,   889,
+    1039,  1246,  1426,
+    1483,  1666,  1876
+};
+
+/*
+ * 4th split:   isf8 to isf11
+ */
+
+const int16 dico4_isf_noise[SIZE_BK_NOISE4*4] =
+{
+
+    -776,  -854,  -891,  -920,
+    -552,  -610,  -663,  -741,
+    -321,  -370,  -476,  -565,
+    274,  -160,  -456,   201,
+    265,    67,  -160,  -306,
+    -8,  -210,    79,   272,
+    163,   236,   307,   308,
+    578,   317,    64,   298,
+    -9,   197,   342,   620,
+    343,   232,   314,   622,
+    173,   149,   548,   527,
+    356,   370,   481,   376,
+    135,   444,   488,   556,
+    391,   471,   487,   653,
+    228,   424,   576,   835,
+    422,   372,   722,   682,
+    295,   673,   693,   635,
+    539,   596,   590,   449,
+    475,   618,   659,   818,
+    735,   517,   491,   673,
+    602,   346,   257,   877,
+    625,   635,   849,   720,
+    727,   818,   698,   595,
+    653,   481,   690,  1139,
+    814,   762,   704,   908,
+    507,   747,   898,   936,
+    848,   855,   924,   785,
+    646,  1037,   882,   795,
+    772,   845,  1024,  1151,
+    1133,   983,   818,   921,
+    940,  1068,  1252,  1302,
+    1588,  1767,  1718,  1513
+};
+
+/*
+ * 5th split:   isf12 to isf15
+ */
+
+const int16 dico5_isf_noise[SIZE_BK_NOISE5*4] =
+{
+    -810,  -879,  -945,  -254,
+    248,   184,   671,   128,
+    288,   703,   918,    99,
+    658,   558,   662,   219,
+    552,   585,   910,   208,
+    559,   804,   759,   119,
+    606,   774,   921,  -139,
+    782,   761,   748,   208,
+    756,   708,   983,    56,
+    544,   864,  1010,   152,
+    737,   698,   987,   299,
+    771,   924,   879,   103,
+    536,   785,   961,   405,
+    667,   916,   801,   328,
+    738,   705,   773,   439,
+    823,   871,   992,   355,
+    640,  1004,  1052,   369,
+    724,   822,   949,   597,
+    415,   655,   729,   482,
+    1009,   896,   793,   363,
+    908,   803,   687,   -25,
+    1016,   838,  1011,   189,
+    947,  1112,   942,   222,
+    914,  1049,   981,   527,
+    956,   987,  1011,  -120,
+    781,  1049,  1121,    92,
+    1178,  1053,   884,    47,
+    1123,  1059,  1182,   118,
+    933,   972,  1277,   357,
+    1109,   918,  1101,   503,
+    1039,  1286,  1220,   317,
+    1351,  1207,  1010,   326
+};
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.cpp
new file mode 100644 (file)
index 0000000..0b63563
--- /dev/null
@@ -0,0 +1,342 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: qpisf_2s.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+    int16 * seed          seed for the random ng
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   Coding/Decoding of ISF parameters  with prediction.
+
+   The ISF vector is quantized using two-stage VQ with split-by-2
+   in 1st stage and split-by-5 (or 3)in the second stage.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+
+#include "qisf_ns.h"
+#include "qpisf_2s.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define MU         10923           /* Prediction factor   (1.0/3.0) in Q15 */
+#define N_SURV_MAX 4               /* 4 survivors max */
+#define ALPHA      29491           /* 0. 9 in Q15     */
+#define ONE_ALPHA (32768-ALPHA)    /* (1.0 - ALPHA) in Q15 */
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
+/*-------------------------------------------------------------------*
+ * routine:   Disf_2s_46b()                                          *
+ *            ~~~~~~~~~                                              *
+ * Decoding of ISF parameters                                        *
+ *-------------------------------------------------------------------*/
+
+void Dpisf_2s_46b(
+    int16 * indice,   /* input:  quantization indices                       */
+    int16 * isf_q,    /* output: quantized ISF in frequency domain (0..0.5) */
+    int16 * past_isfq,/* i/0   : past ISF quantizer                    */
+    int16 * isfold,   /* input : past quantized ISF                    */
+    int16 * isf_buf,  /* input : isf buffer                            */
+    int16 bfi,        /* input : Bad frame indicator                   */
+    int16 enc_dec
+)
+{
+    int16 ref_isf[M];
+    int16 i, j, tmp;
+    int32 L_tmp;
+
+
+    if (bfi == 0)                          /* Good frame */
+    {
+        for (i = 0; i < 9; i++)
+        {
+            isf_q[i] = dico1_isf[(indice[0] << 3) + indice[0] + i];
+        }
+        for (i = 0; i < 7; i++)
+        {
+            isf_q[i + 9] = dico2_isf[(indice[1] << 3) - indice[1] + i];
+        }
+
+        for (i = 0; i < 3; i++)
+        {
+            isf_q[i]      += dico21_isf[indice[2] * 3 + i];
+            isf_q[i + 3]  += dico22_isf[indice[3] * 3 + i];
+            isf_q[i + 6]  += dico23_isf[indice[4] * 3 + i];
+            isf_q[i + 9]  += dico24_isf[indice[5] * 3 + i];
+            isf_q[i + 12] += dico25_isf[(indice[6] << 2) + i];
+        }
+
+        isf_q[i + 12] += dico25_isf[(indice[6] << 2) + i];
+
+        for (i = 0; i < ORDER; i++)
+        {
+            tmp = isf_q[i];
+            isf_q[i] += mean_isf[i];
+            isf_q[i] += ((int32)MU * past_isfq[i]) >> 15;
+            past_isfq[i] = tmp;
+        }
+
+
+        if (enc_dec)
+        {
+            for (i = 0; i < M; i++)
+            {
+                for (j = (L_MEANBUF - 1); j > 0; j--)
+                {
+                    isf_buf[j * M + i] = isf_buf[(j - 1) * M + i];
+                }
+                isf_buf[i] = isf_q[i];
+            }
+        }
+    }
+    else
+    {                                      /* bad frame */
+        for (i = 0; i < M; i++)
+        {
+            L_tmp = mul_16by16_to_int32(mean_isf[i], 8192);
+            for (j = 0; j < L_MEANBUF; j++)
+            {
+                L_tmp = mac_16by16_to_int32(L_tmp, isf_buf[j * M + i], 8192);
+            }
+            ref_isf[i] = amr_wb_round(L_tmp);
+        }
+
+        /* use the past ISFs slightly shifted towards their mean */
+        for (i = 0; i < ORDER; i++)
+        {
+            isf_q[i] = add_int16(mult_int16(ALPHA, isfold[i]), mult_int16(ONE_ALPHA, ref_isf[i]));
+        }
+
+        /* estimate past quantized residual to be used in next frame */
+
+        for (i = 0; i < ORDER; i++)
+        {
+            tmp = add_int16(ref_isf[i], mult_int16(past_isfq[i], MU));      /* predicted ISF */
+            past_isfq[i] = sub_int16(isf_q[i], tmp);
+            past_isfq[i] >>= 1;           /* past_isfq[i] *= 0.5 */
+        }
+
+    }
+
+    Reorder_isf(isf_q, ISF_GAP, ORDER);
+}
+
+/*
+ * routine:   Disf_2s_36b()
+ *            ~~~~~~~~~
+ * Decoding of ISF parameters
+ */
+
+void Dpisf_2s_36b(
+    int16 * indice,    /* input:  quantization indices                       */
+    int16 * isf_q,     /* output: quantized ISF in frequency domain (0..0.5) */
+    int16 * past_isfq, /* i/0   : past ISF quantizer                    */
+    int16 * isfold,    /* input : past quantized ISF                    */
+    int16 * isf_buf,   /* input : isf buffer                            */
+    int16 bfi,         /* input : Bad frame indicator                   */
+    int16 enc_dec
+)
+{
+    int16 ref_isf[M];
+    int16 i, j, tmp;
+    int32 L_tmp;
+
+
+    if (bfi == 0)                          /* Good frame */
+    {
+        for (i = 0; i < 9; i++)
+        {
+            isf_q[i] = dico1_isf[indice[0] * 9 + i];
+        }
+        for (i = 0; i < 7; i++)
+        {
+            isf_q[i + 9] = add_int16(dico2_isf[indice[1] * 7 + i], dico23_isf_36b[indice[4] * 7 + i]);
+        }
+
+        for (i = 0; i < 5; i++)
+        {
+            isf_q[i] = add_int16(isf_q[i], dico21_isf_36b[indice[2] * 5 + i]);
+        }
+        for (i = 0; i < 4; i++)
+        {
+            isf_q[i + 5] = add_int16(isf_q[i + 5], dico22_isf_36b[(indice[3] << 2) + i]);
+        }
+
+        for (i = 0; i < ORDER; i++)
+        {
+            tmp = isf_q[i];
+            isf_q[i] = add_int16(tmp, mean_isf[i]);
+            isf_q[i] = add_int16(isf_q[i], mult_int16(MU, past_isfq[i]));
+            past_isfq[i] = tmp;
+        }
+
+
+        if (enc_dec)
+        {
+            for (i = 0; i < M; i++)
+            {
+                for (j = (L_MEANBUF - 1); j > 0; j--)
+                {
+                    isf_buf[j * M + i] = isf_buf[(j - 1) * M + i];
+                }
+                isf_buf[i] = isf_q[i];
+            }
+        }
+    }
+    else
+    {                                      /* bad frame */
+        for (i = 0; i < M; i++)
+        {
+            L_tmp = mul_16by16_to_int32(mean_isf[i], 8192);
+            for (j = 0; j < L_MEANBUF; j++)
+            {
+                L_tmp = mac_16by16_to_int32(L_tmp, isf_buf[j * M + i], 8192);
+            }
+
+            ref_isf[i] = amr_wb_round(L_tmp);
+        }
+
+        /* use the past ISFs slightly shifted towards their mean */
+        for (i = 0; i < ORDER; i++)
+        {
+            isf_q[i] = add_int16(mult_int16(ALPHA, isfold[i]), mult_int16(ONE_ALPHA, ref_isf[i]));
+        }
+
+        /* estimate past quantized residual to be used in next frame */
+
+        for (i = 0; i < ORDER; i++)
+        {
+            tmp = add_int16(ref_isf[i], mult_int16(past_isfq[i], MU));      /* predicted ISF */
+            past_isfq[i] = sub_int16(isf_q[i], tmp);
+            past_isfq[i] >>=  1;           /* past_isfq[i] *= 0.5 */
+        }
+    }
+
+    Reorder_isf(isf_q, ISF_GAP, ORDER);
+
+    return;
+}
+
+/*
+ * procedure  Reorder_isf()
+ *            ~~~~~~~~~~~~~
+ * To make sure that the  isfs are properly order and to keep a certain
+ * minimum distance between consecutive isfs.
+ *
+ *    Argument         description                     in/out
+ *    ~~~~~~~~         ~~~~~~~~~~~                     ~~~~~~
+ *     isf[]           vector of isfs                    i/o
+ *     min_dist        minimum required distance         i
+ *     n               LPC order                         i
+ */
+
+void Reorder_isf(
+    int16 * isf,                         /* (i/o) Q15: ISF in the frequency domain (0..0.5) */
+    int16 min_dist,                      /* (i) Q15  : minimum distance to keep             */
+    int16 n                              /* (i)      : number of ISF                        */
+)
+{
+    int16 i, isf_min;
+
+    isf_min = min_dist;
+
+    for (i = 0; i < n - 1; i++)
+    {
+        if (isf[i] < isf_min)
+        {
+            isf[i] = isf_min;
+        }
+        isf_min = add_int16(isf[i], min_dist);
+    }
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.h
new file mode 100644 (file)
index 0000000..51e32b6
--- /dev/null
@@ -0,0 +1,111 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./cpp/include/qpisf_2s.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef QPISF_2S_H
+#define QPISF_2S_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "qisf_ns.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+----------------------------------------------------------------------------*/
+
+#define N_SURV  4
+
+#define SIZE_BK1  256
+#define SIZE_BK2  256
+#define SIZE_BK21 64
+#define SIZE_BK22 128
+#define SIZE_BK23 128
+#define SIZE_BK24 32
+#define SIZE_BK25 32
+
+#define SIZE_BK21_36b 128
+#define SIZE_BK22_36b 128
+#define SIZE_BK23_36b 64
+
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+----------------------------------------------------------------------------*/
+extern const int16 mean_isf[ORDER];
+extern const int16 dico1_isf[SIZE_BK1*9];
+extern const int16 dico2_isf[SIZE_BK2*7];
+extern const int16 dico21_isf[SIZE_BK21*3];
+extern const int16 dico22_isf[SIZE_BK22*3];
+extern const int16 dico23_isf[SIZE_BK23*3];
+extern const int16 dico24_isf[SIZE_BK24*3];
+extern const int16 dico25_isf[SIZE_BK25*4];
+extern const int16 dico21_isf_36b[SIZE_BK21_36b*5];
+extern const int16 dico22_isf_36b[SIZE_BK22_36b*4];
+extern const int16 dico23_isf_36b[SIZE_BK23_36b*7];
+
+/*----------------------------------------------------------------------------
+; SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
+#endif  /* QPISF_2S_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s_tab.cpp
new file mode 100644 (file)
index 0000000..d57522e
--- /dev/null
@@ -0,0 +1,1383 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*-------------------------------------------------------------------*
+ *                         qpisf_2s_tab.cpp
+ *-------------------------------------------------------------------*
+ * Quantization tables for two-stage of ISFs (split by 2 in 1st stage)
+ * Version whith prediction MU = 0.25
+ *-------------------------------------------------------------------*/
+
+#include "qisf_ns.h"
+#include "qpisf_2s.h"
+
+
+
+
+/* means of ISFs */
+const int16 mean_isf[ORDER] =
+{
+
+    738,  1326,  2336,  3578,  4596,  5662,  6711,  7730,
+    8750,  9753, 10705, 11728, 12833, 13971, 15043,  4037
+};
+
+/* 46 bits */
+/*
+ *  isf codebooks:  two-stage VQ with split-by-5 in 2nd stage
+ *
+ *  codebook   vector dimension    number of vectors
+ *  ~~~~~~~~   ~~~~~~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~
+ *     1_1            9                  256
+ *     1_2            7                  256
+ *     2_1            3                  64
+ *     2_2            3                  128
+ *     2_3            3                  128
+ *     2_4            3                  32
+ *     2_5            4                  32
+ */
+
+/*
+ * 1st stage codebook; 1st split:   isf0 to isf8
+ */
+
+const int16 dico1_isf[SIZE_BK1*9] =
+{
+
+    579,  1081,  1035,   390,     3,  -263,  -198,   -82,    38,
+    18,   -68,   -12,   313,   761,   405,   249,   111,   -76,
+    740,  1263,  1292,  1006,   997,  1019,  1017,   976,   923,
+    -91,   827,   948,   648,   613,   535,   522,   490,   421,
+    41,   -44,  -281,  -472,   652,   534,   193,   135,   -90,
+    41,  -121,  -356,   -60,   663,   307,    61,   -48,  -344,
+    557,   946,  1049,   867,   846,   990,  1112,  1262,  1241,
+    -118,  -204,   328,   512,   870,   793,   610,   402,   186,
+    156,   293,    74,  -338,  -475,  -897,  -594,  -161,  -497,
+    226,   131,  -138,   307,   169,  -271,  -164,  -387,  -624,
+    62,   -32,   -61,  -252,  -541,  -828, -1027,  -523,  -662,
+    102,   -61,   141,   112,  -270,  -251,  -541,    25,  -150,
+    6,  -132,  -356,  -686,   -96,  -322,  -522,   -31,  -326,
+    -36,  -209,  -521,  -229,   307,  -132,    -5,   -99,  -384,
+    60,   -51,  -237,  -668,  -973,  -407,  -708,   -75,  -172,
+    26,  -138,  -266,   111,  -302,    43,  -278,  -356,  -359,
+    570,   822,   496,  -154,  -312,   -92,   137,   279,   371,
+    -146,   368,   409,    68,     6,    77,   167,   202,   162,
+    633,   898,   996,   756,   662,   683,   783,   909,   996,
+    -103,   294,   607,   415,   483,   462,   480,   431,   408,
+    -120,  -338,  -612,  -524,   584,   331,    92,   433,   276,
+    -178,  -293,  -154,   -41,   269,   100,    -9,   213,   160,
+    830,   736,   278,   820,  1254,   686,   712,  1039,   473,
+    -218,  -304,   463,   454,   397,   273,   202,   286,   273,
+    -232,     7,     6,  -388,  -472,  -427,  -378,  -167,  -100,
+    -294,  -183,   134,   -47,   101,   -88,   -84,  -117,    -3,
+    57,    17,  -202,  -634,  -989, -1119,  -533,   176,   -36,
+    120,   -28,    23,   111,  -319,   318,   -22,   -77,   266,
+    -271,  -464,  -434,  -658,  -640,  -385,  -385,   -99,   -69,
+    -198,  -259,  -266,   -44,   -39,  -139,  -137,   171,    66,
+    9,  -145,  -377,  -846, -1000,  -111,  -325,   342,   135,
+    -81,  -286,  -380,   192,   -57,   307,    76,   -24,  -140,
+    677,   702,   247,    56,   249,   141,  -105,  -236,   -99,
+    36,   -39,   -69,   348,   198,   -93,   322,    91,   -72,
+    503,   885,  1508,  1307,  1282,  1172,  1119,  1209,  1061,
+    416,   719,   989,  1227,  1001,  1052,   954,   741,  1044,
+    -127,  -376,  -657,   139,   623,   223,   501,   306,   220,
+    -113,  -384,  -796,   504,   438,    85,   213,   -83,  -194,
+    585,  1132,  1233,  1091,  1247,  1433,  1512,  1448,  1314,
+    -174,  -422,     7,  1155,  1089,  1182,  1003,   945,   806,
+    8,  -126,  -317,  -103,  -351,  -695,   -98,  -268,  -537,
+    33,  -103,  -290,   167,   -39,  -407,    44,  -208,  -375,
+    104,   -23,   -64,  -291,  -637,  -851, -1084,   -61,  -112,
+    -75,  -306,  -434,   218,  -148,  -354,  -680,  -133,  -216,
+    -121,  -377,  -718,   -97,  -130,  -361,  -156,  -379,  -599,
+    -56,  -254,  -586,   235,   157,  -214,    11,  -260,  -149,
+    -124,  -267,  -397,  -580,  -593,  -527,  -805,  -385,   346,
+    -193,  -440,  -708,  -351,  -141,  -255,  -499,  -147,  -185,
+    448,   660,   494,   208,   509,   461,   338,   291,   149,
+    -223,    88,   335,   159,   212,   191,   286,   308,   205,
+    -31,   469,   803,   659,   619,   658,   843,   987,  1113,
+    -171,  -242,   514,   362,   295,   524,   552,   694,   585,
+    -64,  -308,  -448,   -21,   284,   786,   446,   289,    92,
+    -218,  -390,    -7,   169,   206,   330,   352,   408,   358,
+    -36,   702,   959,   859,   861,  1115,  1269,  1357,  1305,
+    -133,  -341,   -65,   678,   417,   440,   486,   518,   780,
+    33,   -44,  -191,  -344,  -461,  -755,  -201,   217,   -31,
+    -353,  -547,   -44,   123,   -61,   -68,   -79,    29,    60,
+    73,   -57,  -406,  -766, -1243, -1203,   240,   400,   165,
+    -73,  -282,  -601,  -213,  -171,  -375,   332,    35,  -103,
+    -29,  -207,  -553,  -476,  -638,  -908,   172,   -22,  -135,
+    -192,  -239,  -164,  -103,  -111,   -47,   153,   125,   110,
+    -1,  -203,  -570, -1030, -1424,  -535,   155,     1,   147,
+    -333,  -653,  -865,  -197,  -158,   -21,   -44,    95,   108,
+    389,   588,   490,    33,  -237,  -524,  -628,  -136,  -260,
+    40,  -177,  -462,   453,   862,   380,   131,  -130,  -405,
+    842,  1678,  1841,  1549,  1474,  1256,  1082,   905,   742,
+    370,  1216,  1768,  1633,  1212,   636,    22,  -330,    71,
+    -76,  -281,  -741,  -742,   898,   619,   277,    71,  -222,
+    -32,  -265,  -556,   -25,   994,   682,   305,   126,  -165,
+    73,   738,   893,   968,   993,  1768,  2273,  1840,  1391,
+    -69,  -349,  -585,   234,  1158,   903,   626,   510,   251,
+    -1,   -99,  -272,  -210,  -603,  -351,  -540,  -811,  -383,
+    -16,  -230,  -504,   410,   149,  -205,  -343,  -651,  -639,
+    103,    -9,  -227,  -205,  -562,  -781, -1079, -1208,  -156,
+    143,    63,  -135,   -67,  -317,  -602,  -784, -1154,  -640,
+    -144,  -391,  -674,  -622,  -200,  -254,  -660,  -947,  -395,
+    -40,  -250,  -625,    27,   543,    94,  -131,  -386,  -673,
+    -123,  -371,  -757,  -451,  -564,  -614,  -415,  -711,   -35,
+    -116,  -309,  -593,  -268,   239,   -33,  -338,  -650,  -135,
+    94,   251,   554,    57,  -312,  -423,  -154,   -57,   235,
+    -268,   -71,   381,   114,   -44,   -87,   125,   173,   133,
+    1513,  1714,  1238,   534,   276,   315,   461,   459,   508,
+    -131,   -19,  1149,   670,   486,   356,   309,   369,   296,
+    -223,  -501,  -899,  -722,   -70,     6,   131,   310,   394,
+    -99,  -303,  -517,   249,    64,   -53,   135,   -11,   453,
+    -147,  -399,  -730,  -401,   817,   738,   802,   749,   575,
+    -154,  -435,  -739,   800,   593,   366,   529,   318,   326,
+    -224,    45,   -39,  -387,  -515,  -518,  -608,  -384,  -321,
+    -315,  -377,   143,  -101,  -113,  -377,  -177,  -144,   -12,
+    117,    40,  -239,  -651, -1051,  -581,  -737,  -990,  -328,
+    26,   -50,  -157,   -23,  -453,  -283,  -531,  -546,   192,
+    -252,  -501,  -743,  -589,  -627,  -499,  -328,  -118,   -72,
+    -324,  -494,  -244,  -306,  -144,  -177,  -262,  -135,   -78,
+    -36,  -234,  -519,  -961, -1290,  -314,  -479,  -371,   -45,
+    -95,  -292,  -535,    -8,  -300,   112,  -164,  -277,   198,
+    -99,  -128,   880,   836,   579,   351,    23,   -95,  -217,
+    -27,  -258,   124,  1011,   597,   425,   144,     7,   -73,
+    421,  1293,  1640,  1623,  1742,  1617,  1499,  1284,  1006,
+    -95,   752,  1680,  1569,  1618,  1436,  1200,   980,   712,
+    -69,  -300,  -683,  -435,  1132,   899,   504,   332,   109,
+    -74,  -323,  -637,   563,  1074,   608,   371,   105,   -49,
+    -78,   831,  1194,  1110,  1378,  1481,  1492,  1365,  1217,
+    -259,  -121,  1440,  1334,  1628,  1490,  1438,  1223,   933,
+    -82,  -306,  -613,  -222,  -378,  -675,  -545,  -671,  -845,
+    53,  -124,  -347,   422,    52,  -125,  -270,  -529,     9,
+    79,   -89,  -320,  -662,  -999, -1199, -1243,  -676,  -297,
+    -68,  -273,  -611,   137,  -146,  -397,  -627,  -845,  -220,
+    -112,  -346,  -797,  -826,   234,  -132,  -188,  -278,  -522,
+    -159,  -405,  -734,  -419,   293,    74,  -167,  -167,   184,
+    -153,  -437,  -833, -1080,  -336,  -472,  -561,  -340,  -253,
+    -169,  -423,  -820,  -904,  -131,   -19,  -346,  -604,    31,
+    33,   -31,   312,    62,  -148,    49,   -59,   564,   486,
+    -306,  -333,   194,   -44,    67,    72,   147,   205,   243,
+    -207,   -49,  1360,   983,   969,   991,  1014,  1110,   973,
+    -211,  -172,   883,   627,   711,   674,   705,   798,   746,
+    -88,  -325,  -763,  -974,   687,   908,   514,   382,   172,
+    -292,  -612,  -805,    63,   131,   270,   259,   352,   348,
+    -235,   -84,   955,   818,  1120,  1289,  1559,  1480,  1285,
+    -180,  -461,  -614,   657,   691,   745,   854,   783,   713,
+    -97,  -309,  -477,  -614,  -777,  -734,  -768,  -526,  -472,
+    -344,  -476,   -35,  -169,    49,   -77,  -150,  -240,  -141,
+    -52,  -268,  -639,  -919, -1278, -1113,  -342,  -333,  -151,
+    -68,  -242,  -585,   -73,  -209,  -478,  -159,  -429,   133,
+    -197,  -499, -1005, -1268,  -272,  -224,  -105,   -67,    17,
+    -363,  -618,  -414,  -116,   -62,    20,    10,   116,   108,
+    -195,  -475,  -906, -1260,  -891,  -441,  -277,  -142,   -28,
+    -226,  -519,  -950,  -700,  -275,  -266,  -116,  -105,    82,
+    404,   511,   520,   327,    17,  -194,  -333,  -536,  -586,
+    -114,  -130,   276,   237,   204,   342,   135,   -16,  -111,
+    670,  1208,  1168,   860,   742,   601,   528,   403,   309,
+    397,   621,   966,   752,   579,   398,   400,   329,   252,
+    191,   180,  -137,  -467,   272,   106,   -95,    17,  -192,
+    -80,  -290,  -626,   194,   598,   196,    21,  -281,    77,
+    510,   864,  1108,   807,   939,   902,   925,   717,   481,
+    137,   367,   534,   764,   670,   382,   296,   153,    84,
+    303,   497,   144,   -85,  -125,  -539,  -482,  -464,  -764,
+    233,   347,    68,  -147,   169,  -210,  -242,  -226,  -482,
+    307,   422,   154,  -175,  -386,  -722,  -724,  -904, -1015,
+    309,   308,   160,   -60,  -470,  -420,  -598,  -791,  -219,
+    68,   121,  -137,  -560,  -146,  -446,  -515,  -494,  -729,
+    130,    53,  -227,    46,   474,    32,  -161,  -192,  -490,
+    213,   164,   -71,  -465,  -876,  -161,  -456,  -587,   -48,
+    218,   117,    39,   177,  -194,   -88,  -226,  -418,    50,
+    210,   547,   569,   279,   121,   -44,   -50,    10,   -84,
+    58,   140,   182,    -5,   267,   117,   106,   211,   198,
+    539,   835,   913,   719,   617,   544,   591,   565,   642,
+    153,   559,   872,   460,   222,   108,   188,   180,   183,
+    158,   119,   284,  -153,  -271,   229,    87,   110,   -57,
+    -183,    82,   118,    21,    13,    40,   118,   191,   185,
+    162,   889,   654,   108,   -34,   244,   488,   561,   532,
+    163,    56,   609,   341,    50,   329,    68,   266,   218,
+    100,   206,    18,  -304,  -107,  -436,  -487,   -65,  -306,
+    -86,   154,   134,   -30,   -45,   -73,  -104,   -80,   -96,
+    245,   330,    10,  -440,  -849, -1082,    79,    40,  -265,
+    196,   372,   272,  -181,  -493,  -389,   275,    80,   -59,
+    2,   -12,  -246,  -505,  -100,  -436,    21,  -187,  -431,
+    -221,   -48,    36,  -271,  -186,  -147,  -109,    26,    71,
+    213,   140,    72,  -351,  -620,   -84,  -363,    69,    46,
+    91,   167,    -3,   -95,   -99,  -105,   -48,   114,   147,
+    259,   249,   172,   607,   406,    52,    59,  -189,  -320,
+    115,   -85,   -54,   574,   128,   226,   -59,  -253,   130,
+    -62,  1033,  1308,  1035,  1127,  1098,  1029,   961,   823,
+    39,   364,   757,   940,   728,   660,   659,   583,   770,
+    -115,  -338,  -760,  -471,   394,    37,   441,   178,     6,
+    -57,  -305,  -525,   796,   453,   188,    -4,  -114,   248,
+    71,   444,   797,   731,  1096,  1157,  1222,  1029,   811,
+    135,   359,   551,   425,   749,   815,   874,   704,   502,
+    132,   247,     0,  -206,  -449,  -750,  -258,  -514,  -633,
+    248,   249,    91,   121,  -195,  -499,   -90,  -282,  -435,
+    78,    20,  -277,  -623,  -983, -1224,  -415,  -458,  -639,
+    347,   509,   208,  -179,  -464,  -728,   -76,  -237,  -486,
+    -103,  -343,  -756,  -713,  -265,  -609,  -191,  -398,  -636,
+    -121,  -383,  -749,   567,   252,   -36,  -354,  -417,   -50,
+    204,   100,  -149,  -650, -1081,   -47,    -7,  -263,   111,
+    -46,  -180,  -267,  -324,  -562,  -394,  -692,   398,   292,
+    482,   670,   683,   624,   442,   165,   116,    36,  -149,
+    108,   247,   291,   247,   355,   122,   109,   224,   296,
+    -14,   945,   990,   801,   755,   815,   847,   913,   892,
+    292,   349,   725,   482,   388,   329,   429,   620,   667,
+    -34,   197,   213,  -127,    84,   494,   620,   575,   375,
+    126,   207,   172,   167,   362,   202,   296,   395,   455,
+    -6,   250,   539,   467,   636,   801,  1149,  1287,  1118,
+    27,   240,   369,   280,   440,   411,   634,   892,   953,
+    159,   170,   -58,  -395,  -797,  -690,    77,  -211,  -334,
+    -5,   -28,   -13,   -74,  -335,  -603,   300,    88,  -205,
+    82,   -33,  -364,  -698, -1203, -1153,   110,  -146,  -289,
+    113,     1,  -243,  -588,  -994,  -496,   414,   160,    42,
+    -56,  -247,  -440,  -693,  -996,  -479,    11,  -178,  -357,
+    -151,  -353,  -327,  -211,  -340,   141,    65,   425,   453,
+    34,  -169,  -455,  -932, -1215,   138,   499,   256,   324,
+    68,   139,   -15,  -547,  -478,    17,   306,   502,   481,
+    -32,  -134,   445,   129,  -143,  -244,  -503,  -507,  -599,
+    61,  -140,  -345,   496,   458,    -2,    20,  -227,  -514,
+    394,  1765,  1666,  1339,  1117,   806,   642,   479,   380,
+    215,   519,   920,  1053,  1090,   791,   528,   290,   155,
+    -54,  -233,  -647,  -602,   639,   294,    -2,  -167,  -442,
+    -78,  -315,  -791,  -113,   820,   403,   158,  -116,  -356,
+    529,  1851,  2003,  1228,   622,   -41,  -416,   344,   819,
+    -105,  -379,  -236,  1224,   893,   749,   568,   356,   214,
+    -17,  -199,  -144,    50,  -283,  -247,  -578,  -846, -1087,
+    69,   -11,  -381,  -206,   209,  -284,  -387,  -416,  -716,
+    39,    -5,  -145,  -374,  -682,  -909, -1074, -1169, -1066,
+    287,   226,    67,  -221,  -662,  -171,  -421,  -642,  -707,
+    -132,  -348,  -538,  -448,   -20,    -4,  -354,  -748,  -933,
+    4,   -75,  -289,  -598,   317,    52,  -208,  -297,  -559,
+    -88,  -264,  -358,  -589,  -631,  -248,  -523,  -822, -1071,
+    70,    -8,    54,  -314,  -515,    92,  -146,  -274,  -493,
+    199,    62,   391,   158,  -141,    71,  -219,  -203,  -207,
+    152,    40,   329,   162,   -29,    48,  -149,   108,   127,
+    635,  1058,   883,   492,   372,   312,   317,   274,   241,
+    267,   722,  1256,   882,   625,   248,     8,   -81,   -60,
+    -58,  -138,  -291,  -600,   -12,    -2,   -39,   147,   117,
+    -107,  -345,  -513,   459,    76,    92,  -272,   388,   262,
+    362,   516,   203,  -409,  -716,  -831,  -331,   185,   209,
+    -117,  -391,  -298,   671,   292,   538,   257,   166,   -38,
+    -102,  -319,  -194,  -283,  -573,  -262,  -579,  -219,  -444,
+    -235,    78,    11,  -168,  -101,  -229,  -263,  -321,  -123,
+    70,    50,  -170,  -599,  -996,  -588,  -263,  -516,  -455,
+    394,   363,   229,  -136,  -538,    21,  -183,  -348,  -201,
+    -124,  -368,  -640,  -879,  -847,  -209,  -409,  -494,  -515,
+    -127,  -341,  -541,  -425,  -510,   -10,  -252,  -473,  -291,
+    84,   -69,  -201,  -676,  -868,   103,  -311,  -132,  -320,
+    5,  -173,  -188,  -297,  -628,   197,   -57,     7,   -11,
+    49,  -160,    56,   558,   111,    33,  -311,  -440,  -463,
+    -1,  -246,  -307,   862,   453,   139,  -170,  -355,  -232,
+    279,   966,  1642,  1478,  1463,  1123,   795,   525,   339,
+    -197,   -38,  1702,  1331,  1252,   950,   692,   504,   426,
+    -108,  -344,  -861, -1172,   444,   354,    88,   -46,  -220,
+    -53,  -321,  -494,  1113,   744,   364,   198,   -34,   -75,
+    457,   955,  1177,  1214,  1427,  1457,  1345,   917,   539,
+    -69,   199,   897,  1140,  1343,  1183,   977,   742,   522,
+    122,    44,  -269,    27,  -155,  -562,  -307,  -590,  -773,
+    154,    42,  -160,   252,  -129,  -305,  -471,  -733,  -371,
+    135,   185,   -82,  -416,  -722,  -913,  -504,  -743,  -880,
+    149,   214,   -84,  -329,  -680,  -835,  -426,  -661,   -81,
+    -128,  -380,  -735,  -998,  -337,    17,  -182,  -467,  -697,
+    -84,  -290,  -510,  -592,    13,   440,   154,   -38,  -279,
+    70,   -61,  -246,  -727, -1047,   -80,  -381,  -535,  -704,
+    178,    -2,  -146,  -670,  -938,   482,   138,    63,    65,
+    -11,    15,   772,   443,   142,   -20,  -209,  -126,  -161,
+    -32,  -249,    95,   552,   124,    30,  -343,    82,   -86,
+    148,   751,  1515,  1105,   867,   606,   474,   448,   399,
+    -163,  -257,   899,  1097,   906,   751,   502,   390,   294,
+    -51,  -258,  -447,  -806,  -368,   763,   464,   364,   183,
+    -166,  -374,  -367,    87,    35,   399,   418,   856,   833,
+    -205,  -310,   588,   778,   785,  1065,  1118,  1245,  1157,
+    -173,  -312,   107,   345,   400,   790,   870,  1113,  1001,
+    -7,  -120,  -387,  -410,  -614,  -943,  -226,  -384,  -491,
+    -203,  -288,   -51,  -331,   -90,  -178,  -408,  -573,  -338,
+    56,   -29,  -273,  -627, -1041,  -798,  -247,  -467,   148,
+    66,    -2,  -205,  -205,  -575,  -349,   -57,  -352,   -58,
+    -45,  -225,  -471,  -924,  -497,    77,   -32,    44,  -135,
+    -277,  -491,  -497,  -502,  -424,  -202,  -137,    77,    96,
+    26,  -179,  -469, -1008, -1260,   262,   -35,  -132,  -259,
+    -66,  -232,  -447,  -533,  -789,  -191,  -100,  -267,   364
+};
+
+/*------------------------------------------------*
+ * 1st stage codebook; 2nd split:   isf9 to isf15
+ *------------------------------------------------*/
+
+const int16 dico2_isf[SIZE_BK2*7] =
+{
+
+    1357,  1313,  1136,   784,   438,   181,   145,
+    636,   648,   667,   568,   442,   217,   362,
+    427,   440,   674,   524,   332,   117,  -417,
+    121,   295,   468,   465,   230,    44,  -221,
+    -147,  -240,   149,    80,   390,   278,   106,
+    -418,  -556,   552,   511,   235,   144,   -95,
+    43,   193,   274,   150,    67,    34,  -273,
+    -43,  -126,   171,   416,   282,    63,  -354,
+    -372,   -86,  -344,  -108,   -94,  -182,   -89,
+    -600,  -840,  -200,   465,   258,   -11,  -253,
+    -48,   329,    97,  -290,  -543,  -795,  -354,
+    -570,  -117,   187,    10,  -133,  -416,   -76,
+    -618,  -129,  -247,  -371,    45,   -76,   277,
+    -1022, -1079,   126,   474,   254,   127,    52,
+    -281,    76,  -167,  -361,  -283,  -551,  -283,
+    -119,   -52,    -1,   134,   -32,  -204,  -415,
+    1064,   827,   637,   684,   464,   209,    12,
+    482,   416,   449,   371,   335,   294,   194,
+    719,   576,   365,   135,   113,    91,  -199,
+    298,   176,   493,   366,   194,   163,    36,
+    -35,  -236,  -259,   -36,    -4,    99,   152,
+    -98,  -306,   -27,   228,    90,   111,   -86,
+    91,    13,  -211,  -258,  -106,    86,   -64,
+    73,   -35,   -57,   -31,   162,    35,  -192,
+    -109,  -335,  -629,   -66,   -61,  -128,   322,
+    -495,  -669,  -728,   193,    31,  -220,   122,
+    324,    95,   -89,   -91,  -409,  -710,  -154,
+    0,  -234,    92,    33,  -343,  -609,  -220,
+    -343,  -408,  -476,  -655,  -153,    82,   222,
+    -490,  -745,  -255,    49,   -48,   135,  -127,
+    119,   -67,  -328,  -390,  -272,  -545,   -56,
+    -57,  -130,   -10,    -7,  -164,   -47,   -22,
+    984,  1064,   961,   568,   210,   -27,    16,
+    811,   691,   754,   514,   224,   -35,   166,
+    662,   704,   618,   386,    57,  -211,  -257,
+    510,   359,   418,   393,    91,  -144,   -18,
+    -193,   -31,   -27,   223,    89,  -143,    24,
+    -112,   -98,   471,   319,   185,     3,   175,
+    252,   146,   -47,   272,    48,  -211,  -234,
+    146,    69,   203,   364,    68,   -52,    51,
+    -259,  -478,  -697,  -349,  -758,  -501,    63,
+    -501,  -769,  -289,    79,  -311,  -497,  -106,
+    251,    53,  -235,  -469,  -895,  -884,   145,
+    -416,  -551,   140,  -133,  -523,  -775,    44,
+    -326,  -423,  -713,  -497,   -86,  -431,    99,
+    -757,  -772,  -160,   -76,   -46,   -32,   379,
+    85,   -35,  -200,  -401,  -663, -1040,  -247,
+    -180,  -330,   -92,  -376,    27,  -183,  -110,
+    1279,  1086,   781,   502,   324,   164,   157,
+    682,   466,   449,   277,   146,    28,   409,
+    635,   472,   390,   107,  -232,  -538,  -139,
+    196,   396,   332,   213,   209,   -29,   -81,
+    150,   -95,  -312,    76,   -77,  -320,   -50,
+    46,     9,    47,   175,   139,    30,   384,
+    218,   206,   -24,  -250,   -96,  -276,  -183,
+    26,   119,    38,    14,    -4,  -133,   -52,
+    -477,  -614,  -987,  -715,  -631,  -813,   200,
+    -744, -1009, -1065,  -745,  -631,  -171,    18,
+    -137,  -251,  -483,  -613,  -980, -1203,    12,
+    -605,  -767,  -562,  -686, -1088,  -515,    58,
+    -202,  -428,  -782, -1072,   -96,  -234,  -179,
+    -480,  -709, -1070,  -897,  -131,   -92,   321,
+    -145,  -193,  -512,  -729,  -572,  -765,  -210,
+    -331,  -585,  -525,  -631,  -281,  -208,  -303,
+    1165,  1104,   939,   828,   716,   426,   155,
+    6,  -109,   820,   778,   415,   113,   -27,
+    381,   339,   314,   265,   121,    -9,  -474,
+    -373,    47,   584,   442,    99,  -231,  -113,
+    -496,   -38,  -285,   262,   305,   170,     4,
+    -587,  -556,    69,    66,   471,   354,    13,
+    -138,    70,   -18,   106,    67,   167,  -302,
+    -445,  -141,   185,   191,   151,    83,  -133,
+    -257,  -521,  -720,  -198,   134,   -46,  -182,
+    -819, -1168,  -777,   512,   359,    95,  -113,
+    137,    -2,   -74,  -138,  -401,  -114,  -371,
+    -242,  -466,   204,   223,   -31,  -212,  -192,
+    -532,  -637,  -466,  -686,   256,   277,  -139,
+    -1141, -1244,  -381,   -75,   -54,    14,    88,
+    -311,   115,  -143,  -499,  -343,   124,  -416,
+    -616,  -147,  -135,    43,    -4,   121,  -369,
+    835,   783,   641,   390,   355,   350,    64,
+    72,   194,   443,   467,   436,   219,   372,
+    464,   369,   192,     4,  -156,   -72,  -226,
+    57,   206,   303,   205,   188,   101,   265,
+    -40,  -205,  -488,  -184,   276,    64,   -26,
+    -217,  -433,  -297,   137,   328,   308,  -289,
+    378,    81,  -308,  -465,    57,   -37,   227,
+    -100,    24,   -36,  -151,   199,     8,   143,
+    -426,  -697, -1059,  -133,   388,   161,   321,
+    -644, -1023, -1271,    39,    66,  -123,    70,
+    372,   177,  -173,  -556,  -553,  -304,  -189,
+    -117,  -369,  -425,  -122,  -462,  -152,   -73,
+    -649,  -850, -1189,  -767,   497,   360,   222,
+    -798, -1139, -1455,  -190,   430,   234,   179,
+    42,   -94,  -405,  -692,    38,  -202,  -246,
+    -169,  -366,  -290,   -88,   -64,    32,  -292,
+    1010,   923,   938,   710,   465,   230,   342,
+    217,   300,  1054,   675,    68,  -458,  -179,
+    78,   453,   316,    18,  -237,  -496,  -243,
+    167,    21,   424,   215,   -91,  -303,  -170,
+    -290,   -81,   -70,   -67,    40,    54,   -59,
+    -353,  -427,   -90,    53,    94,     9,    54,
+    -28,   318,   283,    15,  -240,   -58,    79,
+    -75,  -121,   229,    35,    58,     6,  -133,
+    -351,  -514,  -744,  -834,  -705,  -137,   164,
+    -1124, -1388, -1055,  -230,   -73,    40,    36,
+    -163,  -233,  -532,  -785, -1170,  -697,    96,
+    -788,  -959,  -246,  -430,  -624,  -165,    -8,
+    -856,  -540,  -630,  -907,  -337,   -70,    76,
+    -937, -1042,  -659,  -733,  -208,   199,   -26,
+    -523,    78,   -98,  -501,  -869,  -890,   -81,
+    -624,  -703,   -45,  -348,   -25,    87,  -186,
+    1005,   823,   546,   249,    90,   -22,   207,
+    298,   397,   381,   319,   200,    62,   303,
+    473,   379,   133,  -247,  -632,  -441,    75,
+    284,   208,   391,   115,   -25,    44,    95,
+    -72,    79,   -95,   -63,  -129,  -293,   203,
+    -164,  -349,   115,   122,    69,    -1,   378,
+    348,   170,    99,    58,  -179,  -302,   188,
+    -190,    -2,   150,    23,   -51,   -11,   216,
+    -615,  -863, -1090, -1427,  -802,   -48,    -6,
+    -961, -1276, -1548,  -727,   -58,    56,   223,
+    -124,  -255,  -561,  -988, -1277,  -148,   -82,
+    -480,  -660,  -891, -1191, -1339,  -325,    20,
+    -621,  -917, -1296, -1350,   264,   289,    50,
+    -844, -1022, -1345, -1329,  -293,    46,   278,
+    -260,  -468,  -829, -1176,  -533,  -560,   -78,
+    -215,  -484,  -822, -1233,  -791,    15,  -138,
+    1301,  1317,  1262,  1048,   716,   357,   -64,
+    578,   824,   925,   802,   630,   362,   102,
+    470,   925,   767,   514,   327,   190,  -112,
+    225,   492,   495,   437,   598,   384,   -45,
+    43,    82,   -42,   175,   519,   342,   -64,
+    -304,  -154,   159,   576,   403,   221,   327,
+    214,   244,   122,   -62,   312,    92,  -160,
+    218,   208,   310,   268,   306,   323,  -199,
+    -285,  -269,   -79,  -124,  -143,  -153,   236,
+    -205,  -384,  -426,   344,    59,  -185,  -184,
+    -272,   247,   126,  -210,  -518,  -468,    78,
+    -99,  -120,   502,   160,  -280,  -557,   304,
+    -423,   -17,  -283,  -443,   215,   212,  -140,
+    -564,  -684,  -228,   510,   361,   130,   323,
+    -428,   335,    98,   -65,    36,  -215,  -246,
+    -362,    51,   364,   -16,  -234,   150,  -165,
+    914,   883,   751,   653,   676,   464,  -153,
+    631,   545,   535,   720,   596,   360,   -81,
+    783,   712,   512,   439,   341,   251,  -391,
+    497,   417,   249,   372,   295,   173,  -193,
+    128,  -110,  -385,    93,    39,   173,  -231,
+    216,   -59,  -253,   462,   389,   154,    69,
+    455,   270,    -4,  -337,   -49,   233,  -322,
+    307,   143,    53,   218,   128,   236,  -156,
+    -37,  -186,  -240,  -411,  -110,     9,   399,
+    -140,  -365,  -628,   258,   380,   214,   277,
+    131,   454,   177,  -285,  -520,   108,  -214,
+    77,  -141,   201,  -123,  -490,  -131,    60,
+    -14,  -194,  -521,  -741,   273,   362,   -33,
+    -362,  -566,  -287,  -228,   161,   237,   317,
+    -269,   195,   -75,  -375,  -204,    11,    77,
+    -128,  -264,  -156,  -223,  -475,   265,    27,
+    1238,  1147,   916,   689,   432,   210,  -280,
+    800,   664,   879,   726,   411,   160,  -164,
+    454,   686,   536,   275,   147,    46,   111,
+    303,   486,   512,   355,   241,   181,   -69,
+    79,    92,    29,   147,   233,    52,    17,
+    -171,   289,   131,   439,   271,     3,   -10,
+    413,   241,   144,   174,   155,    -2,    14,
+    58,   217,   247,   219,   149,   175,   -18,
+    228,    -8,  -240,  -206,  -513,  -191,   202,
+    -96,  -272,  -454,    33,  -300,  -575,    46,
+    -10,  -108,  -246,  -347,  -770,  -535,     9,
+    -326,  -430,   -61,  -321,  -704,  -299,   201,
+    -1,  -280,  -603,  -419,  -185,    18,   -36,
+    -516,  -522,  -379,  -291,  -181,   -97,    27,
+    -159,  -313,  -525,  -224,  -510,  -831,  -197,
+    -292,  -459,   -59,  -310,  -562,  -143,  -351,
+    1066,   912,   631,   389,   207,    86,  -224,
+    596,   512,   596,   505,   314,   122,   -48,
+    787,   861,   441,   -93,  -303,    33,  -190,
+    257,   469,   337,    51,    15,   298,   -93,
+    295,    73,  -119,    25,    36,    23,   108,
+    -28,    -3,   -32,   114,    21,   185,   107,
+    482,   305,    15,  -279,  -319,    52,    96,
+    226,    46,   115,    72,  -136,   133,  -125,
+    18,  -207,  -559,  -590,  -503,  -482,   321,
+    -571,  -789,  -951,  -172,  -441,  -538,   113,
+    181,    14,  -310,  -641, -1001,  -202,   159,
+    -136,  -393,  -433,  -513,  -911,  -144,   -22,
+    72,  -265,  -706,  -954,  -159,    53,   332,
+    -338,  -591,  -852,  -383,  -395,    56,    44,
+    43,  -158,  -464,  -897,  -631,  -157,  -294,
+    -161,  -128,  -328,  -573,  -483,  -125,    11,
+    1017,   906,  1051,  1005,   679,   341,  -102,
+    359,   334,  1567,  1314,   723,   105,    10,
+    -65,   726,   529,   301,   220,    43,  -273,
+    -510,   436,   719,   566,   358,   179,   114,
+    -560,   298,   133,  -120,   342,   225,    14,
+    -899,  -101,   217,   617,   400,   146,   -58,
+    -41,   352,    82,  -196,    39,   121,  -167,
+    -212,    59,   447,   284,   423,   250,  -169,
+    -371,  -484,  -596,    30,   -41,   249,    22,
+    -372,  -650,  -794,   477,   445,   216,   -79,
+    -352,   275,    17,  -443,  -929,    92,    19,
+    -699,  -696,   431,   264,   -49,  -310,   182,
+    -978,  -217,  -430,  -400,   101,   261,    72,
+    -929,  -889,  -357,   -13,   463,   378,   236,
+    -826,    56,    30,  -299,  -360,  -128,   -51,
+    -878,  -299,  -111,    75,    65,    36,     3,
+    817,   368,   -25,   354,   697,   591,  -173,
+    309,   212,   222,   751,   484,   140,   -56,
+    593,   379,    70,    -8,   258,   180,   110,
+    165,   -46,   255,   297,   219,   273,   105,
+    160,   -70,  -358,  -181,   379,   330,   319,
+    -238,  -369,  -198,   740,   580,   319,  -143,
+    201,   109,  -202,  -456,   328,   276,  -141,
+    203,   170,   111,    42,   207,   360,   188,
+    -345,  -399,  -513,  -233,   650,   422,    81,
+    -635,  -961, -1220,   463,   539,   204,   209,
+    202,   -25,  -194,  -498,  -787,   193,  -143,
+    -449,  -538,   195,  -106,  -331,    68,    62,
+    -228,  -477,  -840,  -576,   317,   128,   283,
+    -671,  -937,  -807,  -114,   391,   335,   -62,
+    246,     2,  -314,  -679,  -303,   180,   -88,
+    -107,  -272,    90,  -198,   -28,   290,  -112,
+    885,  1149,  1021,   712,   496,   281,   -83,
+    269,   492,   787,   643,   347,    70,   124,
+    336,   636,   499,    92,  -229,  -179,   191,
+    26,   402,   564,   340,   149,   -11,   135,
+    -440,   561,   470,   204,   -72,  -186,   140,
+    -720,    14,   355,   229,    68,  -133,   465,
+    110,   310,   103,    12,   106,    29,   158,
+    -178,   113,   161,   142,   121,   115,    27,
+    -651,  -414,  -645,  -152,  -164,   -13,  -429,
+    -639,  -944,  -681,  -104,   -81,    52,  -189,
+    -663,  -164,  -316,  -683,  -954,  -205,   -83,
+    -609,  -669,  -172,  -517,  -694,   283,   -80,
+    -646,  -152,  -383,  -678,  -246,   -40,  -143,
+    -747,  -796,  -745,  -390,   -98,    43,   275,
+    -599,  -199,  -398,  -433,  -436,  -538,    31,
+    -1107,  -568,  -376,  -265,  -126,   -21,     1,
+    847,   573,   308,   392,   305,   101,    55,
+    273,   293,   201,   267,   346,   201,   123,
+    727,   480,   226,     2,   -65,  -138,   164,
+    273,   208,   173,   292,    12,   253,   174,
+    340,   207,   180,    88,   116,    46,   475,
+    -460,  -166,   -30,    13,   110,   173,   396,
+    137,    88,    43,  -137,   -94,    34,   284,
+    96,   -14,   226,    40,    63,    70,   130,
+    -467,  -735, -1012, -1174,  -307,   305,   -67,
+    -612,  -920, -1146,  -567,    -8,    92,   -25,
+    -182,  -271,  -492,  -754,  -857,   287,   -75,
+    -494,  -787,  -689,  -683,  -709,   137,  -326,
+    -288,  -550,  -903, -1105,   334,   321,   -62,
+    -354,  -653,  -834,  -445,     1,   377,  -152,
+    -162,  -306,  -608,  -937,  -297,   247,  -192,
+    -234,  -477,  -244,  -488,  -266,   342,  -332
+};
+
+/*
+ * 2nd stage codebook; 1st split:   isf2_0 to isf2_2
+ */
+
+
+const int16 dico21_isf[SIZE_BK21*3] =
+{
+
+    329,   409,   249,
+    -33,   505,   160,
+    -29,   -14,   582,
+    -262,   127,   354,
+    145,   237,   175,
+    -152,   245,   122,
+    27,    42,   340,
+    -84,   -93,   311,
+    285,   222,  -156,
+    47,   -43,  -504,
+    234,   121,   385,
+    104,  -317,    45,
+    176,   195,     8,
+    104,   -59,   -94,
+    177,    53,   192,
+    -34,  -127,   152,
+    570,   277,   -34,
+    -67,  -329,  -639,
+    -157,  -272,   462,
+    -177,  -462,   198,
+    322,   179,   115,
+    -386,   171,    19,
+    19,   -12,   195,
+    -120,  -252,   201,
+    304,    36,  -336,
+    -128,  -221,  -380,
+    171,  -185,   296,
+    -242,  -312,    23,
+    198,    39,    16,
+    -3,  -177,  -111,
+    111,   -93,    76,
+    -92,  -223,     4,
+    177,   406,   -44,
+    -168,   380,  -149,
+    -4,   273,   331,
+    -420,   513,   277,
+    21,   247,    47,
+    -58,   131,    -2,
+    -3,   134,   180,
+    -145,    40,   175,
+    189,    74,  -145,
+    -27,   -45,  -325,
+    370,  -114,   -21,
+    -83,  -415,  -173,
+    77,    95,   -51,
+    -40,   -30,   -67,
+    71,    88,    86,
+    -35,   -98,    14,
+    69,   197,  -334,
+    -196,    79,  -231,
+    -348,  -137,   218,
+    -352,   -89,   -85,
+    47,   201,  -130,
+    -165,    37,   -15,
+    -43,     3,    86,
+    -161,  -108,    79,
+    83,    21,  -237,
+    -81,  -149,  -238,
+    150,  -186,  -251,
+    -186,  -249,  -162,
+    -19,    66,  -139,
+    -26,   -50,  -181,
+    24,    11,     0,
+    -130,  -105,   -98
+};
+
+
+
+/*
+ * 2nd stage codebook; 2nd split:   isf2_3 to isf2_5
+ */
+
+
+const int16 dico22_isf[SIZE_BK22*3] =
+{
+
+    -127,   310,    42,
+    -242,   197,     5,
+    -151,    84,   -17,
+    -214,   127,  -149,
+    -247,  -131,   159,
+    -268,  -267,   -95,
+    -217,     1,   -79,
+    -271,   -80,  -185,
+    -45,   436,   159,
+    165,   199,   391,
+    -33,    81,   187,
+    -66,   -42,   355,
+    -298,   -57,   343,
+    -108,  -537,   226,
+    -144,   -23,   193,
+    176,  -402,    87,
+    53,   296,    25,
+    -84,   253,  -104,
+    -58,   105,  -126,
+    -169,   174,  -314,
+    -48,    44,  -294,
+    -164,  -417,  -242,
+    -139,     3,  -194,
+    -155,  -207,  -211,
+    119,   322,   213,
+    333,    50,   380,
+    237,   247,    -2,
+    466,   -16,   201,
+    238,  -255,  -107,
+    67,  -440,  -149,
+    122,   -88,  -139,
+    88,  -247,   -73,
+    -41,   231,   167,
+    -62,   155,    16,
+    -65,    16,    77,
+    -68,    -2,   -63,
+    -151,  -300,   160,
+    -18,  -333,    54,
+    -56,   -94,     5,
+    2,  -190,    14,
+    92,   148,   209,
+    108,     9,   272,
+    108,    35,   110,
+    142,   -85,   145,
+    47,  -157,   279,
+    3,  -320,   246,
+    43,   -72,    68,
+    86,  -217,   135,
+    36,   140,    79,
+    56,   175,   -49,
+    26,    45,     3,
+    73,    55,  -101,
+    109,  -183,  -242,
+    -4,  -283,  -242,
+    48,   -68,   -48,
+    -6,  -153,  -122,
+    161,   196,    96,
+    232,    80,   190,
+    165,    97,    11,
+    258,   -31,    71,
+    267,   -77,   -91,
+    311,  -209,    87,
+    152,   -14,   -22,
+    150,  -149,     9,
+    -324,   557,   187,
+    -384,   307,    46,
+    -251,    27,    77,
+    -365,    77,   -52,
+    -482,   -84,   160,
+    -424,  -515,   -64,
+    -294,  -120,    -4,
+    -476,  -116,  -109,
+    -97,   318,   365,
+    106,   627,   445,
+    -190,   120,   287,
+    -146,    65,   619,
+    -427,   242,   363,
+    -361,  -371,   432,
+    -347,   102,   168,
+    -629,   195,   -14,
+    -65,   476,   -47,
+    -297,   320,  -168,
+    -55,   356,  -264,
+    -391,    82,  -286,
+    -51,   -31,  -556,
+    -178,  -399,  -586,
+    -205,   -49,  -360,
+    -343,  -238,  -337,
+    220,   457,    58,
+    561,   467,   259,
+    340,   270,  -168,
+    450,    77,  -280,
+    60,   167,  -413,
+    133,  -252,  -492,
+    216,   157,  -290,
+    282,     0,  -495,
+    -226,   293,   183,
+    -157,   135,   122,
+    -158,   -59,    39,
+    -133,  -118,   -97,
+    -332,  -309,   113,
+    -160,  -425,    -6,
+    -149,  -211,    24,
+    -80,  -277,   -90,
+    -11,   125,   338,
+    130,   -71,   465,
+    5,   -45,   184,
+    237,   -95,   253,
+    -139,  -197,   297,
+    -19,  -300,   511,
+    -63,  -152,   139,
+    250,  -289,   336,
+    124,   339,  -150,
+    34,   176,  -208,
+    171,   166,  -116,
+    94,    38,  -229,
+    75,   -65,  -339,
+    -78,  -205,  -385,
+    0,   -30,  -163,
+    -56,  -110,  -242,
+    321,   244,   194,
+    505,   238,    -1,
+    317,   116,    65,
+    309,    88,   -74,
+    452,   -51,   -50,
+    334,  -217,  -290,
+    211,    41,  -152,
+    238,   -55,  -260
+};
+
+
+/*
+ * 2nd stage codebook; 3rd split:   isf2_6 to isf2_8
+ */
+
+
+const int16 dico23_isf[SIZE_BK23*3] =
+{
+
+    -10,   151,   359,
+    136,   298,   223,
+    255,  -104,   290,
+    423,     6,   183,
+    -270,  -269,   -98,
+    -52,   -82,    13,
+    -82,  -274,   -97,
+    90,  -246,   -72,
+    -299,   -70,   421,
+    -88,   365,   430,
+    187,  -318,   381,
+    380,    37,   488,
+    -373,  -316,    79,
+    -308,  -101,     5,
+    -135,  -451,     8,
+    72,  -421,  -154,
+    180,   170,  -121,
+    62,   177,   -40,
+    326,    80,  -105,
+    248,   263,    -5,
+    -168,  -181,  -221,
+    -2,   -23,  -158,
+    -14,  -149,  -121,
+    119,   -91,  -147,
+    119,   332,  -153,
+    49,   303,    34,
+    442,   -55,   -69,
+    217,   454,    58,
+    -359,  -187,  -375,
+    -42,    50,  -274,
+    -8,  -267,  -249,
+    85,   -86,  -346,
+    -77,   -40,   345,
+    89,   134,   219,
+    156,   -80,   160,
+    108,    40,   116,
+    -158,  -206,    29,
+    5,   -32,   175,
+    -65,  -158,   146,
+    55,   -78,    73,
+    -114,  -222,   353,
+    -47,    81,   211,
+    49,  -151,   268,
+    105,     4,   302,
+    -263,  -132,   183,
+    -151,   -28,   201,
+    -177,  -307,   166,
+    101,  -221,   130,
+    74,    58,   -98,
+    32,    44,    13,
+    194,    30,  -142,
+    170,    96,     8,
+    -136,  -119,   -91,
+    -65,     8,   -55,
+    3,  -188,    12,
+    45,   -63,   -49,
+    149,   -21,   -19,
+    24,   144,    95,
+    254,   -22,    60,
+    161,   196,    96,
+    -158,   -61,    48,
+    -70,    33,    82,
+    -23,  -321,    58,
+    155,  -147,     5,
+    -364,   328,    77,
+    -21,   453,   173,
+    -108,    82,   630,
+    367,   263,   208,
+    -300,   -62,  -176,
+    -205,   143,  -158,
+    -169,  -410,  -264,
+    257,  -269,  -100,
+    -636,   289,    -2,
+    -292,   627,   173,
+    -382,  -363,   387,
+    248,   524,   447,
+    -521,  -111,  -107,
+    -395,   118,  -274,
+    -343,  -680,  -125,
+    -172,  -447,  -663,
+    75,   148,  -367,
+    -79,   263,   -94,
+    249,   148,  -286,
+    380,   271,  -162,
+    -142,    -4,  -186,
+    -57,   111,  -125,
+    -35,  -108,  -254,
+    100,    29,  -242,
+    -80,   303,  -264,
+    -78,   464,   -57,
+    248,   -22,  -494,
+    661,   662,    44,
+    -193,   -40,  -330,
+    -178,   145,  -337,
+    -90,  -199,  -400,
+    -40,   -23,  -498,
+    -192,   114,   315,
+    -41,   244,   190,
+    88,   -97,   485,
+    241,    80,   212,
+    -246,    40,    87,
+    -156,   147,   134,
+    -2,  -334,   239,
+    308,  -203,   110,
+    -459,   251,   422,
+    -218,   310,   228,
+    -86,  -346,   654,
+    184,   175,   425,
+    -481,   -63,   169,
+    -349,   117,   188,
+    -125,  -560,   310,
+    158,  -416,    94,
+    46,   171,  -192,
+    -63,   157,    14,
+    256,   -35,  -271,
+    322,   123,    53,
+    -214,     4,   -76,
+    -156,    86,   -18,
+    128,  -197,  -232,
+    265,   -90,   -98,
+    -308,   332,  -145,
+    -131,   308,    58,
+    509,    59,  -339,
+    562,   196,   -14,
+    -378,   100,   -47,
+    -234,   202,     1,
+    104,  -270,  -493,
+    319,  -210,  -325
+};
+
+
+/*
+ * 2nd stage codebook; 4th split:   isf2_9 to isf2_11
+ */
+
+const int16 dico24_isf[SIZE_BK24*3] =
+{
+
+    -79,   -89,    -4,
+    -171,    77,  -211,
+    160,  -193,    98,
+    120,  -103,   323,
+    32,   -22,  -129,
+    72,    78,  -268,
+    182,   -76,   -66,
+    309,    99,  -145,
+    -229,  -157,   -84,
+    -383,    98,   -71,
+    -90,  -352,    12,
+    -284,  -178,   178,
+    -65,  -125,  -166,
+    -87,  -175,  -351,
+    42,  -198,   -48,
+    154,  -140,  -243,
+    -77,    18,   108,
+    -39,   355,    91,
+    87,     8,   155,
+    -4,   158,   239,
+    128,    95,   -54,
+    7,   246,  -124,
+    258,    15,    89,
+    206,   216,    98,
+    -201,     9,    18,
+    -312,   233,   204,
+    -39,  -174,   155,
+    -144,    -9,   284,
+    -57,    70,   -69,
+    -157,   187,    18,
+    54,   -30,    23,
+    24,   135,    55
+};
+
+
+/*
+ * 2nd stage codebook; 5th split:   isf2_12 to isf2_15
+ */
+
+const int16 dico25_isf[SIZE_BK25*4] =
+{
+
+    169,   142,  -119,   115,
+    206,   -20,    94,   226,
+    -106,   313,   -21,    16,
+    -62,   161,    71,   255,
+    -89,   101,  -185,   125,
+    72,   -30,  -201,   344,
+    -258,    33,    -8,    81,
+    -104,  -154,    72,   296,
+    144,   -68,  -268,   -25,
+    81,   -78,   -87,   106,
+    22,   155,  -186,  -119,
+    -46,   -28,    27,    91,
+    -114,   -37,  -175,   -33,
+    -94,  -222,  -189,   122,
+    -132,  -119,  -191,  -270,
+    -172,  -173,    18,   -43,
+    279,   135,   -42,  -128,
+    187,   -86,   229,  -138,
+    159,   240,   140,    46,
+    69,    25,   227,    77,
+    21,   115,    13,     8,
+    68,  -248,   126,    81,
+    -150,   137,   207,    -9,
+    -154,  -133,   289,    67,
+    143,   -37,   -86,  -326,
+    180,   -32,    19,   -23,
+    26,   168,   116,  -233,
+    -32,   -26,   118,   -78,
+    3,    -8,   -45,  -115,
+    57,  -215,   -54,   -83,
+    -209,   112,   -22,  -167,
+    -91,  -151,   168,  -262
+};
+
+
+
+/* 36 bit */
+/*
+ *  isf codebooks:  two-stage VQ with split-by-3 in 2nd stage
+ *                1st stage is kept the same as the 46 bit quantizer
+ *
+ *  codebook   vector dimension    number of vectors
+ *  ~~~~~~~~   ~~~~~~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~
+ *     1_1            9                  256
+ *     1_2            7                  256
+ *     2_1            5                  128
+ *     2_2            4                  128
+ *     2_3            7                  64
+ */
+
+const int16 dico21_isf_36b[SIZE_BK21_36b*5] =
+{
+
+    -52,   -96,   212,   315,   -73,
+    82,  -204,   363,   136,  -197,
+    -126,  -331,   183,   218,   143,
+    -49,   -41,   557,   230,    72,
+    2,   -73,   163,   377,   221,
+    133,   111,   278,   215,  -110,
+    -102,   -20,   284,   113,   273,
+    84,   319,   290,    18,    85,
+    -25,    -5,   125,   132,  -204,
+    -38,    -5,   286,    -9,  -356,
+    -140,  -256,    92,   117,  -189,
+    -144,   191,   313,    51,   -98,
+    167,   -10,    44,   247,    36,
+    381,   197,   238,    74,     6,
+    38,  -408,    29,    -3,   -85,
+    92,   266,   157,   -25,  -200,
+    161,  -121,    70,    84,  -140,
+    -16,   -86,   112,   -94,  -189,
+    -269,  -270,   351,   107,   -24,
+    -68,   -67,   492,  -103,  -155,
+    -53,  -131,    62,   122,    10,
+    135,    84,   283,   -55,  -120,
+    -12,  -219,   331,   -81,   167,
+    220,  -136,   147,  -172,   -42,
+    140,   -95,  -109,   -88,  -194,
+    0,    -2,    -4,   -33,  -381,
+    -66,  -217,   152,  -186,  -402,
+    244,   108,   156,  -140,  -395,
+    113,  -136,  -196,   110,   -24,
+    214,   118,    11,   -64,  -131,
+    -110,  -286,    -6,  -332,    16,
+    94,    97,    79,  -291,  -205,
+    -5,   -39,   -20,   252,   -96,
+    76,   174,   101,   163,    61,
+    -69,  -239,   -55,   399,     6,
+    -115,   319,   164,   275,   196,
+    -15,    36,   -47,   331,   121,
+    226,   209,   271,   325,   184,
+    13,   -80,  -218,   471,   353,
+    288,   378,    16,   -51,   251,
+    174,   116,    52,   149,  -279,
+    235,   276,    39,   120,   -48,
+    0,  -108,  -108,   241,  -339,
+    -93,   534,    45,    33,   -87,
+    194,   149,   -71,   405,   -44,
+    409,   370,    81,  -186,  -154,
+    25,  -102,  -448,   124,  -173,
+    22,   408,  -110,  -310,  -214,
+    -26,    23,   -83,   114,    14,
+    -110,   164,    52,   223,   -82,
+    37,   -25,  -263,   306,   -15,
+    -466,   415,   292,   165,   -18,
+    29,   -19,  -171,   155,   182,
+    179,   144,   -27,   231,   258,
+    -103,  -247,  -396,   238,   113,
+    375,  -154,  -109,    -4,   156,
+    98,    85,  -292,    -5,  -124,
+    116,   139,  -116,   -98,  -294,
+    -14,   -83,  -278,  -117,  -378,
+    106,    33,  -106,  -344,  -484,
+    119,    17,  -412,   138,   166,
+    384,   101,  -204,    88,  -156,
+    -121,  -284,  -300,    -1,  -166,
+    280,    33,  -152,  -313,   -81,
+    -37,    22,   229,   153,    37,
+    -60,   -83,   236,    -8,   -41,
+    -169,  -228,   126,   -20,   363,
+    -235,    17,   364,  -156,   156,
+    -25,   -30,    72,   144,   156,
+    153,   -26,   256,    97,   144,
+    -21,   -37,    48,   -65,   250,
+    63,    77,   273,  -128,   124,
+    -129,   -26,    40,     9,  -115,
+    -6,    82,    38,   -90,  -182,
+    -336,   -13,    28,   158,    91,
+    -30,   241,   137,  -170,   -17,
+    146,    14,   -11,    33,    61,
+    192,   197,    54,   -84,    85,
+    23,  -200,   -78,   -29,   140,
+    122,   237,   106,  -341,   136,
+    -57,  -142,   -85,   -16,   -74,
+    -59,   -90,    -8,  -187,   -20,
+    -211,  -267,   216,  -179,  -110,
+    -50,    -7,   220,  -267,   -70,
+    -57,   -42,   -17,   -15,    71,
+    32,    21,    63,  -137,    33,
+    -137,  -175,   104,   -68,    97,
+    -67,   -43,   133,  -301,   221,
+    -116,  -200,   -81,   -92,  -272,
+    -64,   -41,   -54,  -244,  -220,
+    -287,  -242,   -50,   -87,   -89,
+    -245,   236,   102,  -166,  -295,
+    66,    24,  -162,   -71,    95,
+    66,   136,   -90,  -220,   -36,
+    -98,  -161,  -222,  -188,    29,
+    -18,    18,   -19,  -415,     9,
+    49,    61,   100,    39,   -56,
+    -111,    82,   135,   -31,    52,
+    -90,  -153,   -93,   189,   182,
+    -214,   295,   119,   -74,   284,
+    2,   137,    37,    47,   182,
+    92,   117,   184,   -53,   373,
+    -21,   -14,   -35,   136,   391,
+    146,   129,  -164,   -28,   333,
+    92,    80,   -84,   100,  -134,
+    -8,   217,   -32,     3,   -47,
+    -151,   251,  -215,   142,    92,
+    -224,   310,  -172,  -275,    98,
+    159,   155,  -177,   112,    53,
+    205,    27,     8,  -240,   192,
+    169,   120,  -319,  -201,   106,
+    11,    36,   -86,  -237,   455,
+    -109,  -154,  -163,   174,   -55,
+    -38,    32,  -101,   -78,   -59,
+    -205,  -321,   -97,    69,    79,
+    -310,    44,    18,  -185,    34,
+    -115,   -20,  -148,   -39,   203,
+    -29,   154,   -30,  -158,   166,
+    -45,  -131,  -317,   -24,   363,
+    -165,  -205,  -112,  -222,   265,
+    -32,   -44,  -150,    54,  -193,
+    -6,   -38,  -255,  -169,  -115,
+    -266,    87,  -189,   -36,  -169,
+    -60,   -87,  -266,  -436,  -170,
+    -68,   -81,  -278,    24,    38,
+    -23,   -19,  -155,  -256,   141,
+    -61,  -226,  -565,  -175,    71,
+    9,   -29,  -237,  -515,   263
+};
+
+const int16 dico22_isf_36b[SIZE_BK22_36b*4] =
+{
+
+    -298,    -6,    95,    31,
+    -213,   -87,  -122,   261,
+    4,   -49,   208,    14,
+    -129,  -110,    30,   118,
+    -214,   258,   110,  -235,
+    -41,   -18,  -126,   120,
+    103,    65,   127,   -37,
+    126,   -36,   -24,    25,
+    -138,   -67,  -278,  -186,
+    -164,  -194,  -201,    78,
+    -211,   -87,   -51,  -221,
+    -174,   -79,   -94,   -39,
+    23,    -6,  -157,  -240,
+    22,  -110,  -153,   -68,
+    148,    -5,    -2,  -149,
+    -1,  -135,   -39,  -179,
+    68,   360,  -117,   -15,
+    137,    47,  -278,   146,
+    136,   260,   135,    65,
+    61,   116,   -45,    97,
+    231,   379,    87,  -120,
+    338,   177,  -272,     3,
+    266,   156,    28,   -69,
+    260,    84,   -85,    86,
+    -266,   154,  -256,  -182,
+    -17,   -65,  -304,    -6,
+    -40,   175,  -151,  -180,
+    -27,    27,   -87,   -63,
+    121,   114,  -166,  -469,
+    159,   -66,  -323,  -231,
+    214,   152,  -141,  -212,
+    137,    36,  -184,   -51,
+    -282,  -237,    40,    10,
+    -48,  -235,   -37,   251,
+    -54,  -323,   136,    29,
+    -88,  -174,   213,   198,
+    -390,    99,   -63,  -375,
+    107,  -169,  -164,   424,
+    69,  -111,   141,  -167,
+    74,  -129,    65,   144,
+    -353,  -207,  -205,  -109,
+    -160,  -386,  -355,    98,
+    -176,  -493,   -20,  -143,
+    -252,  -432,    -2,   216,
+    -90,  -174,  -168,  -411,
+    13,  -284,  -229,  -160,
+    -87,  -279,    34,  -251,
+    -75,  -263,   -58,   -42,
+    420,    53,  -211,  -358,
+    384,   -35,  -374,   396,
+    68,  -228,   323,    -2,
+    167,  -307,   192,   194,
+    459,   329,    -5,  -332,
+    375,    79,    -7,   313,
+    282,  -124,   200,   -92,
+    271,  -162,   -70,   180,
+    -157,  -298,  -514,  -309,
+    58,  -163,  -546,    18,
+    124,  -364,   167,  -238,
+    83,  -411,  -117,    96,
+    140,  -112,  -388,  -624,
+    259,  -133,  -317,    41,
+    163,  -130,   -64,  -334,
+    226,  -165,  -124,  -110,
+    -466,   -61,     6,   229,
+    -153,   205,  -145,   242,
+    -159,    48,   195,   148,
+    -58,    28,    31,   279,
+    -303,   185,   279,    -4,
+    -61,   197,    59,    86,
+    -114,   123,   168,   -52,
+    35,    36,   100,   126,
+    -407,   102,   -77,   -40,
+    -338,    -1,  -342,   156,
+    -179,   105,   -34,   -97,
+    -185,    84,   -35,   108,
+    -133,   107,   -91,  -357,
+    -180,    54,  -229,    24,
+    -44,    47,    47,  -182,
+    -66,    13,    45,     4,
+    -339,   251,    64,   226,
+    -42,   101,  -350,   275,
+    -99,   398,   142,   121,
+    111,    12,  -102,   260,
+    0,   505,   260,   -94,
+    161,   285,   -96,   224,
+    -4,   206,   314,    33,
+    167,   139,    88,   204,
+    -235,   316,   -60,   -25,
+    -8,  -150,  -312,   201,
+    -36,   292,    61,  -104,
+    -40,   174,  -162,    42,
+    -21,   402,   -29,  -351,
+    21,   152,  -360,   -93,
+    57,   191,   212,  -196,
+    76,   158,   -21,   -69,
+    -328,  -185,   331,   119,
+    -53,   285,    56,   337,
+    -107,   -24,   405,    29,
+    -18,   137,   272,   277,
+    -255,    22,   173,  -191,
+    295,   322,   325,   302,
+    21,   -27,   332,  -178,
+    119,    13,   271,   129,
+    -455,  -180,   116,  -191,
+    -227,    62,  -148,   524,
+    -176,  -287,   282,  -157,
+    -243,    13,   199,   430,
+    -59,   -49,   115,  -365,
+    72,  -172,  -137,    93,
+    -138,  -126,   141,   -84,
+    5,  -124,    38,   -20,
+    -258,   311,   601,   213,
+    94,   130,   -61,   502,
+    -1,  -157,   485,   313,
+    146,   -74,   158,   345,
+    276,   135,   280,   -57,
+    490,   252,    99,    43,
+    267,   -74,   429,   105,
+    278,   -23,   119,    94,
+    -542,   488,   257,  -115,
+    -84,  -244,  -438,   478,
+    -113,  -545,   387,   101,
+    -95,  -306,   111,   498,
+    95,   166,    22,  -301,
+    420,   -15,   -58,   -78,
+    270,    29,   122,  -282,
+    160,  -240,    50,   -38
+};
+
+const int16 dico23_isf_36b[SIZE_BK23_36b*7] =
+{
+
+    81,   -18,    68,   -27,  -122,  -280,    -4,
+    45,  -177,   209,   -30,  -136,   -74,   131,
+    -44,   101,   -75,   -88,   -48,  -137,   -54,
+    -245,   -28,    63,   -18,  -112,  -103,    58,
+    -79,    -6,   220,   -65,   114,   -35,   -50,
+    109,   -65,   143,  -114,   129,    76,   125,
+    166,    90,   -61,  -242,   186,   -74,   -43,
+    -46,   -92,    49,  -227,    24,  -155,    39,
+    67,    85,    99,   -42,    53,  -184,  -281,
+    142,  -122,     0,    21,  -142,   -15,   -17,
+    223,    92,   -21,   -48,   -82,   -14,  -167,
+    51,   -37,  -243,   -30,   -90,    18,   -56,
+    54,   105,    74,    86,    69,    13,  -101,
+    196,    72,   -89,    43,    65,    19,    39,
+    121,    34,   131,   -82,    25,   213,  -156,
+    101,  -102,  -136,   -21,    57,   214,    22,
+    36,  -124,   205,   204,    58,  -156,   -83,
+    83,  -117,   137,   137,    85,   116,    44,
+    -92,  -148,   -68,    11,  -102,  -197,  -220,
+    -76,  -185,   -58,   132,   -26,  -183,    85,
+    -7,   -31,    -2,    23,   205,  -151,    10,
+    -27,   -37,    -5,   -18,   292,   131,     1,
+    117,  -168,     9,   -93,    80,   -59,  -125,
+    -182,  -244,    98,   -24,   135,   -22,    94,
+    221,    97,   106,    42,    43,  -160,    83,
+    25,   -64,   -21,     6,    14,   -15,   154,
+    126,    15,  -140,   150,   -10,  -207,  -114,
+    79,   -63,  -211,   -70,   -28,  -217,   165,
+    46,    38,   -22,   281,   132,   -62,   109,
+    112,    54,  -112,   -93,   208,    27,   296,
+    115,    10,  -147,    41,   216,    42,  -276,
+    50,  -115,  -254,   167,   117,    -2,    61,
+    17,   144,    34,   -72,  -186,  -150,   272,
+    -29,   -66,   -89,   -95,  -149,   129,   251,
+    122,     0,   -50,  -234,   -91,    36,    26,
+    -105,  -102,   -88,  -121,  -236,    -7,   -11,
+    -204,   109,     5,  -191,   105,   -15,   163,
+    -80,    32,   -24,  -209,    41,   294,    70,
+    -106,   -94,  -204,  -118,   120,   -50,   -37,
+    -82,  -241,    46,  -131,   -29,   150,   -55,
+    33,   155,   120,   -89,    -8,     7,    62,
+    213,    82,    61,    18,  -161,   144,   152,
+    30,   131,    65,   -87,  -255,   -17,  -107,
+    -8,    85,   -64,    51,  -162,   223,   -53,
+    -134,   261,    69,   -56,   218,    72,  -111,
+    2,   155,  -113,   -87,    49,    85,   -28,
+    -163,    42,    -1,  -196,     7,    39,  -245,
+    14,  -137,   -79,    11,  -160,   202,  -293,
+    -94,    33,   208,   100,    56,   -44,   326,
+    -78,   -41,   232,    13,  -142,   227,    80,
+    -16,   -87,   201,    33,  -133,    15,  -183,
+    -58,  -192,   -47,   184,  -128,   133,    99,
+    -205,    11,  -155,    78,    52,    72,   141,
+    -246,    26,    99,   151,    59,   115,   -64,
+    -79,   -47,   -16,   -14,     6,    47,   -43,
+    -72,  -178,   -27,   162,   112,    43,  -174,
+    -175,   238,   186,    71,   -54,  -188,   -76,
+    -225,   233,    39,   -39,  -158,   122,    44,
+    -26,    43,    84,   130,   -93,   -51,    22,
+    3,    92,  -150,   136,  -182,   -57,    97,
+    -131,   179,   -78,    80,    91,  -165,    90,
+    -2,   148,    15,   130,    65,   175,   117,
+    -138,   114,  -137,   132,     3,   -10,  -186,
+    140,    -4,   -37,   254,   -62,    92,  -109
+};
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/scale_signal.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/scale_signal.cpp
new file mode 100644 (file)
index 0000000..d225d28
--- /dev/null
@@ -0,0 +1,146 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: scale_signal.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 signal[],             (i/o) : signal to scale
+     int16 lg,                   (i)   : size of x[]
+     int16 exp                   (i)   : exponent: x = round(x << exp)
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   Scale signal to get maximum of dynamic range
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void scale_signal(
+    int16 x[],              /* (i/o) : signal to scale               */
+    int16 lg,               /* (i)   : size of x[]                   */
+    int16 exp               /* (i)   : exponent: x = round(x << exp) */
+)
+{
+    int16 i;
+    int16 tmp;
+    int16 *pt_x;
+
+
+    int32 L_tmp;
+
+
+    if (exp > 0)
+    {
+        for (i = 0; i < lg; i++)
+        {
+            L_tmp = shl_int32(((int32)x[i] << 16), exp);       /* saturation can occur here */
+            x[i] = amr_wb_round(L_tmp);
+        }
+    }
+    else if (exp < 0)
+    {
+        exp = -exp;
+        exp &= 0xf;
+        tmp = (int16)(0x00008000 >> (16 - exp));
+        pt_x = x;
+
+        for (i = lg >> 1; i != 0; i--)
+        {
+            *(pt_x)   = add_int16(*(pt_x), tmp) >> exp;
+            pt_x++;
+            *(pt_x)   = add_int16(*(pt_x), tmp) >> exp;
+            pt_x++;
+        }
+
+    }
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.cpp
new file mode 100644 (file)
index 0000000..987729f
--- /dev/null
@@ -0,0 +1,432 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: synthesis_amr_wb.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 Aq[],                           A(z)  : quantized Az
+     int16 exc[],                          (i)   : excitation at 12kHz
+     int16 Q_new,                          (i)   : scaling performed on exc
+     int16 synth16k[],                     (o)   : 16kHz synthesis signal
+     int16 prms,                           (i)   : compressed amr wb
+     int16 HfIsf[],
+     int16 nb_bits,
+     int16 newDTXState,
+     Decoder_State * st,                   (i/o) : State structure
+     int16 bfi,                            (i)   : bad frame indicator
+     int16 *ScratchMem
+
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Synthesis of signal at 16kHz with HF extension
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_mem_funcs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+#include "e_pv_amrwbdec.h"
+#include "get_amr_wb_bits.h"
+#include "pvamrwb_math_op.h"
+#include "pvamrwbdecoder_api.h"
+#include "synthesis_amr_wb.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+/* High Band encoding */
+const int16 HP_gain[16] =
+{
+    3624, 4673, 5597, 6479, 7425, 8378, 9324, 10264,
+    11210, 12206, 13391, 14844, 16770, 19655, 24289, 32728
+};
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void synthesis_amr_wb(
+    int16 Aq[],              /* A(z)  : quantized Az               */
+    int16 exc[],             /* (i)   : excitation at 12kHz        */
+    int16 Q_new,             /* (i)   : scaling performed on exc   */
+    int16 synth16k[],        /* (o)   : 16kHz synthesis signal     */
+    int16 prms,              /* (i)   : parameter                  */
+    int16 HfIsf[],
+    int16 nb_bits,
+    int16 newDTXState,
+    Decoder_State * st,      /* (i/o) : State structure            */
+    int16 bfi,               /* (i)   : bad frame indicator        */
+    int16 *ScratchMem
+)
+{
+    int16 i, fac, exp;
+    int16 tmp;
+    int16 ener, exp_ener;
+    int32 L_tmp;
+    int32 L_tmp2;
+
+    int16 HF_corr_gain;
+    int16 HF_gain_ind;
+    int16 gain1, gain2;
+
+    int16 *pt_synth;
+    int16 *pt_HF;
+    int16 *synth_hi =  ScratchMem;
+    int16 *synth_lo = &ScratchMem[M + L_SUBFR];
+    int16 *synth    = &synth_lo[M + L_SUBFR];
+    int16 *HF       = &synth[L_SUBFR];
+    int16 *Ap       = &HF[L_SUBFR16k];       /* High Frequency vector   */
+    int16 *HfA      = &Ap[M16k + 1];
+    int16 *pt_tmp;
+
+    /*------------------------------------------------------------*
+     * speech synthesis                                           *
+     * ~~~~~~~~~~~~~~~~                                           *
+     * - Find synthesis speech corresponding to exc2[].           *
+     * - Perform fixed deemphasis and hp 50hz filtering.          *
+     * - Oversampling from 12.8kHz to 16kHz.                      *
+     *------------------------------------------------------------*/
+
+    pv_memcpy((void *)synth_hi,
+              (void *)st->mem_syn_hi,
+              M*sizeof(*synth_hi));
+
+    pv_memcpy((void *)synth_lo,
+              (void *)st->mem_syn_lo,
+              M*sizeof(*synth_lo));
+
+    Syn_filt_32(Aq, M, exc, Q_new, synth_hi + M, synth_lo + M, L_SUBFR);
+
+    pv_memcpy((void *)st->mem_syn_hi,
+              (void *)(synth_hi + L_SUBFR),
+              M*sizeof(*st->mem_syn_hi));
+
+    pv_memcpy((void *)st->mem_syn_lo,
+              (void *)(synth_lo + L_SUBFR),
+              M*sizeof(*st->mem_syn_lo));
+
+    deemphasis_32(synth_hi + M,
+                  synth_lo + M,
+                  synth,
+                  PREEMPH_FAC,
+                  L_SUBFR,
+                  &(st->mem_deemph));
+
+    highpass_50Hz_at_12k8(synth,
+                          L_SUBFR,
+                          st->mem_sig_out);
+
+    oversamp_12k8_to_16k(synth,
+                         L_SUBFR,
+                         synth16k,
+                         st->mem_oversamp,
+                         ScratchMem);
+
+    /*
+     * HF noise synthesis
+     * - Generate HF noise between 5.5 and 7.5 kHz.
+     * - Set energy of noise according to synthesis tilt.
+     *     tilt > 0.8 ==> - 14 dB (voiced)
+     *     tilt   0.5 ==> - 6 dB  (voiced or noise)
+     *     tilt < 0.0 ==>   0 dB  (noise)
+     */
+
+    /* generate white noise vector */
+    pt_tmp = HF;
+    for (i = L_SUBFR16k >> 2; i != 0 ; i--)
+    {
+        *(pt_tmp++) = noise_gen_amrwb(&(st->seed2)) >> 3;
+        *(pt_tmp++) = noise_gen_amrwb(&(st->seed2)) >> 3;
+        *(pt_tmp++) = noise_gen_amrwb(&(st->seed2)) >> 3;
+        *(pt_tmp++) = noise_gen_amrwb(&(st->seed2)) >> 3;
+    }
+    /* energy of excitation */
+
+    pt_tmp = exc;
+
+    for (i = L_SUBFR >> 2; i != 0; i--)
+    {
+        *(pt_tmp) = add_int16(*(pt_tmp), 0x0004) >> 3;
+        pt_tmp++;
+        *(pt_tmp) = add_int16(*(pt_tmp), 0x0004) >> 3;
+        pt_tmp++;
+        *(pt_tmp) = add_int16(*(pt_tmp), 0x0004) >> 3;
+        pt_tmp++;
+        *(pt_tmp) = add_int16(*(pt_tmp), 0x0004) >> 3;
+        pt_tmp++;
+    }
+
+
+    Q_new -= 3;
+
+    ener = extract_h(Dot_product12(exc, exc, L_SUBFR, &exp_ener));
+    exp_ener -= Q_new << 1;
+
+    /* set energy of white noise to energy of excitation */
+
+    tmp = extract_h(Dot_product12(HF, HF, L_SUBFR16k, &exp));
+
+    if (tmp > ener)
+    {
+        tmp >>=  1;                 /* Be sure tmp < ener */
+        exp += 1;
+    }
+    L_tmp = L_deposit_h(div_16by16(tmp, ener)); /* result is normalized */
+    exp -= exp_ener;
+    one_ov_sqrt_norm(&L_tmp, &exp);
+    L_tmp = shl_int32(L_tmp, exp + 1); /* L_tmp x 2, L_tmp in Q31 */
+
+    tmp = (int16)(L_tmp >> 16);    /* tmp = 2 x sqrt(ener_exc/ener_hf) */
+
+
+
+    pt_tmp = HF;
+    for (i = L_SUBFR16k >> 2; i != 0 ; i--)
+    {
+        *(pt_tmp) = (int16)(fxp_mul_16by16(*(pt_tmp), tmp) >> 15);
+        pt_tmp++;
+        *(pt_tmp) = (int16)(fxp_mul_16by16(*(pt_tmp), tmp) >> 15);
+        pt_tmp++;
+        *(pt_tmp) = (int16)(fxp_mul_16by16(*(pt_tmp), tmp) >> 15);
+        pt_tmp++;
+        *(pt_tmp) = (int16)(fxp_mul_16by16(*(pt_tmp), tmp) >> 15);
+        pt_tmp++;
+    }
+
+    /* find tilt of synthesis speech (tilt: 1=voiced, -1=unvoiced) */
+
+    highpass_400Hz_at_12k8(synth, L_SUBFR, st->mem_hp400);
+
+    L_tmp = 1L;
+    L_tmp2 = 1L;
+
+
+    L_tmp = mac_16by16_to_int32(L_tmp, synth[0], synth[0]);
+
+    for (i = 1; i < L_SUBFR; i++)
+    {
+        L_tmp  = mac_16by16_to_int32(L_tmp,  synth[i], synth[i    ]);
+        L_tmp2 = mac_16by16_to_int32(L_tmp2, synth[i], synth[i - 1]);
+    }
+
+
+    exp = normalize_amr_wb(L_tmp);
+
+    ener = (int16)((L_tmp << exp) >> 16);   /* ener = r[0] */
+    tmp  = (int16)((L_tmp2 << exp) >> 16);    /* tmp = r[1] */
+
+    if (tmp > 0)
+    {
+        fac = div_16by16(tmp, ener);
+    }
+    else
+    {
+        fac = 0;
+    }
+
+    /* modify energy of white noise according to synthesis tilt */
+    gain1 = 32767 - fac;
+    gain2 = mult_int16(gain1, 20480);
+    gain2 = shl_int16(gain2, 1);
+
+    if (st->vad_hist > 0)
+    {
+        tmp  = gain2 - 1;
+    }
+    else
+    {
+        tmp  = gain1 - 1;
+    }
+
+
+    if (tmp != 0)
+    {
+        tmp++;
+    }
+
+    if (tmp < 3277)
+    {
+        tmp = 3277;                        /* 0.1 in Q15 */
+
+    }
+
+
+    if ((nb_bits >= NBBITS_24k) && (bfi == 0))
+    {
+        /* HF correction gain */
+        HF_gain_ind = prms;
+        HF_corr_gain = HP_gain[HF_gain_ind];
+
+        pt_tmp = HF;
+        for (i = L_SUBFR16k >> 2; i != 0 ; i--)
+        {
+            *(pt_tmp) = mult_int16(*(pt_tmp), HF_corr_gain) << 1;
+            pt_tmp++;
+            *(pt_tmp) = mult_int16(*(pt_tmp), HF_corr_gain) << 1;
+            pt_tmp++;
+            *(pt_tmp) = mult_int16(*(pt_tmp), HF_corr_gain) << 1;
+            pt_tmp++;
+            *(pt_tmp) = mult_int16(*(pt_tmp), HF_corr_gain) << 1;
+            pt_tmp++;
+        }
+
+        /* HF gain */
+    }
+    else
+    {
+        pt_tmp = HF;
+        for (i = L_SUBFR16k >> 2; i != 0 ; i--)
+        {
+            *(pt_tmp) = mult_int16(*(pt_tmp), tmp);
+            pt_tmp++;
+            *(pt_tmp) = mult_int16(*(pt_tmp), tmp);
+            pt_tmp++;
+            *(pt_tmp) = mult_int16(*(pt_tmp), tmp);
+            pt_tmp++;
+            *(pt_tmp) = mult_int16(*(pt_tmp), tmp);
+            pt_tmp++;
+        }
+    }
+
+
+    if ((nb_bits <= NBBITS_7k) && (newDTXState == SPEECH))
+    {
+        isf_extrapolation(HfIsf);
+        Isp_Az(HfIsf, HfA, M16k, 0);
+
+        weight_amrwb_lpc(HfA, Ap, 29491, M16k);     /* fac=0.9 */
+
+        wb_syn_filt(Ap,
+                    M16k,
+                    HF,
+                    HF,
+                    L_SUBFR16k,
+                    st->mem_syn_hf,
+                    1,
+                    ScratchMem);
+    }
+    else
+    {
+        /* synthesis of noise: 4.8kHz..5.6kHz --> 6kHz..7kHz */
+        weight_amrwb_lpc(Aq, Ap, 19661, M);         /* fac=0.6 */
+
+        wb_syn_filt(Ap,
+                    M,
+                    HF,
+                    HF,
+                    L_SUBFR16k,
+                    st->mem_syn_hf + (M16k - M),
+                    1,
+                    ScratchMem);
+    }
+
+    /* noise Band Pass filtering (1ms of delay) */
+    band_pass_6k_7k(HF,
+                    L_SUBFR16k,
+                    st->mem_hf,
+                    ScratchMem);
+
+
+    if (nb_bits >= NBBITS_24k)
+    {
+        /* Low Pass filtering (7 kHz) */
+        low_pass_filt_7k(HF,
+                         L_SUBFR16k,
+                         st->mem_hf3,
+                         ScratchMem);
+    }
+    /* add filtered HF noise to speech synthesis */
+
+    pt_synth = synth16k;
+    pt_HF = HF;
+
+    for (i = L_SUBFR16k >> 1; i != 0; i--)
+    {
+        *(pt_synth) = add_int16(*(pt_synth), *(pt_HF++)); /* check 16 bit saturation */
+        pt_synth++;
+        *(pt_synth) = add_int16(*(pt_synth), *(pt_HF++));
+        pt_synth++;
+    }
+
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.h
new file mode 100644 (file)
index 0000000..2074aab
--- /dev/null
@@ -0,0 +1,90 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Pathname: ./cpp/include/synthesis_amr_wb.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef SYNTHESIS_AMR_WB_H
+#define SYNTHESIS_AMR_WB_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES AND SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    void synthesis_amr_wb(
+        int16 Aq[],                          /* A(z)  : quantized Az               */
+        int16 exc[],                         /* (i)   : excitation at 12kHz        */
+        int16 Q_new,                         /* (i)   : scaling performed on exc   */
+        int16 synth16k[],                    /* (o)   : 16kHz synthesis signal     */
+        int16 prms,                          /* (i)   : parameter                  */
+        int16 HfIsf[],
+        int16 nb_bits,
+        int16 newDTXState,
+        Decoder_State * st,                   /* (i/o) : State structure            */
+        int16 bfi,                           /* (i)   : bad frame indicator        */
+        int16 * ScratchMemory
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif  /* PV_NORMALIZE_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/voice_factor.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/voice_factor.cpp
new file mode 100644 (file)
index 0000000..6163335
--- /dev/null
@@ -0,0 +1,167 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: voice_factor.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 exc[],        (i) Q_exc : pitch excitation
+     int16 Q_exc,        (i)       : exc format
+     int16 gain_pit,     (i) Q14   : gain of pitch
+     int16 code[],       (i) Q9    : Fixed codebook excitation
+     int16 gain_code,    (i) Q0    : gain of code
+     int16 L_subfr       (i)       : subframe length
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Find the voicing factor (1=voice to -1=unvoiced).
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwb_math_op.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+int16 voice_factor(    /* (o) Q15   : factor (-1=unvoiced to 1=voiced) */
+    int16 exc[],      /* (i) Q_exc : pitch excitation                 */
+    int16 Q_exc,      /* (i)       : exc format                       */
+    int16 gain_pit,   /* (i) Q14   : gain of pitch                    */
+    int16 code[],     /* (i) Q9    : Fixed codebook excitation        */
+    int16 gain_code,  /* (i) Q0    : gain of code                     */
+    int16 L_subfr     /* (i)       : subframe length                  */
+)
+{
+    int16 i, tmp, exp, ener1, exp1, ener2, exp2;
+    int32 L_tmp;
+
+    ener1 = extract_h(Dot_product12(exc, exc, L_subfr, &exp1));
+    exp1 = sub_int16(exp1, Q_exc << 1);
+    L_tmp = mul_16by16_to_int32(gain_pit, gain_pit);
+    exp = normalize_amr_wb(L_tmp);
+
+    tmp = (int16)((L_tmp << exp) >> 16);
+    ener1 = mult_int16(ener1, tmp);
+    exp1 -= (exp + 10);        /* 10 -> gain_pit Q14 to Q9 */
+
+    ener2 = extract_h(Dot_product12(code, code, L_subfr, &exp2));
+
+    exp = norm_s(gain_code);
+    tmp = shl_int16(gain_code, exp);
+    tmp = mult_int16(tmp, tmp);
+    ener2 = mult_int16(ener2, tmp);
+    exp2 -= (exp << 1);
+
+    i = exp1 - exp2;
+
+
+    if (i >= 0)
+    {
+        ener1 >>=  1;
+        ener2 >>= (i + 1);
+    }
+    else
+    {
+        ener1 >>= (1 - i);
+        ener2 >>= 1;
+    }
+
+    tmp = ener1 - ener2;
+    ener1 += ener2 + 1;
+
+
+    if (tmp >= 0)
+    {
+        tmp = div_16by16(tmp, ener1);
+    }
+    else
+    {
+        tmp = negate_int16(div_16by16(negate_int16(tmp), ener1));
+    }
+
+    return (tmp);
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/wb_syn_filt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/wb_syn_filt.cpp
new file mode 100644 (file)
index 0000000..f307dee
--- /dev/null
@@ -0,0 +1,299 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: wb_syn_filt.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+wb_syn_filt
+
+     int16 a[],               (i) Q12 : a[m+1] prediction coefficients
+     int16 m,                 (i)     : order of LP filter
+     int16 x[],               (i)     : input signal
+     int16 y[],               (o)     : output signal
+     int16 lg,                (i)     : size of filtering
+     int16 mem[],             (i/o)   : memory associated with this filtering.
+     int16 update,            (i)     : 0=no update, 1=update of memory.
+     int16 y_buf[]
+
+Syn_filt_32
+
+     int16 a[],              (i) Q12 : a[m+1] prediction coefficients
+     int16 m,                (i)     : order of LP filter
+     int16 exc[],            (i) Qnew: excitation (exc[i] >> Qnew)
+     int16 Qnew,             (i)     : exc scaling = 0(min) to 8(max)
+     int16 sig_hi[],         (o) /16 : synthesis high
+     int16 sig_lo[],         (o) /16 : synthesis low
+     int16 lg                (i)     : size of filtering
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Do the synthesis filtering 1/A(z)  16 and 32-bits version
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_mem_funcs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwb_math_op.h"
+#include "pvamrwbdecoder_cnst.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void wb_syn_filt(
+    int16 a[],       /* (i) Q12 : a[m+1] prediction coefficients           */
+    int16 m,         /* (i)     : order of LP filter                       */
+    int16 x[],       /* (i)     : input signal                             */
+    int16 y[],       /* (o)     : output signal                            */
+    int16 lg,        /* (i)     : size of filtering                        */
+    int16 mem[],     /* (i/o)   : memory associated with this filtering.   */
+    int16 update,    /* (i)     : 0=no update, 1=update of memory.         */
+    int16 y_buf[]
+)
+{
+
+    int16 i, j;
+    int32 L_tmp1;
+    int32 L_tmp2;
+    int32 L_tmp3;
+    int32 L_tmp4;
+    int16 *yy;
+
+    /* copy initial filter states into synthesis buffer */
+    pv_memcpy(y_buf, mem, m*sizeof(*yy));
+
+    yy = &y_buf[m];
+
+    /* Do the filtering. */
+
+    for (i = 0; i < lg >> 2; i++)
+    {
+        L_tmp1 = -((int32)x[(i<<2)] << 11);
+        L_tmp2 = -((int32)x[(i<<2)+1] << 11);
+        L_tmp3 = -((int32)x[(i<<2)+2] << 11);
+        L_tmp4 = -((int32)x[(i<<2)+3] << 11);
+
+        /* a[] uses Q12 and abs(a) =< 1 */
+
+        L_tmp1  = fxp_mac_16by16(yy[(i<<2) -3], a[3], L_tmp1);
+        L_tmp2  = fxp_mac_16by16(yy[(i<<2) -2], a[3], L_tmp2);
+        L_tmp1  = fxp_mac_16by16(yy[(i<<2) -2], a[2], L_tmp1);
+        L_tmp2  = fxp_mac_16by16(yy[(i<<2) -1], a[2], L_tmp2);
+        L_tmp1  = fxp_mac_16by16(yy[(i<<2) -1], a[1], L_tmp1);
+
+        for (j = 4; j < m; j += 2)
+        {
+            L_tmp1  = fxp_mac_16by16(yy[(i<<2)-1  - j], a[j+1], L_tmp1);
+            L_tmp2  = fxp_mac_16by16(yy[(i<<2)    - j], a[j+1], L_tmp2);
+            L_tmp1  = fxp_mac_16by16(yy[(i<<2)    - j], a[j  ], L_tmp1);
+            L_tmp2  = fxp_mac_16by16(yy[(i<<2)+1  - j], a[j  ], L_tmp2);
+            L_tmp3  = fxp_mac_16by16(yy[(i<<2)+1  - j], a[j+1], L_tmp3);
+            L_tmp4  = fxp_mac_16by16(yy[(i<<2)+2  - j], a[j+1], L_tmp4);
+            L_tmp3  = fxp_mac_16by16(yy[(i<<2)+2  - j], a[j  ], L_tmp3);
+            L_tmp4  = fxp_mac_16by16(yy[(i<<2)+3  - j], a[j  ], L_tmp4);
+        }
+
+        L_tmp1  = fxp_mac_16by16(yy[(i<<2)    - j], a[j], L_tmp1);
+        L_tmp2  = fxp_mac_16by16(yy[(i<<2)+1  - j], a[j], L_tmp2);
+        L_tmp3  = fxp_mac_16by16(yy[(i<<2)+2  - j], a[j], L_tmp3);
+        L_tmp4  = fxp_mac_16by16(yy[(i<<2)+3  - j], a[j], L_tmp4);
+
+        L_tmp1 = shl_int32(L_tmp1, 4);
+
+        y[(i<<2)] = yy[(i<<2)] = amr_wb_round(-L_tmp1);
+
+        L_tmp2  = fxp_mac_16by16(yy[(i<<2)], a[1], L_tmp2);
+
+        L_tmp2 = shl_int32(L_tmp2, 4);
+
+        y[(i<<2)+1] = yy[(i<<2)+1] = amr_wb_round(-L_tmp2);
+
+        L_tmp3  = fxp_mac_16by16(yy[(i<<2) - 1], a[3], L_tmp3);
+        L_tmp4  = fxp_mac_16by16(yy[(i<<2)], a[3], L_tmp4);
+        L_tmp3  = fxp_mac_16by16(yy[(i<<2)], a[2], L_tmp3);
+        L_tmp4  = fxp_mac_16by16(yy[(i<<2) + 1], a[2], L_tmp4);
+        L_tmp3  = fxp_mac_16by16(yy[(i<<2) + 1], a[1], L_tmp3);
+
+        L_tmp3 = shl_int32(L_tmp3, 4);
+
+        y[(i<<2)+2] = yy[(i<<2)+2] = amr_wb_round(-L_tmp3);
+
+        L_tmp4  = fxp_mac_16by16(yy[(i<<2)+2], a[1], L_tmp4);
+
+        L_tmp4 = shl_int32(L_tmp4, 4);
+
+        y[(i<<2)+3] = yy[(i<<2)+3] = amr_wb_round(-L_tmp4);
+    }
+
+
+    /* Update memory if required */
+
+    if (update)
+    {
+        pv_memcpy(mem, &y[lg - m], m*sizeof(*y));
+    }
+
+    return;
+}
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void Syn_filt_32(
+    int16 a[],              /* (i) Q12 : a[m+1] prediction coefficients */
+    int16 m,                /* (i)     : order of LP filter             */
+    int16 exc[],            /* (i) Qnew: excitation (exc[i] >> Qnew)    */
+    int16 Qnew,             /* (i)     : exc scaling = 0(min) to 8(max) */
+    int16 sig_hi[],         /* (o) /16 : synthesis high                 */
+    int16 sig_lo[],         /* (o) /16 : synthesis low                  */
+    int16 lg                /* (i)     : size of filtering              */
+)
+{
+    int16 i, k, a0;
+    int32 L_tmp1;
+    int32 L_tmp2;
+    int32 L_tmp3;
+    int32 L_tmp4;
+
+    a0 = 9 - Qnew;        /* input / 16 and >>Qnew */
+
+    /* Do the filtering. */
+
+    for (i = 0; i < lg >> 1; i++)
+    {
+
+        L_tmp3 = 0;
+        L_tmp4 = 0;
+
+        L_tmp1 = fxp_mul_16by16(sig_lo[(i<<1) - 1], a[1]);
+        L_tmp2 = fxp_mul_16by16(sig_hi[(i<<1) - 1], a[1]);
+
+        for (k = 2; k < m; k += 2)
+        {
+
+            L_tmp1 = fxp_mac_16by16(sig_lo[(i<<1)-1 - k], a[k+1], L_tmp1);
+            L_tmp2 = fxp_mac_16by16(sig_hi[(i<<1)-1 - k], a[k+1], L_tmp2);
+            L_tmp1 = fxp_mac_16by16(sig_lo[(i<<1)   - k], a[k  ], L_tmp1);
+            L_tmp2 = fxp_mac_16by16(sig_hi[(i<<1)   - k], a[k  ], L_tmp2);
+            L_tmp3 = fxp_mac_16by16(sig_lo[(i<<1)   - k], a[k+1], L_tmp3);
+            L_tmp4 = fxp_mac_16by16(sig_hi[(i<<1)   - k], a[k+1], L_tmp4);
+            L_tmp3 = fxp_mac_16by16(sig_lo[(i<<1)+1 - k], a[k  ], L_tmp3);
+            L_tmp4 = fxp_mac_16by16(sig_hi[(i<<1)+1 - k], a[k  ], L_tmp4);
+        }
+
+        L_tmp1 = -fxp_mac_16by16(sig_lo[(i<<1)   - k], a[k], L_tmp1);
+        L_tmp3 =  fxp_mac_16by16(sig_lo[(i<<1)+1 - k], a[k], L_tmp3);
+        L_tmp2 =  fxp_mac_16by16(sig_hi[(i<<1)   - k], a[k], L_tmp2);
+        L_tmp4 =  fxp_mac_16by16(sig_hi[(i<<1)+1 - k], a[k], L_tmp4);
+
+
+
+        L_tmp1 >>= 11;      /* -4 : sig_lo[i] << 4 */
+
+        L_tmp1 += (int32)exc[(i<<1)] << a0;
+
+        L_tmp1 -= (L_tmp2 << 1);
+        /* sig_hi = bit16 to bit31 of synthesis */
+        L_tmp1 = shl_int32(L_tmp1, 3);           /* ai in Q12 */
+
+        sig_hi[(i<<1)] = (int16)(L_tmp1 >> 16);
+
+        L_tmp4 = fxp_mac_16by16((int16)(L_tmp1 >> 16), a[1], L_tmp4);
+
+        /* sig_lo = bit4 to bit15 of synthesis */
+        /* L_tmp1 >>= 4 : sig_lo[i] >> 4 */
+        sig_lo[(i<<1)] = (int16)((L_tmp1 >> 4) - ((L_tmp1 >> 16) << 12));
+
+        L_tmp3 = fxp_mac_16by16(sig_lo[(i<<1)], a[1], L_tmp3);
+        L_tmp3 = -L_tmp3 >> 11;
+
+        L_tmp3 += (int32)exc[(i<<1)+1] << a0;
+
+        L_tmp3 -= (L_tmp4 << 1);
+        /* sig_hi = bit16 to bit31 of synthesis */
+        L_tmp3 = shl_int32(L_tmp3, 3);           /* ai in Q12 */
+        sig_hi[(i<<1)+1] = (int16)(L_tmp3 >> 16);
+
+        /* sig_lo = bit4 to bit15 of synthesis */
+        /* L_tmp1 >>= 4 : sig_lo[i] >> 4 */
+        sig_lo[(i<<1)+1] = (int16)((L_tmp3 >> 4) - (sig_hi[(i<<1)+1] << 12));
+    }
+
+}
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/weight_amrwb_lpc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/weight_amrwb_lpc.cpp
new file mode 100644 (file)
index 0000000..726ef46
--- /dev/null
@@ -0,0 +1,127 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.173
+    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+------------------------------------------------------------------------------
+
+
+
+ Filename: weight_amrwb_lpc.cpp
+
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+     int16 a[],            (i) Q12 : a[m+1]  LPC coefficients
+     int16 ap[],           (o) Q12 : Spectral expanded LPC coefficients
+     int16 gamma,          (i) Q15 : Spectral expansion factor.
+     int16 m               (i)     : LPC order.
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+   Weighting of LPC coefficients.
+     ap[i]  =  a[i]   (gamma    i)
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_amr_wb_type_defs.h"
+#include "pvamrwbdecoder_basic_op.h"
+#include "pvamrwbdecoder_acelp.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+void weight_amrwb_lpc(
+    int16 a[],          /* (i) Q12 : a[m+1]  LPC coefficients             */
+    int16 ap[],         /* (o) Q12 : Spectral expanded LPC coefficients   */
+    int16 gamma,        /* (i) Q15 : Spectral expansion factor.           */
+    int16 m             /* (i)     : LPC order.                           */
+)
+{
+    int16 i, fac;
+    int32 roundFactor = 0x00004000L;
+    ap[0] = a[0];
+    fac = gamma;
+    for (i = 1; i < m; i++)
+    {
+        ap[i] = (int16)(fxp_mac_16by16(a[i], fac, roundFactor) >> 15);
+        fac   = (int16)(fxp_mac_16by16(fac, gamma, roundFactor) >> 15);
+    }
+    ap[i] = (int16)(fxp_mac_16by16(a[i], fac, roundFactor) >> 15);
+
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/common/dec/Android.mk b/opencore/codecs_v2/audio/gsm_amr/common/dec/Android.mk
new file mode 100644 (file)
index 0000000..3ba1c63
--- /dev/null
@@ -0,0 +1,27 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+       
+
+
+
+
+LOCAL_CFLAGS :=   $(PV_CFLAGS)
+
+
+LOCAL_STATIC_LIBRARIES := 
+
+LOCAL_SHARED_LIBRARIES := 
+
+LOCAL_C_INCLUDES := \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/common/dec/build/make \
+       $(PV_TOP)/codecs_v2/audio/gsm_amr/common/dec/include \
+       $(PV_INCLUDES)
+
+LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO)
+
+LOCAL_COPY_HEADERS := \
+       include/pvgsmamrdecoderinterface.h
+
+include $(BUILD_COPY_HEADERS)
diff --git a/opencore/codecs_v2/audio/gsm_amr/common/dec/build/make/local.mk b/opencore/codecs_v2/audio/gsm_amr/common/dec/build/make/local.mk
new file mode 100644 (file)
index 0000000..8db50c4
--- /dev/null
@@ -0,0 +1,16 @@
+# Get the current local path as the first operation
+LOCAL_PATH := $(call get_makefile_dir)
+
+# Clear out the variables used in the local makefiles
+include $(MK)/clear.mk
+
+TARGET :=
+
+
+INCSRCDIR := ../../include
+
+HDRS := pvgsmamrdecoderinterface.h
+
+
+include $(MK)/library.mk
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/common/dec/include/pvgsmamrdecoderinterface.h b/opencore/codecs_v2/audio/gsm_amr/common/dec/include/pvgsmamrdecoderinterface.h
new file mode 100644 (file)
index 0000000..2d9b9df
--- /dev/null
@@ -0,0 +1,206 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+//////////////////////////////////////////////////////////////////////////////////
+//                                                                              //
+//  File: pvgsmamrdecoderinterface.h                                            //
+//                                                                              //
+//////////////////////////////////////////////////////////////////////////////////
+
+#ifndef _PVGSMAMR_DECODER_INTERFACE_H
+#define _PVGSMAMR_DECODER_INTERFACE_H
+
+#include "oscl_base.h"
+
+/*----------------------------------------------------------------------------
+; ENUMERATED TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+typedef enum
+{
+    /*
+     *    One word (2-byte) to indicate type of frame type.
+     *    One word (2-byte) to indicate frame type.
+     *    One word (2-byte) to indicate mode.
+     *    N words (2-byte) containing N bits (bit 0 = 0xff81, bit 1 = 0x007f).
+     */
+    ETS = 0, /* Both AMR-Narrowband and AMR-Wideband */
+
+    /*
+     *    One word (2-byte) for sync word (good frames: 0x6b21, bad frames: 0x6b20)
+     *    One word (2-byte) for frame length N.
+     *    N words (2-byte) containing N bits (bit 0 = 0x007f, bit 1 = 0x0081).
+     */
+    ITU, /* AMR-Wideband */
+
+    /*
+     *   AMR-WB MIME/storage format, see RFC 3267 (sections 5.1 and 5.3) for details
+     */
+    MIME_IETF,
+
+    WMF, /* AMR-Narrowband */
+
+    IF2  /* AMR-Narrowband */
+
+} bitstream_format;
+
+
+
+/*----------------------------------------------------------------------------
+; STRUCTURES TYPEDEF'S
+----------------------------------------------------------------------------*/
+typedef struct
+{
+    int16 prev_ft;
+    int16 prev_mode;
+} RX_State;
+
+
+typedef struct tPVAmrDecoderExternal
+{
+    /*
+     * INPUT:
+     * Pointer to the input buffer that contains the encoded bistream data.
+     * The data is filled in such that the first bit transmitted is
+     * the most-significant bit (MSB) of the first array element.
+     * The buffer is accessed in a linear fashion for speed, and the number of
+     * bytes consumed varies frame to frame. This is use for mime/ietf data
+     */
+    uint8  *pInputBuffer;
+
+    /*
+     * INPUT:
+     * Pointer to the input buffer that contains the encoded stream data.
+     * The data is filled such that the first bit transmitted is
+     * in the  first int16 element.
+     * The buffer is accessed in a linear fashion for speed, and the number of
+     * bytes consumed varies frame to frame.
+     */
+    int16  *pInputSampleBuffer;
+
+    /*
+     * INPUT: (but what is pointed to is an output)
+     * Pointer to the output buffer to hold the 16-bit PCM audio samples.
+     */
+    int16  *pOutputBuffer;
+
+    /*
+     * INPUT:
+     * Number of requested output audio channels. This relieves the calling
+     * environment from having to perform stereo-to-mono or mono-to-stereo
+     * conversions.
+     */
+    int32     desiredChannels;
+
+    /*
+         * INPUT:
+         * Format type of the encoded bitstream.
+         */
+    bitstream_format     input_format;
+
+    /*
+     * OUTPUT:
+     * The sampling rate decoded from the bitstream, in units of
+     * samples/second. For this release of the library this value does
+     * not change from frame to frame, but future versions will.
+     */
+    int32   samplingRate;
+
+    /*
+     * OUTPUT:
+     * This value is the bitrate in units of bits/second. IT
+     * is calculated using the number of bits consumed for the current frame,
+     * and then multiplying by the sampling_rate, divided by points in a frame.
+     * This value can changes frame to frame.
+     */
+    int32   bitRate;
+
+    /*
+     * OUTPUT:
+     * The number of channels decoded from the bitstream. The output data
+     * will have be the amount specified in the variable desiredChannels,
+     * this output is informative only, and can be ignored.
+     */
+    int32     encodedChannels;
+
+    /*
+     * OUTPUT:
+     * This value is the number of output PCM samples per channel.
+     * It is  320.
+     */
+    int16     frameLength;
+
+    /*
+     * OUTPUT:
+     * This value is the quality indicator. 1 (good)  0 (bad)
+    */
+    uint8     quality;
+
+
+    /*
+     * OUTPUT:
+     *  GSM AMR NB and WB mode (i.e. bit-rate )
+     */
+    int16     mode;
+    int16     mode_old;
+
+    /*
+     * OUTPUT:
+     *  GSM AMR NB and WB frame type ( speech_good, speech_bad, sid, etc.)
+     */
+    int16     frame_type;
+
+    int16 reset_flag;
+    int16 reset_flag_old;
+
+    /*
+     * OUTPUT:
+     *  Decoder  status
+     */
+    int32     status;
+
+    /*
+     * OUTPUT:
+     *  Rx status state
+     */
+    RX_State  rx_state;
+
+} tPVAmrDecoderExternal;
+
+// CDecoder_AMRInterface
+
+#ifdef __cplusplus
+
+class CDecoder_AMRInterface
+{
+    public:
+        virtual ~CDecoder_AMRInterface() {};
+        OSCL_IMPORT_REF virtual int32 StartL(tPVAmrDecoderExternal * pExt,
+                                             bool aAllocateInputBuffer  = false,
+                                             bool aAllocateOutputBuffer = false) = 0;
+
+        OSCL_IMPORT_REF virtual int32 ExecuteL(tPVAmrDecoderExternal * pExt) = 0;
+
+        OSCL_IMPORT_REF virtual int32 ResetDecoderL() = 0;
+        OSCL_IMPORT_REF virtual void StopL() = 0;
+        OSCL_IMPORT_REF virtual void TerminateDecoderL() = 0;
+};
+#endif
+
+
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/patent_disclaimer.txt b/opencore/codecs_v2/audio/gsm_amr/patent_disclaimer.txt
new file mode 100644 (file)
index 0000000..b4bf11d
--- /dev/null
@@ -0,0 +1,9 @@
+
+THIS IS NOT A GRANT OF PATENT RIGHTS.
+
+Google makes no representation or warranty that the codecs for which
+source code is made available hereunder are unencumbered by
+third-party patents.  Those intending to use this source code in
+hardware or software products are advised that implementations of
+these codecs, including in open source software or shareware, may
+require patent licenses from the relevant patent holders.
diff --git a/oscl/oscl_base.h b/oscl/oscl_base.h
new file mode 100644 (file)
index 0000000..93e8246
--- /dev/null
@@ -0,0 +1,37 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OSCL_BASE_H
+#define OSCL_BASE_H
+
+#include <stdint.h>
+
+typedef int8_t int8;
+typedef uint8_t uint8;
+typedef int16_t int16;
+typedef uint16_t uint16;
+typedef int32_t int32;
+typedef uint32_t uint32;
+typedef int64_t int64;
+typedef uint64_t uint64;
+
+#define OSCL_IMPORT_REF
+#define OSCL_EXPORT_REF
+#define OSCL_UNUSED_ARG(x) (void)(x)
+
+#endif
diff --git a/oscl/oscl_base_macros.h b/oscl/oscl_base_macros.h
new file mode 100644 (file)
index 0000000..7fadf2e
--- /dev/null
@@ -0,0 +1,25 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OSCL_BASE_MACROS_H
+#define OSCL_BASE_MACROS_H
+
+#define EPV_ARM_GNUC 1
+#define EPV_ARM_RVCT 2
+
+#endif
diff --git a/oscl/oscl_mem.h b/oscl/oscl_mem.h
new file mode 100644 (file)
index 0000000..476b3b3
--- /dev/null
@@ -0,0 +1,38 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OSCL_MEM_H
+#define OSCL_MEM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#define oscl_malloc malloc
+#define oscl_free free
+#define oscl_memset memset
+#define oscl_memmove memmove
+#define oscl_memcpy memcpy
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/packaging/opencore-amr.spec b/packaging/opencore-amr.spec
new file mode 100644 (file)
index 0000000..544354f
--- /dev/null
@@ -0,0 +1,53 @@
+Name:       opencore-amr
+Summary:    opencore AMRNB dev package
+Version:    0.1.3
+Release:    0
+Group:      libdevel
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+
+
+%description
+opencore AMRNB dev package
+
+
+%package devel 
+Summary:    opencore AMRNB dev package (Developement)
+Group:      TO_BE_FILLED 
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+opencore AMRNB dev package (Developement)
+
+%prep
+%setup -q
+
+%build
+./autogen.sh
+./configure --prefix=/usr --mandir=%{_prefix}/share/man --infodir=%{_prefix}/share/info CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+%make_install
+
+%post
+
+%postun
+
+
+%files
+%manifest opencore-amr.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libopencore-amrnb.so*
+%{_libdir}/libopencore-amrwb.so*
+%{_datadir}/license/%{name}
+
+%files devel 
+%defattr(-,root,root,-)
+%{_includedir}/opencore-amrnb/*.h
+%{_includedir}/opencore-amrwb/*.h
+%{_libdir}/pkgconfig/opencore-amrnb.pc
+%{_libdir}/pkgconfig/opencore-amrwb.pc
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644 (file)
index 0000000..a0c4ffa
--- /dev/null
@@ -0,0 +1,35 @@
+
+bin_PROGRAMS = amrwb-dec$(EXEEXT)
+noinst_PROGRAMS = linkboth$(EXEEXT)
+AM_CFLAGS =
+
+if AMRNB_DECODER
+    bin_PROGRAMS += amrnb-dec$(EXEEXT)
+else
+    AM_CFLAGS += -DDISABLE_AMRNB_DECODER
+endif
+if AMRNB_ENCODER
+    bin_PROGRAMS += amrnb-enc$(EXEEXT)
+    noinst_PROGRAMS += amrnb-enc-sine$(EXEEXT)
+else
+    AM_CFLAGS += -DDISABLE_AMRNB_ENCODER
+endif
+
+INCLUDES = -I$(top_srcdir)/amrnb -I$(top_srcdir)/amrwb
+
+amrnb_dec_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la
+amrnb_enc_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la
+amrnb_enc_sine_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la
+amrnb_enc_sine_LDFLAGS = -lm
+amrwb_dec_LDADD = $(top_builddir)/amrwb/libopencore-amrwb.la
+linkboth_LDFLAGS = -static
+linkboth_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la $(top_builddir)/amrwb/libopencore-amrwb.la
+
+amrnb_dec_SOURCES = amrnb-dec.c wavwriter.c
+amrnb_enc_SOURCES = amrnb-enc.c wavreader.c
+amrnb_enc_sine_SOURCES = amrnb-enc-sine.c
+amrwb_dec_SOURCES = amrwb-dec.c wavwriter.c
+linkboth_SOURCES = linkboth.c
+
+noinst_HEADERS = wavwriter.h wavreader.h
+
diff --git a/test/Makefile.in b/test/Makefile.in
new file mode 100644 (file)
index 0000000..fdf116d
--- /dev/null
@@ -0,0 +1,614 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@AMRNB_DECODER_TRUE@am__append_1 = amrnb-dec$(EXEEXT)
+@AMRNB_DECODER_FALSE@am__append_2 = -DDISABLE_AMRNB_DECODER
+@AMRNB_ENCODER_TRUE@am__append_3 = amrnb-enc$(EXEEXT)
+@AMRNB_ENCODER_TRUE@am__append_4 = amrnb-enc-sine$(EXEEXT)
+@AMRNB_ENCODER_FALSE@am__append_5 = -DDISABLE_AMRNB_ENCODER
+subdir = test
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_amrnb_dec_OBJECTS = amrnb-dec.$(OBJEXT) wavwriter.$(OBJEXT)
+amrnb_dec_OBJECTS = $(am_amrnb_dec_OBJECTS)
+amrnb_dec_DEPENDENCIES = $(top_builddir)/amrnb/libopencore-amrnb.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am_amrnb_enc_OBJECTS = amrnb-enc.$(OBJEXT) wavreader.$(OBJEXT)
+amrnb_enc_OBJECTS = $(am_amrnb_enc_OBJECTS)
+amrnb_enc_DEPENDENCIES = $(top_builddir)/amrnb/libopencore-amrnb.la
+am_amrnb_enc_sine_OBJECTS = amrnb-enc-sine.$(OBJEXT)
+amrnb_enc_sine_OBJECTS = $(am_amrnb_enc_sine_OBJECTS)
+amrnb_enc_sine_DEPENDENCIES =  \
+       $(top_builddir)/amrnb/libopencore-amrnb.la
+amrnb_enc_sine_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(AM_CFLAGS) $(CFLAGS) $(amrnb_enc_sine_LDFLAGS) $(LDFLAGS) -o \
+       $@
+am_amrwb_dec_OBJECTS = amrwb-dec.$(OBJEXT) wavwriter.$(OBJEXT)
+amrwb_dec_OBJECTS = $(am_amrwb_dec_OBJECTS)
+amrwb_dec_DEPENDENCIES = $(top_builddir)/amrwb/libopencore-amrwb.la
+am_linkboth_OBJECTS = linkboth.$(OBJEXT)
+linkboth_OBJECTS = $(am_linkboth_OBJECTS)
+linkboth_DEPENDENCIES = $(top_builddir)/amrnb/libopencore-amrnb.la \
+       $(top_builddir)/amrwb/libopencore-amrwb.la
+linkboth_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(linkboth_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC    " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD  " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN   " $@;
+SOURCES = $(amrnb_dec_SOURCES) $(amrnb_enc_SOURCES) \
+       $(amrnb_enc_sine_SOURCES) $(amrwb_dec_SOURCES) \
+       $(linkboth_SOURCES)
+DIST_SOURCES = $(amrnb_dec_SOURCES) $(amrnb_enc_SOURCES) \
+       $(amrnb_enc_sine_SOURCES) $(amrwb_dec_SOURCES) \
+       $(linkboth_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENCORE_AMRNB_VERSION = @OPENCORE_AMRNB_VERSION@
+OPENCORE_AMRWB_VERSION = @OPENCORE_AMRWB_VERSION@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+bin_PROGRAMS = amrwb-dec$(EXEEXT) $(am__append_1) $(am__append_3)
+noinst_PROGRAMS = linkboth$(EXEEXT) $(am__append_4)
+AM_CFLAGS = $(am__append_2) $(am__append_5)
+INCLUDES = -I$(top_srcdir)/amrnb -I$(top_srcdir)/amrwb
+amrnb_dec_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la
+amrnb_enc_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la
+amrnb_enc_sine_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la
+amrnb_enc_sine_LDFLAGS = -lm
+amrwb_dec_LDADD = $(top_builddir)/amrwb/libopencore-amrwb.la
+linkboth_LDFLAGS = -static
+linkboth_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la $(top_builddir)/amrwb/libopencore-amrwb.la
+amrnb_dec_SOURCES = amrnb-dec.c wavwriter.c
+amrnb_enc_SOURCES = amrnb-enc.c wavreader.c
+amrnb_enc_sine_SOURCES = amrnb-enc-sine.c
+amrwb_dec_SOURCES = amrwb-dec.c wavwriter.c
+linkboth_SOURCES = linkboth.c
+noinst_HEADERS = wavwriter.h wavreader.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --gnu test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+       @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+       for p in $$list; do echo "$$p $$p"; done | \
+       sed 's/$(EXEEXT)$$//' | \
+       while read p p1; do if test -f $$p || test -f $$p1; \
+         then echo "$$p"; echo "$$p"; else :; fi; \
+       done | \
+       sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+           -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+       sed 'N;N;N;s,\n, ,g' | \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+           if ($$2 == $$4) files[d] = files[d] " " $$1; \
+           else { print "f", $$3 "/" $$4, $$1; } } \
+         END { for (d in files) print "f", d, files[d] }' | \
+       while read type dir files; do \
+           if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+           test -z "$$files" || { \
+           echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+           $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+           } \
+       ; done
+
+uninstall-binPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+       files=`for p in $$list; do echo "$$p"; done | \
+         sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+             -e 's/$$/$(EXEEXT)/' `; \
+       test -n "$$list" || exit 0; \
+       echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+       @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+       echo " rm -f" $$list; \
+       rm -f $$list || exit $$?; \
+       test -n "$(EXEEXT)" || exit 0; \
+       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+       echo " rm -f" $$list; \
+       rm -f $$list
+
+clean-noinstPROGRAMS:
+       @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+       echo " rm -f" $$list; \
+       rm -f $$list || exit $$?; \
+       test -n "$(EXEEXT)" || exit 0; \
+       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+       echo " rm -f" $$list; \
+       rm -f $$list
+amrnb-dec$(EXEEXT): $(amrnb_dec_OBJECTS) $(amrnb_dec_DEPENDENCIES) $(EXTRA_amrnb_dec_DEPENDENCIES) 
+       @rm -f amrnb-dec$(EXEEXT)
+       $(AM_V_CCLD)$(LINK) $(amrnb_dec_OBJECTS) $(amrnb_dec_LDADD) $(LIBS)
+amrnb-enc$(EXEEXT): $(amrnb_enc_OBJECTS) $(amrnb_enc_DEPENDENCIES) $(EXTRA_amrnb_enc_DEPENDENCIES) 
+       @rm -f amrnb-enc$(EXEEXT)
+       $(AM_V_CCLD)$(LINK) $(amrnb_enc_OBJECTS) $(amrnb_enc_LDADD) $(LIBS)
+amrnb-enc-sine$(EXEEXT): $(amrnb_enc_sine_OBJECTS) $(amrnb_enc_sine_DEPENDENCIES) $(EXTRA_amrnb_enc_sine_DEPENDENCIES) 
+       @rm -f amrnb-enc-sine$(EXEEXT)
+       $(AM_V_CCLD)$(amrnb_enc_sine_LINK) $(amrnb_enc_sine_OBJECTS) $(amrnb_enc_sine_LDADD) $(LIBS)
+amrwb-dec$(EXEEXT): $(amrwb_dec_OBJECTS) $(amrwb_dec_DEPENDENCIES) $(EXTRA_amrwb_dec_DEPENDENCIES) 
+       @rm -f amrwb-dec$(EXEEXT)
+       $(AM_V_CCLD)$(LINK) $(amrwb_dec_OBJECTS) $(amrwb_dec_LDADD) $(LIBS)
+linkboth$(EXEEXT): $(linkboth_OBJECTS) $(linkboth_DEPENDENCIES) $(EXTRA_linkboth_DEPENDENCIES) 
+       @rm -f linkboth$(EXEEXT)
+       $(AM_V_CCLD)$(linkboth_LINK) $(linkboth_OBJECTS) $(linkboth_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amrnb-dec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amrnb-enc-sine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amrnb-enc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amrwb-dec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linkboth.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wavreader.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wavwriter.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       set x; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(bindir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       if test -z '$(STRIP)'; then \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+             install; \
+       else \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+       fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+       clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+       clean-generic clean-libtool clean-noinstPROGRAMS ctags \
+       distclean distclean-compile distclean-generic \
+       distclean-libtool distclean-tags distdir dvi dvi-am html \
+       html-am info info-am install install-am install-binPROGRAMS \
+       install-data install-data-am install-dvi install-dvi-am \
+       install-exec install-exec-am install-html install-html-am \
+       install-info install-info-am install-man install-pdf \
+       install-pdf-am install-ps install-ps-am install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/test/amrnb-dec.c b/test/amrnb-dec.c
new file mode 100644 (file)
index 0000000..f558392
--- /dev/null
@@ -0,0 +1,87 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include "wavwriter.h"
+#include <interf_dec.h>
+
+/* From WmfDecBytesPerFrame in dec_input_format_tab.cpp */
+const int sizes[] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 6, 5, 5, 0, 0, 0, 0 };
+
+
+int main(int argc, char *argv[]) {
+       FILE* in;
+       char header[6];
+       int n;
+       void *wav, *amr;
+       if (argc < 3) {
+               fprintf(stderr, "%s in.amr out.wav\n", argv[0]);
+               return 1;
+       }
+
+       in = fopen(argv[1], "rb");
+       if (!in) {
+               perror(argv[1]);
+               return 1;
+       }
+       n = fread(header, 1, 6, in);
+       if (n != 6 || memcmp(header, "#!AMR\n", 6)) {
+               fprintf(stderr, "Bad header\n");
+               return 1;
+       }
+
+       wav = wav_write_open(argv[2], 8000, 16, 1);
+       if (!wav) {
+               fprintf(stderr, "Unable to open %s\n", argv[2]);
+               return 1;
+       }
+
+       amr = Decoder_Interface_init();
+       while (1) {
+               uint8_t buffer[500], littleendian[320], *ptr;
+               int size, i;
+               int16_t outbuffer[160];
+               /* Read the mode byte */
+               n = fread(buffer, 1, 1, in);
+               if (n <= 0)
+                       break;
+               /* Find the packet size */
+               size = sizes[(buffer[0] >> 3) & 0x0f];
+               n = fread(buffer + 1, 1, size, in);
+               if (n != size)
+                       break;
+
+               /* Decode the packet */
+               Decoder_Interface_Decode(amr, buffer, outbuffer, 0);
+
+               /* Convert to little endian and write to wav */
+               ptr = littleendian;
+               for (i = 0; i < 160; i++) {
+                       *ptr++ = (outbuffer[i] >> 0) & 0xff;
+                       *ptr++ = (outbuffer[i] >> 8) & 0xff;
+               }
+               wav_write_data(wav, littleendian, 320);
+       }
+       fclose(in);
+       Decoder_Interface_exit(amr);
+       wav_write_close(wav);
+       return 0;
+}
+
diff --git a/test/amrnb-enc-sine.c b/test/amrnb-enc-sine.c
new file mode 100644 (file)
index 0000000..51c04b2
--- /dev/null
@@ -0,0 +1,59 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <math.h>
+#include <interf_enc.h>
+
+int main(int argc, char *argv[]) {
+       int i, j;
+       void* amr;
+       FILE* out;
+       int sample_pos = 0;
+
+       if (argc < 2) {
+               fprintf(stderr, "%s out.amr\n", argv[0]);
+               return 1;
+       }
+
+       amr = Encoder_Interface_init(0);
+       out = fopen(argv[1], "wb");
+       if (!out) {
+               perror(argv[1]);
+               return 1;
+       }
+
+       fwrite("#!AMR\n", 1, 6, out);
+       for (i = 0; i < 1000; i++) {
+               short buf[160];
+               uint8_t outbuf[500];
+               int n;
+               for (j = 0; j < 160; j++) {
+                       buf[j] = 32767*sin(440*2*3.141592654*sample_pos/8000);
+                       sample_pos++;
+               }
+               n = Encoder_Interface_Encode(amr, MR475, buf, outbuf, 0);
+               fwrite(outbuf, 1, n, out);
+       }
+       fclose(out);
+       Encoder_Interface_exit(amr);
+
+       return 0;
+}
+
diff --git a/test/amrnb-enc.c b/test/amrnb-enc.c
new file mode 100644 (file)
index 0000000..6fc5d40
--- /dev/null
@@ -0,0 +1,145 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <interf_enc.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "wavreader.h"
+
+void usage(const char* name) {
+       fprintf(stderr, "%s [-r bitrate] [-d] in.wav out.amr\n", name);
+}
+
+enum Mode findMode(const char* str) {
+       struct {
+               enum Mode mode;
+               int rate;
+       } modes[] = {
+               { MR475,  4750 },
+               { MR515,  5150 },
+               { MR59,   5900 },
+               { MR67,   6700 },
+               { MR74,   7400 },
+               { MR795,  7950 },
+               { MR102, 10200 },
+               { MR122, 12200 }
+       };
+       int rate = atoi(str);
+       int closest = -1;
+       int closestdiff = 0;
+       unsigned int i;
+       for (i = 0; i < sizeof(modes)/sizeof(modes[0]); i++) {
+               if (modes[i].rate == rate)
+                       return modes[i].mode;
+               if (closest < 0 || closestdiff > abs(modes[i].rate - rate)) {
+                       closest = i;
+                       closestdiff = abs(modes[i].rate - rate);
+               }
+       }
+       fprintf(stderr, "Using bitrate %d\n", modes[closest].rate);
+       return modes[closest].mode;
+}
+
+int main(int argc, char *argv[]) {
+       enum Mode mode = MR122;
+       int ch, dtx = 0;
+       const char *infile, *outfile;
+       FILE *out;
+       void *wav, *amr;
+       int format, sampleRate, channels, bitsPerSample;
+       int inputSize;
+       uint8_t* inputBuf;
+       while ((ch = getopt(argc, argv, "r:d")) != -1) {
+               switch (ch) {
+               case 'r':
+                       mode = findMode(optarg);
+                       break;
+               case 'd':
+                       dtx = 1;
+                       break;
+               case '?':
+               default:
+                       usage(argv[0]);
+                       return 1;
+               }
+       }
+       if (argc - optind < 2) {
+               usage(argv[0]);
+               return 1;
+       }
+       infile = argv[optind];
+       outfile = argv[optind + 1];
+
+       wav = wav_read_open(infile);
+       if (!wav) {
+               fprintf(stderr, "Unable to open wav file %s\n", infile);
+               return 1;
+       }
+       if (!wav_get_header(wav, &format, &channels, &sampleRate, &bitsPerSample, NULL)) {
+               fprintf(stderr, "Bad wav file %s\n", infile);
+               return 1;
+       }
+       if (format != 1) {
+               fprintf(stderr, "Unsupported WAV format %d\n", format);
+               return 1;
+       }
+       if (bitsPerSample != 16) {
+               fprintf(stderr, "Unsupported WAV sample depth %d\n", bitsPerSample);
+               return 1;
+       }
+       if (channels != 1)
+               fprintf(stderr, "Warning, only compressing one audio channel\n");
+       if (sampleRate != 8000)
+               fprintf(stderr, "Warning, AMR-NB uses 8000 Hz sample rate (WAV file has %d Hz)\n", sampleRate);
+       inputSize = channels*2*160;
+       inputBuf = (uint8_t*) malloc(inputSize);
+
+       amr = Encoder_Interface_init(dtx);
+       out = fopen(outfile, "wb");
+       if (!out) {
+               perror(outfile);
+               return 1;
+       }
+
+       fwrite("#!AMR\n", 1, 6, out);
+       while (1) {
+               short buf[160];
+               uint8_t outbuf[500];
+               int read, i, n;
+               read = wav_read_data(wav, inputBuf, inputSize);
+               read /= channels;
+               read /= 2;
+               if (read < 160)
+                       break;
+               for (i = 0; i < 160; i++) {
+                       const uint8_t* in = &inputBuf[2*channels*i];
+                       buf[i] = in[0] | (in[1] << 8);
+               }
+               n = Encoder_Interface_Encode(amr, mode, buf, outbuf, 0);
+               fwrite(outbuf, 1, n, out);
+       }
+       free(inputBuf);
+       fclose(out);
+       Encoder_Interface_exit(amr);
+       wav_read_close(wav);
+
+       return 0;
+}
+
diff --git a/test/amrwb-dec.c b/test/amrwb-dec.c
new file mode 100644 (file)
index 0000000..7a121e8
--- /dev/null
@@ -0,0 +1,87 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include "wavwriter.h"
+#include <dec_if.h>
+
+/* From pvamrwbdecoder_api.h, by dividing by 8 and rounding up */
+const int sizes[] = { 17, 23, 32, 36, 40, 46, 50, 58, 60, 5, -1, -1, -1, -1, -1, 0 };
+
+int main(int argc, char *argv[]) {
+       FILE* in;
+       char header[9];
+       int n;
+       void *wav, *amr;
+       if (argc < 3) {
+               fprintf(stderr, "%s in.amr out.wav\n", argv[0]);
+               return 1;
+       }
+
+       in = fopen(argv[1], "rb");
+       if (!in) {
+               perror(argv[1]);
+               return 1;
+       }
+       n = fread(header, 1, 9, in);
+       if (n != 9 || memcmp(header, "#!AMR-WB\n", 9)) {
+               fprintf(stderr, "Bad header\n");
+               return 1;
+       }
+
+       wav = wav_write_open(argv[2], 16000, 16, 1);
+       if (!wav) {
+               fprintf(stderr, "Unable to open %s\n", argv[2]);
+               return 1;
+       }
+       amr = D_IF_init();
+       while (1) {
+               uint8_t buffer[500], littleendian[640], *ptr;
+               int size, i;
+               int16_t outbuffer[320];
+               /* Read the mode byte */
+               n = fread(buffer, 1, 1, in);
+               if (n <= 0)
+                       break;
+               /* Find the packet size */
+               size = sizes[(buffer[0] >> 3) & 0x0f];
+               if (size < 0)
+                       break;
+               n = fread(buffer + 1, 1, size, in);
+               if (n != size)
+                       break;
+
+               /* Decode the packet */
+               D_IF_decode(amr, buffer, outbuffer, 0);
+
+               /* Convert to little endian and write to wav */
+               ptr = littleendian;
+               for (i = 0; i < 320; i++) {
+                       *ptr++ = (outbuffer[i] >> 0) & 0xff;
+                       *ptr++ = (outbuffer[i] >> 8) & 0xff;
+               }
+               wav_write_data(wav, littleendian, 640);
+       }
+       fclose(in);
+       D_IF_exit(amr);
+       wav_write_close(wav);
+       return 0;
+}
+
diff --git a/test/linkboth.c b/test/linkboth.c
new file mode 100644 (file)
index 0000000..26a3f35
--- /dev/null
@@ -0,0 +1,39 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <interf_dec.h>
+#include <interf_enc.h>
+#include <dec_if.h>
+
+int main(int argc, char *argv[]) {
+#ifndef DISABLE_AMRNB_DECODER
+       void* amrnb = Decoder_Interface_init();
+       Decoder_Interface_exit(amrnb);
+#endif
+#ifndef DISABLE_AMRNB_ENCODER
+       void* amrnb_enc = Encoder_Interface_init(0);
+       Encoder_Interface_exit(amrnb_enc);
+#endif
+       void* amrwb = D_IF_init();
+       D_IF_exit(amrwb);
+       return 0;
+}
+
diff --git a/test/wavreader.c b/test/wavreader.c
new file mode 100644 (file)
index 0000000..55d2ab9
--- /dev/null
@@ -0,0 +1,162 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#include "wavreader.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+#define TAG(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
+
+struct wav_reader {
+       FILE *wav;
+       uint32_t data_length;
+
+       int format;
+       int sample_rate;
+       int bits_per_sample;
+       int channels;
+       int byte_rate;
+       int block_align;
+};
+
+static uint32_t read_tag(struct wav_reader* wr) {
+       uint32_t tag = 0;
+       tag = (tag << 8) | fgetc(wr->wav);
+       tag = (tag << 8) | fgetc(wr->wav);
+       tag = (tag << 8) | fgetc(wr->wav);
+       tag = (tag << 8) | fgetc(wr->wav);
+       return tag;
+}
+
+static uint32_t read_int32(struct wav_reader* wr) {
+       uint32_t value = 0;
+       value |= fgetc(wr->wav) <<  0;
+       value |= fgetc(wr->wav) <<  8;
+       value |= fgetc(wr->wav) << 16;
+       value |= fgetc(wr->wav) << 24;
+       return value;
+}
+
+static uint16_t read_int16(struct wav_reader* wr) {
+       uint16_t value = 0;
+       value |= fgetc(wr->wav) << 0;
+       value |= fgetc(wr->wav) << 8;
+       return value;
+}
+
+void* wav_read_open(const char *filename) {
+       struct wav_reader* wr = (struct wav_reader*) malloc(sizeof(*wr));
+       long data_pos = 0;
+       memset(wr, 0, sizeof(*wr));
+
+       wr->wav = fopen(filename, "rb");
+       if (wr->wav == NULL) {
+               free(wr);
+               return NULL;
+       }
+
+       while (1) {
+               uint32_t tag, tag2, length;
+               tag = read_tag(wr);
+               if (feof(wr->wav))
+                       break;
+               length = read_int32(wr);
+               if (tag != TAG('R', 'I', 'F', 'F') || length < 4) {
+                       fseek(wr->wav, length, SEEK_CUR);
+                       continue;
+               }
+               tag2 = read_tag(wr);
+               length -= 4;
+               if (tag2 != TAG('W', 'A', 'V', 'E')) {
+                       fseek(wr->wav, length, SEEK_CUR);
+                       continue;
+               }
+               // RIFF chunk found, iterate through it
+               while (length >= 8) {
+                       uint32_t subtag, sublength;
+                       subtag = read_tag(wr);
+                       if (feof(wr->wav))
+                               break;
+                       sublength = read_int32(wr);
+                       length -= 8;
+                       if (length < sublength)
+                               break;
+                       if (subtag == TAG('f', 'm', 't', ' ')) {
+                               if (sublength < 16) {
+                                       // Insufficient data for 'fmt '
+                                       break;
+                               }
+                               wr->format          = read_int16(wr);
+                               wr->channels        = read_int16(wr);
+                               wr->sample_rate     = read_int32(wr);
+                               wr->byte_rate       = read_int32(wr);
+                               wr->block_align     = read_int16(wr);
+                               wr->bits_per_sample = read_int16(wr);
+                       } else if (subtag == TAG('d', 'a', 't', 'a')) {
+                               data_pos = ftell(wr->wav);
+                               wr->data_length = sublength;
+                               fseek(wr->wav, sublength, SEEK_CUR);
+                       } else {
+                               fseek(wr->wav, sublength, SEEK_CUR);
+                       }
+                       length -= sublength;
+               }
+               if (length > 0) {
+                       // Bad chunk?
+                       fseek(wr->wav, length, SEEK_CUR);
+               }
+       }
+       fseek(wr->wav, data_pos, SEEK_SET);
+       return wr;
+}
+
+void wav_read_close(void* obj) {
+       struct wav_reader* wr = (struct wav_reader*) obj;
+       fclose(wr->wav);
+       free(wr);
+}
+
+int wav_get_header(void* obj, int* format, int* channels, int* sample_rate, int* bits_per_sample, unsigned int* data_length) {
+       struct wav_reader* wr = (struct wav_reader*) obj;
+       if (format)
+               *format = wr->format;
+       if (channels)
+               *channels = wr->channels;
+       if (sample_rate)
+               *sample_rate = wr->sample_rate;
+       if (bits_per_sample)
+               *bits_per_sample = wr->bits_per_sample;
+       if (data_length)
+               *data_length = wr->data_length;
+       return wr->format && wr->sample_rate;
+}
+
+int wav_read_data(void* obj, unsigned char* data, unsigned int length) {
+       struct wav_reader* wr = (struct wav_reader*) obj;
+       int n;
+       if (wr->wav == NULL)
+               return -1;
+       if (length > wr->data_length)
+               length = wr->data_length;
+       n = fread(data, 1, length, wr->wav);
+       wr->data_length -= length;
+       return n;
+}
+
diff --git a/test/wavreader.h b/test/wavreader.h
new file mode 100644 (file)
index 0000000..57a13ff
--- /dev/null
@@ -0,0 +1,37 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef WAVREADER_H
+#define WAVREADER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* wav_read_open(const char *filename);
+void wav_read_close(void* obj);
+
+int wav_get_header(void* obj, int* format, int* channels, int* sample_rate, int* bits_per_sample, unsigned int* data_length);
+int wav_read_data(void* obj, unsigned char* data, unsigned int length);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/test/wavwriter.c b/test/wavwriter.c
new file mode 100644 (file)
index 0000000..3df9914
--- /dev/null
@@ -0,0 +1,111 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#include "wavwriter.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+struct wav_writer {
+       FILE *wav;
+       int data_length;
+
+       int sample_rate;
+       int bits_per_sample;
+       int channels;
+};
+
+static void write_string(struct wav_writer* ww, const char *str) {
+       fputc(str[0], ww->wav);
+       fputc(str[1], ww->wav);
+       fputc(str[2], ww->wav);
+       fputc(str[3], ww->wav);
+}
+
+static void write_int32(struct wav_writer* ww, int value) {
+       fputc((value >>  0) & 0xff, ww->wav);
+       fputc((value >>  8) & 0xff, ww->wav);
+       fputc((value >> 16) & 0xff, ww->wav);
+       fputc((value >> 24) & 0xff, ww->wav);
+}
+
+static void write_int16(struct wav_writer* ww, int value) {
+       fputc((value >> 0) & 0xff, ww->wav);
+       fputc((value >> 8) & 0xff, ww->wav);
+}
+
+static void write_header(struct wav_writer* ww, int length) {
+       int bytes_per_frame, bytes_per_sec;
+       write_string(ww, "RIFF");
+       write_int32(ww, 4 + 8 + 16 + 8 + length);
+       write_string(ww, "WAVE");
+
+       write_string(ww, "fmt ");
+       write_int32(ww, 16);
+
+       bytes_per_frame = ww->bits_per_sample/8*ww->channels;
+       bytes_per_sec   = bytes_per_frame*ww->sample_rate;
+       write_int16(ww, 1);                   // Format
+       write_int16(ww, ww->channels);        // Channels
+       write_int32(ww, ww->sample_rate);     // Samplerate
+       write_int32(ww, bytes_per_sec);       // Bytes per sec
+       write_int16(ww, bytes_per_frame);     // Bytes per frame
+       write_int16(ww, ww->bits_per_sample); // Bits per sample
+
+       write_string(ww, "data");
+       write_int32(ww, length);
+}
+
+void* wav_write_open(const char *filename, int sample_rate, int bits_per_sample, int channels) {
+       struct wav_writer* ww = (struct wav_writer*) malloc(sizeof(*ww));
+       memset(ww, 0, sizeof(*ww));
+       ww->wav = fopen(filename, "wb");
+       if (ww->wav == NULL) {
+               free(ww);
+               return NULL;
+       }
+       ww->data_length = 0;
+       ww->sample_rate = sample_rate;
+       ww->bits_per_sample = bits_per_sample;
+       ww->channels = channels;
+
+       write_header(ww, ww->data_length);
+       return ww;
+}
+
+void wav_write_close(void* obj) {
+       struct wav_writer* ww = (struct wav_writer*) obj;
+       if (ww->wav == NULL) {
+               free(ww);
+               return;
+       }
+       fseek(ww->wav, 0, SEEK_SET);
+       write_header(ww, ww->data_length);
+       fclose(ww->wav);
+       free(ww);
+}
+
+void wav_write_data(void* obj, const unsigned char* data, int length) {
+       struct wav_writer* ww = (struct wav_writer*) obj;
+       if (ww->wav == NULL)
+               return;
+       fwrite(data, length, 1, ww->wav);
+       ww->data_length += length;
+}
+
diff --git a/test/wavwriter.h b/test/wavwriter.h
new file mode 100644 (file)
index 0000000..9767ad1
--- /dev/null
@@ -0,0 +1,36 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef WAVWRITER_H
+#define WAVWRITER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* wav_write_open(const char *filename, int sample_rate, int bits_per_sample, int channels);
+void wav_write_close(void* obj);
+
+void wav_write_data(void* obj, const unsigned char* data, int length);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+