├── .gitignore ├── ChangeLog ├── LICENSE ├── Makefile.am ├── README ├── README.md ├── amrnb ├── .gitignore ├── Makefile.am ├── interf_dec.h ├── interf_enc.h ├── opencore-amrnb.pc.in ├── opencore-amrnb.sym └── wrapper.cpp ├── amrwb ├── .gitignore ├── Makefile.am ├── dec_if.h ├── if_rom.h ├── opencore-amrwb.pc.in ├── opencore-amrwb.sym └── wrapper.cpp ├── configure.ac ├── js ├── Makefile ├── amrnb.js ├── bld.sh ├── demo.html ├── hello.ogg ├── pre.js ├── yuan.amr └── yuan.wav ├── m4 └── .gitkeep ├── opencore ├── ChangeLog ├── NOTICE ├── README └── codecs_v2 │ └── audio │ └── gsm_amr │ ├── amr_nb │ ├── common │ │ ├── Android.mk │ │ ├── build │ │ │ └── make │ │ │ │ └── local.mk │ │ ├── include │ │ │ ├── abs_s.h │ │ │ ├── add.h │ │ │ ├── az_lsp.h │ │ │ ├── basic_op.h │ │ │ ├── basic_op_arm_gcc_v5.h │ │ │ ├── basic_op_c_equivalent.h │ │ │ ├── basicop_malloc.h │ │ │ ├── bitno_tab.h │ │ │ ├── bitreorder_tab.h │ │ │ ├── bytesused.h │ │ │ ├── cnst.h │ │ │ ├── cnst_vad.h │ │ │ ├── d_gain_c.h │ │ │ ├── d_gain_p.h │ │ │ ├── d_plsf.h │ │ │ ├── div_s.h │ │ │ ├── dtx_common_def.h │ │ │ ├── frame.h │ │ │ ├── frame_type_3gpp.h │ │ │ ├── gc_pred.h │ │ │ ├── get_const_tbls.h │ │ │ ├── gmed_n.h │ │ │ ├── gsm_amr_typedefs.h │ │ │ ├── int_lpc.h │ │ │ ├── int_lsf.h │ │ │ ├── inv_sqrt.h │ │ │ ├── l_add.h │ │ │ ├── l_add_c.h │ │ │ ├── l_comp.h │ │ │ ├── l_extract.h │ │ │ ├── l_mac.h │ │ │ ├── l_msu.h │ │ │ ├── l_mult.h │ │ │ ├── l_negate.h │ │ │ ├── l_shl.h │ │ │ ├── l_shr.h │ │ │ ├── l_shr_r.h │ │ │ ├── l_sub.h │ │ │ ├── log2.h │ │ │ ├── log2_norm.h │ │ │ ├── lsfwt.h │ │ │ ├── lsp.h │ │ │ ├── lsp_az.h │ │ │ ├── lsp_lsf.h │ │ │ ├── lsp_tab.h │ │ │ ├── mac_32.h │ │ │ ├── mode.h │ │ │ ├── mpy_32.h │ │ │ ├── mpy_32_16.h │ │ │ ├── mult.h │ │ │ ├── mult_r.h │ │ │ ├── n_proc.h │ │ │ ├── negate.h │ │ │ ├── norm_l.h │ │ │ ├── norm_s.h │ │ │ ├── oper_32b.h │ │ │ ├── p_ol_wgh.h │ │ │ ├── pow2.h │ │ │ ├── pred_lt.h │ │ │ ├── pvgsmamr.h │ │ │ ├── q_plsf.h │ │ │ ├── q_plsf_3_tbl.h │ │ │ ├── q_plsf_5_tbl.h │ │ │ ├── qgain475_tab.h │ │ │ ├── qua_gain.h │ │ │ ├── qua_gain_tbl.h │ │ │ ├── reorder.h │ │ │ ├── residu.h │ │ │ ├── reverse_bits.h │ │ │ ├── round.h │ │ │ ├── set_zero.h │ │ │ ├── shl.h │ │ │ ├── shr.h │ │ │ ├── shr_r.h │ │ │ ├── sqrt_l.h │ │ │ ├── sub.h │ │ │ ├── syn_filt.h │ │ │ ├── typedef.h │ │ │ ├── vad.h │ │ │ ├── weight_a.h │ │ │ ├── window_tab.h │ │ │ └── wmf_to_ets.h │ │ └── src │ │ │ ├── add.cpp │ │ │ ├── az_lsp.cpp │ │ │ ├── bitno_tab.cpp │ │ │ ├── bitreorder_tab.cpp │ │ │ ├── bits2prm.cpp │ │ │ ├── c2_9pf_tab.cpp │ │ │ ├── copy.cpp │ │ │ ├── div_32.cpp │ │ │ ├── div_s.cpp │ │ │ ├── extract_h.cpp │ │ │ ├── extract_l.cpp │ │ │ ├── gains_tbl.cpp │ │ │ ├── gc_pred.cpp │ │ │ ├── get_const_tbls.cpp │ │ │ ├── gmed_n.cpp │ │ │ ├── gray_tbl.cpp │ │ │ ├── grid_tbl.cpp │ │ │ ├── int_lpc.cpp │ │ │ ├── inv_sqrt.cpp │ │ │ ├── inv_sqrt_tbl.cpp │ │ │ ├── l_abs.cpp │ │ │ ├── l_deposit_h.cpp │ │ │ ├── l_deposit_l.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 │ │ │ ├── negate.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 │ │ │ ├── r_fft.cpp │ │ │ ├── reorder.cpp │ │ │ ├── residu.cpp │ │ │ ├── round.cpp │ │ │ ├── set_zero.cpp │ │ │ ├── shr.cpp │ │ │ ├── shr_r.cpp │ │ │ ├── sqrt_l.cpp │ │ │ ├── sqrt_l_tbl.cpp │ │ │ ├── sub.cpp │ │ │ ├── syn_filt.cpp │ │ │ ├── vad1.cpp │ │ │ ├── vad2.cpp │ │ │ ├── weight_a.cpp │ │ │ └── window_tab.cpp │ ├── dec │ │ ├── Android.mk │ │ ├── build │ │ │ └── make │ │ │ │ └── local.mk │ │ ├── include │ │ │ ├── decoder_gsm_amr.h │ │ │ └── pvamrnbdecoder_api.h │ │ └── src │ │ │ ├── a_refl.cpp │ │ │ ├── a_refl.h │ │ │ ├── agc.cpp │ │ │ ├── agc.h │ │ │ ├── amrdecode.cpp │ │ │ ├── amrdecode.h │ │ │ ├── b_cn_cod.cpp │ │ │ ├── b_cn_cod.h │ │ │ ├── bgnscd.cpp │ │ │ ├── bgnscd.h │ │ │ ├── c_g_aver.cpp │ │ │ ├── c_g_aver.h │ │ │ ├── d1035pf.cpp │ │ │ ├── d1035pf.h │ │ │ ├── d2_11pf.cpp │ │ │ ├── d2_11pf.h │ │ │ ├── d2_9pf.cpp │ │ │ ├── d2_9pf.h │ │ │ ├── d3_14pf.cpp │ │ │ ├── d3_14pf.h │ │ │ ├── d4_17pf.cpp │ │ │ ├── d4_17pf.h │ │ │ ├── d8_31pf.cpp │ │ │ ├── d8_31pf.h │ │ │ ├── d_gain_c.cpp │ │ │ ├── d_gain_p.cpp │ │ │ ├── d_plsf.cpp │ │ │ ├── d_plsf_3.cpp │ │ │ ├── d_plsf_5.cpp │ │ │ ├── dec_amr.cpp │ │ │ ├── dec_amr.h │ │ │ ├── dec_gain.cpp │ │ │ ├── dec_gain.h │ │ │ ├── dec_input_format_tab.cpp │ │ │ ├── dec_lag3.cpp │ │ │ ├── dec_lag3.h │ │ │ ├── dec_lag6.cpp │ │ │ ├── dec_lag6.h │ │ │ ├── decoder_gsm_amr.cpp │ │ │ ├── dtx_dec.cpp │ │ │ ├── dtx_dec.h │ │ │ ├── ec_gains.cpp │ │ │ ├── ec_gains.h │ │ │ ├── ex_ctrl.cpp │ │ │ ├── ex_ctrl.h │ │ │ ├── gsmamr_dec.h │ │ │ ├── if2_to_ets.cpp │ │ │ ├── if2_to_ets.h │ │ │ ├── int_lsf.cpp │ │ │ ├── lsp_avg.cpp │ │ │ ├── lsp_avg.h │ │ │ ├── ph_disp.cpp │ │ │ ├── ph_disp.h │ │ │ ├── post_pro.cpp │ │ │ ├── post_pro.h │ │ │ ├── preemph.cpp │ │ │ ├── preemph.h │ │ │ ├── pstfilt.cpp │ │ │ ├── pstfilt.h │ │ │ ├── pvgsmamrdecoder.cpp │ │ │ ├── pvgsmamrdecoder.h │ │ │ ├── pvgsmamrdecoder_dpi.h │ │ │ ├── qgain475_tab.cpp │ │ │ ├── sp_dec.cpp │ │ │ ├── sp_dec.h │ │ │ └── wmf_to_ets.cpp │ └── enc │ │ ├── Android.mk │ │ ├── build │ │ └── make │ │ │ └── local.mk │ │ ├── include │ │ └── gsmamr_encoder_wrapper.h │ │ └── src │ │ ├── amrencode.cpp │ │ ├── amrencode.h │ │ ├── autocorr.cpp │ │ ├── autocorr.h │ │ ├── c1035pf.cpp │ │ ├── c1035pf.h │ │ ├── c2_11pf.cpp │ │ ├── c2_11pf.h │ │ ├── c2_9pf.cpp │ │ ├── c2_9pf.h │ │ ├── c3_14pf.cpp │ │ ├── c3_14pf.h │ │ ├── c4_17pf.cpp │ │ ├── c4_17pf.h │ │ ├── c8_31pf.cpp │ │ ├── c8_31pf.h │ │ ├── calc_cor.cpp │ │ ├── calc_cor.h │ │ ├── calc_en.cpp │ │ ├── calc_en.h │ │ ├── cbsearch.cpp │ │ ├── cbsearch.h │ │ ├── cl_ltp.cpp │ │ ├── cl_ltp.h │ │ ├── cod_amr.cpp │ │ ├── cod_amr.h │ │ ├── convolve.cpp │ │ ├── convolve.h │ │ ├── cor_h.cpp │ │ ├── cor_h.h │ │ ├── cor_h_x.cpp │ │ ├── cor_h_x.h │ │ ├── cor_h_x2.cpp │ │ ├── cor_h_x2.h │ │ ├── corrwght_tab.cpp │ │ ├── div_32.cpp │ │ ├── div_32.h │ │ ├── dtx_enc.cpp │ │ ├── dtx_enc.h │ │ ├── enc_lag3.cpp │ │ ├── enc_lag3.h │ │ ├── enc_lag6.cpp │ │ ├── enc_lag6.h │ │ ├── enc_output_format_tab.cpp │ │ ├── ets_to_if2.cpp │ │ ├── ets_to_if2.h │ │ ├── ets_to_wmf.cpp │ │ ├── ets_to_wmf.h │ │ ├── g_adapt.cpp │ │ ├── g_adapt.h │ │ ├── g_code.cpp │ │ ├── g_code.h │ │ ├── g_pitch.cpp │ │ ├── g_pitch.h │ │ ├── gain_q.cpp │ │ ├── gain_q.h │ │ ├── gsmamr_enc.h │ │ ├── gsmamr_encoder_wrapper.cpp │ │ ├── hp_max.cpp │ │ ├── hp_max.h │ │ ├── inter_36.cpp │ │ ├── inter_36.h │ │ ├── inter_36_tab.cpp │ │ ├── inter_36_tab.h │ │ ├── l_abs.cpp │ │ ├── l_abs.h │ │ ├── l_comp.cpp │ │ ├── l_extract.cpp │ │ ├── l_negate.cpp │ │ ├── lag_wind.cpp │ │ ├── lag_wind.h │ │ ├── lag_wind_tab.cpp │ │ ├── lag_wind_tab.h │ │ ├── levinson.cpp │ │ ├── levinson.h │ │ ├── lflg_upd.cpp │ │ ├── lpc.cpp │ │ ├── lpc.h │ │ ├── ol_ltp.cpp │ │ ├── ol_ltp.h │ │ ├── p_ol_wgh.cpp │ │ ├── pitch_fr.cpp │ │ ├── pitch_fr.h │ │ ├── pitch_ol.cpp │ │ ├── pitch_ol.h │ │ ├── pre_big.cpp │ │ ├── pre_big.h │ │ ├── pre_proc.cpp │ │ ├── pre_proc.h │ │ ├── prm2bits.cpp │ │ ├── prm2bits.h │ │ ├── q_gain_c.cpp │ │ ├── q_gain_c.h │ │ ├── q_gain_p.cpp │ │ ├── q_gain_p.h │ │ ├── qgain475.cpp │ │ ├── qgain475.h │ │ ├── qgain795.cpp │ │ ├── qgain795.h │ │ ├── qua_gain.cpp │ │ ├── s10_8pf.cpp │ │ ├── s10_8pf.h │ │ ├── set_sign.cpp │ │ ├── set_sign.h │ │ ├── sid_sync.cpp │ │ ├── sid_sync.h │ │ ├── sp_enc.cpp │ │ ├── sp_enc.h │ │ ├── spreproc.cpp │ │ ├── spreproc.h │ │ ├── spstproc.cpp │ │ ├── spstproc.h │ │ ├── ton_stab.cpp │ │ ├── ton_stab.h │ │ ├── vad1.cpp │ │ ├── vad1.h │ │ └── vad2.h │ ├── amr_wb │ └── dec │ │ ├── Android.mk │ │ ├── build │ │ └── make │ │ │ └── local.mk │ │ ├── include │ │ ├── decoder_amr_wb.h │ │ └── pvamrwbdecoder_api.h │ │ └── src │ │ ├── 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.h │ │ ├── dtx_decoder_amr_wb.cpp │ │ ├── e_pv_amrwbdec.h │ │ ├── get_amr_wb_bits.cpp │ │ ├── get_amr_wb_bits.h │ │ ├── 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 │ │ ├── mime_io.h │ │ ├── noise_gen_amrwb.cpp │ │ ├── normalize_amr_wb.cpp │ │ ├── normalize_amr_wb.h │ │ ├── oversamp_12k8_to_16k.cpp │ │ ├── phase_dispersion.cpp │ │ ├── pit_shrp.cpp │ │ ├── pred_lt4.cpp │ │ ├── preemph_amrwb_dec.cpp │ │ ├── pv_amr_wb_type_defs.h │ │ ├── pvamrwb_math_op.cpp │ │ ├── pvamrwb_math_op.h │ │ ├── pvamrwbdecoder.cpp │ │ ├── pvamrwbdecoder.h │ │ ├── pvamrwbdecoder_acelp.h │ │ ├── pvamrwbdecoder_basic_op.h │ │ ├── pvamrwbdecoder_basic_op_cequivalent.h │ │ ├── pvamrwbdecoder_basic_op_gcc_armv5.h │ │ ├── pvamrwbdecoder_cnst.h │ │ ├── pvamrwbdecoder_mem_funcs.h │ │ ├── q_gain2_tab.cpp │ │ ├── q_pulse.h │ │ ├── qisf_ns.cpp │ │ ├── qisf_ns.h │ │ ├── qisf_ns_tab.cpp │ │ ├── qpisf_2s.cpp │ │ ├── qpisf_2s.h │ │ ├── qpisf_2s_tab.cpp │ │ ├── scale_signal.cpp │ │ ├── synthesis_amr_wb.cpp │ │ ├── synthesis_amr_wb.h │ │ ├── voice_factor.cpp │ │ ├── wb_syn_filt.cpp │ │ └── weight_amrwb_lpc.cpp │ ├── common │ └── dec │ │ ├── Android.mk │ │ ├── build │ │ └── make │ │ │ └── local.mk │ │ └── include │ │ └── pvgsmamrdecoderinterface.h │ └── patent_disclaimer.txt ├── oscl ├── oscl_base.h ├── oscl_base_macros.h └── oscl_mem.h └── test ├── .gitignore ├── Makefile.am ├── amrnb-dec.c ├── amrnb-enc-sine.c ├── amrnb-enc.c ├── amrwb-dec.c ├── linkboth.c ├── wavreader.c ├── wavreader.h ├── wavwriter.c └── wavwriter.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.lo 3 | *.pc 4 | Makefile 5 | Makefile.in 6 | aclocal.m4 7 | autom4te.cache 8 | configure 9 | .deps 10 | .libs 11 | config.guess 12 | config.log 13 | config.status 14 | config.sub 15 | depcomp 16 | install-sh 17 | libtool 18 | ltmain.sh 19 | m4/libtool.m4 20 | m4/ltoptions.m4 21 | m4/ltsugar.m4 22 | m4/ltversion.m4 23 | m4/lt~obsolete.m4 24 | missing 25 | stamp-h1 26 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 0.1.3 2 | - Adjusted libtool flags for building DLLs for windows 3 | - Update to the latest upstream opencore source 4 | - Updated and improved example applications 5 | - Add options for enabling the arm inline assembly 6 | - Add options for disabling the encoder or decoder in the amrnb library 7 | - Avoid dependencies on libstdc++ if building the source as C 8 | - Hide internal symbols in shared libraries 9 | - Minor tweaks 10 | - Remove old static makefiles and corresponding build scripts 11 | 12 | 0.1.2 13 | - Fixed AMR-NB encoding on 64-bit architectures 14 | - Switch to using automake/autoconf/libtool 15 | - Update to the latest upstream opencore source as of September 1, 2009 16 | 17 | 0.1.1 18 | - Rename the libraries from libamr* to libopencore-amr* 19 | - Fix a bunch of compiler warnings 20 | 21 | 0.1.0 22 | - Start of opencore-amr project. 23 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = amrnb amrwb 2 | if EXAMPLES 3 | SUBDIRS += test 4 | endif 5 | 6 | ACLOCAL_AMFLAGS = -I m4 7 | 8 | noinst_HEADERS = oscl/oscl_base.h oscl/oscl_mem.h oscl/oscl_base_macros.h 9 | 10 | EXTRA_DIST = $(top_srcdir)/LICENSE \ 11 | $(top_srcdir)/opencore/README \ 12 | $(top_srcdir)/opencore/NOTICE opencore/ChangeLog \ 13 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/patent_disclaimer.txt \ 14 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/common/dec/include \ 15 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/common/dec/build \ 16 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/common/dec/Android.mk \ 17 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk \ 18 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build \ 19 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include \ 20 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/*.cpp \ 21 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/Android.mk \ 22 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/build \ 23 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include \ 24 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/*.cpp \ 25 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/*.h \ 26 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk \ 27 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build \ 28 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/include \ 29 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/*.cpp \ 30 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/*.h \ 31 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk \ 32 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/build \ 33 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include \ 34 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/*.cpp \ 35 | $(top_srcdir)/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/*.h 36 | 37 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | OpenCORE Adaptive Multi Rate (AMR) speech codec library implementation. 2 | 3 | This library contains an implementation of the 3GPP TS 26.073 specification for 4 | the Adaptive Multi Rate (AMR) speech codec and an implementation for the 5 | 3GPP TS 26.173 specification for the Adaptive Multi-Rate - Wideband (AMR-WB) 6 | speech decoder. The implementation is derived from the OpenCORE framework, part 7 | of the Google Android project. 8 | 9 | This library is Licensed under the Apache License, Version 2.0. A copy me be 10 | found in the file 'LICENSE' and at 11 | http://www.apache.org/licenses/LICENSE-2.0.html 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | opencore-amr-js 2 | =================== 3 | 4 | AMR-NB Codec in Javascript. Ported [opencore-amr master](http://sourceforge.net/projects/opencore-amr/) 5 | using [emscripten](http://emscripten.org). This project is inspired by [amr.js](https://github.com/jpemartins/amr.js). 6 | 7 | Build under Ubuntu 8 | ----- 9 | 10 | Download and unzip portable emscripten SDK to a directory, say `EMSDK_PORTABLE`: 11 | 12 | 13 | Install and activate the emscripten SDK under `EMSDK_PORTABLE`: 14 | 15 | ``` 16 | ./emsdk update 17 | ./emsdk install latest 18 | ./emsdk activate latest 19 | source ./emsdk_env.sh 20 | sudo apt-get install nodejs-legacy 21 | ``` 22 | 23 | Install automake and autoconf tools: 24 | 25 | `sudo apt-get install libtool automake autoconf` 26 | 27 | Run `make` under `js` directory of the project source code tree. 28 | 29 | Build under Mac OS X 30 | ----- 31 | 32 | Install [homebrew](http://brew.sh/). 33 | 34 | Download and unzip portable emscripten SDK to a directory, say `EMSDK_PORTABLE`: 35 | 36 | 37 | Install and activate the emscripten SDK under `EMSDK_PORTABLE`: 38 | 39 | ``` 40 | brew install cmake nodejs python 41 | ./emsdk update 42 | ./emsdk install latest 43 | ./emsdk activate latest 44 | source ./emsdk_env.sh 45 | ``` 46 | 47 | Install automake and autoconf tools: 48 | 49 | `brew install libtool automake autoconf` 50 | 51 | Run `make` under `js` directory of the project source code tree. 52 | 53 | Demo 54 | ----- 55 | 56 | The demo file is `js/demo.html` and could also be accessed online from . 57 | 58 | Browser Compatibility 59 | ----- 60 | 61 | Firefox 30+ 62 | 63 | Chrome 39+ 64 | 65 | License 66 | ----- 67 | 68 | Released under the same lincense of Apache License V2.0 as the original project. 69 | -------------------------------------------------------------------------------- /amrnb/.gitignore: -------------------------------------------------------------------------------- 1 | libopencore-amrnb.* 2 | -------------------------------------------------------------------------------- /amrnb/interf_dec.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef OPENCORE_AMRNB_INTERF_DEC_H 20 | #define OPENCORE_AMRNB_INTERF_DEC_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | void* Decoder_Interface_init(void); 27 | void Decoder_Interface_exit(void* state); 28 | void Decoder_Interface_Decode(void* state, const unsigned char* in, short* out, int bfi); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /amrnb/interf_enc.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef OPENCORE_AMRNB_INTERF_ENC_H 20 | #define OPENCORE_AMRNB_INTERF_ENC_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #ifndef AMRNB_WRAPPER_INTERNAL 27 | /* Copied from enc/src/gsmamr_enc.h */ 28 | enum Mode { 29 | MR475 = 0,/* 4.75 kbps */ 30 | MR515, /* 5.15 kbps */ 31 | MR59, /* 5.90 kbps */ 32 | MR67, /* 6.70 kbps */ 33 | MR74, /* 7.40 kbps */ 34 | MR795, /* 7.95 kbps */ 35 | MR102, /* 10.2 kbps */ 36 | MR122, /* 12.2 kbps */ 37 | MRDTX, /* DTX */ 38 | N_MODES /* Not Used */ 39 | }; 40 | #endif 41 | 42 | void* Encoder_Interface_init(int dtx); 43 | void Encoder_Interface_exit(void* state); 44 | int Encoder_Interface_Encode(void* state, enum Mode mode, const short* speech, unsigned char* out, int forceSpeech); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /amrnb/opencore-amrnb.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: OpenCORE AMR-NB 7 | Description: Adaptive Multi-Rate speech codec library 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -lopencore-amrnb 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /amrnb/opencore-amrnb.sym: -------------------------------------------------------------------------------- 1 | Decoder_Interface_init 2 | Decoder_Interface_exit 3 | Decoder_Interface_Decode 4 | Encoder_Interface_init 5 | Encoder_Interface_exit 6 | Encoder_Interface_Encode 7 | -------------------------------------------------------------------------------- /amrnb/wrapper.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #define AMRNB_WRAPPER_INTERNAL 20 | #include 21 | #include 22 | #include 23 | #include "interf_dec.h" 24 | #include "interf_enc.h" 25 | #include 26 | 27 | #ifndef DISABLE_AMRNB_DECODER 28 | void* Decoder_Interface_init(void) { 29 | void* ptr = NULL; 30 | GSMInitDecode(&ptr, (int8*)"Decoder"); 31 | return ptr; 32 | } 33 | 34 | void Decoder_Interface_exit(void* state) { 35 | GSMDecodeFrameExit(&state); 36 | } 37 | 38 | void Decoder_Interface_Decode(void* state, const unsigned char* in, short* out, int bfi) { 39 | unsigned char type = (in[0] >> 3) & 0x0f; 40 | in++; 41 | if (bfi) { 42 | type = AMR_NO_DATA; 43 | } 44 | AMRDecode(state, (enum Frame_Type_3GPP) type, (UWord8*) in, out, MIME_IETF); 45 | } 46 | #endif 47 | 48 | #ifndef DISABLE_AMRNB_ENCODER 49 | struct encoder_state { 50 | void* encCtx; 51 | void* pidSyncCtx; 52 | }; 53 | 54 | void* Encoder_Interface_init(int dtx) { 55 | struct encoder_state* state = (struct encoder_state*) malloc(sizeof(struct encoder_state)); 56 | AMREncodeInit(&state->encCtx, &state->pidSyncCtx, dtx); 57 | return state; 58 | } 59 | 60 | void Encoder_Interface_exit(void* s) { 61 | struct encoder_state* state = (struct encoder_state*) s; 62 | AMREncodeExit(&state->encCtx, &state->pidSyncCtx); 63 | free(state); 64 | } 65 | 66 | int Encoder_Interface_Encode(void* s, enum Mode mode, const short* speech, unsigned char* out, int forceSpeech) { 67 | struct encoder_state* state = (struct encoder_state*) s; 68 | enum Frame_Type_3GPP frame_type = (enum Frame_Type_3GPP) mode; 69 | int ret = AMREncode(state->encCtx, state->pidSyncCtx, mode, (Word16*) speech, out, &frame_type, AMR_TX_IETF); 70 | out[0] |= 0x04; 71 | return ret; 72 | } 73 | #endif 74 | 75 | -------------------------------------------------------------------------------- /amrwb/.gitignore: -------------------------------------------------------------------------------- 1 | libopencore-amrwb.* 2 | -------------------------------------------------------------------------------- /amrwb/Makefile.am: -------------------------------------------------------------------------------- 1 | # Just set OC_BASE to the opencore root, or set AMR_BASE directly to 2 | # a detached gsm_amr directory 3 | OC_BASE = $(top_srcdir)/opencore 4 | AMR_BASE = $(OC_BASE)/codecs_v2/audio/gsm_amr 5 | 6 | DEC_DIR = $(AMR_BASE)/amr_wb/dec 7 | DEC_SRC_DIR = $(DEC_DIR)/src 8 | OSCL = $(top_srcdir)/oscl 9 | 10 | AM_CFLAGS = -I$(OSCL) -I$(DEC_SRC_DIR) -I$(DEC_DIR)/include \ 11 | -I$(AMR_BASE)/common/dec/include 12 | 13 | if GCC_ARMV5 14 | AM_CFLAGS += -DPV_CPU_ARCH_VERSION=5 -DPV_COMPILER=1 15 | endif 16 | 17 | if COMPILE_AS_C 18 | AM_CFLAGS += -x c -std=c99 19 | libopencore_amrwb_la_LINK = $(LINK) $(libopencore_amrwb_la_LDFLAGS) 20 | # Mention a dummy pure C file to trigger generation of the $(LINK) variable 21 | nodist_EXTRA_libopencore_amrwb_la_SOURCES = dummy.c 22 | else 23 | libopencore_amrwb_la_LINK = $(CXXLINK) $(libopencore_amrwb_la_LDFLAGS) 24 | endif 25 | 26 | AM_CXXFLAGS = $(AM_CFLAGS) 27 | 28 | amrwbincludedir = $(includedir)/opencore-amrwb 29 | amrwbinclude_HEADERS = dec_if.h if_rom.h 30 | 31 | pkgconfigdir = $(libdir)/pkgconfig 32 | pkgconfig_DATA = opencore-amrwb.pc 33 | 34 | lib_LTLIBRARIES = libopencore-amrwb.la 35 | 36 | libopencore_amrwb_la_LDFLAGS = -version-info @OPENCORE_AMRWB_VERSION@ -no-undefined -export-symbols $(top_srcdir)/amrwb/opencore-amrwb.sym 37 | EXTRA_DIST = $(top_srcdir)/amrwb/opencore-amrwb.sym 38 | 39 | # Our sources to include. There are certain sources we exclude and they are 40 | # $(DEC_SRC_DIR)/decoder_amr_wb.cpp 41 | libopencore_amrwb_la_SOURCES = \ 42 | wrapper.cpp \ 43 | $(DEC_SRC_DIR)/agc2_amr_wb.cpp \ 44 | $(DEC_SRC_DIR)/band_pass_6k_7k.cpp \ 45 | $(DEC_SRC_DIR)/dec_acelp_2p_in_64.cpp \ 46 | $(DEC_SRC_DIR)/dec_acelp_4p_in_64.cpp \ 47 | $(DEC_SRC_DIR)/dec_alg_codebook.cpp \ 48 | $(DEC_SRC_DIR)/dec_gain2_amr_wb.cpp \ 49 | $(DEC_SRC_DIR)/deemphasis_32.cpp \ 50 | $(DEC_SRC_DIR)/dtx_decoder_amr_wb.cpp \ 51 | $(DEC_SRC_DIR)/get_amr_wb_bits.cpp \ 52 | $(DEC_SRC_DIR)/highpass_400hz_at_12k8.cpp \ 53 | $(DEC_SRC_DIR)/highpass_50hz_at_12k8.cpp \ 54 | $(DEC_SRC_DIR)/homing_amr_wb_dec.cpp \ 55 | $(DEC_SRC_DIR)/interpolate_isp.cpp \ 56 | $(DEC_SRC_DIR)/isf_extrapolation.cpp \ 57 | $(DEC_SRC_DIR)/isp_az.cpp \ 58 | $(DEC_SRC_DIR)/isp_isf.cpp \ 59 | $(DEC_SRC_DIR)/lagconceal.cpp \ 60 | $(DEC_SRC_DIR)/low_pass_filt_7k.cpp \ 61 | $(DEC_SRC_DIR)/median5.cpp \ 62 | $(DEC_SRC_DIR)/mime_io.cpp \ 63 | $(DEC_SRC_DIR)/noise_gen_amrwb.cpp \ 64 | $(DEC_SRC_DIR)/normalize_amr_wb.cpp \ 65 | $(DEC_SRC_DIR)/oversamp_12k8_to_16k.cpp \ 66 | $(DEC_SRC_DIR)/phase_dispersion.cpp \ 67 | $(DEC_SRC_DIR)/pit_shrp.cpp \ 68 | $(DEC_SRC_DIR)/pred_lt4.cpp \ 69 | $(DEC_SRC_DIR)/preemph_amrwb_dec.cpp \ 70 | $(DEC_SRC_DIR)/pvamrwbdecoder.cpp \ 71 | $(DEC_SRC_DIR)/pvamrwb_math_op.cpp \ 72 | $(DEC_SRC_DIR)/q_gain2_tab.cpp \ 73 | $(DEC_SRC_DIR)/qisf_ns.cpp \ 74 | $(DEC_SRC_DIR)/qisf_ns_tab.cpp \ 75 | $(DEC_SRC_DIR)/qpisf_2s.cpp \ 76 | $(DEC_SRC_DIR)/qpisf_2s_tab.cpp \ 77 | $(DEC_SRC_DIR)/scale_signal.cpp \ 78 | $(DEC_SRC_DIR)/synthesis_amr_wb.cpp \ 79 | $(DEC_SRC_DIR)/voice_factor.cpp \ 80 | $(DEC_SRC_DIR)/wb_syn_filt.cpp \ 81 | $(DEC_SRC_DIR)/weight_amrwb_lpc.cpp 82 | 83 | -------------------------------------------------------------------------------- /amrwb/dec_if.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef OPENCORE_AMRWB_DEC_IF_H 20 | #define OPENCORE_AMRWB_DEC_IF_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #define _good_frame 0 27 | 28 | void* D_IF_init(void); 29 | void D_IF_decode(void* state, const unsigned char* bits, short* synth, int bfi); 30 | void D_IF_exit(void* state); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /amrwb/if_rom.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef OPENCORE_AMRWB_IF_ROM_H 20 | #define OPENCORE_AMRWB_IF_ROM_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #include 27 | typedef int16_t Word16; 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /amrwb/opencore-amrwb.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: OpenCORE AMR-WB 7 | Description: Adaptive Multi-Rate Wideband speech codec library 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -lopencore-amrwb 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /amrwb/opencore-amrwb.sym: -------------------------------------------------------------------------------- 1 | D_IF_init 2 | D_IF_decode 3 | D_IF_exit 4 | -------------------------------------------------------------------------------- /amrwb/wrapper.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #include "dec_if.h" 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | /* This is basically a C rewrite of decode_amr_wb.cpp */ 28 | 29 | struct state { 30 | void *st; /* State structure */ 31 | unsigned char *pt_st; 32 | int16 *ScratchMem; 33 | 34 | uint8* iInputBuf; 35 | int16* iInputSampleBuf; 36 | int16* iOutputBuf; 37 | 38 | uint8 quality; 39 | int16 mode; 40 | int16 mode_old; 41 | int16 frame_type; 42 | 43 | int16 reset_flag; 44 | int16 reset_flag_old; 45 | int16 status; 46 | RX_State rx_state; 47 | }; 48 | 49 | void* D_IF_init(void) { 50 | struct state* state = (struct state*) malloc(sizeof(struct state)); 51 | memset(state, 0, sizeof(*state)); 52 | 53 | state->iInputSampleBuf = (int16*) malloc(sizeof(int16)*KAMRWB_NB_BITS_MAX); 54 | state->reset_flag = 0; 55 | state->reset_flag_old = 1; 56 | state->mode_old = 0; 57 | state->rx_state.prev_ft = RX_SPEECH_GOOD; 58 | state->rx_state.prev_mode = 0; 59 | state->pt_st = (unsigned char*) malloc(pvDecoder_AmrWbMemRequirements()); 60 | 61 | pvDecoder_AmrWb_Init(&state->st, state->pt_st, &state->ScratchMem); 62 | return state; 63 | } 64 | 65 | void D_IF_exit(void* s) { 66 | struct state* state = (struct state*) s; 67 | free(state->pt_st); 68 | free(state->iInputSampleBuf); 69 | free(state); 70 | } 71 | 72 | void D_IF_decode(void* s, const unsigned char* in, short* out, int bfi) { 73 | struct state* state = (struct state*) s; 74 | 75 | state->mode = (in[0] >> 3) & 0x0f; 76 | in++; 77 | if (bfi) { 78 | state->mode = 15; // NO_DATA 79 | } 80 | 81 | state->quality = 1; /* ? */ 82 | mime_unsorting((uint8*) in, state->iInputSampleBuf, &state->frame_type, &state->mode, state->quality, &state->rx_state); 83 | 84 | if ((state->frame_type == RX_NO_DATA) | (state->frame_type == RX_SPEECH_LOST)) { 85 | state->mode = state->mode_old; 86 | state->reset_flag = 0; 87 | } else { 88 | state->mode_old = state->mode; 89 | 90 | /* if homed: check if this frame is another homing frame */ 91 | if (state->reset_flag_old == 1) { 92 | /* only check until end of first subframe */ 93 | state->reset_flag = pvDecoder_AmrWb_homing_frame_test_first(state->iInputSampleBuf, state->mode); 94 | } 95 | } 96 | 97 | /* produce encoder homing frame if homed & input=decoder homing frame */ 98 | if ((state->reset_flag != 0) && (state->reset_flag_old != 0)) { 99 | /* set homing sequence ( no need to decode anything */ 100 | 101 | for (int16 i = 0; i < AMR_WB_PCM_FRAME; i++) { 102 | out[i] = EHF_MASK; 103 | } 104 | } else { 105 | int16 frameLength; 106 | state->status = pvDecoder_AmrWb(state->mode, 107 | state->iInputSampleBuf, 108 | out, 109 | &frameLength, 110 | state->st, 111 | state->frame_type, 112 | state->ScratchMem); 113 | } 114 | 115 | for (int16 i = 0; i < AMR_WB_PCM_FRAME; i++) { /* Delete the 2 LSBs (14-bit output) */ 116 | out[i] &= 0xfffC; 117 | } 118 | 119 | /* if not homed: check whether current frame is a homing frame */ 120 | if (state->reset_flag_old == 0) { 121 | /* check whole frame */ 122 | state->reset_flag = pvDecoder_AmrWb_homing_frame_test(state->iInputSampleBuf, state->mode); 123 | } 124 | /* reset decoder if current frame is a homing frame */ 125 | if (state->reset_flag != 0) { 126 | pvDecoder_AmrWb_Reset(state->st, 1); 127 | } 128 | state->reset_flag_old = state->reset_flag; 129 | 130 | } 131 | 132 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | dnl -*- Autoconf -*- 2 | dnl Process this file with autoconf to produce a configure script. 3 | 4 | AC_INIT([opencore-amr], [0.1.3], [http://sourceforge.net/projects/opencore-amr/]) 5 | AC_CONFIG_AUX_DIR(.) 6 | AC_CONFIG_MACRO_DIR([m4]) 7 | AM_INIT_AUTOMAKE([tar-ustar foreign]) 8 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 9 | AM_MAINTAINER_MODE 10 | 11 | dnl Various options for configure 12 | AC_ARG_ENABLE([compile-c], 13 | [AS_HELP_STRING([--enable-compile-c], 14 | [enable compiling as C program (default is yes)])], 15 | [compile_as_c=$enableval], 16 | [compile_as_c=yes]) 17 | AC_ARG_ENABLE([gcc-armv5], 18 | [AS_HELP_STRING([--enable-gcc-armv5], 19 | [enable GCC specific ARMv5 assembler (default is no)])], 20 | [gcc_armv5=$enableval], [gcc_armv5=no]) 21 | AC_ARG_ENABLE([amrnb-encoder], 22 | [AS_HELP_STRING([--enable-amrnb-encoder], 23 | [enable AMR-NB encoder (default is yes)])], 24 | [amrnb_encoder=$enableval], [amrnb_encoder=yes]) 25 | AC_ARG_ENABLE([amrnb-decoder], 26 | [AS_HELP_STRING([--enable-amrnb-decoder], 27 | [enable AMR-NB decoder (default is yes)])], 28 | [amrnb_decoder=$enableval], [amrnb_decoder=yes]) 29 | AC_ARG_ENABLE([examples], 30 | [AS_HELP_STRING([--enable-examples], 31 | [enable example encoding/decoding programs (default is no)])], 32 | [examples=$enableval], [examples=no]) 33 | 34 | dnl Automake conditionals to set 35 | AM_CONDITIONAL(COMPILE_AS_C, test x$compile_as_c = xyes) 36 | AM_CONDITIONAL(GCC_ARMV5, test x$gcc_armv5 = xyes) 37 | AM_CONDITIONAL(AMRNB_ENCODER, test x$amrnb_encoder = xyes) 38 | AM_CONDITIONAL(AMRNB_DECODER, test x$amrnb_decoder = xyes) 39 | AM_CONDITIONAL(EXAMPLES, test x$examples = xyes) 40 | 41 | dnl Checks for programs. 42 | AC_PROG_CXX 43 | AC_PROG_CC 44 | AC_PROG_INSTALL 45 | AC_PROG_LN_S 46 | AC_PROG_MAKE_SET 47 | 48 | dnl Setup for libtool 49 | LT_INIT 50 | 51 | dnl Checks for libraries. 52 | AC_CHECK_LIB([m], [main]) 53 | 54 | dnl Checks for header files. 55 | AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) 56 | 57 | dnl Checks for typedefs, structures, and compiler characteristics. 58 | AC_HEADER_STDBOOL 59 | AC_C_INLINE 60 | AC_TYPE_INT16_T 61 | AC_TYPE_INT32_T 62 | AC_TYPE_INT64_T 63 | AC_TYPE_INT8_T 64 | AC_TYPE_UINT16_T 65 | AC_TYPE_UINT32_T 66 | AC_TYPE_UINT64_T 67 | AC_TYPE_UINT8_T 68 | 69 | dnl Checks for library functions. 70 | AC_FUNC_MALLOC 71 | AC_CHECK_FUNCS([memset]) 72 | 73 | dnl OpenCORE AMR soname version to use 74 | dnl goes by ‘current[:revision[:age]]’ with the soname ending up as 75 | dnl current.age.revision. 76 | OPENCORE_AMRNB_VERSION=0:3:0 77 | OPENCORE_AMRWB_VERSION=0:3:0 78 | AC_SUBST(OPENCORE_AMRNB_VERSION) 79 | AC_SUBST(OPENCORE_AMRWB_VERSION) 80 | 81 | AC_CONFIG_FILES([Makefile 82 | amrnb/Makefile 83 | amrwb/Makefile 84 | test/Makefile 85 | amrnb/opencore-amrnb.pc 86 | amrwb/opencore-amrwb.pc]) 87 | AC_OUTPUT 88 | -------------------------------------------------------------------------------- /js/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all clean 2 | 3 | all: amrnb.js 4 | 5 | amrnb.js: amrnb.bc pre.js 6 | em++ amrnb.bc -O3 -s NO_EXIT_RUNTIME=1 -s TOTAL_MEMORY=524288 -s TOTAL_STACK=65536 -s \ 7 | EXPORTED_FUNCTIONS="['_Decoder_Interface_init','_Decoder_Interface_exit','_Decoder_Interface_Decode','_Encoder_Interface_init','_Encoder_Interface_exit', '_Encoder_Interface_Encode']" \ 8 | --pre-js pre.js --memory-init-file 0 -o out.js 9 | echo "var AMR = (function() {" > $@ 10 | cat out.js >> $@ 11 | echo "return AMR; })();" >> $@ 12 | 13 | amrnb.bc: bld.sh 14 | ./bld.sh 15 | 16 | clean: 17 | rm -rf build 18 | rm -f amrnb.* 19 | 20 | -------------------------------------------------------------------------------- /js/bld.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case `uname` in 4 | Darwin*) 5 | libtoolize="glibtoolize" 6 | so="dylib" 7 | ;; 8 | 9 | *) 10 | libtoolize="libtoolize" 11 | so="so" 12 | ;; 13 | esac 14 | 15 | 16 | # generate configure file 17 | pushd . 18 | cd .. 19 | ${libtoolize} --force 20 | aclocal 21 | automake --force-missing --add-missing 22 | autoconf -i 23 | popd 24 | 25 | # build with emscripten to get llvm bitcode. 26 | pushd . 27 | rm -rf build 28 | mkdir -p build 29 | cd build 30 | emconfigure ../../configure --prefix=`pwd` 31 | emmake make install 32 | cp lib/libopencore-amrnb.${so} ../amrnb.bc 33 | popd 34 | 35 | -------------------------------------------------------------------------------- /js/hello.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yxl/opencore-amr-js/dcf3d2b5f384a1d9ded2a54e4c137a81747b222b/js/hello.ogg -------------------------------------------------------------------------------- /js/yuan.amr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yxl/opencore-amr-js/dcf3d2b5f384a1d9ded2a54e4c137a81747b222b/js/yuan.amr -------------------------------------------------------------------------------- /js/yuan.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yxl/opencore-amr-js/dcf3d2b5f384a1d9ded2a54e4c137a81747b222b/js/yuan.wav -------------------------------------------------------------------------------- /m4/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yxl/opencore-amr-js/dcf3d2b5f384a1d9ded2a54e4c137a81747b222b/m4/.gitkeep -------------------------------------------------------------------------------- /opencore/README: -------------------------------------------------------------------------------- 1 | Welcome to OpenCORE 2 | 3 | http://www.opencore.net/ 4 | 5 | OpenCORE is the multimedia framework of Android originally contributed by 6 | PacketVideo. It provides an extensible framework for multimedia rendering and 7 | authoring and video telephony (3G-324M). 8 | 9 | The following an overview of the directory structure which includes a list of 10 | the top-level directories along with a brief note describing the contents. 11 | 12 | __ 13 | |-- android [Contains the components the interface OpenCORE with 14 | | other parts of Android] 15 | |-- baselibs [Contains basic libraries for data containers, MIME string 16 | | handling, messaging across thread boundaries, etc] 17 | |-- build_config [Contains top-level build files used to build the libraries 18 | | outside of Android] 19 | |-- codecs_v2 [Contains the implementations of PV's audio and video 20 | | codecs as well as the OpenMax IL interface layer] 21 | |-- doc [Contains the documentation required to interface with 22 | | OpenCORE] 23 | |-- engines [Contains the implementation of the player and author 24 | | engines as well as a utility for metadata] 25 | |-- extern_libs_v2 [Contains 3rd-party libraries used by OpenCORE. 26 | | Currently this directory contains header files 27 | | defining the Khronos OpenMax IL interface] 28 | |-- extern_tools_v2 [Contains 3rd-party tools used to build OpenCORE 29 | | indpendently of the Android build system] 30 | |-- fileformats [Contains the libraries for parsing a variety of 31 | | fileformats including mp4/3gp,mp3,wav,aac] 32 | |-- modules [Contains build files for aggregating low-level libraries] 33 | |-- nodes [Contains the OpenCORE framework "nodes", which is 34 | | the abstraction used to implement independent multimedia 35 | | processing units that can be connected in a flow graph] 36 | |-- oscl [This is the Operating System Compatibility Layer which 37 | | provides the mapping OS APIs as well as some basic 38 | | data structures and utilities] 39 | |-- protocols [Contains parsers and composers for a variety of network 40 | | protocols such as HTTP, RTP/RTCP, RTSP, and SDP] 41 | |-- pvmi [Contains fundamental definitions that make up OpenCORE. 42 | | The directory name is an abbreviation of PacketVideo 43 | | Multimedia Infrastructure] 44 | |-- tools_v2 [Contains tools used to build the libraries outside of Android] 45 | 46 | Within each library, the following directory structure, with a few exceptions, 47 | is implemented to organize the files: 48 | 49 | __ 50 | |-- build 51 | |-- make <- makefile to build outside of Android is here 52 | |-- doc <- directory for any documentation specific to this lib 53 | |-- include <- header files that are part of the external interface go here 54 | |-- src <- source and internal header files of the library 55 | |-- test <- test code (follows a similar structure) 56 | |-- build 57 | |-- make 58 | |-- include 59 | |-- src 60 | 61 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES := \ 5 | src/add.cpp \ 6 | src/az_lsp.cpp \ 7 | src/bitno_tab.cpp \ 8 | src/bitreorder_tab.cpp \ 9 | src/c2_9pf_tab.cpp \ 10 | src/div_s.cpp \ 11 | src/gains_tbl.cpp \ 12 | src/gc_pred.cpp \ 13 | src/get_const_tbls.cpp \ 14 | src/gmed_n.cpp \ 15 | src/grid_tbl.cpp \ 16 | src/gray_tbl.cpp \ 17 | src/int_lpc.cpp \ 18 | src/inv_sqrt.cpp \ 19 | src/inv_sqrt_tbl.cpp \ 20 | src/l_shr_r.cpp \ 21 | src/log2.cpp \ 22 | src/log2_norm.cpp \ 23 | src/log2_tbl.cpp \ 24 | src/lsfwt.cpp \ 25 | src/lsp.cpp \ 26 | src/lsp_az.cpp \ 27 | src/lsp_lsf.cpp \ 28 | src/lsp_lsf_tbl.cpp \ 29 | src/lsp_tab.cpp \ 30 | src/mult_r.cpp \ 31 | src/norm_l.cpp \ 32 | src/norm_s.cpp \ 33 | src/overflow_tbl.cpp \ 34 | src/ph_disp_tab.cpp \ 35 | src/pow2.cpp \ 36 | src/pow2_tbl.cpp \ 37 | src/pred_lt.cpp \ 38 | src/q_plsf.cpp \ 39 | src/q_plsf_3.cpp \ 40 | src/q_plsf_3_tbl.cpp \ 41 | src/q_plsf_5.cpp \ 42 | src/q_plsf_5_tbl.cpp \ 43 | src/qua_gain_tbl.cpp \ 44 | src/reorder.cpp \ 45 | src/residu.cpp \ 46 | src/round.cpp \ 47 | src/shr.cpp \ 48 | src/shr_r.cpp \ 49 | src/sqrt_l.cpp \ 50 | src/sqrt_l_tbl.cpp \ 51 | src/sub.cpp \ 52 | src/syn_filt.cpp \ 53 | src/weight_a.cpp \ 54 | src/window_tab.cpp 55 | 56 | 57 | LOCAL_MODULE := libpv_amr_nb_common_lib 58 | 59 | LOCAL_CFLAGS := $(PV_CFLAGS) 60 | LOCAL_ARM_MODE := arm 61 | 62 | LOCAL_STATIC_LIBRARIES := 63 | 64 | LOCAL_SHARED_LIBRARIES := 65 | 66 | LOCAL_C_INCLUDES := \ 67 | $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/src \ 68 | $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/include \ 69 | $(PV_INCLUDES) 70 | 71 | LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO) 72 | 73 | LOCAL_COPY_HEADERS := \ 74 | 75 | 76 | include $(BUILD_STATIC_LIBRARY) 77 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build/make/local.mk: -------------------------------------------------------------------------------- 1 | # Get the current local path as the first operation 2 | LOCAL_PATH := $(call get_makefile_dir) 3 | 4 | # Clear out the variables used in the local makefiles 5 | include $(MK)/clear.mk 6 | 7 | TARGET := pv_amr_nb_common_lib 8 | 9 | 10 | OPTIMIZE_FOR_PERFORMANCE_OVER_SIZE := true 11 | 12 | SRCDIR := ../../src 13 | INCSRCDIR := ../../include 14 | 15 | SRCS := add.cpp \ 16 | az_lsp.cpp \ 17 | bitno_tab.cpp \ 18 | bitreorder_tab.cpp \ 19 | c2_9pf_tab.cpp \ 20 | div_s.cpp \ 21 | gains_tbl.cpp \ 22 | gc_pred.cpp \ 23 | get_const_tbls.cpp \ 24 | gmed_n.cpp \ 25 | grid_tbl.cpp \ 26 | gray_tbl.cpp \ 27 | int_lpc.cpp \ 28 | inv_sqrt.cpp \ 29 | inv_sqrt_tbl.cpp \ 30 | l_shr_r.cpp \ 31 | log2.cpp \ 32 | log2_norm.cpp \ 33 | log2_tbl.cpp \ 34 | lsfwt.cpp \ 35 | lsp.cpp \ 36 | lsp_az.cpp \ 37 | lsp_lsf.cpp \ 38 | lsp_lsf_tbl.cpp \ 39 | lsp_tab.cpp \ 40 | mult_r.cpp \ 41 | norm_l.cpp \ 42 | norm_s.cpp \ 43 | overflow_tbl.cpp \ 44 | ph_disp_tab.cpp \ 45 | pow2.cpp \ 46 | pow2_tbl.cpp \ 47 | pred_lt.cpp \ 48 | q_plsf.cpp \ 49 | q_plsf_3.cpp \ 50 | q_plsf_3_tbl.cpp \ 51 | q_plsf_5.cpp \ 52 | q_plsf_5_tbl.cpp \ 53 | qua_gain_tbl.cpp \ 54 | reorder.cpp \ 55 | residu.cpp \ 56 | round.cpp \ 57 | shr.cpp \ 58 | shr_r.cpp \ 59 | sqrt_l.cpp \ 60 | sqrt_l_tbl.cpp \ 61 | sub.cpp \ 62 | syn_filt.cpp \ 63 | weight_a.cpp \ 64 | window_tab.cpp 65 | 66 | include $(MK)/library.mk 67 | 68 | 69 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/add.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | 31 | Filename: add.h 32 | 33 | ------------------------------------------------------------------------------ 34 | INCLUDE DESCRIPTION 35 | 36 | This file contains all the constant definitions and prototype definitions 37 | needed by the add function. 38 | 39 | ------------------------------------------------------------------------------ 40 | */ 41 | 42 | #ifndef ADD_H 43 | #define ADD_H 44 | 45 | /*---------------------------------------------------------------------------- 46 | ; INCLUDES 47 | ----------------------------------------------------------------------------*/ 48 | #include "basicop_malloc.h" 49 | 50 | /*--------------------------------------------------------------------------*/ 51 | #ifdef __cplusplus 52 | extern "C" 53 | { 54 | #endif 55 | 56 | /*---------------------------------------------------------------------------- 57 | ; MACROS 58 | ; Define module specific macros here 59 | ----------------------------------------------------------------------------*/ 60 | 61 | /*---------------------------------------------------------------------------- 62 | ; DEFINES 63 | ; Include all pre-processor statements here. 64 | ----------------------------------------------------------------------------*/ 65 | 66 | /*---------------------------------------------------------------------------- 67 | ; EXTERNAL VARIABLES REFERENCES 68 | ; Declare variables used in this module but defined elsewhere 69 | ----------------------------------------------------------------------------*/ 70 | 71 | /*---------------------------------------------------------------------------- 72 | ; SIMPLE TYPEDEF'S 73 | ----------------------------------------------------------------------------*/ 74 | 75 | /*---------------------------------------------------------------------------- 76 | ; ENUMERATED TYPEDEF'S 77 | ----------------------------------------------------------------------------*/ 78 | 79 | /*---------------------------------------------------------------------------- 80 | ; STRUCTURES TYPEDEF'S 81 | ----------------------------------------------------------------------------*/ 82 | 83 | /*---------------------------------------------------------------------------- 84 | ; GLOBAL FUNCTION DEFINITIONS 85 | ; Function Prototype declaration 86 | ----------------------------------------------------------------------------*/ 87 | OSCL_IMPORT_REF Word16 add_16(Word16 var1, Word16 var2, Flag *pOverflow); 88 | 89 | /*---------------------------------------------------------------------------- 90 | ; END 91 | ----------------------------------------------------------------------------*/ 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* _ADD_H_ */ 97 | 98 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | 31 | Filename: bytesused.h 32 | 33 | ------------------------------------------------------------------------------ 34 | INCLUDE DESCRIPTION 35 | 36 | This file declares a table BytesUsed. 37 | 38 | ------------------------------------------------------------------------------ 39 | */ 40 | 41 | /*---------------------------------------------------------------------------- 42 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 43 | ----------------------------------------------------------------------------*/ 44 | #ifndef BYTESUSED_H 45 | #define BYTESUSED_H 46 | 47 | /*---------------------------------------------------------------------------- 48 | ; INCLUDES 49 | ----------------------------------------------------------------------------*/ 50 | 51 | /*--------------------------------------------------------------------------*/ 52 | #ifdef __cplusplus 53 | extern "C" 54 | { 55 | #endif 56 | 57 | /*---------------------------------------------------------------------------- 58 | ; MACROS 59 | ; Define module specific macros here 60 | ----------------------------------------------------------------------------*/ 61 | 62 | /*---------------------------------------------------------------------------- 63 | ; DEFINES 64 | ; Include all pre-processor statements here. 65 | ----------------------------------------------------------------------------*/ 66 | 67 | /*---------------------------------------------------------------------------- 68 | ; EXTERNAL VARIABLES REFERENCES 69 | ; Declare variables used in this module but defined elsewhere 70 | ----------------------------------------------------------------------------*/ 71 | extern const short BytesUsed[]; 72 | 73 | /*---------------------------------------------------------------------------- 74 | ; SIMPLE TYPEDEF'S 75 | ----------------------------------------------------------------------------*/ 76 | 77 | /*---------------------------------------------------------------------------- 78 | ; ENUMERATED TYPEDEF'S 79 | ----------------------------------------------------------------------------*/ 80 | 81 | /*---------------------------------------------------------------------------- 82 | ; STRUCTURES TYPEDEF'S 83 | ----------------------------------------------------------------------------*/ 84 | 85 | 86 | /*---------------------------------------------------------------------------- 87 | ; GLOBAL FUNCTION DEFINITIONS 88 | ; Function Prototype declaration 89 | ----------------------------------------------------------------------------*/ 90 | 91 | 92 | /*---------------------------------------------------------------------------- 93 | ; END 94 | ----------------------------------------------------------------------------*/ 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | #endif 100 | 101 | 102 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_p.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : d_gain_p.h 39 | * Purpose : Decodes the pitch gain using the received index. 40 | * 41 | ******************************************************************************** 42 | */ 43 | #ifndef d_gain_p_h 44 | #define d_gain_p_h "$Id $" 45 | 46 | /* 47 | ******************************************************************************** 48 | * INCLUDE FILES 49 | ******************************************************************************** 50 | */ 51 | #include "typedef.h" 52 | #include "mode.h" 53 | 54 | #ifdef __cplusplus 55 | extern "C" 56 | { 57 | #endif 58 | 59 | /* 60 | ************************************************************************** 61 | * 62 | * Function : d_gain_pitch 63 | * Purpose : Decodes the pitch gain using the received index. 64 | * Description : In case of no frame erasure, the gain is obtained 65 | * from the quantization table at the given index; 66 | * otherwise, a downscaled past gain is used. 67 | * Returns : Quantized pitch gain 68 | * 69 | ************************************************************************** 70 | */ 71 | Word16 d_gain_pitch( /* return value: gain (Q14) */ 72 | enum Mode mode, /* i : AMR mode */ 73 | Word16 index, /* i : index of quantization */ 74 | const Word16* qua_gain_pitch_ptr /* i : pointer to read-only tables */ 75 | ); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/dtx_common_def.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | Filename: dtx_common_def.h 31 | 32 | ------------------------------------------------------------------------------ 33 | INCLUDE DESCRIPTION 34 | 35 | File : dtx_common_def.h 36 | Purpose : DTX definitions common to encoder and decoder 37 | 38 | ------------------------------------------------------------------------------ 39 | */ 40 | 41 | /*---------------------------------------------------------------------------- 42 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 43 | ----------------------------------------------------------------------------*/ 44 | #ifndef DTX_COMMON_DEF_H 45 | #define DTX_COMMON_DEF_H 46 | 47 | /*---------------------------------------------------------------------------- 48 | ; INCLUDES 49 | ----------------------------------------------------------------------------*/ 50 | 51 | /*--------------------------------------------------------------------------*/ 52 | #ifdef __cplusplus 53 | extern "C" 54 | { 55 | #endif 56 | 57 | /*---------------------------------------------------------------------------- 58 | ; MACROS 59 | ; Define module specific macros here 60 | ----------------------------------------------------------------------------*/ 61 | 62 | /*---------------------------------------------------------------------------- 63 | ; DEFINES 64 | ; Include all pre-processor statements here. 65 | ----------------------------------------------------------------------------*/ 66 | #define DTX_MAX_EMPTY_THRESH 50 67 | #define DTX_HIST_SIZE 8 68 | #define DTX_ELAPSED_FRAMES_THRESH (24 + 7 -1) 69 | #define DTX_HANG_CONST 7 /* yields eight frames of SP HANGOVER */ 70 | 71 | /*---------------------------------------------------------------------------- 72 | ; EXTERNAL VARIABLES REFERENCES 73 | ; Declare variables used in this module but defined elsewhere 74 | ----------------------------------------------------------------------------*/ 75 | 76 | /*---------------------------------------------------------------------------- 77 | ; SIMPLE TYPEDEF'S 78 | ----------------------------------------------------------------------------*/ 79 | 80 | 81 | /*---------------------------------------------------------------------------- 82 | ; ENUMERATED TYPEDEF'S 83 | ----------------------------------------------------------------------------*/ 84 | 85 | /*---------------------------------------------------------------------------- 86 | ; STRUCTURES TYPEDEF'S 87 | ----------------------------------------------------------------------------*/ 88 | /*---------------------------------------------------------------------------- 89 | ; END 90 | ----------------------------------------------------------------------------*/ 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* DTX_COMMON_DEF_H */ 96 | 97 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/get_const_tbls.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | #ifndef GET_CONST_TBLS_H 19 | #define GET_CONST_TBLS_H 20 | 21 | #include "typedef.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" 25 | { 26 | #endif 27 | typedef struct 28 | { 29 | const Word16* dgray_ptr; 30 | const Word16* dico1_lsf_3_ptr; 31 | const Word16* dico1_lsf_5_ptr; 32 | const Word16* dico2_lsf_3_ptr; 33 | const Word16* dico2_lsf_5_ptr; 34 | const Word16* dico3_lsf_3_ptr; 35 | const Word16* dico3_lsf_5_ptr; 36 | const Word16* dico4_lsf_5_ptr; 37 | const Word16* dico5_lsf_5_ptr; 38 | const Word16* gray_ptr; 39 | const Word16* lsp_init_data_ptr; 40 | const Word16* mean_lsf_3_ptr; 41 | const Word16* mean_lsf_5_ptr; 42 | const Word16* mr515_3_lsf_ptr; 43 | const Word16* mr795_1_lsf_ptr; 44 | const Word16* past_rq_init_ptr; 45 | const Word16* pred_fac_3_ptr; 46 | const Word16* qua_gain_code_ptr; 47 | const Word16* qua_gain_pitch_ptr; 48 | const Word16* startPos_ptr; 49 | const Word16* table_gain_lowrates_ptr; 50 | const Word16* table_gain_highrates_ptr; 51 | const Word16* prmno_ptr; 52 | const Word16* const* bitno_ptr; 53 | const Word16* numOfBits_ptr; 54 | const Word16* const* reorderBits_ptr; 55 | const Word16* numCompressedBytes_ptr; 56 | const Word16* window_200_40_ptr; 57 | const Word16* window_160_80_ptr; 58 | const Word16* window_232_8_ptr; 59 | const Word16* ph_imp_low_MR795_ptr; 60 | const Word16* ph_imp_mid_MR795_ptr; 61 | const Word16* ph_imp_low_ptr; 62 | const Word16* ph_imp_mid_ptr; 63 | } CommonAmrTbls; 64 | 65 | OSCL_IMPORT_REF void get_const_tbls(CommonAmrTbls* tbl_struct_ptr); 66 | 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gmed_n.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : gmed_n.h 39 | * Purpose : calculates N-point median. 40 | * 41 | ******************************************************************************** 42 | */ 43 | #ifndef gmed_n_h 44 | #define gmed_n_h "$Id $" 45 | 46 | /* 47 | ******************************************************************************** 48 | * INCLUDE FILES 49 | ******************************************************************************** 50 | */ 51 | #include "typedef.h" 52 | 53 | #ifdef __cplusplus 54 | extern "C" 55 | { 56 | #endif 57 | 58 | /* 59 | ******************************************************************************** 60 | * DEFINITION OF DATA TYPES 61 | ******************************************************************************** 62 | */ 63 | 64 | /* 65 | ******************************************************************************** 66 | * DECLARATION OF PROTOTYPES 67 | ******************************************************************************** 68 | */ 69 | OSCL_IMPORT_REF Word16 gmed_n( /* o : index of the median value (0...N-1) */ 70 | Word16 ind[], /* i : Past gain values */ 71 | Word16 n /* i : The number of gains; this routine */ 72 | /* is only valid for a odd number of gains */ 73 | ); 74 | 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_tab.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | 31 | Filename: lsp_tab.h 32 | 33 | ------------------------------------------------------------------------------ 34 | INCLUDE DESCRIPTION 35 | 36 | This file declares a table lsp_init_data. 37 | 38 | ------------------------------------------------------------------------------ 39 | */ 40 | 41 | /*---------------------------------------------------------------------------- 42 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 43 | ----------------------------------------------------------------------------*/ 44 | #ifndef LSP_TAB_H 45 | #define LSP_TAB_H 46 | 47 | /*---------------------------------------------------------------------------- 48 | ; INCLUDES 49 | ----------------------------------------------------------------------------*/ 50 | #include "typedef.h" 51 | #include "cnst.h" 52 | 53 | /*--------------------------------------------------------------------------*/ 54 | #ifdef __cplusplus 55 | extern "C" 56 | { 57 | #endif 58 | 59 | /*---------------------------------------------------------------------------- 60 | ; MACROS 61 | ; Define module specific macros here 62 | ----------------------------------------------------------------------------*/ 63 | 64 | /*---------------------------------------------------------------------------- 65 | ; DEFINES 66 | ; Include all pre-processor statements here. 67 | ----------------------------------------------------------------------------*/ 68 | 69 | /*---------------------------------------------------------------------------- 70 | ; EXTERNAL VARIABLES REFERENCES 71 | ; Declare variables used in this module but defined elsewhere 72 | ----------------------------------------------------------------------------*/ 73 | extern const Word16 lsp_init_data[]; 74 | 75 | /*---------------------------------------------------------------------------- 76 | ; SIMPLE TYPEDEF'S 77 | ----------------------------------------------------------------------------*/ 78 | 79 | /*---------------------------------------------------------------------------- 80 | ; ENUMERATED TYPEDEF'S 81 | ----------------------------------------------------------------------------*/ 82 | 83 | /*---------------------------------------------------------------------------- 84 | ; STRUCTURES TYPEDEF'S 85 | ----------------------------------------------------------------------------*/ 86 | 87 | 88 | /*---------------------------------------------------------------------------- 89 | ; GLOBAL FUNCTION DEFINITIONS 90 | ; Function Prototype declaration 91 | ----------------------------------------------------------------------------*/ 92 | 93 | 94 | /*---------------------------------------------------------------------------- 95 | ; END 96 | ----------------------------------------------------------------------------*/ 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif 102 | 103 | 104 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mode.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : mode.h 39 | * Purpose : Declaration of mode type 40 | * 41 | ******************************************************************************** 42 | */ 43 | #ifndef mode_h 44 | #define mode_h "$Id $" 45 | 46 | /* 47 | ******************************************************************************** 48 | * INCLUDE FILES 49 | ******************************************************************************** 50 | */ 51 | 52 | 53 | #ifdef __cplusplus 54 | extern "C" 55 | { 56 | #endif 57 | 58 | /* 59 | ******************************************************************************** 60 | * DEFINITION OF DATA TYPES 61 | ******************************************************************************** 62 | */ 63 | enum Mode { MR475 = 0, 64 | MR515, 65 | MR59, 66 | MR67, 67 | MR74, 68 | MR795, 69 | MR102, 70 | MR122, 71 | 72 | MRDTX, 73 | 74 | N_MODES /* number of (SPC) modes */ 75 | 76 | }; 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult_r.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | 31 | Filename: mult_r.h 32 | 33 | ------------------------------------------------------------------------------ 34 | INCLUDE DESCRIPTION 35 | 36 | This file contains all the constant definitions and prototype definitions 37 | needed by the mult_r function. 38 | 39 | ------------------------------------------------------------------------------ 40 | */ 41 | 42 | #ifndef MULT_R__H 43 | #define MULT_R__H 44 | 45 | /*---------------------------------------------------------------------------- 46 | ; INCLUDES 47 | ----------------------------------------------------------------------------*/ 48 | 49 | #include "basicop_malloc.h" 50 | 51 | /*--------------------------------------------------------------------------*/ 52 | #ifdef __cplusplus 53 | extern "C" 54 | { 55 | #endif 56 | 57 | /*---------------------------------------------------------------------------- 58 | ; MACROS 59 | ; Define module specific macros here 60 | ----------------------------------------------------------------------------*/ 61 | 62 | /*---------------------------------------------------------------------------- 63 | ; DEFINES 64 | ; Include all pre-processor statements here. 65 | ----------------------------------------------------------------------------*/ 66 | 67 | /*---------------------------------------------------------------------------- 68 | ; EXTERNAL VARIABLES REFERENCES 69 | ; Declare variables used in this module but defined elsewhere 70 | ----------------------------------------------------------------------------*/ 71 | 72 | /*---------------------------------------------------------------------------- 73 | ; SIMPLE TYPEDEF'S 74 | ----------------------------------------------------------------------------*/ 75 | 76 | /*---------------------------------------------------------------------------- 77 | ; ENUMERATED TYPEDEF'S 78 | ----------------------------------------------------------------------------*/ 79 | 80 | /*---------------------------------------------------------------------------- 81 | ; STRUCTURES TYPEDEF'S 82 | ----------------------------------------------------------------------------*/ 83 | 84 | /*---------------------------------------------------------------------------- 85 | ; GLOBAL FUNCTION DEFINITIONS 86 | ; Function Prototype declaration 87 | ----------------------------------------------------------------------------*/ 88 | OSCL_IMPORT_REF Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow); 89 | 90 | /*---------------------------------------------------------------------------- 91 | ; END 92 | ----------------------------------------------------------------------------*/ 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | 98 | #endif /* _MULT_R_H_ */ 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/n_proc.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* $Id $ */ 30 | 31 | void proc_head(char *mes); 32 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /***************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | **************************************************************************/ 29 | /* 30 | Filename: negate.h 31 | 32 | ------------------------------------------------------------------------------ 33 | INCLUDE DESCRIPTION 34 | 35 | This file contains all the constant definitions and prototype definitions 36 | needed by the negate function. 37 | 38 | ------------------------------------------------------------------------------ 39 | */ 40 | 41 | /*---------------------------------------------------------------------------- 42 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 43 | ----------------------------------------------------------------------------*/ 44 | #ifndef NEGATE_H 45 | #define NEGATE_H 46 | 47 | /*---------------------------------------------------------------------------- 48 | ; INCLUDES 49 | ----------------------------------------------------------------------------*/ 50 | #include "basicop_malloc.h" 51 | 52 | /*--------------------------------------------------------------------------*/ 53 | #ifdef __cplusplus 54 | extern "C" 55 | { 56 | #endif 57 | 58 | /*---------------------------------------------------------------------------- 59 | ; MACROS 60 | ; Define module specific macros here 61 | ----------------------------------------------------------------------------*/ 62 | 63 | /*---------------------------------------------------------------------------- 64 | ; DEFINES 65 | ; Include all pre-processor statements here. 66 | ----------------------------------------------------------------------------*/ 67 | 68 | /*---------------------------------------------------------------------------- 69 | ; EXTERNAL VARIABLES REFERENCES 70 | ; Declare variables used in this module but defined elsewhere 71 | ----------------------------------------------------------------------------*/ 72 | 73 | /*---------------------------------------------------------------------------- 74 | ; SIMPLE TYPEDEF'S 75 | ----------------------------------------------------------------------------*/ 76 | 77 | /*---------------------------------------------------------------------------- 78 | ; ENUMERATED TYPEDEF'S 79 | ----------------------------------------------------------------------------*/ 80 | 81 | /*---------------------------------------------------------------------------- 82 | ; STRUCTURES TYPEDEF'S 83 | ----------------------------------------------------------------------------*/ 84 | 85 | /*---------------------------------------------------------------------------- 86 | ; GLOBAL FUNCTION DEFINITIONS 87 | ; Function Prototype declaration 88 | ----------------------------------------------------------------------------*/ 89 | Word16 negate(register Word16 var1); 90 | 91 | /*---------------------------------------------------------------------------- 92 | ; END 93 | ----------------------------------------------------------------------------*/ 94 | #ifdef __cplusplus 95 | } 96 | #endif 97 | 98 | #endif 99 | 100 | 101 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/oper_32b.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | 31 | Filename: oper_32b.h 32 | 33 | ------------------------------------------------------------------------------ 34 | INCLUDE DESCRIPTION 35 | 36 | This file includes all the oper_32b.c functions' header files. 37 | 38 | ------------------------------------------------------------------------------ 39 | */ 40 | 41 | /*---------------------------------------------------------------------------- 42 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 43 | ----------------------------------------------------------------------------*/ 44 | #ifndef OPER_32B_H 45 | #define OPER_32B_H 46 | 47 | /*---------------------------------------------------------------------------- 48 | ; INCLUDES 49 | ----------------------------------------------------------------------------*/ 50 | #include "typedef.h" 51 | 52 | #include "l_comp.h" 53 | #include "l_extract.h" 54 | 55 | /*---------------------------------------------------------------------------- 56 | ; MACROS 57 | ; Define module specific macros here 58 | ----------------------------------------------------------------------------*/ 59 | 60 | /*---------------------------------------------------------------------------- 61 | ; DEFINES 62 | ; Include all pre-processor statements here. 63 | ----------------------------------------------------------------------------*/ 64 | 65 | /*---------------------------------------------------------------------------- 66 | ; EXTERNAL VARIABLES REFERENCES 67 | ; Declare variables used in this module but defined elsewhere 68 | ----------------------------------------------------------------------------*/ 69 | 70 | /*---------------------------------------------------------------------------- 71 | ; SIMPLE TYPEDEF'S 72 | ----------------------------------------------------------------------------*/ 73 | 74 | /*---------------------------------------------------------------------------- 75 | ; ENUMERATED TYPEDEF'S 76 | ----------------------------------------------------------------------------*/ 77 | 78 | /*---------------------------------------------------------------------------- 79 | ; STRUCTURES TYPEDEF'S 80 | ----------------------------------------------------------------------------*/ 81 | 82 | /*---------------------------------------------------------------------------- 83 | ; GLOBAL FUNCTION DEFINITIONS 84 | ; Function Prototype declaration 85 | ----------------------------------------------------------------------------*/ 86 | 87 | /*---------------------------------------------------------------------------- 88 | ; END 89 | ----------------------------------------------------------------------------*/ 90 | #endif 91 | 92 | 93 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pvgsmamr.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | #ifndef __PVGSMAMR_H 30 | #define __PVGSMAMR_H 31 | 32 | 33 | // includes 34 | #include 35 | #include 36 | 37 | #include "sp_dec.h" 38 | #include "pvglobals.h" 39 | 40 | 41 | // PVGsmDecoder AO 42 | class CPVGsmDecoder : public CBase 43 | { 44 | public: 45 | IMPORT_C static CPVGsmDecoder* NewL(void); 46 | IMPORT_C ~CPVGsmDecoder(); 47 | IMPORT_C TInt StartL(void); 48 | 49 | // only port the API's used in PVPlayer 2.0 50 | IMPORT_C TInt DecodeFrame(enum Mode mode, unsigned char* compressedBlock, unsigned char* audioBuffer); 51 | IMPORT_C TInt InitDecoder(void); 52 | IMPORT_C void ExitDecoder(void); 53 | 54 | private: 55 | CPVGsmDecoder(); 56 | void ConstructL(void); 57 | 58 | Speech_Decode_FrameState* decState; 59 | enum RXFrameType rx_type; 60 | struct globalDataStruct *gds; 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qgain475_tab.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | 31 | Filename: qgain475_tab.h 32 | 33 | ------------------------------------------------------------------------------ 34 | INCLUDE DESCRIPTION 35 | 36 | This file declares tables defined in qgain475_tab.c. 37 | 38 | ------------------------------------------------------------------------------ 39 | */ 40 | 41 | /*---------------------------------------------------------------------------- 42 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 43 | ----------------------------------------------------------------------------*/ 44 | #ifndef QGAIN475_TAB_H 45 | #define QGAIN475_TAB_H 46 | 47 | #define MR475_VQ_SIZE 256 48 | 49 | /*---------------------------------------------------------------------------- 50 | ; INCLUDES 51 | ----------------------------------------------------------------------------*/ 52 | #include "typedef.h" 53 | 54 | #ifdef __cplusplus 55 | extern "C" 56 | { 57 | #endif 58 | 59 | /*---------------------------------------------------------------------------- 60 | ; MACROS 61 | ; Define module specific macros here 62 | ----------------------------------------------------------------------------*/ 63 | 64 | /*---------------------------------------------------------------------------- 65 | ; DEFINES 66 | ; Include all pre-processor statements here. 67 | ----------------------------------------------------------------------------*/ 68 | 69 | /*---------------------------------------------------------------------------- 70 | ; EXTERNAL VARIABLES REFERENCES 71 | ; Declare variables used in this module but defined elsewhere 72 | ----------------------------------------------------------------------------*/ 73 | extern const Word16 table_gain_MR475[]; 74 | 75 | /*---------------------------------------------------------------------------- 76 | ; SIMPLE TYPEDEF'S 77 | ----------------------------------------------------------------------------*/ 78 | 79 | /*---------------------------------------------------------------------------- 80 | ; ENUMERATED TYPEDEF'S 81 | ----------------------------------------------------------------------------*/ 82 | 83 | /*---------------------------------------------------------------------------- 84 | ; STRUCTURES TYPEDEF'S 85 | ----------------------------------------------------------------------------*/ 86 | 87 | 88 | /*---------------------------------------------------------------------------- 89 | ; GLOBAL FUNCTION DEFINITIONS 90 | ; Function Prototype declaration 91 | ----------------------------------------------------------------------------*/ 92 | 93 | 94 | /*---------------------------------------------------------------------------- 95 | ; END 96 | ----------------------------------------------------------------------------*/ 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain_tbl.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | 31 | Filename: qua_gain_tbl.h 32 | 33 | ------------------------------------------------------------------------------ 34 | INCLUDE DESCRIPTION 35 | 36 | This file declares tables defined in qua_gain_tbl.c. 37 | 38 | ------------------------------------------------------------------------------ 39 | */ 40 | 41 | /*---------------------------------------------------------------------------- 42 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 43 | ----------------------------------------------------------------------------*/ 44 | #ifndef QUA_GAIN_TBL_H 45 | #define QUA_GAIN_TBL_H 46 | 47 | /*---------------------------------------------------------------------------- 48 | ; INCLUDES 49 | ----------------------------------------------------------------------------*/ 50 | #include "typedef.h" 51 | 52 | #ifdef __cplusplus 53 | extern "C" 54 | { 55 | #endif 56 | 57 | /*---------------------------------------------------------------------------- 58 | ; MACROS 59 | ; Define module specific macros here 60 | ----------------------------------------------------------------------------*/ 61 | 62 | /*---------------------------------------------------------------------------- 63 | ; DEFINES 64 | ; Include all pre-processor statements here. 65 | ----------------------------------------------------------------------------*/ 66 | 67 | /*---------------------------------------------------------------------------- 68 | ; EXTERNAL VARIABLES REFERENCES 69 | ; Declare variables used in this module but defined elsewhere 70 | ----------------------------------------------------------------------------*/ 71 | extern const Word16 table_gain_highrates[]; 72 | extern const Word16 table_gain_lowrates[]; 73 | 74 | /*---------------------------------------------------------------------------- 75 | ; SIMPLE TYPEDEF'S 76 | ----------------------------------------------------------------------------*/ 77 | 78 | /*---------------------------------------------------------------------------- 79 | ; ENUMERATED TYPEDEF'S 80 | ----------------------------------------------------------------------------*/ 81 | 82 | /*---------------------------------------------------------------------------- 83 | ; STRUCTURES TYPEDEF'S 84 | ----------------------------------------------------------------------------*/ 85 | 86 | 87 | /*---------------------------------------------------------------------------- 88 | ; GLOBAL FUNCTION DEFINITIONS 89 | ; Function Prototype declaration 90 | ----------------------------------------------------------------------------*/ 91 | 92 | 93 | /*---------------------------------------------------------------------------- 94 | ; END 95 | ----------------------------------------------------------------------------*/ 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | 100 | #endif 101 | 102 | 103 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/residu.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : residu.h 39 | * Purpose : Computes the LP residual. 40 | * Description : The LP residual is computed by filtering the input 41 | * : speech through the LP inverse filter A(z). 42 | * 43 | * 44 | ******************************************************************************** 45 | */ 46 | #ifndef residu_h 47 | #define residu_h "$Id $" 48 | 49 | /* 50 | ******************************************************************************** 51 | * INCLUDE FILES 52 | ******************************************************************************** 53 | */ 54 | #include "typedef.h" 55 | 56 | #ifdef __cplusplus 57 | extern "C" 58 | { 59 | #endif 60 | 61 | /* 62 | ******************************************************************************** 63 | * DEFINITION OF DATA TYPES 64 | ******************************************************************************** 65 | */ 66 | 67 | /* 68 | ******************************************************************************** 69 | * DECLARATION OF PROTOTYPES 70 | ******************************************************************************** 71 | */ 72 | OSCL_IMPORT_REF void Residu( 73 | Word16 a[], /* (i) : prediction coefficients */ 74 | Word16 x[], /* (i) : speech signal */ 75 | Word16 y[], /* (o) : residual signal */ 76 | Word16 lg /* (i) : size of filtering */ 77 | ); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/round.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | Filename: round.h 31 | 32 | ------------------------------------------------------------------------------ 33 | INCLUDE DESCRIPTION 34 | 35 | This file contains all the constant definitions and prototype definitions 36 | needed by the pv_round function. 37 | 38 | ------------------------------------------------------------------------------ 39 | */ 40 | 41 | /*---------------------------------------------------------------------------- 42 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 43 | ----------------------------------------------------------------------------*/ 44 | #ifndef ROUND_H 45 | #define ROUND_H 46 | 47 | /*---------------------------------------------------------------------------- 48 | ; INCLUDES 49 | ----------------------------------------------------------------------------*/ 50 | #include "basicop_malloc.h" 51 | 52 | /*--------------------------------------------------------------------------*/ 53 | #ifdef __cplusplus 54 | extern "C" 55 | { 56 | #endif 57 | 58 | /*---------------------------------------------------------------------------- 59 | ; MACROS 60 | ; Define module specific macros here 61 | ----------------------------------------------------------------------------*/ 62 | 63 | /*---------------------------------------------------------------------------- 64 | ; DEFINES 65 | ; Include all pre-processor statements here. 66 | ----------------------------------------------------------------------------*/ 67 | 68 | /*---------------------------------------------------------------------------- 69 | ; EXTERNAL VARIABLES REFERENCES 70 | ; Declare variables used in this module but defined elsewhere 71 | ----------------------------------------------------------------------------*/ 72 | 73 | /*---------------------------------------------------------------------------- 74 | ; SIMPLE TYPEDEF'S 75 | ----------------------------------------------------------------------------*/ 76 | 77 | /*---------------------------------------------------------------------------- 78 | ; ENUMERATED TYPEDEF'S 79 | ----------------------------------------------------------------------------*/ 80 | 81 | /*---------------------------------------------------------------------------- 82 | ; STRUCTURES TYPEDEF'S 83 | ----------------------------------------------------------------------------*/ 84 | 85 | /*---------------------------------------------------------------------------- 86 | ; GLOBAL FUNCTION DEFINITIONS 87 | ; Function Prototype declaration 88 | ----------------------------------------------------------------------------*/ 89 | OSCL_IMPORT_REF Word16 pv_round(Word32 L_var1, Flag *pOverflow); 90 | 91 | /*---------------------------------------------------------------------------- 92 | ; END 93 | ----------------------------------------------------------------------------*/ 94 | #ifdef __cplusplus 95 | } 96 | #endif 97 | 98 | #endif /* _ROUND_H_ */ 99 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/set_zero.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : set_zero.h 39 | * Description : Set vector x[] to zero 40 | * 41 | * 42 | ******************************************************************************** 43 | */ 44 | #ifndef set_zero_h 45 | #define set_zero_h "$Id $" 46 | 47 | /* 48 | ******************************************************************************** 49 | * INCLUDE FILES 50 | ******************************************************************************** 51 | */ 52 | #include "typedef.h" 53 | 54 | #ifdef __cplusplus 55 | extern "C" 56 | { 57 | #endif 58 | 59 | /* 60 | ******************************************************************************** 61 | * DEFINITION OF DATA TYPES 62 | ******************************************************************************** 63 | */ 64 | 65 | /* 66 | ******************************************************************************** 67 | * DECLARATION OF PROTOTYPES 68 | ******************************************************************************** 69 | */ 70 | void Set_zero( 71 | Word16 x[], /* (o) : vector to clear */ 72 | Word16 L /* (i) : length of vector */ 73 | ); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/syn_filt.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : syn_filt.h 39 | * Purpose : Perform synthesis filtering through 1/A(z). 40 | * 41 | * 42 | ******************************************************************************** 43 | */ 44 | #ifndef syn_filt_h 45 | #define syn_filt_h "$Id $" 46 | 47 | /* 48 | ******************************************************************************** 49 | * INCLUDE FILES 50 | ******************************************************************************** 51 | */ 52 | #include "typedef.h" 53 | 54 | #ifdef __cplusplus 55 | extern "C" 56 | { 57 | #endif 58 | 59 | /* 60 | ******************************************************************************** 61 | * DEFINITION OF DATA TYPES 62 | ******************************************************************************** 63 | */ 64 | 65 | /* 66 | ******************************************************************************** 67 | * DECLARATION OF PROTOTYPES 68 | ******************************************************************************** 69 | */ 70 | OSCL_IMPORT_REF void Syn_filt( 71 | Word16 a[], /* (i) : a[m+1] prediction coefficients (m=10) */ 72 | Word16 x[], /* (i) : input signal */ 73 | Word16 y[], /* (o) : output signal */ 74 | Word16 lg, /* (i) : size of filtering */ 75 | Word16 mem[], /* (i/o): memory associated with this filtering. */ 76 | Word16 update /* (i) : 0=no update, 1=update of memory. */ 77 | ); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2010 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : typedef.c 39 | * Purpose : Basic types. 40 | * 41 | ******************************************************************************** 42 | */ 43 | #include "oscl_base_macros.h"// has integer values of PV_COMPILER 44 | #ifndef typedef_h 45 | #define typedef_h "$Id $" 46 | 47 | #undef ORIGINAL_TYPEDEF_H /* CHANGE THIS TO #define to get the */ 48 | /* "original" ETSI version of typedef.h */ 49 | /* CHANGE TO #undef for PV version */ 50 | 51 | #ifdef ORIGINAL_TYPEDEF_H 52 | /* 53 | * this is the original code from the ETSI file typedef.h 54 | */ 55 | 56 | #if defined(__unix__) || defined(__unix) 57 | typedef signed char Word8; 58 | typedef short Word16; 59 | typedef int Word32; 60 | typedef int Flag; 61 | 62 | #else 63 | #error No System recognized 64 | #endif 65 | #else /* not original typedef.h */ 66 | 67 | /* 68 | * use (improved) type definition file typdefs.h 69 | */ 70 | #include "gsm_amr_typedefs.h" 71 | 72 | #endif 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | **-------------------------------------------------------------------------** 32 | ** ** 33 | ** GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 ** 34 | ** R99 Version 3.2.0 ** 35 | ** REL-4 Version 4.0.0 ** 36 | ** ** 37 | **-------------------------------------------------------------------------** 38 | ******************************************************************************** 39 | * 40 | * File : vad.h 41 | * Purpose : Voice Activity Detection (VAD) for AMR 42 | * 43 | ******************************************************************************** 44 | */ 45 | #ifndef vad_h 46 | #define vad_h "$Id $" 47 | 48 | /* 49 | ******************************************************************************** 50 | * INCLUDE FILES 51 | ******************************************************************************** 52 | */ 53 | 54 | #include "vad1.h" /* for VAD option 1 */ 55 | #include "vad2.h" /* for VAD option 2 */ 56 | 57 | /* 58 | ******************************************************************************** 59 | * LOCAL VARIABLES AND TABLES 60 | ******************************************************************************** 61 | */ 62 | 63 | /* 64 | ******************************************************************************** 65 | * DEFINITION OF DATA TYPES 66 | ******************************************************************************** 67 | */ 68 | 69 | #ifndef VAD2 70 | #define vadState vadState1 71 | #else 72 | #define vadState vadState2 73 | #endif 74 | 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/weight_a.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : weight_a.h 39 | * Purpose : Spectral expansion of LP coefficients. (order==10) 40 | * Description : a_exp[i] = a[i] * fac[i-1] ,i=1,10 41 | * 42 | * 43 | ******************************************************************************** 44 | */ 45 | #ifndef weight_a_h 46 | #define weight_a_h "$Id $" 47 | 48 | /* 49 | ******************************************************************************** 50 | * INCLUDE FILES 51 | ******************************************************************************** 52 | */ 53 | #include "typedef.h" 54 | 55 | #ifdef __cplusplus 56 | extern "C" 57 | { 58 | #endif 59 | 60 | /* 61 | ******************************************************************************** 62 | * DEFINITION OF DATA TYPES 63 | ******************************************************************************** 64 | */ 65 | 66 | /* 67 | ******************************************************************************** 68 | * DECLARATION OF PROTOTYPES 69 | ******************************************************************************** 70 | */ 71 | OSCL_IMPORT_REF void Weight_Ai( 72 | Word16 a[], /* (i) : a[m+1] LPC coefficients (m=10) */ 73 | const Word16 fac[],/* (i) : Spectral expansion factors. */ 74 | Word16 a_exp[] /* (o) : Spectral expanded LPC coefficients */ 75 | ); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/window_tab.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | Filename: window_tab.h 31 | 32 | ------------------------------------------------------------------------------ 33 | INCLUDE DESCRIPTION 34 | 35 | This file declares a tables in window_tab.c used in lpc.c. 36 | 37 | ------------------------------------------------------------------------------ 38 | */ 39 | 40 | /*---------------------------------------------------------------------------- 41 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 42 | ----------------------------------------------------------------------------*/ 43 | #ifndef WINDOW_TAB_H 44 | #define WINDOW_TAB_H 45 | 46 | /*---------------------------------------------------------------------------- 47 | ; INCLUDES 48 | ----------------------------------------------------------------------------*/ 49 | #include "typedef.h" 50 | #include "cnst.h" 51 | 52 | #ifdef __cplusplus 53 | extern "C" 54 | { 55 | #endif 56 | 57 | /*---------------------------------------------------------------------------- 58 | ; MACROS 59 | ; Define module specific macros here 60 | ----------------------------------------------------------------------------*/ 61 | 62 | /*---------------------------------------------------------------------------- 63 | ; DEFINES 64 | ; Include all pre-processor statements here. 65 | ----------------------------------------------------------------------------*/ 66 | 67 | /*---------------------------------------------------------------------------- 68 | ; EXTERNAL VARIABLES REFERENCES 69 | ; Declare variables used in this module but defined elsewhere 70 | ----------------------------------------------------------------------------*/ 71 | extern const Word16 window_200_40[]; 72 | extern const Word16 window_160_80[]; 73 | extern const Word16 window_232_8[]; 74 | 75 | /*---------------------------------------------------------------------------- 76 | ; SIMPLE TYPEDEF'S 77 | ----------------------------------------------------------------------------*/ 78 | 79 | /*---------------------------------------------------------------------------- 80 | ; ENUMERATED TYPEDEF'S 81 | ----------------------------------------------------------------------------*/ 82 | 83 | /*---------------------------------------------------------------------------- 84 | ; STRUCTURES TYPEDEF'S 85 | ----------------------------------------------------------------------------*/ 86 | 87 | 88 | /*---------------------------------------------------------------------------- 89 | ; GLOBAL FUNCTION DEFINITIONS 90 | ; Function Prototype declaration 91 | ----------------------------------------------------------------------------*/ 92 | 93 | 94 | /*---------------------------------------------------------------------------- 95 | ; END 96 | ----------------------------------------------------------------------------*/ 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif 102 | 103 | 104 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/copy.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * File : copy.h 38 | * 39 | ******************************************************************************** 40 | */ 41 | 42 | /* 43 | ******************************************************************************** 44 | * MODULE INCLUDE FILE AND VERSION ID 45 | ******************************************************************************** 46 | */ 47 | #include "copy.h" 48 | 49 | /* 50 | ******************************************************************************** 51 | * INCLUDE FILES 52 | ******************************************************************************** 53 | */ 54 | #include "typedef.h" 55 | #include "basic_op.h" 56 | #include "oscl_mem.h" 57 | 58 | /* 59 | ******************************************************************************** 60 | * PUBLIC PROGRAM CODE 61 | ******************************************************************************** 62 | */ 63 | /************************************************************************* 64 | * 65 | * FUNCTION: Copy 66 | * 67 | * PURPOSE: Copy vector x[] to y[] 68 | * 69 | * 70 | *************************************************************************/ 71 | /* 72 | ************************************************************************** 73 | * 74 | * Function : Copy 75 | * Purpose : Copy vector x[] to y[] 76 | * 77 | ************************************************************************** 78 | */ 79 | void Copy( 80 | const Word16 x[], /* i : input vector (L) */ 81 | Word16 y[], /* o : output vector (L) */ 82 | Word16 L /* i : vector length */ 83 | ) 84 | { 85 | oscl_memmove(y, x, L*sizeof(*x)); 86 | } 87 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/set_zero.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 32 | * R99 Version 3.2.0 33 | * REL-4 Version 4.0.0 34 | * 35 | ******************************************************************************** 36 | * 37 | * File : set_zero.h 38 | * 39 | ******************************************************************************** 40 | */ 41 | /* 42 | ******************************************************************************** 43 | * MODULE INCLUDE FILE AND VERSION ID 44 | ******************************************************************************** 45 | */ 46 | #include "set_zero.h" 47 | 48 | /* 49 | ******************************************************************************** 50 | * INCLUDE FILES 51 | ******************************************************************************** 52 | */ 53 | #include "typedef.h" 54 | #include "basic_op.h" 55 | 56 | /* 57 | ******************************************************************************** 58 | * PUBLIC PROGRAM CODE 59 | ******************************************************************************** 60 | */ 61 | void Set_zero( 62 | Word16 x[], /* (o) : vector to clear */ 63 | Word16 L /* (i) : length of vector */ 64 | ) 65 | { 66 | Word16 i; 67 | 68 | for (i = 0; i < L; i++) 69 | { 70 | x[i] = 0; 71 | } 72 | 73 | return; 74 | } 75 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES := \ 5 | src/decoder_gsm_amr.cpp \ 6 | src/a_refl.cpp \ 7 | src/agc.cpp \ 8 | src/amrdecode.cpp \ 9 | src/b_cn_cod.cpp \ 10 | src/bgnscd.cpp \ 11 | src/c_g_aver.cpp \ 12 | src/d1035pf.cpp \ 13 | src/d2_11pf.cpp \ 14 | src/d2_9pf.cpp \ 15 | src/d3_14pf.cpp \ 16 | src/d4_17pf.cpp \ 17 | src/d8_31pf.cpp \ 18 | src/d_gain_c.cpp \ 19 | src/d_gain_p.cpp \ 20 | src/d_plsf.cpp \ 21 | src/d_plsf_3.cpp \ 22 | src/d_plsf_5.cpp \ 23 | src/dec_amr.cpp \ 24 | src/dec_gain.cpp \ 25 | src/dec_input_format_tab.cpp \ 26 | src/dec_lag3.cpp \ 27 | src/dec_lag6.cpp \ 28 | src/dtx_dec.cpp \ 29 | src/ec_gains.cpp \ 30 | src/ex_ctrl.cpp \ 31 | src/if2_to_ets.cpp \ 32 | src/int_lsf.cpp \ 33 | src/lsp_avg.cpp \ 34 | src/ph_disp.cpp \ 35 | src/post_pro.cpp \ 36 | src/preemph.cpp \ 37 | src/pstfilt.cpp \ 38 | src/qgain475_tab.cpp \ 39 | src/sp_dec.cpp \ 40 | src/wmf_to_ets.cpp 41 | 42 | 43 | LOCAL_MODULE := libpvdecoder_gsmamr 44 | 45 | LOCAL_CFLAGS := $(PV_CFLAGS) 46 | LOCAL_ARM_MODE := arm 47 | 48 | LOCAL_STATIC_LIBRARIES := 49 | 50 | LOCAL_SHARED_LIBRARIES := 51 | 52 | LOCAL_C_INCLUDES := \ 53 | $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/dec/src \ 54 | $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/dec/include \ 55 | $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/include \ 56 | $(PV_INCLUDES) 57 | 58 | LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO) 59 | 60 | LOCAL_COPY_HEADERS := \ 61 | include/decoder_gsm_amr.h \ 62 | include/pvamrnbdecoder_api.h 63 | 64 | include $(BUILD_STATIC_LIBRARY) 65 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/build/make/local.mk: -------------------------------------------------------------------------------- 1 | # Get the current local path as the first operation 2 | LOCAL_PATH := $(call get_makefile_dir) 3 | 4 | # Clear out the variables used in the local makefiles 5 | include $(MK)/clear.mk 6 | 7 | TARGET := pvdecoder_gsmamr 8 | 9 | 10 | OPTIMIZE_FOR_PERFORMANCE_OVER_SIZE := true 11 | 12 | XINCDIRS := ../../../common/include 13 | 14 | SRCDIR := ../../src 15 | INCSRCDIR := ../../include 16 | 17 | SRCS := decoder_gsm_amr.cpp \ 18 | a_refl.cpp \ 19 | agc.cpp \ 20 | amrdecode.cpp \ 21 | b_cn_cod.cpp \ 22 | bgnscd.cpp \ 23 | c_g_aver.cpp \ 24 | d1035pf.cpp \ 25 | d2_11pf.cpp \ 26 | d2_9pf.cpp \ 27 | d3_14pf.cpp \ 28 | d4_17pf.cpp \ 29 | d8_31pf.cpp \ 30 | d_gain_c.cpp \ 31 | d_gain_p.cpp \ 32 | d_plsf.cpp \ 33 | d_plsf_3.cpp \ 34 | d_plsf_5.cpp \ 35 | dec_amr.cpp \ 36 | dec_gain.cpp \ 37 | dec_input_format_tab.cpp \ 38 | dec_lag3.cpp \ 39 | dec_lag6.cpp \ 40 | dtx_dec.cpp \ 41 | ec_gains.cpp \ 42 | ex_ctrl.cpp \ 43 | if2_to_ets.cpp \ 44 | int_lsf.cpp \ 45 | lsp_avg.cpp \ 46 | ph_disp.cpp \ 47 | post_pro.cpp \ 48 | preemph.cpp \ 49 | pstfilt.cpp \ 50 | qgain475_tab.cpp \ 51 | sp_dec.cpp \ 52 | wmf_to_ets.cpp 53 | 54 | HDRS := decoder_gsm_amr.h pvamrnbdecoder_api.h 55 | 56 | include $(MK)/library.mk 57 | 58 | 59 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/decoder_gsm_amr.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | ////////////////////////////////////////////////////////////////////////////////// 30 | // // 31 | // File: decoder_amr_nb.h // 32 | // // 33 | ////////////////////////////////////////////////////////////////////////////////// 34 | 35 | #ifndef _DECODER_AMR_NB_H 36 | #define _DECODER_AMR_NB_H 37 | 38 | #include "oscl_base.h" 39 | #include "pvgsmamrdecoderinterface.h" 40 | 41 | // CDecoder_AMR_WB 42 | class CDecoder_AMRInterface; 43 | class CDecoder_AMR_NB: public CDecoder_AMRInterface 44 | { 45 | public: 46 | OSCL_IMPORT_REF void ConstructL(); 47 | OSCL_IMPORT_REF static CDecoder_AMR_NB *NewL(); 48 | OSCL_IMPORT_REF virtual ~CDecoder_AMR_NB(); 49 | 50 | OSCL_IMPORT_REF virtual int32 StartL(tPVAmrDecoderExternal * pExt, 51 | bool aAllocateInputBuffer = false, 52 | bool aAllocateOutputBuffer = false); 53 | 54 | OSCL_IMPORT_REF virtual int32 ExecuteL(tPVAmrDecoderExternal * pExt); 55 | 56 | OSCL_IMPORT_REF virtual int32 ResetDecoderL(); 57 | OSCL_IMPORT_REF virtual void StopL(); 58 | OSCL_IMPORT_REF virtual void TerminateDecoderL(); 59 | 60 | private: 61 | void* iDecState; 62 | 63 | int16* iInputBuf; 64 | int16* iOutputBuf; 65 | 66 | 67 | }; 68 | 69 | 70 | #endif 71 | 72 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : d2_11pf.h 39 | * Purpose : Algebraic codebook decoder 40 | * 41 | ******************************************************************************** 42 | */ 43 | #ifndef d2_11pf_h 44 | #define d2_11pf_h "$Id $" 45 | 46 | /* 47 | ******************************************************************************** 48 | * INCLUDE FILES 49 | ******************************************************************************** 50 | */ 51 | #include "typedef.h" 52 | 53 | #ifdef __cplusplus 54 | extern "C" 55 | { 56 | #endif 57 | 58 | /* 59 | ******************************************************************************** 60 | * LOCAL VARIABLES AND TABLES 61 | ******************************************************************************** 62 | */ 63 | 64 | /* 65 | ******************************************************************************** 66 | * DEFINITION OF DATA TYPES 67 | ******************************************************************************** 68 | */ 69 | 70 | /* 71 | ******************************************************************************** 72 | * DECLARATION OF PROTOTYPES 73 | ******************************************************************************** 74 | */ 75 | /************************************************************************* 76 | * 77 | * FUNCTION: decode_2i40_11bits (decod_ACELP()) 78 | * 79 | * PURPOSE: Algebraic codebook decoder for 2 pulses coded with 11 bits 80 | * 81 | *************************************************************************/ 82 | 83 | void decode_2i40_11bits( 84 | Word16 sign, /* i : signs of 2 pulses. */ 85 | Word16 index, /* i : Positions of the 2 pulses. */ 86 | Word16 cod[] /* o : algebraic (fixed) codebook excitation */ 87 | ); 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | 30 | #include "PVGSMAMRDecoder.h" 31 | 32 | 33 | ///////////////////////////////////////////////////////////////////////////// 34 | OSCL_EXPORT_REF CPVGSMAMRDecoder::CPVGSMAMRDecoder() 35 | { 36 | } 37 | 38 | 39 | ///////////////////////////////////////////////////////////////////////////// 40 | OSCL_EXPORT_REF CPVGSMAMRDecoder::~CPVGSMAMRDecoder() 41 | { 42 | delete iDecState; 43 | iDecState = NULL; 44 | } 45 | 46 | 47 | ///////////////////////////////////////////////////////////////////////////// 48 | OSCL_EXPORT_REF int32 CPVGSMAMRDecoder::InitDecoder(void) 49 | { 50 | return GSMInitDecode(&iDecState, (int8*)"Decoder"); 51 | } 52 | 53 | 54 | ///////////////////////////////////////////////////////////////////////////// 55 | OSCL_EXPORT_REF int32 CPVGSMAMRDecoder::DecodeFrame(Frame_Type_3GPP aType, 56 | uint8* aCompressedBlock, 57 | uint8* aAudioBuffer, 58 | int32 aFormat) 59 | { 60 | return AMRDecode(iDecState, aType, aCompressedBlock, (Word16*)aAudioBuffer, (Word16) aFormat); 61 | } 62 | 63 | 64 | ///////////////////////////////////////////////////////////////////////////// 65 | OSCL_EXPORT_REF int32 CPVGSMAMRDecoder::ResetDecoder(void) 66 | { 67 | return Speech_Decode_Frame_reset(iDecState); 68 | } 69 | 70 | 71 | ///////////////////////////////////////////////////////////////////////////// 72 | OSCL_EXPORT_REF void CPVGSMAMRDecoder::TerminateDecoder(void) 73 | { 74 | GSMDecodeFrameExit(&iDecState); 75 | iDecState = NULL; 76 | } 77 | 78 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | 30 | #ifndef __PVGSMAMRDECODER_H 31 | #define __PVGSMAMRDECODER_H 32 | 33 | #include "oscl_base.h" 34 | 35 | #include "gsmamr_dec.h" 36 | 37 | // PVGSMAMRDecoder 38 | class CPVGSMAMRDecoder 39 | { 40 | public: 41 | OSCL_IMPORT_REF CPVGSMAMRDecoder(); 42 | OSCL_IMPORT_REF ~CPVGSMAMRDecoder(); 43 | 44 | OSCL_IMPORT_REF int32 InitDecoder(void); 45 | OSCL_IMPORT_REF int32 DecodeFrame(Frame_Type_3GPP aType, 46 | uint8* aCompressedBlock, 47 | uint8* aAudioBuffer, 48 | int32 aFormat); 49 | OSCL_IMPORT_REF int32 ResetDecoder(void); 50 | OSCL_IMPORT_REF void TerminateDecoder(void); 51 | 52 | private: 53 | void* iDecState; 54 | }; 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pvgsmamrdecoder_dpi.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | 30 | #ifndef __PVGSMAMRDECODER_H 31 | #define __PVGSMAMRDECODER_H 32 | 33 | #include "oscl_base.h" 34 | 35 | #include "gsmamr_dec.h" 36 | #include "gsmamrdpidecoder.h" 37 | 38 | // PVGSMAMRDecoder 39 | class CPVGSMAMRDecoder 40 | { 41 | public: 42 | OSCL_IMPORT_REF CPVGSMAMRDecoder(); 43 | OSCL_IMPORT_REF ~CPVGSMAMRDecoder(); 44 | 45 | OSCL_IMPORT_REF int32 InitDecoder(void); 46 | OSCL_IMPORT_REF int32 DecodeFrame(Frame_Type_3GPP aType, 47 | uint8* aCompressedBlock, 48 | uint8* aAudioBuffer, 49 | int32 aFormat); 50 | OSCL_IMPORT_REF int32 ResetDecoder(void); 51 | OSCL_IMPORT_REF void TerminateDecoder(void); 52 | 53 | private: 54 | void* iDecState; 55 | CPvGsmAmrDPIDecoder *iDecoder; 56 | }; 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES := \ 5 | src/amrencode.cpp \ 6 | src/autocorr.cpp \ 7 | src/c1035pf.cpp \ 8 | src/c2_11pf.cpp \ 9 | src/c2_9pf.cpp \ 10 | src/c3_14pf.cpp \ 11 | src/c4_17pf.cpp \ 12 | src/c8_31pf.cpp \ 13 | src/calc_cor.cpp \ 14 | src/calc_en.cpp \ 15 | src/cbsearch.cpp \ 16 | src/cl_ltp.cpp \ 17 | src/cod_amr.cpp \ 18 | src/convolve.cpp \ 19 | src/cor_h.cpp \ 20 | src/cor_h_x.cpp \ 21 | src/cor_h_x2.cpp \ 22 | src/corrwght_tab.cpp \ 23 | src/div_32.cpp \ 24 | src/dtx_enc.cpp \ 25 | src/enc_lag3.cpp \ 26 | src/enc_lag6.cpp \ 27 | src/enc_output_format_tab.cpp \ 28 | src/ets_to_if2.cpp \ 29 | src/ets_to_wmf.cpp \ 30 | src/g_adapt.cpp \ 31 | src/g_code.cpp \ 32 | src/g_pitch.cpp \ 33 | src/gain_q.cpp \ 34 | src/gsmamr_encoder_wrapper.cpp \ 35 | src/hp_max.cpp \ 36 | src/inter_36.cpp \ 37 | src/inter_36_tab.cpp \ 38 | src/l_abs.cpp \ 39 | src/l_comp.cpp \ 40 | src/l_extract.cpp \ 41 | src/l_negate.cpp \ 42 | src/lag_wind.cpp \ 43 | src/lag_wind_tab.cpp \ 44 | src/levinson.cpp \ 45 | src/lpc.cpp \ 46 | src/ol_ltp.cpp \ 47 | src/p_ol_wgh.cpp \ 48 | src/pitch_fr.cpp \ 49 | src/pitch_ol.cpp \ 50 | src/pre_big.cpp \ 51 | src/pre_proc.cpp \ 52 | src/prm2bits.cpp \ 53 | src/q_gain_c.cpp \ 54 | src/q_gain_p.cpp \ 55 | src/qgain475.cpp \ 56 | src/qgain795.cpp \ 57 | src/qua_gain.cpp \ 58 | src/s10_8pf.cpp \ 59 | src/set_sign.cpp \ 60 | src/sid_sync.cpp \ 61 | src/sp_enc.cpp \ 62 | src/spreproc.cpp \ 63 | src/spstproc.cpp \ 64 | src/ton_stab.cpp \ 65 | src/vad1.cpp 66 | 67 | 68 | LOCAL_MODULE := libpvencoder_gsmamr 69 | 70 | LOCAL_CFLAGS := $(PV_CFLAGS) 71 | LOCAL_ARM_MODE := arm 72 | 73 | LOCAL_STATIC_LIBRARIES := 74 | 75 | LOCAL_SHARED_LIBRARIES := 76 | 77 | LOCAL_C_INCLUDES := \ 78 | $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/enc/src \ 79 | $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/enc/include \ 80 | $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/include \ 81 | $(PV_INCLUDES) 82 | 83 | LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO) 84 | 85 | LOCAL_COPY_HEADERS := \ 86 | include/gsmamr_encoder_wrapper.h 87 | 88 | include $(BUILD_STATIC_LIBRARY) 89 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build/make/local.mk: -------------------------------------------------------------------------------- 1 | # Get the current local path as the first operation 2 | LOCAL_PATH := $(call get_makefile_dir) 3 | 4 | # Clear out the variables used in the local makefiles 5 | include $(MK)/clear.mk 6 | 7 | 8 | 9 | TARGET := pvencoder_gsmamr 10 | 11 | 12 | OPTIMIZE_FOR_PERFORMANCE_OVER_SIZE := true 13 | 14 | XINCDIRS += ../../../common/include 15 | 16 | SRCDIR := ../../src 17 | INCSRCDIR := ../../include 18 | 19 | SRCS := amrencode.cpp \ 20 | autocorr.cpp \ 21 | c1035pf.cpp \ 22 | c2_11pf.cpp \ 23 | c2_9pf.cpp \ 24 | c3_14pf.cpp \ 25 | c4_17pf.cpp \ 26 | c8_31pf.cpp \ 27 | calc_cor.cpp \ 28 | calc_en.cpp \ 29 | cbsearch.cpp \ 30 | cl_ltp.cpp \ 31 | cod_amr.cpp \ 32 | convolve.cpp \ 33 | cor_h.cpp \ 34 | cor_h_x.cpp \ 35 | cor_h_x2.cpp \ 36 | corrwght_tab.cpp \ 37 | div_32.cpp \ 38 | dtx_enc.cpp \ 39 | enc_lag3.cpp \ 40 | enc_lag6.cpp \ 41 | enc_output_format_tab.cpp \ 42 | ets_to_if2.cpp \ 43 | ets_to_wmf.cpp \ 44 | g_adapt.cpp \ 45 | g_code.cpp \ 46 | g_pitch.cpp \ 47 | gain_q.cpp \ 48 | gsmamr_encoder_wrapper.cpp \ 49 | hp_max.cpp \ 50 | inter_36.cpp \ 51 | inter_36_tab.cpp \ 52 | l_abs.cpp \ 53 | l_comp.cpp \ 54 | l_extract.cpp \ 55 | l_negate.cpp \ 56 | lag_wind.cpp \ 57 | lag_wind_tab.cpp \ 58 | levinson.cpp \ 59 | lpc.cpp \ 60 | ol_ltp.cpp \ 61 | p_ol_wgh.cpp \ 62 | pitch_fr.cpp \ 63 | pitch_ol.cpp \ 64 | pre_big.cpp \ 65 | pre_proc.cpp \ 66 | prm2bits.cpp \ 67 | q_gain_c.cpp \ 68 | q_gain_p.cpp \ 69 | qgain475.cpp \ 70 | qgain795.cpp \ 71 | qua_gain.cpp \ 72 | s10_8pf.cpp \ 73 | set_sign.cpp \ 74 | sid_sync.cpp \ 75 | sp_enc.cpp \ 76 | spreproc.cpp \ 77 | spstproc.cpp \ 78 | ton_stab.cpp \ 79 | vad1.cpp 80 | 81 | HDRS := gsmamr_encoder_wrapper.h 82 | 83 | include $(MK)/library.mk 84 | 85 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : calc_cor.h 39 | * Purpose : Calculate all correlations for prior the OL LTP 40 | * 41 | ******************************************************************************** 42 | */ 43 | #ifndef calc_cor_h 44 | #define calc_cor_h "$Id $" 45 | 46 | /* 47 | ******************************************************************************** 48 | * INCLUDE FILES 49 | ******************************************************************************** 50 | */ 51 | #include "typedef.h" 52 | 53 | #ifdef __cplusplus 54 | extern "C" 55 | { 56 | #endif 57 | 58 | /* 59 | ******************************************************************************** 60 | * DECLARATION OF PROTOTYPES 61 | ******************************************************************************** 62 | */ 63 | /************************************************************************* 64 | * 65 | * FUNCTION: comp_corr 66 | * 67 | * PURPOSE: Calculate all correlations of scal_sig[] in a given delay 68 | * range. 69 | * 70 | * DESCRIPTION: 71 | * The correlation is given by 72 | * cor[t] = , t=lag_min,...,lag_max 73 | * The functions outputs all correlations in the given range 74 | * 75 | *************************************************************************/ 76 | void comp_corr(Word16 scal_sig[], /* i : scaled signal. */ 77 | Word16 L_frame, /* i : length of frame to compute pitch */ 78 | Word16 lag_max, /* i : maximum lag */ 79 | Word16 lag_min, /* i : minimum lag */ 80 | Word32 corr[] /* o : correlation of selected lag */ 81 | ); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : convolve.h 39 | * Purpose : Perform the convolution between two vectors x[] 40 | * : and h[] and write the result in the vector y[]. 41 | * : All vectors are of length L and only the first 42 | * : L samples of the convolution are computed. 43 | * 44 | ******************************************************************************** 45 | */ 46 | #ifndef convolve_h 47 | #define convolve_h "$Id $" 48 | 49 | /* 50 | ******************************************************************************** 51 | * INCLUDE FILES 52 | ******************************************************************************** 53 | */ 54 | #include "typedef.h" 55 | 56 | #ifdef __cplusplus 57 | extern "C" 58 | { 59 | #endif 60 | 61 | /* 62 | ******************************************************************************** 63 | * DEFINITION OF DATA TYPES 64 | ******************************************************************************** 65 | */ 66 | 67 | /* 68 | ******************************************************************************** 69 | * DECLARATION OF PROTOTYPES 70 | ******************************************************************************** 71 | */ 72 | void Convolve( 73 | Word16 x[], /* (i) : input vector */ 74 | Word16 h[], /* (i) : impulse response */ 75 | Word16 y[], /* (o) : output vector */ 76 | Word16 L /* (i) : vector size */ 77 | ); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /*---------------------------------------------------------------------------- 30 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 31 | ----------------------------------------------------------------------------*/ 32 | #ifndef COR_H_H 33 | #define COR_H_H 34 | 35 | /*---------------------------------------------------------------------------- 36 | ; INCLUDES 37 | ----------------------------------------------------------------------------*/ 38 | #include "typedef.h" 39 | 40 | #include "cor_h_x.h" /* Used by legacy files */ 41 | #include "cor_h_x2.h" /* Used by legacy files */ 42 | 43 | /*--------------------------------------------------------------------------*/ 44 | #ifdef __cplusplus 45 | extern "C" 46 | { 47 | #endif 48 | 49 | /*---------------------------------------------------------------------------- 50 | ; MACROS 51 | ; Define module specific macros here 52 | ----------------------------------------------------------------------------*/ 53 | 54 | /*---------------------------------------------------------------------------- 55 | ; DEFINES 56 | ; Include all pre-processor statements here. 57 | ----------------------------------------------------------------------------*/ 58 | 59 | /*---------------------------------------------------------------------------- 60 | ; EXTERNAL VARIABLES REFERENCES 61 | ; Declare variables used in this module but defined elsewhere 62 | ----------------------------------------------------------------------------*/ 63 | 64 | /*---------------------------------------------------------------------------- 65 | ; SIMPLE TYPEDEF'S 66 | ----------------------------------------------------------------------------*/ 67 | 68 | /*---------------------------------------------------------------------------- 69 | ; ENUMERATED TYPEDEF'S 70 | ----------------------------------------------------------------------------*/ 71 | 72 | /*---------------------------------------------------------------------------- 73 | ; STRUCTURES TYPEDEF'S 74 | ----------------------------------------------------------------------------*/ 75 | 76 | /*---------------------------------------------------------------------------- 77 | ; GLOBAL FUNCTION DEFINITIONS 78 | ; Function Prototype declaration 79 | ----------------------------------------------------------------------------*/ 80 | void cor_h( 81 | Word16 h[], /* (i) : impulse response of weighted synthesis 82 | filter */ 83 | Word16 sign[], /* (i) : sign of d[n] */ 84 | Word16 rr[][L_CODE], /* (o) : matrix of autocorrelation */ 85 | Flag *pOverflow 86 | ); 87 | 88 | /*---------------------------------------------------------------------------- 89 | ; END 90 | ----------------------------------------------------------------------------*/ 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif 96 | 97 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | 31 | Filename: l_abs.h 32 | 33 | ------------------------------------------------------------------------------ 34 | INCLUDE DESCRIPTION 35 | 36 | This file contains all the constant definitions and prototype definitions 37 | needed by the L_abs function. 38 | 39 | ------------------------------------------------------------------------------ 40 | */ 41 | 42 | /*---------------------------------------------------------------------------- 43 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 44 | ----------------------------------------------------------------------------*/ 45 | #ifndef L_ABS_H 46 | #define L_ABS_H 47 | 48 | /*---------------------------------------------------------------------------- 49 | ; INCLUDES 50 | ----------------------------------------------------------------------------*/ 51 | #include "basicop_malloc.h" 52 | 53 | /*--------------------------------------------------------------------------*/ 54 | #ifdef __cplusplus 55 | extern "C" 56 | { 57 | #endif 58 | 59 | /*---------------------------------------------------------------------------- 60 | ; MACROS 61 | ; Define module specific macros here 62 | ----------------------------------------------------------------------------*/ 63 | 64 | /*---------------------------------------------------------------------------- 65 | ; DEFINES 66 | ; Include all pre-processor statements here. 67 | ----------------------------------------------------------------------------*/ 68 | 69 | /*---------------------------------------------------------------------------- 70 | ; EXTERNAL VARIABLES REFERENCES 71 | ; Declare variables used in this module but defined elsewhere 72 | ----------------------------------------------------------------------------*/ 73 | 74 | /*---------------------------------------------------------------------------- 75 | ; SIMPLE TYPEDEF'S 76 | ----------------------------------------------------------------------------*/ 77 | 78 | /*---------------------------------------------------------------------------- 79 | ; ENUMERATED TYPEDEF'S 80 | ----------------------------------------------------------------------------*/ 81 | 82 | /*---------------------------------------------------------------------------- 83 | ; STRUCTURES TYPEDEF'S 84 | ----------------------------------------------------------------------------*/ 85 | 86 | /*---------------------------------------------------------------------------- 87 | ; GLOBAL FUNCTION DEFINITIONS 88 | ; Function Prototype declaration 89 | ----------------------------------------------------------------------------*/ 90 | Word32 L_abs(Word32 L_var1); 91 | 92 | /*---------------------------------------------------------------------------- 93 | ; END 94 | ----------------------------------------------------------------------------*/ 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | #endif 100 | 101 | 102 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.073 22 | ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ******************************************************************************** 31 | * 32 | * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 33 | * R99 Version 3.2.0 34 | * REL-4 Version 4.0.0 35 | * 36 | ******************************************************************************** 37 | * 38 | * File : prm2bits.h 39 | * Purpose : Converts the encoder parameter vector into a 40 | * : vector of serial bits. 41 | * 42 | ******************************************************************************** 43 | */ 44 | #ifndef prm2bits_h 45 | #define prm2bits_h "$Id $" 46 | 47 | /* 48 | ******************************************************************************** 49 | * INCLUDE FILES 50 | ******************************************************************************** 51 | */ 52 | #include "typedef.h" 53 | #include "mode.h" 54 | #include "get_const_tbls.h" 55 | 56 | #ifdef __cplusplus 57 | extern "C" 58 | { 59 | #endif 60 | 61 | /* 62 | ******************************************************************************** 63 | * DEFINITION OF DATA TYPES 64 | ******************************************************************************** 65 | */ 66 | 67 | /* 68 | ******************************************************************************** 69 | * DECLARATION OF PROTOTYPES 70 | ******************************************************************************** 71 | */ 72 | void Prm2bits( 73 | enum Mode mode, /* i : AMR mode */ 74 | Word16 prm[], /* input : analysis parameters */ 75 | Word16 bits[], /* output: serial bits */ 76 | CommonAmrTbls* common_amr_tbls /* i : ptr to strcut of table ptrs */ 77 | ); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES := \ 5 | src/agc2_amr_wb.cpp \ 6 | src/band_pass_6k_7k.cpp \ 7 | src/dec_acelp_2p_in_64.cpp \ 8 | src/dec_acelp_4p_in_64.cpp \ 9 | src/dec_alg_codebook.cpp \ 10 | src/dec_gain2_amr_wb.cpp \ 11 | src/decoder_amr_wb.cpp \ 12 | src/deemphasis_32.cpp \ 13 | src/dtx_decoder_amr_wb.cpp \ 14 | src/get_amr_wb_bits.cpp \ 15 | src/highpass_400hz_at_12k8.cpp \ 16 | src/highpass_50hz_at_12k8.cpp \ 17 | src/homing_amr_wb_dec.cpp \ 18 | src/interpolate_isp.cpp \ 19 | src/isf_extrapolation.cpp \ 20 | src/isp_az.cpp \ 21 | src/isp_isf.cpp \ 22 | src/lagconceal.cpp \ 23 | src/low_pass_filt_7k.cpp \ 24 | src/median5.cpp \ 25 | src/mime_io.cpp \ 26 | src/noise_gen_amrwb.cpp \ 27 | src/normalize_amr_wb.cpp \ 28 | src/oversamp_12k8_to_16k.cpp \ 29 | src/phase_dispersion.cpp \ 30 | src/pit_shrp.cpp \ 31 | src/pred_lt4.cpp \ 32 | src/preemph_amrwb_dec.cpp \ 33 | src/pvamrwb_math_op.cpp \ 34 | src/pvamrwbdecoder.cpp \ 35 | src/q_gain2_tab.cpp \ 36 | src/qisf_ns.cpp \ 37 | src/qisf_ns_tab.cpp \ 38 | src/qpisf_2s.cpp \ 39 | src/qpisf_2s_tab.cpp \ 40 | src/scale_signal.cpp \ 41 | src/synthesis_amr_wb.cpp \ 42 | src/voice_factor.cpp \ 43 | src/wb_syn_filt.cpp \ 44 | src/weight_amrwb_lpc.cpp 45 | 46 | 47 | LOCAL_MODULE := libpvamrwbdecoder 48 | 49 | LOCAL_CFLAGS := $(PV_CFLAGS) 50 | LOCAL_ARM_MODE := arm 51 | 52 | LOCAL_STATIC_LIBRARIES := 53 | 54 | LOCAL_SHARED_LIBRARIES := 55 | 56 | LOCAL_C_INCLUDES := \ 57 | $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_wb/dec/src \ 58 | $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_wb/dec/include \ 59 | $(PV_INCLUDES) 60 | 61 | LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO) 62 | 63 | LOCAL_COPY_HEADERS := \ 64 | include/decoder_amr_wb.h \ 65 | include/pvamrwbdecoder_api.h 66 | 67 | include $(BUILD_STATIC_LIBRARY) 68 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/build/make/local.mk: -------------------------------------------------------------------------------- 1 | # Get the current local path as the first operation 2 | LOCAL_PATH := $(call get_makefile_dir) 3 | 4 | # Clear out the variables used in the local makefiles 5 | include $(MK)/clear.mk 6 | 7 | TARGET := pvamrwbdecoder 8 | 9 | 10 | OPTIMIZE_FOR_PERFORMANCE_OVER_SIZE := true 11 | 12 | SRCDIR := ../../src 13 | INCSRCDIR := ../../include 14 | SRCS := agc2_amr_wb.cpp \ 15 | band_pass_6k_7k.cpp \ 16 | dec_acelp_2p_in_64.cpp \ 17 | dec_acelp_4p_in_64.cpp \ 18 | dec_alg_codebook.cpp \ 19 | dec_gain2_amr_wb.cpp \ 20 | decoder_amr_wb.cpp \ 21 | deemphasis_32.cpp \ 22 | dtx_decoder_amr_wb.cpp \ 23 | get_amr_wb_bits.cpp \ 24 | highpass_400hz_at_12k8.cpp \ 25 | highpass_50hz_at_12k8.cpp \ 26 | homing_amr_wb_dec.cpp \ 27 | interpolate_isp.cpp \ 28 | isf_extrapolation.cpp \ 29 | isp_az.cpp \ 30 | isp_isf.cpp \ 31 | lagconceal.cpp \ 32 | low_pass_filt_7k.cpp \ 33 | median5.cpp \ 34 | mime_io.cpp \ 35 | noise_gen_amrwb.cpp \ 36 | normalize_amr_wb.cpp \ 37 | oversamp_12k8_to_16k.cpp \ 38 | phase_dispersion.cpp \ 39 | pit_shrp.cpp \ 40 | pred_lt4.cpp \ 41 | preemph_amrwb_dec.cpp \ 42 | pvamrwb_math_op.cpp \ 43 | pvamrwbdecoder.cpp \ 44 | q_gain2_tab.cpp \ 45 | qisf_ns.cpp \ 46 | qisf_ns_tab.cpp \ 47 | qpisf_2s.cpp \ 48 | qpisf_2s_tab.cpp \ 49 | scale_signal.cpp \ 50 | synthesis_amr_wb.cpp \ 51 | voice_factor.cpp \ 52 | wb_syn_filt.cpp \ 53 | weight_amrwb_lpc.cpp 54 | 55 | 56 | HDRS := decoder_amr_wb.h pvamrwbdecoder_api.h 57 | 58 | include $(MK)/library.mk 59 | 60 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/decoder_amr_wb.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.173 22 | ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | ////////////////////////////////////////////////////////////////////////////////// 30 | // // 31 | // File: decoder_amr_wb.h // 32 | // // 33 | ////////////////////////////////////////////////////////////////////////////////// 34 | 35 | #ifndef _DECODER_AMR_WB_H 36 | #define _DECODER_AMR_WB_H 37 | 38 | #include "oscl_base.h" 39 | #include "pvamrwbdecoder_api.h" 40 | #include "pvgsmamrdecoderinterface.h" 41 | 42 | // CDecoder_AMR_WB 43 | class CDecoder_AMRInterface; 44 | class CDecoder_AMR_WB: public CDecoder_AMRInterface 45 | { 46 | public: 47 | OSCL_IMPORT_REF void ConstructL(); 48 | OSCL_IMPORT_REF static CDecoder_AMR_WB *NewL(); 49 | OSCL_IMPORT_REF virtual ~CDecoder_AMR_WB(); 50 | 51 | OSCL_IMPORT_REF virtual int32 StartL(tPVAmrDecoderExternal * pExt, 52 | bool aAllocateInputBuffer = false, 53 | bool aAllocateOutputBuffer = false); 54 | 55 | OSCL_IMPORT_REF virtual int32 ExecuteL(tPVAmrDecoderExternal * pExt); 56 | 57 | OSCL_IMPORT_REF virtual int32 ResetDecoderL(void); 58 | OSCL_IMPORT_REF virtual void StopL(); 59 | OSCL_IMPORT_REF virtual void TerminateDecoderL(); 60 | 61 | private: 62 | void *st; /* State structure */ 63 | void *pt_st; 64 | int16 *ScratchMem; 65 | 66 | uint8* iInputBuf; 67 | int16* iInputSampleBuf; 68 | int16* iOutputBuf; 69 | 70 | 71 | }; 72 | 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.173 22 | ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /*--------------------------------------------------------------------------* 30 | * get_amr_wb_bits.h * 31 | *--------------------------------------------------------------------------* 32 | * Number of bits for different modes * 33 | *--------------------------------------------------------------------------*/ 34 | 35 | #ifndef GET_AMR_WB_BITS_H 36 | #define GET_AMR_WB_BITS_H 37 | 38 | 39 | #include "pv_amr_wb_type_defs.h" 40 | 41 | #ifdef __cplusplus 42 | extern "C" 43 | { 44 | #endif 45 | 46 | 47 | int16 Serial_parm( /* Return the parameter */ 48 | int16 no_of_bits, /* input : number of bits */ 49 | int16 ** prms 50 | ); 51 | 52 | int16 Serial_parm_1bit( /* Return the parameter */ 53 | int16 ** prms 54 | ); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.173 22 | ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ------------------------------------------------------------------------------ 31 | 32 | 33 | 34 | Pathname: ./cpp/include/mime_io.h 35 | 36 | ------------------------------------------------------------------------------ 37 | INCLUDE DESCRIPTION 38 | 39 | ------------------------------------------------------------------------------ 40 | */ 41 | 42 | #ifndef MIME_IO_H 43 | #define MIME_IO_H 44 | 45 | 46 | /*---------------------------------------------------------------------------- 47 | ; INCLUDES 48 | ----------------------------------------------------------------------------*/ 49 | 50 | /*---------------------------------------------------------------------------- 51 | ; MACROS 52 | ; Define module specific macros here 53 | ----------------------------------------------------------------------------*/ 54 | 55 | 56 | /*---------------------------------------------------------------------------- 57 | ; DEFINES 58 | ----------------------------------------------------------------------------*/ 59 | 60 | 61 | 62 | /*---------------------------------------------------------------------------- 63 | ; EXTERNAL VARIABLES REFERENCES 64 | ----------------------------------------------------------------------------*/ 65 | extern const uint8 toc_byte[16]; 66 | 67 | /* number of speech bits for all modes */ 68 | extern const int16 unpacked_size[16]; 69 | 70 | /* size of packed frame for each mode, excluding TOC byte */ 71 | extern const int16 packed_size[16]; 72 | 73 | /* number of unused speech bits in packed format for each mode */ 74 | extern const int16 unused_size[16]; 75 | 76 | /* sorting tables for all modes */ 77 | 78 | extern const int16 sort_660[132]; 79 | 80 | extern const int16 sort_885[177]; 81 | 82 | extern const int16 sort_1265[253]; 83 | 84 | extern const int16 sort_1425[285]; 85 | 86 | extern const int16 sort_1585[317]; 87 | 88 | extern const int16 sort_1825[365]; 89 | 90 | extern const int16 sort_1985[397]; 91 | 92 | extern const int16 sort_2305[461]; 93 | 94 | extern const int16 sort_2385[477]; 95 | 96 | extern const int16 sort_SID[35]; 97 | 98 | 99 | /*---------------------------------------------------------------------------- 100 | ; SIMPLE TYPEDEF'S 101 | ----------------------------------------------------------------------------*/ 102 | 103 | 104 | 105 | #ifdef __cplusplus 106 | extern "C" 107 | { 108 | #endif 109 | 110 | 111 | #ifdef __cplusplus 112 | } 113 | #endif 114 | 115 | 116 | 117 | 118 | #endif /* MIME_IO_H */ 119 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2010 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.173 22 | ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ------------------------------------------------------------------------------ 31 | 32 | 33 | 34 | Pathname: ./c/include/normalize_amr_wb.h 35 | 36 | ------------------------------------------------------------------------------ 37 | INCLUDE DESCRIPTION 38 | 39 | ------------------------------------------------------------------------------ 40 | */ 41 | 42 | #ifndef NORMALIZE_AMR_WB_H 43 | #define NORMALIZE_AMR_WB_H 44 | 45 | 46 | /*---------------------------------------------------------------------------- 47 | ; INCLUDES 48 | ----------------------------------------------------------------------------*/ 49 | 50 | #include "pv_amr_wb_type_defs.h" 51 | /*---------------------------------------------------------------------------- 52 | ; MACROS 53 | ; Define module specific macros here 54 | ----------------------------------------------------------------------------*/ 55 | 56 | /*---------------------------------------------------------------------------- 57 | ; EXTERNAL VARIABLES REFERENCES 58 | ----------------------------------------------------------------------------*/ 59 | 60 | /*---------------------------------------------------------------------------- 61 | ; DEFINES AND SIMPLE TYPEDEF'S 62 | ----------------------------------------------------------------------------*/ 63 | 64 | #if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC)) 65 | 66 | 67 | __inline int16 normalize_amr_wb(int32 x) 68 | { 69 | register int32 y; 70 | register int32 ra = x; 71 | 72 | 73 | asm volatile( 74 | "clz %0, %1\n\t" 75 | "sub %0, %0, #1" 76 | : "=&r*i"(y) 77 | : "r"(ra)); 78 | return (y); 79 | 80 | } 81 | 82 | #else 83 | 84 | #ifdef __cplusplus 85 | extern "C" 86 | { 87 | #endif 88 | 89 | int16 normalize_amr_wb(int32 x); 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif 96 | 97 | 98 | 99 | #endif /* PV_NORMALIZE_H */ 100 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_mem_funcs.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.173 22 | ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ------------------------------------------------------------------------------ 31 | 32 | 33 | 34 | Filename: pvamrwbdecoder_mem_funcs.h 35 | 36 | 37 | ---------------------------------------------------------------------------- 38 | ; CONTINUE ONLY IF NOT ALREADY DEFINED 39 | ----------------------------------------------------------------------------*/ 40 | 41 | #ifndef PVAMRWBDECODER_MEM_FUNCS_H 42 | #define PVAMRWBDECODER_MEM_FUNCS_H 43 | 44 | 45 | #include "oscl_mem.h" 46 | 47 | 48 | 49 | #define pv_memset(to, c, n) oscl_memset(to, c, n) 50 | 51 | 52 | #define pv_memcpy(to, from, n) oscl_memcpy(to, from, n) 53 | #define pv_memmove(to, from, n) oscl_memmove(to, from, n) 54 | #define pv_memcmp(p, q, n) oscl_memcmp(p, q, n) 55 | 56 | 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_pulse.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.173 22 | ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ------------------------------------------------------------------------------ 31 | 32 | 33 | 34 | Pathname: ./cpp/include/q_pulse.h 35 | 36 | ------------------------------------------------------------------------------ 37 | INCLUDE DESCRIPTION 38 | 39 | Coding and decoding of algebraic codebook 40 | ------------------------------------------------------------------------------ 41 | */ 42 | 43 | #ifndef Q_PULSE_H 44 | #define Q_PULSE_H 45 | 46 | 47 | /*---------------------------------------------------------------------------- 48 | ; INCLUDES 49 | ----------------------------------------------------------------------------*/ 50 | 51 | #include "pv_amr_wb_type_defs.h" 52 | 53 | 54 | #ifdef __cplusplus 55 | extern "C" 56 | { 57 | #endif 58 | 59 | 60 | void dec_1p_N1(int32 index, int16 N, int16 offset, int16 pos[]); 61 | void dec_2p_2N1(int32 index, int16 N, int16 offset, int16 pos[]); 62 | void dec_3p_3N1(int32 index, int16 N, int16 offset, int16 pos[]); 63 | void dec_4p_4N1(int32 index, int16 N, int16 offset, int16 pos[]); 64 | void dec_4p_4N(int32 index, int16 N, int16 offset, int16 pos[]); 65 | void dec_5p_5N(int32 index, int16 N, int16 offset, int16 pos[]); 66 | void dec_6p_6N_2(int32 index, int16 N, int16 offset, int16 pos[]); 67 | 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* Q_PULSE_H */ 74 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.173 22 | ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ------------------------------------------------------------------------------ 31 | 32 | 33 | 34 | Pathname: ./cpp/include/qisf_ns.h 35 | 36 | ------------------------------------------------------------------------------ 37 | INCLUDE DESCRIPTION 38 | 39 | ------------------------------------------------------------------------------ 40 | */ 41 | 42 | #ifndef QISF_NS_H 43 | #define QISF_NS_H 44 | 45 | 46 | /*---------------------------------------------------------------------------- 47 | ; INCLUDES 48 | ----------------------------------------------------------------------------*/ 49 | 50 | #include "pv_amr_wb_type_defs.h" 51 | 52 | /*---------------------------------------------------------------------------- 53 | ; DEFINES 54 | ----------------------------------------------------------------------------*/ 55 | 56 | 57 | #define ORDER 16 /* order of linear prediction filter */ 58 | #define ISF_GAP 128 59 | 60 | #define SIZE_BK_NOISE1 64 61 | #define SIZE_BK_NOISE2 64 62 | #define SIZE_BK_NOISE3 64 63 | #define SIZE_BK_NOISE4 32 64 | #define SIZE_BK_NOISE5 32 65 | 66 | #define NB_QUA_GAIN6B 64 /* Number of quantization level */ 67 | #define NB_QUA_GAIN7B 128 /* Number of quantization level */ 68 | 69 | /*---------------------------------------------------------------------------- 70 | ; MACROS 71 | ; Define module specific macros here 72 | ----------------------------------------------------------------------------*/ 73 | 74 | /*---------------------------------------------------------------------------- 75 | ; EXTERNAL VARIABLES REFERENCES 76 | ----------------------------------------------------------------------------*/ 77 | extern const int16 mean_isf_noise[ORDER]; 78 | extern const int16 dico1_isf_noise[SIZE_BK_NOISE1*2]; 79 | extern const int16 dico2_isf_noise[SIZE_BK_NOISE2*3]; 80 | extern const int16 dico3_isf_noise[SIZE_BK_NOISE3*3]; 81 | extern const int16 dico4_isf_noise[SIZE_BK_NOISE4*4]; 82 | extern const int16 dico5_isf_noise[SIZE_BK_NOISE5*4]; 83 | 84 | extern const int16 t_qua_gain6b[NB_QUA_GAIN6B*2]; 85 | extern const int16 t_qua_gain7b[NB_QUA_GAIN7B*2]; 86 | 87 | /*---------------------------------------------------------------------------- 88 | ; SIMPLE TYPEDEF'S 89 | ----------------------------------------------------------------------------*/ 90 | 91 | 92 | 93 | 94 | #ifdef __cplusplus 95 | extern "C" 96 | { 97 | #endif 98 | 99 | 100 | #ifdef __cplusplus 101 | } 102 | #endif 103 | 104 | 105 | 106 | 107 | #endif /* QISF_NS_H */ 108 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.173 22 | ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ------------------------------------------------------------------------------ 31 | 32 | 33 | 34 | Pathname: ./cpp/include/qpisf_2s.h 35 | 36 | ------------------------------------------------------------------------------ 37 | INCLUDE DESCRIPTION 38 | 39 | ------------------------------------------------------------------------------ 40 | */ 41 | 42 | #ifndef QPISF_2S_H 43 | #define QPISF_2S_H 44 | 45 | 46 | /*---------------------------------------------------------------------------- 47 | ; INCLUDES 48 | ----------------------------------------------------------------------------*/ 49 | 50 | #include "qisf_ns.h" 51 | 52 | /*---------------------------------------------------------------------------- 53 | ; MACROS 54 | ; Define module specific macros here 55 | ----------------------------------------------------------------------------*/ 56 | 57 | 58 | /*---------------------------------------------------------------------------- 59 | ; DEFINES 60 | ----------------------------------------------------------------------------*/ 61 | 62 | #define N_SURV 4 63 | 64 | #define SIZE_BK1 256 65 | #define SIZE_BK2 256 66 | #define SIZE_BK21 64 67 | #define SIZE_BK22 128 68 | #define SIZE_BK23 128 69 | #define SIZE_BK24 32 70 | #define SIZE_BK25 32 71 | 72 | #define SIZE_BK21_36b 128 73 | #define SIZE_BK22_36b 128 74 | #define SIZE_BK23_36b 64 75 | 76 | 77 | /*---------------------------------------------------------------------------- 78 | ; EXTERNAL VARIABLES REFERENCES 79 | ----------------------------------------------------------------------------*/ 80 | extern const int16 mean_isf[ORDER]; 81 | extern const int16 dico1_isf[SIZE_BK1*9]; 82 | extern const int16 dico2_isf[SIZE_BK2*7]; 83 | extern const int16 dico21_isf[SIZE_BK21*3]; 84 | extern const int16 dico22_isf[SIZE_BK22*3]; 85 | extern const int16 dico23_isf[SIZE_BK23*3]; 86 | extern const int16 dico24_isf[SIZE_BK24*3]; 87 | extern const int16 dico25_isf[SIZE_BK25*4]; 88 | extern const int16 dico21_isf_36b[SIZE_BK21_36b*5]; 89 | extern const int16 dico22_isf_36b[SIZE_BK22_36b*4]; 90 | extern const int16 dico23_isf_36b[SIZE_BK23_36b*7]; 91 | 92 | /*---------------------------------------------------------------------------- 93 | ; SIMPLE TYPEDEF'S 94 | ----------------------------------------------------------------------------*/ 95 | 96 | 97 | 98 | #ifdef __cplusplus 99 | extern "C" 100 | { 101 | #endif 102 | 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | 108 | 109 | 110 | 111 | #endif /* QPISF_2S_H */ 112 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 1998-2009 PacketVideo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | /**************************************************************************************** 19 | Portions of this file are derived from the following 3GPP standard: 20 | 21 | 3GPP TS 26.173 22 | ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec 23 | Available from http://www.3gpp.org 24 | 25 | (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26 | Permission to distribute, modify and use this file under the standard license 27 | terms listed above has been obtained from the copyright holder. 28 | ****************************************************************************************/ 29 | /* 30 | ------------------------------------------------------------------------------ 31 | 32 | 33 | 34 | Pathname: ./cpp/include/synthesis_amr_wb.h 35 | 36 | ------------------------------------------------------------------------------ 37 | INCLUDE DESCRIPTION 38 | 39 | ------------------------------------------------------------------------------ 40 | */ 41 | 42 | #ifndef SYNTHESIS_AMR_WB_H 43 | #define SYNTHESIS_AMR_WB_H 44 | 45 | 46 | /*---------------------------------------------------------------------------- 47 | ; INCLUDES 48 | ----------------------------------------------------------------------------*/ 49 | 50 | #include "pv_amr_wb_type_defs.h" 51 | 52 | /*---------------------------------------------------------------------------- 53 | ; MACROS 54 | ; Define module specific macros here 55 | ----------------------------------------------------------------------------*/ 56 | 57 | /*---------------------------------------------------------------------------- 58 | ; EXTERNAL VARIABLES REFERENCES 59 | ----------------------------------------------------------------------------*/ 60 | 61 | /*---------------------------------------------------------------------------- 62 | ; DEFINES AND SIMPLE TYPEDEF'S 63 | ----------------------------------------------------------------------------*/ 64 | 65 | #ifdef __cplusplus 66 | extern "C" 67 | { 68 | #endif 69 | 70 | void synthesis_amr_wb( 71 | int16 Aq[], /* A(z) : quantized Az */ 72 | int16 exc[], /* (i) : excitation at 12kHz */ 73 | int16 Q_new, /* (i) : scaling performed on exc */ 74 | int16 synth16k[], /* (o) : 16kHz synthesis signal */ 75 | int16 prms, /* (i) : parameter */ 76 | int16 HfIsf[], 77 | int16 nb_bits, 78 | int16 newDTXState, 79 | Decoder_State * st, /* (i/o) : State structure */ 80 | int16 bfi, /* (i) : bad frame indicator */ 81 | int16 * ScratchMemory 82 | ); 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | 89 | 90 | #endif /* PV_NORMALIZE_H */ 91 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/common/dec/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES := \ 5 | 6 | 7 | 8 | 9 | 10 | LOCAL_CFLAGS := $(PV_CFLAGS) 11 | 12 | 13 | LOCAL_STATIC_LIBRARIES := 14 | 15 | LOCAL_SHARED_LIBRARIES := 16 | 17 | LOCAL_C_INCLUDES := \ 18 | $(PV_TOP)/codecs_v2/audio/gsm_amr/common/dec/build/make \ 19 | $(PV_TOP)/codecs_v2/audio/gsm_amr/common/dec/include \ 20 | $(PV_INCLUDES) 21 | 22 | LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO) 23 | 24 | LOCAL_COPY_HEADERS := \ 25 | include/pvgsmamrdecoderinterface.h 26 | 27 | include $(BUILD_COPY_HEADERS) 28 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/common/dec/build/make/local.mk: -------------------------------------------------------------------------------- 1 | # Get the current local path as the first operation 2 | LOCAL_PATH := $(call get_makefile_dir) 3 | 4 | # Clear out the variables used in the local makefiles 5 | include $(MK)/clear.mk 6 | 7 | TARGET := 8 | 9 | 10 | INCSRCDIR := ../../include 11 | 12 | HDRS := pvgsmamrdecoderinterface.h 13 | 14 | 15 | include $(MK)/library.mk 16 | 17 | -------------------------------------------------------------------------------- /opencore/codecs_v2/audio/gsm_amr/patent_disclaimer.txt: -------------------------------------------------------------------------------- 1 | 2 | THIS IS NOT A GRANT OF PATENT RIGHTS. 3 | 4 | Google makes no representation or warranty that the codecs for which 5 | source code is made available hereunder are unencumbered by 6 | third-party patents. Those intending to use this source code in 7 | hardware or software products are advised that implementations of 8 | these codecs, including in open source software or shareware, may 9 | require patent licenses from the relevant patent holders. 10 | -------------------------------------------------------------------------------- /oscl/oscl_base.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef OSCL_BASE_H 20 | #define OSCL_BASE_H 21 | 22 | #include 23 | 24 | typedef int8_t int8; 25 | typedef uint8_t uint8; 26 | typedef int16_t int16; 27 | typedef uint16_t uint16; 28 | typedef int32_t int32; 29 | typedef uint32_t uint32; 30 | typedef int64_t int64; 31 | typedef uint64_t uint64; 32 | 33 | #define OSCL_IMPORT_REF 34 | #define OSCL_EXPORT_REF 35 | #define OSCL_UNUSED_ARG(x) (void)(x) 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /oscl/oscl_base_macros.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef OSCL_BASE_MACROS_H 20 | #define OSCL_BASE_MACROS_H 21 | 22 | #define EPV_ARM_GNUC 1 23 | #define EPV_ARM_RVCT 2 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /oscl/oscl_mem.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef OSCL_MEM_H 20 | #define OSCL_MEM_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #include 27 | #include 28 | #define oscl_malloc malloc 29 | #define oscl_free free 30 | #define oscl_memset memset 31 | #define oscl_memmove memmove 32 | #define oscl_memcpy memcpy 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | amrnb-dec 2 | amrnb-enc 3 | amrnb-enc-sine 4 | amrwb-dec 5 | linkboth 6 | -------------------------------------------------------------------------------- /test/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | bin_PROGRAMS = amrwb-dec$(EXEEXT) 3 | noinst_PROGRAMS = linkboth$(EXEEXT) 4 | AM_CFLAGS = 5 | 6 | if AMRNB_DECODER 7 | bin_PROGRAMS += amrnb-dec$(EXEEXT) 8 | else 9 | AM_CFLAGS += -DDISABLE_AMRNB_DECODER 10 | endif 11 | if AMRNB_ENCODER 12 | bin_PROGRAMS += amrnb-enc$(EXEEXT) 13 | noinst_PROGRAMS += amrnb-enc-sine$(EXEEXT) 14 | else 15 | AM_CFLAGS += -DDISABLE_AMRNB_ENCODER 16 | endif 17 | 18 | INCLUDES = -I$(top_srcdir)/amrnb -I$(top_srcdir)/amrwb 19 | 20 | amrnb_dec_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la 21 | amrnb_enc_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la 22 | amrnb_enc_sine_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la 23 | amrnb_enc_sine_LDFLAGS = -lm 24 | amrwb_dec_LDADD = $(top_builddir)/amrwb/libopencore-amrwb.la 25 | linkboth_LDFLAGS = -static 26 | linkboth_LDADD = $(top_builddir)/amrnb/libopencore-amrnb.la $(top_builddir)/amrwb/libopencore-amrwb.la 27 | 28 | amrnb_dec_SOURCES = amrnb-dec.c wavwriter.c 29 | amrnb_enc_SOURCES = amrnb-enc.c wavreader.c 30 | amrnb_enc_sine_SOURCES = amrnb-enc-sine.c 31 | amrwb_dec_SOURCES = amrwb-dec.c wavwriter.c 32 | linkboth_SOURCES = linkboth.c 33 | 34 | noinst_HEADERS = wavwriter.h wavreader.h 35 | 36 | -------------------------------------------------------------------------------- /test/amrnb-dec.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include "wavwriter.h" 23 | #include 24 | 25 | /* From WmfDecBytesPerFrame in dec_input_format_tab.cpp */ 26 | const int sizes[] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 6, 5, 5, 0, 0, 0, 0 }; 27 | 28 | 29 | int main(int argc, char *argv[]) { 30 | FILE* in; 31 | char header[6]; 32 | int n; 33 | void *wav, *amr; 34 | if (argc < 3) { 35 | fprintf(stderr, "%s in.amr out.wav\n", argv[0]); 36 | return 1; 37 | } 38 | 39 | in = fopen(argv[1], "rb"); 40 | if (!in) { 41 | perror(argv[1]); 42 | return 1; 43 | } 44 | n = fread(header, 1, 6, in); 45 | if (n != 6 || memcmp(header, "#!AMR\n", 6)) { 46 | fprintf(stderr, "Bad header\n"); 47 | return 1; 48 | } 49 | 50 | wav = wav_write_open(argv[2], 8000, 16, 1); 51 | if (!wav) { 52 | fprintf(stderr, "Unable to open %s\n", argv[2]); 53 | return 1; 54 | } 55 | 56 | amr = Decoder_Interface_init(); 57 | while (1) { 58 | uint8_t buffer[500], littleendian[320], *ptr; 59 | int size, i; 60 | int16_t outbuffer[160]; 61 | /* Read the mode byte */ 62 | n = fread(buffer, 1, 1, in); 63 | if (n <= 0) 64 | break; 65 | /* Find the packet size */ 66 | size = sizes[(buffer[0] >> 3) & 0x0f]; 67 | n = fread(buffer + 1, 1, size, in); 68 | if (n != size) 69 | break; 70 | 71 | /* Decode the packet */ 72 | Decoder_Interface_Decode(amr, buffer, outbuffer, 0); 73 | 74 | /* Convert to little endian and write to wav */ 75 | ptr = littleendian; 76 | for (i = 0; i < 160; i++) { 77 | *ptr++ = (outbuffer[i] >> 0) & 0xff; 78 | *ptr++ = (outbuffer[i] >> 8) & 0xff; 79 | } 80 | wav_write_data(wav, littleendian, 320); 81 | } 82 | fclose(in); 83 | Decoder_Interface_exit(amr); 84 | wav_write_close(wav); 85 | return 0; 86 | } 87 | 88 | -------------------------------------------------------------------------------- /test/amrnb-enc-sine.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | int main(int argc, char *argv[]) { 25 | int i, j; 26 | void* amr; 27 | FILE* out; 28 | int sample_pos = 0; 29 | 30 | if (argc < 2) { 31 | fprintf(stderr, "%s out.amr\n", argv[0]); 32 | return 1; 33 | } 34 | 35 | amr = Encoder_Interface_init(0); 36 | out = fopen(argv[1], "wb"); 37 | if (!out) { 38 | perror(argv[1]); 39 | return 1; 40 | } 41 | 42 | fwrite("#!AMR\n", 1, 6, out); 43 | for (i = 0; i < 1000; i++) { 44 | short buf[160]; 45 | uint8_t outbuf[500]; 46 | int n; 47 | for (j = 0; j < 160; j++) { 48 | buf[j] = 32767*sin(440*2*3.141592654*sample_pos/8000); 49 | sample_pos++; 50 | } 51 | n = Encoder_Interface_Encode(amr, MR475, buf, outbuf, 0); 52 | fwrite(outbuf, 1, n, out); 53 | } 54 | fclose(out); 55 | Encoder_Interface_exit(amr); 56 | 57 | return 0; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /test/amrnb-enc.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "wavreader.h" 25 | 26 | void usage(const char* name) { 27 | fprintf(stderr, "%s [-r bitrate] [-d] in.wav out.amr\n", name); 28 | } 29 | 30 | enum Mode findMode(const char* str) { 31 | struct { 32 | enum Mode mode; 33 | int rate; 34 | } modes[] = { 35 | { MR475, 4750 }, 36 | { MR515, 5150 }, 37 | { MR59, 5900 }, 38 | { MR67, 6700 }, 39 | { MR74, 7400 }, 40 | { MR795, 7950 }, 41 | { MR102, 10200 }, 42 | { MR122, 12200 } 43 | }; 44 | int rate = atoi(str); 45 | int closest = -1; 46 | int closestdiff = 0; 47 | unsigned int i; 48 | for (i = 0; i < sizeof(modes)/sizeof(modes[0]); i++) { 49 | if (modes[i].rate == rate) 50 | return modes[i].mode; 51 | if (closest < 0 || closestdiff > abs(modes[i].rate - rate)) { 52 | closest = i; 53 | closestdiff = abs(modes[i].rate - rate); 54 | } 55 | } 56 | fprintf(stderr, "Using bitrate %d\n", modes[closest].rate); 57 | return modes[closest].mode; 58 | } 59 | 60 | int main(int argc, char *argv[]) { 61 | enum Mode mode = MR122; 62 | int ch, dtx = 0; 63 | const char *infile, *outfile; 64 | FILE *out; 65 | void *wav, *amr; 66 | int format, sampleRate, channels, bitsPerSample; 67 | int inputSize; 68 | uint8_t* inputBuf; 69 | while ((ch = getopt(argc, argv, "r:d")) != -1) { 70 | switch (ch) { 71 | case 'r': 72 | mode = findMode(optarg); 73 | break; 74 | case 'd': 75 | dtx = 1; 76 | break; 77 | case '?': 78 | default: 79 | usage(argv[0]); 80 | return 1; 81 | } 82 | } 83 | if (argc - optind < 2) { 84 | usage(argv[0]); 85 | return 1; 86 | } 87 | infile = argv[optind]; 88 | outfile = argv[optind + 1]; 89 | 90 | wav = wav_read_open(infile); 91 | if (!wav) { 92 | fprintf(stderr, "Unable to open wav file %s\n", infile); 93 | return 1; 94 | } 95 | if (!wav_get_header(wav, &format, &channels, &sampleRate, &bitsPerSample, NULL)) { 96 | fprintf(stderr, "Bad wav file %s\n", infile); 97 | return 1; 98 | } 99 | if (format != 1) { 100 | fprintf(stderr, "Unsupported WAV format %d\n", format); 101 | return 1; 102 | } 103 | if (bitsPerSample != 16) { 104 | fprintf(stderr, "Unsupported WAV sample depth %d\n", bitsPerSample); 105 | return 1; 106 | } 107 | if (channels != 1) 108 | fprintf(stderr, "Warning, only compressing one audio channel\n"); 109 | if (sampleRate != 8000) 110 | fprintf(stderr, "Warning, AMR-NB uses 8000 Hz sample rate (WAV file has %d Hz)\n", sampleRate); 111 | inputSize = channels*2*160; 112 | inputBuf = (uint8_t*) malloc(inputSize); 113 | 114 | amr = Encoder_Interface_init(dtx); 115 | out = fopen(outfile, "wb"); 116 | if (!out) { 117 | perror(outfile); 118 | return 1; 119 | } 120 | 121 | fwrite("#!AMR\n", 1, 6, out); 122 | while (1) { 123 | short buf[160]; 124 | uint8_t outbuf[500]; 125 | int read, i, n; 126 | read = wav_read_data(wav, inputBuf, inputSize); 127 | read /= channels; 128 | read /= 2; 129 | if (read < 160) 130 | break; 131 | for (i = 0; i < 160; i++) { 132 | const uint8_t* in = &inputBuf[2*channels*i]; 133 | buf[i] = in[0] | (in[1] << 8); 134 | } 135 | n = Encoder_Interface_Encode(amr, mode, buf, outbuf, 0); 136 | fwrite(outbuf, 1, n, out); 137 | } 138 | free(inputBuf); 139 | fclose(out); 140 | Encoder_Interface_exit(amr); 141 | wav_read_close(wav); 142 | 143 | return 0; 144 | } 145 | 146 | -------------------------------------------------------------------------------- /test/amrwb-dec.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include "wavwriter.h" 23 | #include 24 | 25 | /* From pvamrwbdecoder_api.h, by dividing by 8 and rounding up */ 26 | const int sizes[] = { 17, 23, 32, 36, 40, 46, 50, 58, 60, 5, -1, -1, -1, -1, -1, 0 }; 27 | 28 | int main(int argc, char *argv[]) { 29 | FILE* in; 30 | char header[9]; 31 | int n; 32 | void *wav, *amr; 33 | if (argc < 3) { 34 | fprintf(stderr, "%s in.amr out.wav\n", argv[0]); 35 | return 1; 36 | } 37 | 38 | in = fopen(argv[1], "rb"); 39 | if (!in) { 40 | perror(argv[1]); 41 | return 1; 42 | } 43 | n = fread(header, 1, 9, in); 44 | if (n != 9 || memcmp(header, "#!AMR-WB\n", 9)) { 45 | fprintf(stderr, "Bad header\n"); 46 | return 1; 47 | } 48 | 49 | wav = wav_write_open(argv[2], 16000, 16, 1); 50 | if (!wav) { 51 | fprintf(stderr, "Unable to open %s\n", argv[2]); 52 | return 1; 53 | } 54 | amr = D_IF_init(); 55 | while (1) { 56 | uint8_t buffer[500], littleendian[640], *ptr; 57 | int size, i; 58 | int16_t outbuffer[320]; 59 | /* Read the mode byte */ 60 | n = fread(buffer, 1, 1, in); 61 | if (n <= 0) 62 | break; 63 | /* Find the packet size */ 64 | size = sizes[(buffer[0] >> 3) & 0x0f]; 65 | if (size < 0) 66 | break; 67 | n = fread(buffer + 1, 1, size, in); 68 | if (n != size) 69 | break; 70 | 71 | /* Decode the packet */ 72 | D_IF_decode(amr, buffer, outbuffer, 0); 73 | 74 | /* Convert to little endian and write to wav */ 75 | ptr = littleendian; 76 | for (i = 0; i < 320; i++) { 77 | *ptr++ = (outbuffer[i] >> 0) & 0xff; 78 | *ptr++ = (outbuffer[i] >> 8) & 0xff; 79 | } 80 | wav_write_data(wav, littleendian, 640); 81 | } 82 | fclose(in); 83 | D_IF_exit(amr); 84 | wav_write_close(wav); 85 | return 0; 86 | } 87 | 88 | -------------------------------------------------------------------------------- /test/linkboth.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | int main(int argc, char *argv[]) { 27 | #ifndef DISABLE_AMRNB_DECODER 28 | void* amrnb = Decoder_Interface_init(); 29 | Decoder_Interface_exit(amrnb); 30 | #endif 31 | #ifndef DISABLE_AMRNB_ENCODER 32 | void* amrnb_enc = Encoder_Interface_init(0); 33 | Encoder_Interface_exit(amrnb_enc); 34 | #endif 35 | void* amrwb = D_IF_init(); 36 | D_IF_exit(amrwb); 37 | return 0; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /test/wavreader.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef WAVREADER_H 20 | #define WAVREADER_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | void* wav_read_open(const char *filename); 27 | void wav_read_close(void* obj); 28 | 29 | int wav_get_header(void* obj, int* format, int* channels, int* sample_rate, int* bits_per_sample, unsigned int* data_length); 30 | int wav_read_data(void* obj, unsigned char* data, unsigned int length); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /test/wavwriter.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #include "wavwriter.h" 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | struct wav_writer { 26 | FILE *wav; 27 | int data_length; 28 | 29 | int sample_rate; 30 | int bits_per_sample; 31 | int channels; 32 | }; 33 | 34 | static void write_string(struct wav_writer* ww, const char *str) { 35 | fputc(str[0], ww->wav); 36 | fputc(str[1], ww->wav); 37 | fputc(str[2], ww->wav); 38 | fputc(str[3], ww->wav); 39 | } 40 | 41 | static void write_int32(struct wav_writer* ww, int value) { 42 | fputc((value >> 0) & 0xff, ww->wav); 43 | fputc((value >> 8) & 0xff, ww->wav); 44 | fputc((value >> 16) & 0xff, ww->wav); 45 | fputc((value >> 24) & 0xff, ww->wav); 46 | } 47 | 48 | static void write_int16(struct wav_writer* ww, int value) { 49 | fputc((value >> 0) & 0xff, ww->wav); 50 | fputc((value >> 8) & 0xff, ww->wav); 51 | } 52 | 53 | static void write_header(struct wav_writer* ww, int length) { 54 | int bytes_per_frame, bytes_per_sec; 55 | write_string(ww, "RIFF"); 56 | write_int32(ww, 4 + 8 + 16 + 8 + length); 57 | write_string(ww, "WAVE"); 58 | 59 | write_string(ww, "fmt "); 60 | write_int32(ww, 16); 61 | 62 | bytes_per_frame = ww->bits_per_sample/8*ww->channels; 63 | bytes_per_sec = bytes_per_frame*ww->sample_rate; 64 | write_int16(ww, 1); // Format 65 | write_int16(ww, ww->channels); // Channels 66 | write_int32(ww, ww->sample_rate); // Samplerate 67 | write_int32(ww, bytes_per_sec); // Bytes per sec 68 | write_int16(ww, bytes_per_frame); // Bytes per frame 69 | write_int16(ww, ww->bits_per_sample); // Bits per sample 70 | 71 | write_string(ww, "data"); 72 | write_int32(ww, length); 73 | } 74 | 75 | void* wav_write_open(const char *filename, int sample_rate, int bits_per_sample, int channels) { 76 | struct wav_writer* ww = (struct wav_writer*) malloc(sizeof(*ww)); 77 | memset(ww, 0, sizeof(*ww)); 78 | ww->wav = fopen(filename, "wb"); 79 | if (ww->wav == NULL) { 80 | free(ww); 81 | return NULL; 82 | } 83 | ww->data_length = 0; 84 | ww->sample_rate = sample_rate; 85 | ww->bits_per_sample = bits_per_sample; 86 | ww->channels = channels; 87 | 88 | write_header(ww, ww->data_length); 89 | return ww; 90 | } 91 | 92 | void wav_write_close(void* obj) { 93 | struct wav_writer* ww = (struct wav_writer*) obj; 94 | if (ww->wav == NULL) { 95 | free(ww); 96 | return; 97 | } 98 | fseek(ww->wav, 0, SEEK_SET); 99 | write_header(ww, ww->data_length); 100 | fclose(ww->wav); 101 | free(ww); 102 | } 103 | 104 | void wav_write_data(void* obj, const unsigned char* data, int length) { 105 | struct wav_writer* ww = (struct wav_writer*) obj; 106 | if (ww->wav == NULL) 107 | return; 108 | fwrite(data, length, 1, ww->wav); 109 | ww->data_length += length; 110 | } 111 | 112 | -------------------------------------------------------------------------------- /test/wavwriter.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | * Copyright (C) 2009 Martin Storsjo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 | * express or implied. 14 | * See the License for the specific language governing permissions 15 | * and limitations under the License. 16 | * ------------------------------------------------------------------- 17 | */ 18 | 19 | #ifndef WAVWRITER_H 20 | #define WAVWRITER_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | void* wav_write_open(const char *filename, int sample_rate, int bits_per_sample, int channels); 27 | void wav_write_close(void* obj); 28 | 29 | void wav_write_data(void* obj, const unsigned char* data, int length); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | 37 | --------------------------------------------------------------------------------