summaryrefslogtreecommitdiff
path: root/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include
diff options
context:
space:
mode:
Diffstat (limited to 'opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include')
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/abs_s.h101
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/add.h97
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/az_lsp.h105
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h425
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h537
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h499
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basicop_malloc.h107
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitno_tab.h134
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitreorder_tab.h112
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h101
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst.h129
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst_vad.h133
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_c.h118
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_p.h81
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_plsf.h190
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_s.h101
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/dtx_common_def.h96
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame.h114
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame_type_3gpp.h113
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gc_pred.h166
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/get_const_tbls.h72
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gmed_n.h80
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gsm_amr_typedefs.h147
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lpc.h201
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lsf.h105
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/inv_sqrt.h100
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h152
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add_c.h101
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_comp.h101
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_extract.h103
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h166
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h155
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h162
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_negate.h101
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shl.h102
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr.h101
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr_r.h100
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h157
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2.h104
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2_norm.h103
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsfwt.h104
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp.h173
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_az.h103
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_lsf.h111
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_tab.h103
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mac_32.h136
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mode.h82
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h258
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h206
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h171
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult_r.h103
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/n_proc.h31
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h100
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h138
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h140
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/oper_32b.h92
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/p_ol_wgh.h134
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pow2.h104
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pred_lt.h105
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pvgsmamr.h63
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf.h156
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_3_tbl.h123
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_5_tbl.h104
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qgain475_tab.h101
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain.h126
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain_tbl.h102
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reorder.h101
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/residu.h83
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reverse_bits.h100
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/round.h98
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/set_zero.h79
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shl.h102
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr.h99
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr_r.h100
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sqrt_l.h102
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sub.h99
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/syn_filt.h83
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h73
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad.h76
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/weight_a.h81
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/window_tab.h103
-rw-r--r--opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/wmf_to_ets.h108
82 files changed, 10528 insertions, 0 deletions
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/abs_s.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/abs_s.h
new file mode 100644
index 0000000..04e383a
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/abs_s.h
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: abs_s.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the abs_s function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef ABS_S_H
+#define ABS_S_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ Word16 abs_s(Word16 var1);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ABS_S_H */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/add.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/add.h
new file mode 100644
index 0000000..18fdcee
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/add.h
@@ -0,0 +1,97 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: add.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the add function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef ADD_H
+#define ADD_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF Word16 add_16(Word16 var1, Word16 var2, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ADD_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/az_lsp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/az_lsp.h
new file mode 100644
index 0000000..cd2e91f
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/az_lsp.h
@@ -0,0 +1,105 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: az_lsp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the function Az_lsp()
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef AZ_LSP_H
+#define AZ_LSP_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+#define grid_points 60
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 grid[];
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ void Az_lsp(
+ Word16 a[], /* (i) : predictor coefficients (MP1) */
+ Word16 lsp[], /* (o) : line spectral pairs (M) */
+ Word16 old_lsp[], /* (i) : old lsp[] (in case not found 10 roots) (M) */
+ Flag *pOverflow /* (i/o): overflow flag */
+ );
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _AZ_LSP_H */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h
new file mode 100644
index 0000000..d38f953
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h
@@ -0,0 +1,425 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: basic_op.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file includes all the basicop2.c functions' header files.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BASIC_OP_H
+#define BASIC_OP_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+#if defined(PV_ARM_V5)
+#include "basic_op_arm_v5.h"
+
+#elif defined(PV_ARM_GCC_V5)
+#include "basic_op_arm_gcc_v5.h"
+
+#else
+#include "basic_op_c_equivalent.h"
+
+#endif
+
+
+
+#include "add.h"
+#include "div_s.h"
+#include "l_shr_r.h"
+#include "mult_r.h"
+#include "norm_l.h"
+#include "norm_s.h"
+#include "round.h"
+#include "shr_r.h"
+#include "sub.h"
+#include "shr.h"
+#include "l_negate.h"
+#include "l_extract.h"
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: mac_32
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var3 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+ L_var1_hi = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+ L_var1_lo = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+ L_var2_hi = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+ L_var2_lo = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit mac operation resulted in overflow
+
+ Returns:
+ L_var3 = 32-bit result of L_var3 + (L_var1 * L_var2)(Word32)
+
+ */
+ static inline Word32 Mac_32(Word32 L_var3,
+ Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 L_var2_hi,
+ Word16 L_var2_lo,
+ Flag *pOverflow)
+ {
+ Word16 product;
+
+ L_var3 = L_mac(L_var3, L_var1_hi, L_var2_hi, pOverflow);
+
+ product = mult(L_var1_hi, L_var2_lo, pOverflow);
+ L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+ product = mult(L_var1_lo, L_var2_hi, pOverflow);
+ L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+ return (L_var3);
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: mac_32_16
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var3 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+ L_var1_hi = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+ L_var1_lo = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+ var2= 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit mac operation resulted in overflow
+
+ Returns:
+ L_var3 = 32-bit result of L_var3 + (L_var1 * var2)(Word32)
+ */
+
+ static inline Word32 Mac_32_16(Word32 L_var3,
+ Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 var2,
+ Flag *pOverflow)
+ {
+ Word16 product;
+
+ L_var3 = L_mac(L_var3, L_var1_hi, var2, pOverflow);
+
+ product = mult(L_var1_lo, var2, pOverflow);
+ L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+ return (L_var3);
+ }
+
+
+ /*----------------------------------------------------------------------------
+ Function Name : negate
+
+ Negate var1 with saturation, saturate in the case where input is -32768:
+ negate(var1) = sub(0,var1).
+
+ Inputs :
+ var1
+ 16 bit short signed integer (Word16) whose value falls in the
+ range : 0x8000 <= var1 <= 0x7fff.
+
+ Outputs :
+ none
+
+ Return Value :
+ 16 bit short signed integer (Word16) whose value falls in the
+ range : 0x8000 <= var_out <= 0x7fff.
+ ----------------------------------------------------------------------------*/
+
+ static inline Word16 negate(Word16 var1)
+ {
+ return (((var1 == MIN_16) ? MAX_16 : -var1));
+ }
+
+ /*----------------------------------------------------------------------------
+
+ Function Name : shl
+
+ Arithmetically shift the 16 bit input var1 left var2 positions.Zero fill
+ the var2 LSB of the result. If var2 is negative, arithmetically shift
+ var1 right by -var2 with sign extension. Saturate the result in case of
+ underflows or overflows.
+
+ Inputs :
+ var1
+ 16 bit short signed integer (Word16) whose value falls in the
+ range : 0x8000 <= var1 <= 0x7fff.
+
+ var2
+ 16 bit short signed integer (Word16) whose value falls in the
+ range : 0x8000 <= var1 <= 0x7fff.
+
+ pOverflow : pointer to overflow (Flag)
+
+ Return Value :
+ var_out
+ 16 bit short signed integer (Word16) whose value falls in the
+ range : 0x8000 <= var_out <= 0x7fff.
+ ----------------------------------------------------------------------------*/
+
+ static inline Word16 shl(Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ Word16 var_out = 0;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ if (var2 < 0)
+ {
+ var2 = -var2;
+ if (var2 < 15)
+ {
+ var_out = var1 >> var2;
+ }
+
+ }
+ else
+ {
+ var_out = var1 << var2;
+ if (var_out >> var2 != var1)
+ {
+ var_out = (var1 >> 15) ^ MAX_16;
+ }
+ }
+ return (var_out);
+ }
+
+
+ /*----------------------------------------------------------------------------
+
+ Function Name : L_shl
+
+ Arithmetically shift the 32 bit input L_var1 left var2 positions. Zero
+ fill the var2 LSB of the result. If var2 is negative, arithmetically
+ shift L_var1 right by -var2 with sign extension. Saturate the result in
+ case of underflows or overflows.
+
+ Inputs :
+ L_var1 32 bit long signed integer (Word32) whose value falls in the
+ range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ var2
+ 16 bit short signed integer (Word16) whose value falls in the
+ range : 8000 <= var2 <= 7fff.
+
+ pOverflow : pointer to overflow (Flag)
+
+ Return Value :
+ 32 bit long signed integer (Word32) whose value falls in the
+ range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+ ----------------------------------------------------------------------------*/
+
+ static inline Word32 L_shl(Word32 L_var1, Word16 var2, Flag *pOverflow)
+ {
+ Word32 L_var_out = 0;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ if (var2 > 0)
+ {
+ L_var_out = L_var1 << var2;
+ if (L_var_out >> var2 != L_var1)
+ {
+ L_var_out = (L_var1 >> 31) ^ MAX_32;
+ }
+ }
+ else
+ {
+ var2 = -var2;
+ if (var2 < 31)
+ {
+ L_var_out = L_var1 >> var2;
+ }
+
+ }
+
+ return (L_var_out);
+ }
+
+
+ /*----------------------------------------------------------------------------
+
+ Function Name : L_shr
+
+ Arithmetically shift the 32 bit input L_var1 right var2 positions with
+ sign extension. If var2 is negative, arithmetically shift L_var1 left
+ by -var2 and zero fill the -var2 LSB of the result. Saturate the result
+ in case of underflows or overflows.
+
+ Inputs :
+ L_var1 32 bit long signed integer (Word32) whose value falls in the
+ range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ var2
+ 16 bit short signed integer (Word16) whose value falls in the
+ range : 8000 <= var2 <= 7fff.
+
+ pOverflow : pointer to overflow (Flag)
+
+ Return Value :
+ 32 bit long signed integer (Word32) whose value falls in the
+ range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
+
+ ----------------------------------------------------------------------------*/
+
+ static inline Word32 L_shr(Word32 L_var1, Word16 var2, Flag *pOverflow)
+ {
+ Word32 L_var_out = 0;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ if (var2 > 0)
+ {
+ if (var2 < 31)
+ {
+ L_var_out = L_var1 >> var2;
+ }
+ }
+ else
+ {
+ var2 = -var2;
+
+ L_var_out = L_var1 << (var2) ;
+ if ((L_var_out >> (var2)) != L_var1)
+ {
+ L_var_out = (L_var1 >> 31) ^ MAX_32;
+ }
+
+ }
+
+ return (L_var_out);
+ }
+
+ /*----------------------------------------------------------------------------
+
+ Function Name : abs_s
+
+ Absolute value of var1; abs_s(-32768) = 32767.
+
+ Inputs :
+ var1
+ 16 bit short signed integer (Word16) whose value falls in the
+ range : 0x8000 <= var1 <= 0x7fff.
+
+ pOverflow : pointer to overflow (Flag)
+
+ Outputs :
+ none
+
+ Return Value :
+ 16 bit short signed integer (Word16) whose value falls in the
+ range : 0x0000 <= var_out <= 0x7fff.
+
+ ----------------------------------------------------------------------------*/
+
+ static inline Word16 abs_s(Word16 var1)
+ {
+
+ Word16 y = var1 - (var1 < 0);
+ y = y ^(y >> 15);
+ return (y);
+
+ }
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* BASIC_OP_H */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h
new file mode 100644
index 0000000..1abc4fa
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h
@@ -0,0 +1,537 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: basic_op_arm_gcc_v5.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file includes all the GCC-ARM V5 basicop.c functions.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BASIC_OP_ARM_GCC_V5_H
+#define BASIC_OP_ARM_GCC_V5_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: L_add
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var1 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ L_var2 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+ Returns:
+ L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
+ */
+
+ __inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
+ {
+ register Word32 ra = L_var1;
+ register Word32 rb = L_var2;
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("qadd %0, %1, %2"
+ : "=r"(result)
+ : "r"(ra), "r"(rb)
+ );
+ return (result);
+
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: L_sub
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var1 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ L_var2 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+ Returns:
+ L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
+ */
+ __inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
+{
+ register Word32 ra = L_var1;
+ register Word32 rb = L_var2;
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("qsub %0, %1, %2"
+ : "=r"(result)
+ : "r"(ra), "r"(rb)
+ );
+
+ return (result);
+ }
+
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: L_mac
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var3 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+ var1 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+ var2 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+ Returns:
+ result = 32-bit result of L_var3 + (var1 * var2)(Word32)
+ */
+ static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+{
+ register Word32 ra = L_var3;
+ register Word32 rb = var1;
+ register Word32 rc = var2;
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(result)
+ : "r"(rb), "r"(rc)
+ );
+
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(rc)
+ : "r"(ra), "r"(result)
+ );
+
+ return (rc);
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: L_mult
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var1 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+ L_var2 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+ Returns:
+ L_product = 32-bit product of L_var1 and L_var2 (Word32)
+ */
+
+ __inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
+{
+ register Word32 ra = var1;
+ register Word32 rb = var2;
+ Word32 result;
+ Word32 product;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(product)
+ : "r"(ra), "r"(rb)
+ );
+
+ asm volatile("qadd %0, %1, %2"
+ : "=r"(result)
+ : "r"(product), "r"(product)
+ );
+
+ return(result);
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: L_msu
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var3 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+
+ var1 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+ var2 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit operation resulted in overflow
+
+ Returns:
+ result = 32-bit result of L_var3 - (var1 * var2)
+ */
+ __inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+{
+ register Word32 ra = L_var3;
+ register Word32 rb = var1;
+ register Word32 rc = var2;
+ Word32 product;
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(product)
+ : "r"(rb), "r"(rc)
+ );
+
+ asm volatile("qdsub %0, %1, %2"
+ : "=r"(result)
+ : "r"(ra), "r"(product)
+ );
+
+ return (result);
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: Mpy_32
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var1_hi = most significant word of first input (Word16).
+ L_var1_lo = least significant word of first input (Word16).
+ L_var2_hi = most significant word of second input (Word16).
+ L_var2_lo = least significant word of second input (Word16).
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit multiply operation resulted in overflow
+
+ Returns:
+ L_product = 32-bit product of L_var1 and L_var2 (Word32)
+ */
+ static inline Word32 Mpy_32(Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 L_var2_hi,
+ Word16 L_var2_lo,
+ Flag *pOverflow)
+{
+ register Word32 product32;
+ register Word32 L_sum;
+ register Word32 L_product, result;
+ register Word32 ra = L_var1_hi;
+ register Word32 rb = L_var1_lo;
+ register Word32 rc = L_var2_hi;
+ register Word32 rd = L_var2_lo;
+
+
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(L_product)
+ : "r"(ra), "r"(rc)
+ );
+ asm volatile("mov %0, #0"
+ : "=r"(result)
+ );
+
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(L_sum)
+ : "r"(result), "r"(L_product)
+ );
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(product32)
+ : "r"(ra), "r"(rd)
+ );
+
+ asm volatile("mov %0, %1, ASR #15"
+ : "=r"(ra)
+ : "r"(product32)
+ );
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(L_product)
+ : "r"(L_sum), "r"(ra)
+ );
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(product32)
+ : "r"(rb), "r"(rc)
+ );
+
+ asm volatile("mov %0, %1, ASR #15"
+ : "=r"(rb)
+ : "r"(product32)
+ );
+
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(L_sum)
+ : "r"(L_product), "r"(rb)
+ );
+
+ return (L_sum);
+ }
+
+
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: Mpy_32_16
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var1_hi = most significant 16 bits of 32-bit input (Word16).
+ L_var1_lo = least significant 16 bits of 32-bit input (Word16).
+ var2 = 16-bit signed integer (Word16).
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit product operation resulted in overflow
+
+ Returns:
+ product = 32-bit product of the 32-bit L_var1 and 16-bit var1 (Word32)
+ */
+ static inline Word32 Mpy_32_16(Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 var2,
+ Flag *pOverflow)
+{
+
+ register Word32 ra = L_var1_hi;
+ register Word32 rb = L_var1_lo;
+ register Word32 rc = var2;
+ Word32 result, L_product;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(L_product)
+ : "r"(ra), "r"(rc)
+ );
+ asm volatile("mov %0, #0"
+ : "=r"(result)
+ );
+
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(L_product)
+ : "r"(result), "r"(L_product)
+ );
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(result)
+ : "r"(rb), "r"(rc)
+ );
+
+ asm volatile("mov %0, %1, ASR #15"
+ : "=r"(ra)
+ : "r"(result)
+ );
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(result)
+ : "r"(L_product), "r"(ra)
+ );
+
+ return (result);
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: mult
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ var1 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+ var2 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the add operation resulted in overflow
+
+ Returns:
+ product = 16-bit limited product of var1 and var2 (Word16)
+ */
+ __inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
+{
+ register Word32 ra = var1;
+ register Word32 rb = var2;
+ Word32 product;
+ Word32 temp;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile(
+ "smulbb %0, %1, %2"
+ : "=r"(temp)
+ : "r"(ra), "r"(rb)
+ );
+ asm volatile(
+ "qadd %0, %1, %2\n\t"
+ "mov %0, %0, asr #16"
+ : "=&r*i"(product)
+ : "r"(temp), "r"(temp)
+ );
+
+ return ((Word16) product);
+ }
+
+ __inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
+{
+ register Word32 ra = L_var1;
+ register Word32 rb = L_var2;
+ register Word32 rc = L_var3;
+ Word32 result;
+
+ asm volatile("smlabb %0, %1, %2, %3"
+ : "=r"(result)
+ : "r"(ra), "r"(rb), "r"(rc)
+ );
+ return (result);
+ }
+
+ __inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
+{
+ register Word32 ra = L_var1;
+ register Word32 rb = L_var2;
+ register Word32 rc = L_var3;
+ Word32 result;
+
+ asm volatile("rsb %0, %1, #0"
+ : "=r"(ra)
+ : "r"(ra)
+ );
+
+ asm volatile("smlabb %0, %1, %2, %3"
+ : "=r"(result)
+ : "r"(ra), "r"(rb), "r"(rc)
+ );
+ return (result);
+ }
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BASIC_OP_ARM_GCC_V5_H */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h
new file mode 100644
index 0000000..eb91049
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h
@@ -0,0 +1,499 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: basic_op_c_equivalent.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file includes all the C-Equivalent basicop.c functions.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BASIC_OP_C_EQUIVALENT_H
+#define BASIC_OP_C_EQUIVALENT_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: L_add
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var1 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ L_var2 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+ Returns:
+ L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
+ */
+ static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
+ {
+ Word32 L_sum;
+
+ L_sum = L_var1 + L_var2;
+
+ if ((L_var1 ^ L_var2) >= 0)
+ {
+ if ((L_sum ^ L_var1) < 0)
+ {
+ L_sum = (L_var1 < 0) ? MIN_32 : MAX_32;
+ *pOverflow = 1;
+ }
+ }
+
+ return (L_sum);
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: L_sub
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var1 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ L_var2 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+ Returns:
+ L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
+ */
+ static inline Word32 L_sub(register Word32 L_var1, register Word32 L_var2,
+ register Flag *pOverflow)
+ {
+ Word32 L_diff;
+
+ L_diff = L_var1 - L_var2;
+
+ if ((L_var1 ^ L_var2) < 0)
+ {
+ if ((L_diff ^ L_var1) & MIN_32)
+ {
+ L_diff = (L_var1 < 0L) ? MIN_32 : MAX_32;
+ *pOverflow = 1;
+ }
+ }
+
+ return (L_diff);
+ }
+
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: L_mac
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var3 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+ var1 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+ var2 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+ Returns:
+ result = 32-bit result of L_var3 + (var1 * var2)(Word32)
+ */
+ static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ Word32 result;
+ Word32 L_sum;
+ result = (Word32) var1 * var2;
+ if (result != (Word32) 0x40000000L)
+ {
+ L_sum = (result << 1) + L_var3;
+
+ /* Check if L_sum and L_var_3 share the same sign */
+ if ((L_var3 ^ result) > 0)
+ {
+ if ((L_sum ^ L_var3) < 0)
+ {
+ L_sum = (L_var3 < 0) ? MIN_32 : MAX_32;
+ *pOverflow = 1;
+ }
+ }
+ }
+ else
+ {
+ *pOverflow = 1;
+ L_sum = MAX_32;
+ }
+ return (L_sum);
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: L_mult
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var1 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+ L_var2 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit add operation resulted in overflow
+
+ Returns:
+ L_product = 32-bit product of L_var1 and L_var2 (Word32)
+ */
+ static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ register Word32 L_product;
+
+ L_product = (Word32) var1 * var2;
+
+ if (L_product != (Word32) 0x40000000L)
+ {
+ L_product <<= 1; /* Multiply by 2 */
+ }
+ else
+ {
+ *pOverflow = 1;
+ L_product = MAX_32;
+ }
+
+ return (L_product);
+ }
+
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: L_msu
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var3 = 32 bit long signed integer (Word32) whose value falls
+ in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
+
+ var1 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+ var2 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit operation resulted in overflow
+
+ Returns:
+ result = 32-bit result of L_var3 - (var1 * var2)
+ */
+
+ static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ Word32 result;
+
+ result = L_mult(var1, var2, pOverflow);
+ result = L_sub(L_var3, result, pOverflow);
+
+ return (result);
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: Mpy_32
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var1_hi = most significant word of first input (Word16).
+ L_var1_lo = least significant word of first input (Word16).
+ L_var2_hi = most significant word of second input (Word16).
+ L_var2_lo = least significant word of second input (Word16).
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit multiply operation resulted in overflow
+
+ Returns:
+ L_product = 32-bit product of L_var1 and L_var2 (Word32)
+ */
+ static inline Word32 Mpy_32(Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 L_var2_hi,
+ Word16 L_var2_lo,
+ Flag *pOverflow)
+ {
+ Word32 L_product;
+ Word32 L_sum;
+ Word32 product32;
+
+ OSCL_UNUSED_ARG(pOverflow);
+ L_product = (Word32) L_var1_hi * L_var2_hi;
+
+ if (L_product != (Word32) 0x40000000L)
+ {
+ L_product <<= 1;
+ }
+ else
+ {
+ L_product = MAX_32;
+ }
+
+ /* result = mult (L_var1_hi, L_var2_lo, pOverflow); */
+ product32 = ((Word32) L_var1_hi * L_var2_lo) >> 15;
+
+ /* L_product = L_mac (L_product, result, 1, pOverflow); */
+ L_sum = L_product + (product32 << 1);
+
+ if ((L_product ^ product32) > 0)
+ {
+ if ((L_sum ^ L_product) < 0)
+ {
+ L_sum = (L_product < 0) ? MIN_32 : MAX_32;
+ }
+ }
+
+ L_product = L_sum;
+
+ /* result = mult (L_var1_lo, L_var2_hi, pOverflow); */
+ product32 = ((Word32) L_var1_lo * L_var2_hi) >> 15;
+
+ /* L_product = L_mac (L_product, result, 1, pOverflow); */
+ L_sum = L_product + (product32 << 1);
+
+ if ((L_product ^ product32) > 0)
+ {
+ if ((L_sum ^ L_product) < 0)
+ {
+ L_sum = (L_product < 0) ? MIN_32 : MAX_32;
+ }
+ }
+ return (L_sum);
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: Mpy_32_16
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ L_var1_hi = most significant 16 bits of 32-bit input (Word16).
+ L_var1_lo = least significant 16 bits of 32-bit input (Word16).
+ var2 = 16-bit signed integer (Word16).
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the 32 bit product operation resulted in overflow
+
+ Returns:
+ product = 32-bit product of the 32-bit L_var1 and 16-bit var1 (Word32)
+ */
+
+ static inline Word32 Mpy_32_16(Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 var2,
+ Flag *pOverflow)
+ {
+
+ Word32 L_product;
+ Word32 L_sum;
+ Word32 result;
+ L_product = (Word32) L_var1_hi * var2;
+
+ if (L_product != (Word32) 0x40000000L)
+ {
+ L_product <<= 1;
+ }
+ else
+ {
+ *pOverflow = 1;
+ L_product = MAX_32;
+ }
+
+ result = ((Word32)L_var1_lo * var2) >> 15;
+
+ L_sum = L_product + (result << 1);
+
+ if ((L_product ^ result) > 0)
+ {
+ if ((L_sum ^ L_product) < 0)
+ {
+ L_sum = (L_product < 0) ? MIN_32 : MAX_32;
+ *pOverflow = 1;
+ }
+ }
+ return (L_sum);
+
+ }
+
+ /*
+ ------------------------------------------------------------------------------
+ FUNCTION NAME: mult
+ ------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+ var1 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+
+ var2 = 16 bit short signed integer (Word16) whose value falls in
+ the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
+
+ pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+ pOverflow -> 1 if the add operation resulted in overflow
+
+ Returns:
+ product = 16-bit limited product of var1 and var2 (Word16)
+ */
+ static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ register Word32 product;
+
+ product = ((Word32) var1 * var2) >> 15;
+
+ /* Saturate result (if necessary). */
+ /* var1 * var2 >0x00007fff is the only case */
+ /* that saturation occurs. */
+
+ if (product > 0x00007fffL)
+ {
+ *pOverflow = 1;
+ product = (Word32) MAX_16;
+ }
+
+
+ /* Return the product as a 16 bit value by type casting Word32 to Word16 */
+
+ return ((Word16) product);
+ }
+
+
+ static inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
+ {
+ Word32 result;
+
+ result = L_var3 + L_var1 * L_var2;
+
+ return result;
+ }
+
+ static inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
+ {
+ Word32 result;
+
+ result = L_var3 - L_var1 * L_var2;
+
+ return result;
+ }
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BASIC_OP_C_EQUIVALENT_H */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basicop_malloc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basicop_malloc.h
new file mode 100644
index 0000000..4d94c4c
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basicop_malloc.h
@@ -0,0 +1,107 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: basicop_malloc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains constant definitions and external references to the stores
+ used by any arithmetic function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BASICOP_MALLOC_H
+#define BASICOP_MALLOC_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+#define MAX_32 (Word32)0x7fffffffL
+#define MIN_32 (Word32)0x80000000L
+
+#define MAX_16 (Word16)0x7fff
+#define MIN_16 (Word16)0x8000
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern Flag Overflow;
+ extern Flag Carry;
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitno_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitno_tab.h
new file mode 100644
index 0000000..b071c71
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitno_tab.h
@@ -0,0 +1,134 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: bitno_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a tables in bitno_tab.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BITNO_TAB_H
+#define BITNO_TAB_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+#define BIT_0 0
+#define BIT_1 1
+
+#define PRMNO_MR475 17
+#define PRMNO_MR515 19
+#define PRMNO_MR59 19
+#define PRMNO_MR67 19
+#define PRMNO_MR74 19
+#define PRMNO_MR795 23
+#define PRMNO_MR102 39
+#define PRMNO_MR122 57
+#define PRMNO_MRDTX 5
+
+ /* number of parameters to first subframe */
+#define PRMNOFSF_MR475 7
+#define PRMNOFSF_MR515 7
+#define PRMNOFSF_MR59 7
+#define PRMNOFSF_MR67 7
+#define PRMNOFSF_MR74 7
+#define PRMNOFSF_MR795 8
+#define PRMNOFSF_MR102 12
+#define PRMNOFSF_MR122 18
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 prmno[];
+ extern const Word16 prmnofsf[];
+ extern const Word16 bitno_MR475[];
+ extern const Word16 bitno_MR515[];
+ extern const Word16 bitno_MR59[];
+ extern const Word16 bitno_MR67[];
+ extern const Word16 bitno_MR74[];
+ extern const Word16 bitno_MR95[];
+ extern const Word16 bitno_MR102[];
+ extern const Word16 bitno_MR122[];
+ extern const Word16 bitno_MRDTX[];
+ extern const Word16 *const bitno[];
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitreorder_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitreorder_tab.h
new file mode 100644
index 0000000..48d8e08
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bitreorder_tab.h
@@ -0,0 +1,112 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: bitreorder_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a tables in bitreorder.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BITREORDER_H
+#define BITREORDER_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 numOfBits[];
+ extern const Word16 reorderBits_MR475[];
+ extern const Word16 reorderBits_MR515[];
+ extern const Word16 reorderBits_MR59[];
+ extern const Word16 reorderBits_MR67[];
+ extern const Word16 reorderBits_MR74[];
+ extern const Word16 reorderBits_MR795[];
+ extern const Word16 reorderBits_MR102[];
+ extern const Word16 reorderBits_MR122[];
+
+ extern const Word16 *const reorderBits[];
+ extern const Word16 numCompressedBytes[];
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h
new file mode 100644
index 0000000..f97beae
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: bytesused.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a table BytesUsed.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef BYTESUSED_H
+#define BYTESUSED_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const short BytesUsed[];
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst.h
new file mode 100644
index 0000000..b648eb7
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst.h
@@ -0,0 +1,129 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ INCLUDE DESCRIPTION
+
+ This file contains the Speech code (encoder, decoder, and postfilter)
+ constant parameters.
+
+ NOTE: This file must be synchronized with /gsm-amr/asm/include/cnst.inc file.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef _CNST_H_
+#define _CNST_H_
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+#define L_TOTAL 320 /* Total size of speech buffer. */
+#define L_WINDOW 240 /* Window size in LP analysis */
+#define L_FRAME 160 /* Frame size */
+#define L_FRAME_BY2 80 /* Frame size divided by 2 */
+#define L_SUBFR 40 /* Subframe size */
+#define L_CODE 40 /* codevector length */
+#define NB_TRACK 5 /* number of tracks */
+#define STEP 5 /* codebook step size */
+#define NB_TRACK_MR102 4 /* number of tracks mode mr102 */
+#define STEP_MR102 4 /* codebook step size mode mr102 */
+#define M 10 /* Order of LP filter */
+#define MP1 (M+1) /* Order of LP filter + 1 */
+#define LSF_GAP 205 /* Minimum distance between LSF after quan- */
+ /* tization; 50 Hz = 205 */
+#define LSP_PRED_FAC_MR122 21299 /* MR122 LSP prediction factor (0.65 Q15) */
+#define AZ_SIZE (4*M+4) /* Size of array of LP filters in 4 subfr.s */
+#define PIT_MIN_MR122 18 /* Minimum pitch lag (MR122 mode) */
+#define PIT_MIN 20 /* Minimum pitch lag (all other modes) */
+#define PIT_MAX 143 /* Maximum pitch lag */
+#define L_INTERPOL (10+1) /* Length of filter for interpolation */
+#define L_INTER_SRCH 4 /* Length of filter for CL LTP search */
+ /* interpolation */
+
+#define MU 26214 /* Factor for tilt compensation filter 0.8 */
+#define AGC_FAC 29491 /* Factor for automatic gain control 0.9 */
+
+#define L_NEXT 40 /* Overhead in LP analysis */
+#define SHARPMAX 13017 /* Maximum value of pitch sharpening */
+#define SHARPMIN 0 /* Minimum value of pitch sharpening */
+
+
+#define MAX_PRM_SIZE 57 /* max. num. of params */
+#define MAX_SERIAL_SIZE 244 /* max. num. of serial bits */
+
+#define GP_CLIP 15565 /* Pitch gain clipping = 0.95 */
+#define N_FRAME 7 /* old pitch gains in average calculation */
+
+#define EHF_MASK 0x0008 /* encoder homing frame pattern */
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CNST_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst_vad.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst_vad.h
new file mode 100644
index 0000000..6877a1b
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/cnst_vad.h
@@ -0,0 +1,133 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+**-------------------------------------------------------------------------**
+** **
+** GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 **
+** R99 Version 3.2.0 **
+** REL-4 Version 4.0.0 **
+** **
+**-------------------------------------------------------------------------**
+********************************************************************************
+*
+* File : cnst_vad.h
+* Purpose : Constants and definitions for VAD
+*
+********************************************************************************
+*/
+#ifndef cnst_vad_h
+#define cnst_vad_h "$Id $"
+
+#define FRAME_LEN 160 /* Length (samples) of the input frame */
+#define COMPLEN 9 /* Number of sub-bands used by VAD */
+#define INV_COMPLEN 3641 /* 1.0/COMPLEN*2^15 */
+#define LOOKAHEAD 40 /* length of the lookahead used by speech coder */
+
+#define UNITY 512 /* Scaling used with SNR calculation */
+#define UNIRSHFT 6 /* = log2(MAX_16/UNITY) */
+
+#define TONE_THR (Word16)(0.65*MAX_16) /* Threshold for tone detection */
+
+/* Constants for background spectrum update */
+#define ALPHA_UP1 (Word16)((1.0 - 0.95)*MAX_16) /* Normal update, upwards: */
+#define ALPHA_DOWN1 (Word16)((1.0 - 0.936)*MAX_16) /* Normal update, downwards */
+#define ALPHA_UP2 (Word16)((1.0 - 0.985)*MAX_16) /* Forced update, upwards */
+#define ALPHA_DOWN2 (Word16)((1.0 - 0.943)*MAX_16) /* Forced update, downwards */
+#define ALPHA3 (Word16)((1.0 - 0.95)*MAX_16) /* Update downwards */
+#define ALPHA4 (Word16)((1.0 - 0.9)*MAX_16) /* For stationary estimation */
+#define ALPHA5 (Word16)((1.0 - 0.5)*MAX_16) /* For stationary estimation */
+
+/* Constants for VAD threshold */
+#define VAD_THR_HIGH 1260 /* Highest threshold */
+#define VAD_THR_LOW 720 /* Lowest threshold */
+#define VAD_P1 0 /* Noise level for highest threshold */
+#define VAD_P2 6300 /* Noise level for lowest threshold */
+#define VAD_SLOPE (Word16)(MAX_16*(float)(VAD_THR_LOW-VAD_THR_HIGH)/(float)(VAD_P2-VAD_P1))
+
+/* Parameters for background spectrum recovery function */
+#define STAT_COUNT 20 /* threshold of stationary detection counter */
+#define STAT_COUNT_BY_2 10 /* threshold of stationary detection counter */
+#define CAD_MIN_STAT_COUNT 5 /* threshold of stationary detection counter */
+
+#define STAT_THR_LEVEL 184 /* Threshold level for stationarity detection */
+#define STAT_THR 1000 /* Threshold for stationarity detection */
+
+/* Limits for background noise estimate */
+#define NOISE_MIN 40 /* minimum */
+#define NOISE_MAX 16000 /* maximum */
+#define NOISE_INIT 150 /* initial */
+
+/* Constants for VAD hangover addition */
+#define HANG_NOISE_THR 100
+#define BURST_LEN_HIGH_NOISE 4
+#define HANG_LEN_HIGH_NOISE 7
+#define BURST_LEN_LOW_NOISE 5
+#define HANG_LEN_LOW_NOISE 4
+
+/* Thresholds for signal power */
+#define VAD_POW_LOW (Word32)15000 /* If input power is lower, */
+/* VAD is set to 0 */
+#define POW_PITCH_THR (Word32)343040 /* If input power is lower, pitch */
+/* detection is ignored */
+
+#define POW_COMPLEX_THR (Word32)15000 /* If input power is lower, complex */
+/* flags value for previous frame is un-set */
+
+
+/* Constants for the filter bank */
+#define LEVEL_SHIFT 0 /* scaling */
+#define COEFF3 13363 /* coefficient for the 3rd order filter */
+#define COEFF5_1 21955 /* 1st coefficient the for 5th order filter */
+#define COEFF5_2 6390 /* 2nd coefficient the for 5th order filter */
+
+/* Constants for pitch detection */
+#define LTHRESH 4
+#define NTHRESH 4
+
+/* Constants for complex signal VAD */
+#define CVAD_THRESH_ADAPT_HIGH (Word16)(0.6 * MAX_16) /* threshold for adapt stopping high */
+#define CVAD_THRESH_ADAPT_LOW (Word16)(0.5 * MAX_16) /* threshold for adapt stopping low */
+#define CVAD_THRESH_IN_NOISE (Word16)(0.65 * MAX_16) /* threshold going into speech on */
+/* a short term basis */
+
+#define CVAD_THRESH_HANG (Word16)(0.70 * MAX_16) /* threshold */
+#define CVAD_HANG_LIMIT (Word16)(100) /* 2 second estimation time */
+#define CVAD_HANG_LENGTH (Word16)(250) /* 5 second hangover */
+
+#define CVAD_LOWPOW_RESET (Word16) (0.40 * MAX_16) /* init in low power segment */
+#define CVAD_MIN_CORR (Word16) (0.40 * MAX_16) /* lowest adaptation value */
+
+#define CVAD_BURST 20 /* speech burst length for speech reset */
+#define CVAD_ADAPT_SLOW (Word16)(( 1.0 - 0.98) * MAX_16) /* threshold for slow adaption */
+#define CVAD_ADAPT_FAST (Word16)((1.0 - 0.92) * MAX_16) /* threshold for fast adaption */
+#define CVAD_ADAPT_REALLY_FAST (Word16)((1.0 - 0.80) * MAX_16) /* threshold for really fast */
+/* adaption */
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_c.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_c.h
new file mode 100644
index 0000000..99c2540
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_c.h
@@ -0,0 +1,118 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: d_gain_c.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ File : d_gain_c.h
+ Purpose : Decode the fixed codebook gain using the received index.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _D_GAIN_C_H_
+#define _D_GAIN_C_H_
+#define d_gain_c_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "gc_pred.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; [Define module specific macros here]
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; [Include all pre-processor statements here.]
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; [Declare variables used in this module but defined elsewhere]
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; [List function prototypes here]
+ ----------------------------------------------------------------------------*/
+ /*
+ * Function : d_gain_code
+ * Purpose : Decode the fixed codebook gain using the received index.
+ * Description : The received index gives the gain correction factor
+ * gamma. The quantized gain is given by g_q = g0 * gamma
+ * where g0 is the predicted gain. To find g0, 4th order
+ * MA prediction is applied to the mean-removed innovation
+ * energy in dB.
+ * Returns : void
+ */
+ void d_gain_code(
+ gc_predState *pred_state, /* i/o : MA predictor state */
+ enum Mode mode, /* i : AMR mode */
+ Word16 index, /* i : received quantization index */
+ Word16 code[], /* i : innovation codevector */
+ const Word16* qua_gain_code_ptr, /* i : Pointer to read-only table */
+ Word16 *gain_code, /* o : decoded innovation gain */
+ Flag *pOverflow
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _D_GAIN_C_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_p.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_p.h
new file mode 100644
index 0000000..04babd9
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_gain_p.h
@@ -0,0 +1,81 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
+* R99 Version 3.2.0
+* REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+* File : d_gain_p.h
+* Purpose : Decodes the pitch gain using the received index.
+*
+********************************************************************************
+*/
+#ifndef d_gain_p_h
+#define d_gain_p_h "$Id $"
+
+/*
+********************************************************************************
+* INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+#include "mode.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*
+ **************************************************************************
+ *
+ * Function : d_gain_pitch
+ * Purpose : Decodes the pitch gain using the received index.
+ * Description : In case of no frame erasure, the gain is obtained
+ * from the quantization table at the given index;
+ * otherwise, a downscaled past gain is used.
+ * Returns : Quantized pitch gain
+ *
+ **************************************************************************
+ */
+ Word16 d_gain_pitch( /* return value: gain (Q14) */
+ enum Mode mode, /* i : AMR mode */
+ Word16 index, /* i : index of quantization */
+ const Word16* qua_gain_pitch_ptr /* i : pointer to read-only tables */
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_plsf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_plsf.h
new file mode 100644
index 0000000..dbefcba
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/d_plsf.h
@@ -0,0 +1,190 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: d_plsf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the d_plsf_3.c and d_plsf_5.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef d_plsf_h
+#define d_plsf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "mode.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+ typedef struct
+ {
+ Word16 past_r_q[M]; /* Past quantized prediction error, Q15 */
+ Word16 past_lsf_q[M]; /* Past dequantized lsfs, Q15 */
+ } D_plsfState;
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+ /*
+ **************************************************************************
+ *
+ * Function : D_plsf_reset
+ * Purpose : Resets state memory
+ * Returns : 0 on success
+ *
+ **************************************************************************
+ */
+ Word16 D_plsf_reset(D_plsfState *st, const Word16* mean_lsf_5_ptr);
+
+ /*
+ **************************************************************************
+ *
+ * Function : D_plsf_exit
+ * Purpose : The memory used for state memory is freed
+ * Description : Stores NULL in *st
+ * Returns : void
+ *
+ **************************************************************************
+ */
+ void D_plsf_exit(D_plsfState **st);
+
+ /*
+ **************************************************************************
+ *
+ * Function : D_plsf_5
+ * Purpose : Decodes the 2 sets of LSP parameters in a frame
+ * using the received quantization indices.
+ * Description : The two sets of LSFs are quantized using split by
+ * 5 matrix quantization (split-MQ) with 1st order MA
+ * prediction.
+ * See "q_plsf_5.c" for more details about the
+ * quantization procedure
+ * Returns : 0
+ *
+ **************************************************************************
+ */
+ void D_plsf_5(
+ D_plsfState *st, /* i/o: State variables */
+ Word16 bfi, /* i : bad frame indicator (set to 1 if a bad
+ frame is received) */
+ Word16 *indice, /* i : quantization indices of 5 submatrices, Q0 */
+ CommonAmrTbls* common_amr_tbls, /* i : structure containing ptrs to read-only tables */
+ Word16 *lsp1_q, /* o : quantized 1st LSP vector (M) Q15 */
+ Word16 *lsp2_q, /* o : quantized 2nd LSP vector (M) Q15 */
+ Flag *pOverflow /* o : Flag set when overflow occurs */
+ );
+
+ /*************************************************************************
+ *
+ * FUNCTION: D_plsf_3()
+ *
+ * PURPOSE: Decodes the LSP parameters using the received quantization
+ * indices.1st order MA prediction and split by 3 matrix
+ * quantization (split-MQ)
+ *
+ *************************************************************************/
+
+ void D_plsf_3(
+ D_plsfState *st, /* i/o: State struct */
+ enum Mode mode, /* i : coder mode */
+ Word16 bfi, /* i : bad frame indicator (set to 1 if a */
+ /* bad frame is received) */
+ Word16 * indice, /* i : quantization indices of 3 submatrices, Q0 */
+ CommonAmrTbls* common_amr_tbls, /* i : structure containing ptrs to read-only tables */
+ Word16 * lsp1_q, /* o : quantized 1st LSP vector, Q15 */
+ Flag *pOverflow /* o : Flag set when overflow occurs */
+ );
+
+ /*************************************************************************
+ *
+ * FUNCTION: Init_D_plsf_3()
+ *
+ * PURPOSE: Set the past_r_q[M] vector to one of the eight
+ * past_rq_init vectors.
+ *
+ *************************************************************************/
+ void Init_D_plsf_3(D_plsfState *st, /* i/o: State struct */
+ Word16 index, /* i : past_rq_init[] index [0, 7] */
+ const Word16* past_rq_init_ptr /* ptr to read-only table */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Q_PLSF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_s.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_s.h
new file mode 100644
index 0000000..98aa0f9
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_s.h
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: div_s.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the div_s function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef DIV_S_H
+#define DIV_S_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF Word16 div_s(Word16 var1, Word16 var2);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/dtx_common_def.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/dtx_common_def.h
new file mode 100644
index 0000000..0daa965
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/dtx_common_def.h
@@ -0,0 +1,96 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: dtx_common_def.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ File : dtx_common_def.h
+ Purpose : DTX definitions common to encoder and decoder
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef DTX_COMMON_DEF_H
+#define DTX_COMMON_DEF_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+#define DTX_MAX_EMPTY_THRESH 50
+#define DTX_HIST_SIZE 8
+#define DTX_ELAPSED_FRAMES_THRESH (24 + 7 -1)
+#define DTX_HANG_CONST 7 /* yields eight frames of SP HANGOVER */
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DTX_COMMON_DEF_H */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame.h
new file mode 100644
index 0000000..1d0c6c1
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame.h
@@ -0,0 +1,114 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+*****************************************************************************
+*
+* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
+* R99 Version 3.2.0
+* REL-4 Version 4.0.0
+*
+*****************************************************************************
+*
+* File : frame.h
+* Purpose : Declaration of received and transmitted frame types
+*
+*****************************************************************************
+*/
+#ifndef frame_h
+#define frame_h "$Id $"
+
+/*
+*****************************************************************************
+* INCLUDE FILES
+*****************************************************************************
+*/
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*
+ *****************************************************************************
+ * DEFINITION OF DATA TYPES
+ *****************************************************************************
+ * Note: The order of the TX and RX_Type identifiers has been chosen in
+ * the way below to be compatible to an earlier version of the
+ * AMR-NB C reference program.
+ *****************************************************************************
+ */
+
+ enum RXFrameType { RX_SPEECH_GOOD = 0,
+ RX_SPEECH_DEGRADED,
+ RX_ONSET,
+ RX_SPEECH_BAD,
+ RX_SID_FIRST,
+ RX_SID_UPDATE,
+ RX_SID_BAD,
+ RX_NO_DATA,
+ RX_N_FRAMETYPES /* number of frame types */
+ };
+
+ enum TXFrameType { TX_SPEECH_GOOD = 0,
+ TX_SID_FIRST,
+ TX_SID_UPDATE,
+ TX_NO_DATA,
+ TX_SPEECH_DEGRADED,
+ TX_SPEECH_BAD,
+ TX_SID_BAD,
+ TX_ONSET,
+ TX_N_FRAMETYPES /* number of frame types */
+ };
+
+
+ /* Channel decoded frame type */
+ enum CHDECFrameType { CHDEC_SID_FIRST = 0,
+ CHDEC_SID_FIRST_INCOMPLETE,
+ CHDEC_SID_UPDATE_INCOMPLETE,
+ CHDEC_SID_UPDATE,
+ CHDEC_SPEECH,
+ CHDEC_SPEECH_ONSET,
+ CHDEC_ESCAPE_MARKER,
+ CHDEC_ESCAPE_DATA,
+ CHDEC_NO_DATA
+ };
+
+ /* Channel decoded frame quality */
+ enum CHDECFrameQuality { CHDEC_GOOD = 0,
+ CHDEC_PROBABLY_DEGRADED,
+ CHDEC_PROBABLY_BAD,
+ CHDEC_BAD
+ };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame_type_3gpp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame_type_3gpp.h
new file mode 100644
index 0000000..f82ec46
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame_type_3gpp.h
@@ -0,0 +1,113 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: frame_type_3gpp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the definition of the 3GPP frame types.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef FRAME_TYPE_3GPP_H
+#define FRAME_TYPE_3GPP_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ enum Frame_Type_3GPP
+ {
+ AMR_475 = 0,
+ AMR_515,
+ AMR_59,
+ AMR_67,
+ AMR_74,
+ AMR_795,
+ AMR_102,
+ AMR_122,
+ AMR_SID,
+ GSM_EFR_SID,
+ TDMA_EFR_SID,
+ PDC_EFR_SID,
+ FOR_FUTURE_USE1,
+ FOR_FUTURE_USE2,
+ FOR_FUTURE_USE3,
+ AMR_NO_DATA
+ };
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _FRAME_TYPE_3GPP_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gc_pred.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gc_pred.h
new file mode 100644
index 0000000..f2c1f55
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gc_pred.h
@@ -0,0 +1,166 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: gc_pred.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ File : gc_pred.h
+ Purpose : codebook gain MA prediction
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef _GC_PRED_H_
+#define _GC_PRED_H_
+#define gc_pred_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; [Define module specific macros here]
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; [Include all pre-processor statements here.]
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; [Declare variables used in this module but defined elsewhere]
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+ typedef struct
+ {
+ Word16 past_qua_en[4]; /* normal MA predictor memory, Q10 */
+ /* (contains 20*log10(qua_err)) */
+ Word16 past_qua_en_MR122[4]; /* MA predictor memory for MR122 mode, Q10 */
+ /* (contains log2(qua_err)) */
+ } gc_predState;
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; [List function prototypes here]
+ ----------------------------------------------------------------------------*/
+
+ OSCL_IMPORT_REF Word16 gc_pred_reset(gc_predState *st);
+ /* reset of codebook gain MA predictor state (i.e. set state memory to zero)
+ returns 0 on success
+ */
+ void gc_pred_exit(gc_predState **st);
+ /* de-initialize codebook gain MA predictor state (i.e. free state struct)
+ stores NULL in *st
+ */
+
+ void
+ gc_pred_copy(
+ gc_predState *st_src, /* i : State struct */
+ gc_predState *st_dest /* o : State struct */
+ );
+
+ /*
+ * FUNCTION: gc_pred()
+ * PURPOSE: MA prediction of the innovation energy
+ * (in dB/(20*log10(2))) with mean removed).
+ */
+ OSCL_IMPORT_REF void gc_pred(
+ gc_predState *st, /* i/o: State struct */
+ enum Mode mode, /* i : AMR mode */
+ Word16 *code, /* i : innovative codebook vector (L_SUBFR) */
+ /* MR122: Q12, other modes: Q13 */
+ Word16 *exp_gcode0, /* o : exponent of predicted gain factor, Q0 */
+ Word16 *frac_gcode0,/* o : fraction of predicted gain factor Q15 */
+ Word16 *exp_en, /* o : exponent of innovation energy, Q0 */
+ /* (only calculated for MR795) */
+ Word16 *frac_en, /* o : fraction of innovation energy, Q15 */
+ /* (only calculated for MR795) */
+ Flag *pOverflow
+ );
+
+ /*
+ * FUNCTION: gc_pred_update()
+ * PURPOSE: update MA predictor with last quantized energy
+ */
+ OSCL_IMPORT_REF void gc_pred_update(
+ gc_predState *st, /* i/o: State struct */
+ Word16 qua_ener_MR122, /* i : quantized energy for update, Q10 */
+ /* (log2(qua_err)) */
+ Word16 qua_ener /* i : quantized energy for update, Q10 */
+ /* (20*log10(qua_err)) */
+ );
+
+ /*
+ * FUNCTION: gc_pred_average_limited()
+ * PURPOSE: get average of MA predictor state values (with a lower limit)
+ * [used in error concealment]
+ */
+ OSCL_IMPORT_REF void gc_pred_average_limited(
+ gc_predState *st, /* i: State struct */
+ Word16 *ener_avg_MR122, /* o: averaged quantized energy, Q10 */
+ /* (log2(qua_err)) */
+ Word16 *ener_avg, /* o: averaged quantized energy, Q10 */
+ /* (20*log10(qua_err)) */
+ Flag *pOverflow
+ );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GC_PRED_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/get_const_tbls.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/get_const_tbls.h
new file mode 100644
index 0000000..cb617b5
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/get_const_tbls.h
@@ -0,0 +1,72 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+#ifndef GET_CONST_TBLS_H
+#define GET_CONST_TBLS_H
+
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+ typedef struct
+ {
+ const Word16* dgray_ptr;
+ const Word16* dico1_lsf_3_ptr;
+ const Word16* dico1_lsf_5_ptr;
+ const Word16* dico2_lsf_3_ptr;
+ const Word16* dico2_lsf_5_ptr;
+ const Word16* dico3_lsf_3_ptr;
+ const Word16* dico3_lsf_5_ptr;
+ const Word16* dico4_lsf_5_ptr;
+ const Word16* dico5_lsf_5_ptr;
+ const Word16* gray_ptr;
+ const Word16* lsp_init_data_ptr;
+ const Word16* mean_lsf_3_ptr;
+ const Word16* mean_lsf_5_ptr;
+ const Word16* mr515_3_lsf_ptr;
+ const Word16* mr795_1_lsf_ptr;
+ const Word16* past_rq_init_ptr;
+ const Word16* pred_fac_3_ptr;
+ const Word16* qua_gain_code_ptr;
+ const Word16* qua_gain_pitch_ptr;
+ const Word16* startPos_ptr;
+ const Word16* table_gain_lowrates_ptr;
+ const Word16* table_gain_highrates_ptr;
+ const Word16* prmno_ptr;
+ const Word16* const* bitno_ptr;
+ const Word16* numOfBits_ptr;
+ const Word16* const* reorderBits_ptr;
+ const Word16* numCompressedBytes_ptr;
+ const Word16* window_200_40_ptr;
+ const Word16* window_160_80_ptr;
+ const Word16* window_232_8_ptr;
+ const Word16* ph_imp_low_MR795_ptr;
+ const Word16* ph_imp_mid_MR795_ptr;
+ const Word16* ph_imp_low_ptr;
+ const Word16* ph_imp_mid_ptr;
+ } CommonAmrTbls;
+
+ OSCL_IMPORT_REF void get_const_tbls(CommonAmrTbls* tbl_struct_ptr);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gmed_n.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gmed_n.h
new file mode 100644
index 0000000..49f4c51
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gmed_n.h
@@ -0,0 +1,80 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
+* R99 Version 3.2.0
+* REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+* File : gmed_n.h
+* Purpose : calculates N-point median.
+*
+********************************************************************************
+*/
+#ifndef gmed_n_h
+#define gmed_n_h "$Id $"
+
+/*
+********************************************************************************
+* INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*
+ ********************************************************************************
+ * DEFINITION OF DATA TYPES
+ ********************************************************************************
+ */
+
+ /*
+ ********************************************************************************
+ * DECLARATION OF PROTOTYPES
+ ********************************************************************************
+ */
+ OSCL_IMPORT_REF Word16 gmed_n( /* o : index of the median value (0...N-1) */
+ Word16 ind[], /* i : Past gain values */
+ Word16 n /* i : The number of gains; this routine */
+ /* is only valid for a odd number of gains */
+ );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gsm_amr_typedefs.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gsm_amr_typedefs.h
new file mode 100644
index 0000000..465e705
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/gsm_amr_typedefs.h
@@ -0,0 +1,147 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: gsm_amr_typedefs.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the definition of the amr codec types.
+
+------------------------------------------------------------------------------
+*/
+#ifndef GSM_AMR_TYPEDEFS_H
+#define GSM_AMR_TYPEDEFS_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "oscl_base.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+#ifndef Word8
+typedef int8 Word8;
+#endif
+
+#ifndef UWord8
+typedef uint8 UWord8;
+#endif
+
+
+/*----------------------------------------------------------------------------
+; Define 16 bit signed and unsigned words
+----------------------------------------------------------------------------*/
+
+#ifndef Word16
+typedef int16 Word16;
+
+#endif
+
+#ifndef UWord16
+typedef uint16 UWord16;
+
+#endif
+
+/*----------------------------------------------------------------------------
+; Define 32 bit signed and unsigned words
+----------------------------------------------------------------------------*/
+
+#ifndef Word32
+typedef int32 Word32;
+#endif
+
+#ifndef UWord32
+typedef uint32 UWord32;
+#endif
+
+
+/*----------------------------------------------------------------------------
+; Define boolean type
+----------------------------------------------------------------------------*/
+#ifndef Bool
+typedef int Bool;
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef OFF
+#define OFF 0
+#endif
+
+#ifndef ON
+#define ON 1
+#endif
+
+#ifndef NO
+#define NO 0
+#endif
+
+#ifndef YES
+#define YES 1
+#endif
+
+#ifndef SUCCESS
+#define SUCCESS 0
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef Flag
+typedef int32 Flag;
+#endif
+
+#endif /* GSM_AMR_TYPEDEFS_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lpc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lpc.h
new file mode 100644
index 0000000..3f241cb
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lpc.h
@@ -0,0 +1,201 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: int_lpc.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsp_avg.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef int_lpc_h
+#define int_lpc_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+ /*
+ **************************************************************************
+ *
+ * Function : Int_lpc_1and3
+ * Purpose : Interpolates the LSPs and converts to LPC parameters
+ * to get a different LP filter in each subframe.
+ * Description : The 20 ms speech frame is divided into 4 subframes.
+ * The LSPs are quantized and transmitted at the 2nd and
+ * 4th subframes (twice per frame) and interpolated at the
+ * 1st and 3rd subframe.
+ *
+ * |------|------|------|------|
+ * sf1 sf2 sf3 sf4
+ * F0 Fm F1
+ *
+ * sf1: 1/2 Fm + 1/2 F0 sf3: 1/2 F1 + 1/2 Fm
+ * sf2: Fm sf4: F1
+ * Returns : void
+ *
+ **************************************************************************
+ */
+ OSCL_IMPORT_REF void Int_lpc_1and3(
+ Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */
+ Word16 lsp_mid[], /* i : LSP vector at the 2nd subfr. of
+ present frame (M) */
+ Word16 lsp_new[], /* i : LSP vector at the 4th subfr. of
+ present frame (M) */
+ Word16 Az[], /* o : interpolated LP parameters in all subfr.
+ (AZ_SIZE) */
+ Flag *pOverflow
+ );
+
+ /*
+ **************************************************************************
+ *
+ * Function : Int_lpc_1and3_2
+ * Purpose : Interpolation of the LPC parameters. Same as the Int_lpc
+ * function but we do not recompute Az() for subframe 2 and
+ * 4 because it is already available.
+ * Returns : void
+ *
+ **************************************************************************
+ */
+ void Int_lpc_1and3_2(
+ Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */
+ Word16 lsp_mid[], /* i : LSP vector at the 2nd subframe of
+ present frame (M) */
+ Word16 lsp_new[], /* i : LSP vector at the 4th subframe of
+ present frame (M) */
+ Word16 Az[], /* o :interpolated LP parameters
+ in subframes 1 and 3 (AZ_SIZE) */
+ Flag *pOverflow
+ );
+
+ /*
+ **************************************************************************
+ *
+ * Function : Int_lpc_1to3
+ * Purpose : Interpolates the LSPs and converts to LPC parameters
+ * to get a different LP filter in each subframe.
+ * Description : The 20 ms speech frame is divided into 4 subframes.
+ * The LSPs are quantized and transmitted at the 4th
+ * subframes (once per frame) and interpolated at the
+ * 1st, 2nd and 3rd subframe.
+ *
+ * |------|------|------|------|
+ * sf1 sf2 sf3 sf4
+ * F0 F1
+ *
+ * sf1: 3/4 F0 + 1/4 F1 sf3: 1/4 F0 + 3/4 F1
+ * sf2: 1/2 F0 + 1/2 F1 sf4: F1
+ * Returns : void
+ *
+ **************************************************************************
+ */
+ OSCL_IMPORT_REF void Int_lpc_1to3(
+ Word16 lsp_old[], /* i : LSP vector at the 4th SF of past frame (M) */
+ Word16 lsp_new[], /* i : LSP vector at the 4th SF of present frame (M) */
+ Word16 Az[], /* o : interpolated LP parameters in all SFs (AZ_SIZE) */
+ Flag *pOverflow
+ );
+
+ /*
+ **************************************************************************
+ *
+ * Function : Int_lpc_1to3_2
+ * Purpose : Interpolation of the LPC parameters. Same as the Int_lpc
+ * function but we do not recompute Az() for subframe 4
+ * because it is already available.
+ * Returns : void
+ *
+ **************************************************************************
+ */
+ void Int_lpc_1to3_2(
+ Word16 lsp_old[], /* i : LSP vector at the 4th SF of past frame (M) */
+ Word16 lsp_new[], /* i : LSP vector at the 4th SF present frame (M) */
+ Word16 Az[], /* o :interpolated LP parameters in SFs 1, 2, 3
+ (AZ_SIZE) */
+ Flag *pOverflow
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INT_LPC_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lsf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lsf.h
new file mode 100644
index 0000000..2ee9e71
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lsf.h
@@ -0,0 +1,105 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: int_lsf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the int_lsf function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef int_lsf_h
+#define int_lsf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ void Int_lsf(
+ Word16 lsf_old[], /* i : LSF vector at the 4th SF of past frame */
+ Word16 lsf_new[], /* i : LSF vector at the 4th SF of present frame */
+ Word16 i_subfr, /* i : Current sf (equal to 0,40,80 or 120) */
+ Word16 lsf_out[], /* o : interpolated LSF parameters for current sf */
+ Flag *pOverflow /* o : flag set if overflow occurs */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INT_LSF_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/inv_sqrt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/inv_sqrt.h
new file mode 100644
index 0000000..937a417
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/inv_sqrt.h
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: inv_sqrt.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the inv_sqrt() function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef INV_SQRT_H
+#define INV_SQRT_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 inv_sqrt_tbl[];
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF Word32 Inv_sqrt( /* (o) : output value */
+ Word32 L_x, /* (i) : input value */
+ Flag *pOverflow /* (i) : pointer to overflow flag */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INV_SQRT_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h
new file mode 100644
index 0000000..8fceb9d
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h
@@ -0,0 +1,152 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_add.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_add function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_ADD_H
+#define L_ADD_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
+
+ __inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
+ {
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+ __asm
+ {
+ QADD result, L_var1, L_var2
+ }
+ return(result);
+ }
+
+#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
+
+ __inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
+ {
+ register Word32 ra = L_var1;
+ register Word32 rb = L_var2;
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("qadd %0, %1, %2"
+ : "=r"(result)
+ : "r"(ra), "r"(rb)
+ );
+ return (result);
+
+ }
+
+#else /* C EQUIVALENT */
+
+
+ static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
+ {
+ Word32 L_sum;
+
+ L_sum = L_var1 + L_var2;
+
+ if ((L_var1 ^ L_var2) >= 0)
+ {
+ if ((L_sum ^ L_var1) < 0)
+ {
+ L_sum = (L_var1 < 0) ? MIN_32 : MAX_32;
+ *pOverflow = 1;
+ }
+ }
+
+ return (L_sum);
+ }
+
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_ADD_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add_c.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add_c.h
new file mode 100644
index 0000000..7af7cdc
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add_c.h
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_add_c.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_add_c function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_ADD_C_H
+#define L_ADD_C_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ Word32 L_add_c(Word32 L_var1, Word32 L_var2, Flag *pOverflow, Flag *pCarry);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_ADD_C_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_comp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_comp.h
new file mode 100644
index 0000000..7738ad2
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_comp.h
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_comp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_comp function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_COMP_H
+#define L_COMP_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ Word32 L_Comp(Word16 hi, Word16 lo, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_extract.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_extract.h
new file mode 100644
index 0000000..2816f83
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_extract.h
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_extract.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_extract function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_EXTRACT_H
+#define L_EXTRACT_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ void L_Extract(Word32 L_var,
+ Word16 *pL_var_hi,
+ Word16 *pL_var_lo,
+ Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_EXTRACT_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h
new file mode 100644
index 0000000..865f043
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h
@@ -0,0 +1,166 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_mac.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_mac function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_MAC_H
+#define L_MAC_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
+
+ __inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ Word32 result;
+ Word32 L_sum;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ __asm {SMULBB result, var1, var2}
+ __asm {QDADD L_sum, L_var3, result}
+ return (L_sum);
+ }
+
+#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
+
+ static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ register Word32 ra = L_var3;
+ register Word32 rb = var1;
+ register Word32 rc = var2;
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(result)
+ : "r"(rb), "r"(rc)
+ );
+
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(rc)
+ : "r"(ra), "r"(result)
+ );
+
+ return (rc);
+ }
+
+#else /* C_EQUIVALENT */
+
+ __inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ Word32 result;
+ Word32 L_sum;
+ result = (Word32) var1 * var2;
+ if (result != (Word32) 0x40000000L)
+ {
+ L_sum = (result << 1) + L_var3;
+
+ /* Check if L_sum and L_var_3 share the same sign */
+ if ((L_var3 ^ result) > 0)
+ {
+ if ((L_sum ^ L_var3) < 0)
+ {
+ L_sum = (L_var3 < 0) ? MIN_32 : MAX_32;
+ *pOverflow = 1;
+ }
+ }
+ }
+ else
+ {
+ *pOverflow = 1;
+ L_sum = MAX_32;
+ }
+ return (L_sum);
+ }
+
+#endif
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_MAC_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h
new file mode 100644
index 0000000..b1a51ba
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h
@@ -0,0 +1,155 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_msu.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_msu function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_MSU_H
+#define L_MSU_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+#include "l_mult.h"
+#include "l_sub.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
+
+ __inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ Word32 product;
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ __asm
+ {
+ SMULBB product, var1, var2
+ QDSUB result, L_var3, product
+ }
+
+ return (result);
+ }
+
+#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
+
+ __inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ register Word32 ra = L_var3;
+ register Word32 rb = var1;
+ register Word32 rc = var2;
+ Word32 product;
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(product)
+ : "r"(rb), "r"(rc)
+ );
+
+ asm volatile("qdsub %0, %1, %2"
+ : "=r"(result)
+ : "r"(ra), "r"(product)
+ );
+
+ return (result);
+ }
+
+#else /* C EQUIVALENT */
+
+ static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ Word32 result;
+
+ result = L_mult(var1, var2, pOverflow);
+ result = L_sub(L_var3, result, pOverflow);
+
+ return (result);
+ }
+
+#endif
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_MSU_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h
new file mode 100644
index 0000000..2aaea47
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h
@@ -0,0 +1,162 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_mult.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_mult function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_MULT_H
+#define L_MULT_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
+
+ __inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ Word32 result;
+ Word32 product;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ __asm
+ {
+ SMULBB product, var1, var2
+ QADD result, product, product
+ }
+
+ return (result);
+ }
+
+#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
+
+ __inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ register Word32 ra = var1;
+ register Word32 rb = var2;
+ Word32 result;
+ Word32 product;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(product)
+ : "r"(ra), "r"(rb)
+ );
+
+ asm volatile("qadd %0, %1, %2"
+ : "=r"(result)
+ : "r"(product), "r"(product)
+ );
+
+ return(result);
+ }
+
+#else /* C EQUIVALENT */
+
+ static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ register Word32 L_product;
+
+ L_product = (Word32) var1 * var2;
+
+ if (L_product != (Word32) 0x40000000L)
+ {
+ L_product <<= 1; /* Multiply by 2 */
+ }
+ else
+ {
+ *pOverflow = 1;
+ L_product = MAX_32;
+ }
+
+ return (L_product);
+ }
+#endif
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_MULT_H */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_negate.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_negate.h
new file mode 100644
index 0000000..e406bb8
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_negate.h
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_negate.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_negate function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_NEGATE_H
+#define L_NEGATE_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ Word32 L_negate(Word32 L_var1);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shl.h
new file mode 100644
index 0000000..5430bc7
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shl.h
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_shl.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_shl function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_SHL_H
+#define L_SHL_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ Word32 L_shl(Word32 L_var1, Word16 var2, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_SHL_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr.h
new file mode 100644
index 0000000..424c948
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr.h
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: l_shr.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_shr function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_SHR_H
+#define L_SHR_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ Word32 L_shr(Word32 L_var1, Word16 var2, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_SHR_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr_r.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr_r.h
new file mode 100644
index 0000000..29d99da
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_shr_r.h
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_shr_r.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_shr_r function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_SHR_R_H
+#define L_SHR_R_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF Word32 L_shr_r(Word32 L_var1, Word16 var2, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_SHR_R_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h
new file mode 100644
index 0000000..a9b0732
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h
@@ -0,0 +1,157 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: l_sub.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the L_sub function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef L_SUB_H
+#define L_SUB_H
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
+
+ __inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
+ {
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ __asm
+ {
+ QSUB result, L_var1, L_var2
+ }
+
+ return(result);
+
+ }
+
+#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
+
+ __inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
+ {
+ register Word32 ra = L_var1;
+ register Word32 rb = L_var2;
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("qsub %0, %1, %2"
+ : "=r"(result)
+ : "r"(ra), "r"(rb)
+ );
+
+ return (result);
+ }
+
+#else /* C EQUIVALENT */
+
+ static inline Word32 L_sub(register Word32 L_var1, register Word32 L_var2,
+ register Flag *pOverflow)
+ {
+ Word32 L_diff;
+
+ L_diff = L_var1 - L_var2;
+
+ if ((L_var1 ^ L_var2) < 0)
+ {
+ if ((L_diff ^ L_var1) & MIN_32)
+ {
+ L_diff = (L_var1 < 0L) ? MIN_32 : MAX_32;
+ *pOverflow = 1;
+ }
+ }
+
+ return (L_diff);
+ }
+
+#endif
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _L_SUB_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2.h
new file mode 100644
index 0000000..ce27dba
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2.h
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: log2.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the function prototype definition for Log2 function.
+
+------------------------------------------------------------------------------
+*/
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef LOG2_H
+#define LOG2_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+#include "log2_norm.h" /* Used by legacy files */
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF void Log2(
+ Word32 L_x, /* (i) : input value */
+ Word16 *pExponent, /* (o) : Integer part of Log2. (range: 0<=val<=30)*/
+ Word16 *pFraction, /* (o) : Fractional part of Log2. (range: 0<=val<1) */
+ Flag *pOverflow /* (i/o) : overflow flag */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LOG2_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2_norm.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2_norm.h
new file mode 100644
index 0000000..3b06244
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/log2_norm.h
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: log2_norm.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the prototype declaration for Log2_norm function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef LOG2_NORM_H
+#define LOG2_NORM_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 log2_tbl[];
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ void Log2_norm(
+ Word32 L_x, /* (i) : input value (normalized) */
+ Word16 exp, /* (i) : norm_l (L_x) */
+ Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */
+ Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1) */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LOG2_NORM_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsfwt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsfwt.h
new file mode 100644
index 0000000..cca36d4
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsfwt.h
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lsfwt.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsfwt.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef lsfwt_h
+#define lsfwt_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ void Lsf_wt(
+ Word16 *lsf, /* input : LSF vector */
+ Word16 *wf, /* output: square of weighting factors */
+ Flag * pOverflow); /* o : Flag set when overflow occurs */
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LSF_WT_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp.h
new file mode 100644
index 0000000..99b6151
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp.h
@@ -0,0 +1,173 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lsp.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsp.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef lsp_h
+#define lsp_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "q_plsf.h"
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+ typedef struct
+ {
+
+ /* Past LSPs */
+ Word16 lsp_old[M];
+ Word16 lsp_old_q[M];
+
+ /* Quantization state */
+ Q_plsfState *qSt;
+
+ } lspState;
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ /*
+ **************************************************************************
+ *
+ * Function : lsp_init
+ * Purpose : Allocates memory and initializes state variables
+ * Description : Stores pointer to filter status struct in *st. This
+ * pointer has to be passed to lsp in each call.
+ * Returns : 0 on success
+ *
+ **************************************************************************
+ */
+ OSCL_IMPORT_REF Word16 lsp_init(lspState **st);
+
+ /*
+ **************************************************************************
+ *
+ * Function : lsp_reset
+ * Purpose : Resets state memory
+ * Returns : 0 on success
+ *
+ **************************************************************************
+ */
+ OSCL_IMPORT_REF Word16 lsp_reset(lspState *st);
+
+ /*
+ **************************************************************************
+ *
+ * Function : lsp_exit
+ * Purpose : The memory used for state memory is freed
+ * Description : Stores NULL in *st
+ *
+ **************************************************************************
+ */
+ OSCL_IMPORT_REF void lsp_exit(lspState **st);
+
+ /*
+ **************************************************************************
+ *
+ * Function : lsp
+ * Purpose : Conversion from LP coefficients to LSPs.
+ * Quantization of LSPs.
+ * Description : Generates 2 sets of LSPs from 2 sets of
+ * LP coefficients for mode 12.2. For the other
+ * modes 1 set of LSPs is generated from 1 set of
+ * LP coefficients. These LSPs are quantized with
+ * Matrix/Vector quantization (depending on the mode)
+ * and interpolated for the subframes not yet having
+ * their own LSPs.
+ *
+ **************************************************************************
+ */
+ OSCL_IMPORT_REF void lsp(lspState *st, /* i/o : State struct */
+ enum Mode req_mode, /* i : requested coder mode */
+ enum Mode used_mode,/* i : used coder mode */
+ Word16 az[], /* i/o : interpolated LP parameters Q12 */
+ Word16 azQ[], /* o : quantization interpol. LP parameters Q12*/
+ Word16 lsp_new[], /* o : new lsp vector */
+ Word16 **anap, /* o : analysis parameters */
+ Flag *pOverflow /* o : Flag set when overflow occurs */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LSP_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_az.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_az.h
new file mode 100644
index 0000000..fb3d248
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_az.h
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lsp_az.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsp_az function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef LSP_AZ_H
+#define LSP_AZ_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF void Lsp_Az(
+ Word16 lsp[], /* (i) : line spectral frequencies */
+ Word16 a[], /* (o) : predictor coefficients (order = 10) */
+ Flag *pOverflow /* (o) : overflow flag */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LSP_AZ_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_lsf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_lsf.h
new file mode 100644
index 0000000..ac7fca0
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_lsf.h
@@ -0,0 +1,111 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: lsp_lsf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the lsp_lsf.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef lsp_lsf_h
+#define lsp_lsf_h
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+ OSCL_IMPORT_REF void Lsf_lsp(
+ Word16 lsf[], /* (i) : lsf[m] normalized (range: 0.0<=val<=0.5) */
+ Word16 lsp[], /* (o) : lsp[m] (range: -1<=val<1) */
+ Word16 m, /* (i) : LPC order */
+ Flag *pOverflow /* (o) : Flag set when overflow occurs */
+ );
+ OSCL_IMPORT_REF void Lsp_lsf(
+ Word16 lsp[], /* (i) : lsp[m] (range: -1<=val<1) */
+ Word16 lsf[], /* (o) : lsf[m] normalized (range: 0.0<=val<=0.5) */
+ Word16 m, /* (i) : LPC order */
+ Flag *pOverflow /* (o) : Flag set when overflow occurs */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LSP_LSF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_tab.h
new file mode 100644
index 0000000..db3cd52
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/lsp_tab.h
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: lsp_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a table lsp_init_data.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef LSP_TAB_H
+#define LSP_TAB_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 lsp_init_data[];
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mac_32.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mac_32.h
new file mode 100644
index 0000000..b79a84f
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mac_32.h
@@ -0,0 +1,136 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mac_32.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the Mac_32 and Mac_32_16 functions
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef MAC_32_H
+#define MAC_32_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+ static inline Word32 Mac_32(Word32 L_var3,
+ Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 L_var2_hi,
+ Word16 L_var2_lo,
+ Flag *pOverflow)
+ {
+ Word16 product;
+
+ L_var3 = L_mac(L_var3, L_var1_hi, L_var2_hi, pOverflow);
+
+ product = mult(L_var1_hi, L_var2_lo, pOverflow);
+ L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+ product = mult(L_var1_lo, L_var2_hi, pOverflow);
+ L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+ return (L_var3);
+ }
+
+ static inline Word32 Mac_32_16(Word32 L_var3,
+ Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 var2,
+ Flag *pOverflow)
+ {
+ Word16 product;
+
+ L_var3 = L_mac(L_var3, L_var1_hi, var2, pOverflow);
+
+ product = mult(L_var1_lo, var2, pOverflow);
+ L_var3 = L_mac(L_var3, product, 1, pOverflow);
+
+ return (L_var3);
+ }
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MAC_32_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mode.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mode.h
new file mode 100644
index 0000000..75f86cb
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mode.h
@@ -0,0 +1,82 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
+* R99 Version 3.2.0
+* REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+* File : mode.h
+* Purpose : Declaration of mode type
+*
+********************************************************************************
+*/
+#ifndef mode_h
+#define mode_h "$Id $"
+
+/*
+********************************************************************************
+* INCLUDE FILES
+********************************************************************************
+*/
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*
+ ********************************************************************************
+ * DEFINITION OF DATA TYPES
+ ********************************************************************************
+ */
+ enum Mode { MR475 = 0,
+ MR515,
+ MR59,
+ MR67,
+ MR74,
+ MR795,
+ MR102,
+ MR122,
+
+ MRDTX,
+
+ N_MODES /* number of (SPC) modes */
+
+ };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h
new file mode 100644
index 0000000..f2cb7cf
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h
@@ -0,0 +1,258 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mpy_32.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the Mpy_32 function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef MPY_32_H
+#define MPY_32_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
+
+ __inline Word32 Mpy_32(Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 L_var2_hi,
+ Word16 L_var2_lo,
+ Flag *pOverflow)
+
+ {
+ /*----------------------------------------------------------------------------
+ ; Define all local variables
+ ----------------------------------------------------------------------------*/
+ Word32 L_product;
+ Word32 L_sum;
+ Word32 product32;
+
+ OSCL_UNUSED_ARG(pOverflow);
+ /*----------------------------------------------------------------------------
+ ; Function body here
+ ----------------------------------------------------------------------------*/
+ /* L_product = L_mult (L_var1_hi, L_var2_hi, pOverflow);*/
+
+ __asm {SMULBB L_product, L_var1_hi, L_var2_hi}
+ __asm {QDADD L_product, 0, L_product}
+ __asm {SMULBB product32, L_var1_hi, L_var2_lo}
+ product32 >>= 15;
+ __asm {QDADD L_sum, L_product, product32}
+ L_product = L_sum;
+ __asm {SMULBB product32, L_var1_lo, L_var2_hi}
+ product32 >>= 15;
+ __asm {QDADD L_sum, L_product, product32}
+ return (L_sum);
+ }
+
+#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
+
+ static inline Word32 Mpy_32(Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 L_var2_hi,
+ Word16 L_var2_lo,
+ Flag *pOverflow)
+ {
+ register Word32 product32;
+ register Word32 L_sum;
+ register Word32 L_product, result;
+ register Word32 ra = L_var1_hi;
+ register Word32 rb = L_var1_lo;
+ register Word32 rc = L_var2_hi;
+ register Word32 rd = L_var2_lo;
+
+
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(L_product)
+ : "r"(ra), "r"(rc)
+ );
+ asm volatile("mov %0, #0"
+ : "=r"(result)
+ );
+
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(L_sum)
+ : "r"(result), "r"(L_product)
+ );
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(product32)
+ : "r"(ra), "r"(rd)
+ );
+
+ asm volatile("mov %0, %1, ASR #15"
+ : "=r"(ra)
+ : "r"(product32)
+ );
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(L_product)
+ : "r"(L_sum), "r"(ra)
+ );
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(product32)
+ : "r"(rb), "r"(rc)
+ );
+
+ asm volatile("mov %0, %1, ASR #15"
+ : "=r"(rb)
+ : "r"(product32)
+ );
+
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(L_sum)
+ : "r"(L_product), "r"(rb)
+ );
+
+ return (L_sum);
+ }
+
+#else /* C_EQUIVALENT */
+
+ __inline Word32 Mpy_32(Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 L_var2_hi,
+ Word16 L_var2_lo,
+ Flag *pOverflow)
+ {
+ Word32 L_product;
+ Word32 L_sum;
+ Word32 product32;
+
+ OSCL_UNUSED_ARG(pOverflow);
+ L_product = (Word32) L_var1_hi * L_var2_hi;
+
+ if (L_product != (Word32) 0x40000000L)
+ {
+ L_product <<= 1;
+ }
+ else
+ {
+ L_product = MAX_32;
+ }
+
+ /* result = mult (L_var1_hi, L_var2_lo, pOverflow); */
+ product32 = ((Word32) L_var1_hi * L_var2_lo) >> 15;
+
+ /* L_product = L_mac (L_product, result, 1, pOverflow); */
+ L_sum = L_product + (product32 << 1);
+
+ if ((L_product ^ product32) > 0)
+ {
+ if ((L_sum ^ L_product) < 0)
+ {
+ L_sum = (L_product < 0) ? MIN_32 : MAX_32;
+ }
+ }
+
+ L_product = L_sum;
+
+ /* result = mult (L_var1_lo, L_var2_hi, pOverflow); */
+ product32 = ((Word32) L_var1_lo * L_var2_hi) >> 15;
+
+ /* L_product = L_mac (L_product, result, 1, pOverflow); */
+ L_sum = L_product + (product32 << 1);
+
+ if ((L_product ^ product32) > 0)
+ {
+ if ((L_sum ^ L_product) < 0)
+ {
+ L_sum = (L_product < 0) ? MIN_32 : MAX_32;
+ }
+ }
+
+ /*----------------------------------------------------------------------------
+ ; Return nothing or data or data pointer
+ ----------------------------------------------------------------------------*/
+ return (L_sum);
+ }
+
+#endif
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MPY_32_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h
new file mode 100644
index 0000000..33ade51
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h
@@ -0,0 +1,206 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mpy_32_16.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the Mpy_32_16 function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef MPY_32_16_H
+#define MPY_32_16_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
+
+ __inline Word32 Mpy_32_16(Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 var2,
+ Flag *pOverflow)
+ {
+
+ Word32 L_product;
+ Word32 L_sum;
+ Word32 result;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ __asm {SMULBB L_product, L_var1_hi, var2}
+ __asm {QDADD L_product, 0, L_product}
+ __asm {SMULBB result, L_var1_lo, var2}
+ result >>= 15;
+ __asm {QDADD L_sum, L_product, result}
+ return (L_sum);
+ }
+
+#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
+
+ static inline Word32 Mpy_32_16(Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 var2,
+ Flag *pOverflow)
+ {
+
+ register Word32 ra = L_var1_hi;
+ register Word32 rb = L_var1_lo;
+ register Word32 rc = var2;
+ Word32 result, L_product;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(L_product)
+ : "r"(ra), "r"(rc)
+ );
+ asm volatile("mov %0, #0"
+ : "=r"(result)
+ );
+
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(L_product)
+ : "r"(result), "r"(L_product)
+ );
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(result)
+ : "r"(rb), "r"(rc)
+ );
+
+ asm volatile("mov %0, %1, ASR #15"
+ : "=r"(ra)
+ : "r"(result)
+ );
+ asm volatile("qdadd %0, %1, %2"
+ : "=r"(result)
+ : "r"(L_product), "r"(ra)
+ );
+
+ return (result);
+ }
+
+#else /* C_EQUIVALENT */
+ static inline Word32 Mpy_32_16(Word16 L_var1_hi,
+ Word16 L_var1_lo,
+ Word16 var2,
+ Flag *pOverflow)
+ {
+
+ Word32 L_product;
+ Word32 L_sum;
+ Word32 result;
+ L_product = (Word32) L_var1_hi * var2;
+
+ if (L_product != (Word32) 0x40000000L)
+ {
+ L_product <<= 1;
+ }
+ else
+ {
+ *pOverflow = 1;
+ L_product = MAX_32;
+ }
+
+ result = ((Word32)L_var1_lo * var2) >> 15;
+
+ L_sum = L_product + (result << 1);
+
+ if ((L_product ^ result) > 0)
+ {
+ if ((L_sum ^ L_product) < 0)
+ {
+ L_sum = (L_product < 0) ? MIN_32 : MAX_32;
+ *pOverflow = 1;
+ }
+ }
+ return (L_sum);
+
+ }
+
+#endif
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MPY_32_16_H_ */
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h
new file mode 100644
index 0000000..eac2004
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h
@@ -0,0 +1,171 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mult.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the mult function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef MULT_H
+#define MULT_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#if defined(PV_ARM_V5)
+
+ __inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ Word32 product;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ __asm
+ {
+ SMULBB product, var1, var2
+ MOV product, product, ASR #15
+ CMP product, 0x7FFF
+ MOVGE product, 0x7FFF
+ }
+
+ return ((Word16) product);
+ }
+
+#elif defined(PV_ARM_GCC_V5)
+
+ __inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ register Word32 ra = var1;
+ register Word32 rb = var2;
+ Word32 product;
+ Word32 temp = 0x7FFF;
+
+ OSCL_UNUSED_ARG(pOverflow);
+
+ asm volatile("smulbb %0, %1, %2"
+ : "=r"(product)
+ : "r"(ra), "r"(rb)
+ );
+ asm volatile("mov %0, %1, ASR #15"
+ : "=r"(product)
+ : "r"(product)
+ );
+ asm volatile("cmp %0, %1"
+ : "=r"(product)
+ : "r"(temp)
+ );
+ asm volatile("movge %0, %1"
+ : "=r"(product)
+ : "r"(temp)
+ );
+
+ return ((Word16) product);
+ }
+
+#else /* C EQUIVALENT */
+
+ static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
+ {
+ register Word32 product;
+
+ product = ((Word32) var1 * var2) >> 15;
+
+ /* Saturate result (if necessary). */
+ /* var1 * var2 >0x00007fff is the only case */
+ /* that saturation occurs. */
+
+ if (product > 0x00007fffL)
+ {
+ *pOverflow = 1;
+ product = (Word32) MAX_16;
+ }
+
+
+ /* Return the product as a 16 bit value by type casting Word32 to Word16 */
+
+ return ((Word16) product);
+ }
+
+#endif
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MULT_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult_r.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult_r.h
new file mode 100644
index 0000000..90f7e83
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult_r.h
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: mult_r.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the mult_r function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef MULT_R__H
+#define MULT_R__H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _MULT_R_H_ */
+
+
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/n_proc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/n_proc.h
new file mode 100644
index 0000000..e5738c1
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/n_proc.h
@@ -0,0 +1,31 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/* $Id $ */
+
+void proc_head(char *mes);
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h
new file mode 100644
index 0000000..2b77f77
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/*****************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+**************************************************************************/
+/*
+ Filename: negate.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the negate function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef NEGATE_H
+#define NEGATE_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ Word16 negate(register Word16 var1);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h
new file mode 100644
index 0000000..faea591
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h
@@ -0,0 +1,138 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: norm_l.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the norm_l function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef NORM_L_H
+#define NORM_L_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) )
+
+ /* C EQUIVALENT */
+ OSCL_IMPORT_REF Word16 norm_l(Word32 L_var1);
+
+#elif defined(PV_ARM_V5)
+
+ __inline Word16 norm_l(Word32 L_var1)
+ {
+ register Word32 var_out = 0;
+
+ __asm
+ {
+ CMP L_var1, #0
+ EORNE L_var1, L_var1, L_var1, LSL #1
+ CLZNE var_out, L_var1
+ }
+
+ return ((Word16)var_out);
+ }
+
+#elif defined(PV_ARM_GCC_V5)
+
+ static inline Word16 norm_l(Word32 L_var1)
+ {
+ register Word32 var_out = 0;
+ register Word32 ra = L_var1;
+ if (L_var1)
+ {
+ ra ^= (ra << 1);
+ asm volatile(
+ "clz %0, %1"
+ : "=r"(var_out)
+ : "r"(ra)
+ );
+ }
+ return (var_out);
+ }
+
+#endif
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h
new file mode 100644
index 0000000..955903a
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h
@@ -0,0 +1,140 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: norm_s.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the norm_s function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef NORM_S_H
+#define NORM_S_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+#if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) )
+
+ /* C EQUIVALENT */
+
+ OSCL_IMPORT_REF Word16 norm_s(Word16 var1);
+
+#elif defined(PV_ARM_V5)
+
+ __inline Word16 norm_s(Word16 var)
+ {
+ register Word32 var_out = 0;
+ Word32 var1 = var << 16;
+
+ __asm
+ {
+ CMP var1, #0
+ EORNE var1, var1, var1, LSL #1
+ CLZNE var_out, var1
+ }
+
+ return ((Word16)var_out);
+ }
+
+#elif defined(PV_ARM_GCC_V5)
+
+ static inline Word16 norm_s(Word16 var1)
+ {
+ register Word32 var_out = 0;
+ register Word32 ra = var1 << 16;
+ if (ra)
+ {
+ ra ^= (ra << 1);
+ asm volatile(
+ "clz %0, %1"
+ : "=r"(var_out)
+ : "r"(ra)
+ );
+ }
+ return (var_out);
+ }
+
+#endif
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/oper_32b.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/oper_32b.h
new file mode 100644
index 0000000..c2ef975
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/oper_32b.h
@@ -0,0 +1,92 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: oper_32b.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file includes all the oper_32b.c functions' header files.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef OPER_32B_H
+#define OPER_32B_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+#include "l_comp.h"
+#include "l_extract.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; ENUMERATED TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; STRUCTURES TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; GLOBAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; END
+----------------------------------------------------------------------------*/
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/p_ol_wgh.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/p_ol_wgh.h
new file mode 100644
index 0000000..f07ea36
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/p_ol_wgh.h
@@ -0,0 +1,134 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: p_ol_wgh.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ File : p_ol_wgh.h
+ Purpose : Compute the open loop pitch lag with weighting.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef P_OL_WGH_H
+#define P_OL_WGH_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "mode.h"
+#include "vad.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; [Define module specific macros here]
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; [Include all pre-processor statements here.]
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; [Declare variables used in this module but defined elsewhere]
+ ----------------------------------------------------------------------------*/
+ extern const Word16 corrweight[];
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+ /* state variable */
+
+ typedef struct
+ {
+ Word16 old_T0_med;
+ Word16 ada_w;
+ Word16 wght_flg;
+ } pitchOLWghtState;
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; [List function prototypes here]
+ ----------------------------------------------------------------------------*/
+ Word16 p_ol_wgh_init(pitchOLWghtState **st);
+ /* initialize one instance of the pre processing state.
+ Stores pointer to filter status struct in *st. This pointer has to
+ be passed to p_ol_wgh in each call.
+ returns 0 on success
+ */
+
+ Word16 p_ol_wgh_reset(pitchOLWghtState *st);
+ /* reset of pre processing state (i.e. set state memory to zero)
+ returns 0 on success
+ */
+
+ void p_ol_wgh_exit(pitchOLWghtState **st);
+ /* de-initialize pre processing state (i.e. free status struct)
+ stores NULL in *st
+ */
+
+ Word16 Pitch_ol_wgh( /* o : open loop pitch lag */
+ pitchOLWghtState *st, /* i/o : State struct */
+ vadState *vadSt, /* i/o : VAD state struct */
+ Word16 signal[], /* i : signal used to compute the open loop pitch */
+ /* signal[-pit_max] to signal[-1] should be known */
+ Word16 pit_min, /* i : minimum pitch lag */
+ Word16 pit_max, /* i : maximum pitch lag */
+ Word16 L_frame, /* i : length of frame to compute pitch */
+ Word16 old_lags[], /* i : history with old stored Cl lags */
+ Word16 ol_gain_flg[], /* i : OL gain flag */
+ Word16 idx, /* i : index */
+ Flag dtx, /* i : dtx flag; use dtx=1, do not use dtx=0 */
+ Flag *pOverflow /* o : overflow flag */
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _P_OL_WGH_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pow2.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pow2.h
new file mode 100644
index 0000000..ba83477
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pow2.h
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: pow2.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains the prototype declaration for Pow2() function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef POW2_H
+#define POW2_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 pow2_tbl[];
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+ OSCL_IMPORT_REF Word32 Pow2(
+ /* (o) : result (range: 0<=val<=0x7fffffff) */
+ Word16 exponent, /* (i) : Integer part. (range: 0<=val<=30) */
+ Word16 fraction, /* (i) : Fractional part. (range: 0.0<=val<1.0) */
+ Flag *pOverflow /* (i/o) : overflow flag */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _POW2_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pred_lt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pred_lt.h
new file mode 100644
index 0000000..28a0dd8
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pred_lt.h
@@ -0,0 +1,105 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: pred_lt.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the pred_lt function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef pred_lt_h
+#define pred_lt_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF void Pred_lt_3or6(
+ Word16 exc[], /* in/out: excitation buffer */
+ Word16 T0, /* input : integer pitch lag */
+ Word16 frac, /* input : fraction of lag */
+ Word16 L_subfr, /* input : subframe size */
+ Word16 flag3, /* input : if set, upsampling rate = 3 (6 otherwise) */
+ Flag *pOverflow /* output: if set, overflow occurred in this function */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PRED_LT_H */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pvgsmamr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pvgsmamr.h
new file mode 100644
index 0000000..b697524
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/pvgsmamr.h
@@ -0,0 +1,63 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+#ifndef __PVGSMAMR_H
+#define __PVGSMAMR_H
+
+
+// includes
+#include <e32std.h>
+#include <e32base.h>
+
+#include "sp_dec.h"
+#include "pvglobals.h"
+
+
+// PVGsmDecoder AO
+class CPVGsmDecoder : public CBase
+{
+ public:
+ IMPORT_C static CPVGsmDecoder* NewL(void);
+ IMPORT_C ~CPVGsmDecoder();
+ IMPORT_C TInt StartL(void);
+
+ // only port the API's used in PVPlayer 2.0
+ IMPORT_C TInt DecodeFrame(enum Mode mode, unsigned char* compressedBlock, unsigned char* audioBuffer);
+ IMPORT_C TInt InitDecoder(void);
+ IMPORT_C void ExitDecoder(void);
+
+ private:
+ CPVGsmDecoder();
+ void ConstructL(void);
+
+ Speech_Decode_FrameState* decState;
+ enum RXFrameType rx_type;
+ struct globalDataStruct *gds;
+};
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf.h
new file mode 100644
index 0000000..9298d09
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf.h
@@ -0,0 +1,156 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: q_plsf.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the q_plsf_3.c and q_plsf_5.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef q_plsf_h
+#define q_plsf_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+#define MR795_1_SIZE 512
+#define PAST_RQ_INIT_SIZE 8
+
+#define DICO1_SIZE 256
+#define DICO2_SIZE 512
+#define DICO3_SIZE 512
+
+#define DICO1_5_SIZE 128
+#define DICO2_5_SIZE 256
+#define DICO3_5_SIZE 256
+#define DICO4_5_SIZE 256
+#define DICO5_5_SIZE 64
+
+#define MR515_3_SIZE 128
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+ typedef struct
+ {
+ Word16 past_rq[M]; /* Past quantized prediction error, Q15 */
+
+ } Q_plsfState;
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+ Word16 Q_plsf_init(Q_plsfState **st);
+ /* initialize one instance of the state.
+ Stores pointer to filter status struct in *st. This pointer has to
+ be passed to Q_plsf_5 / Q_plsf_3 in each call.
+ returns 0 on success
+ */
+
+ Word16 Q_plsf_reset(Q_plsfState *st);
+ /* reset of state (i.e. set state memory to zero)
+ returns 0 on success
+ */
+
+ void Q_plsf_exit(Q_plsfState **st);
+ /* de-initialize state (i.e. free status struct)
+ stores NULL in *st
+ */
+
+ OSCL_IMPORT_REF void Q_plsf_3(
+ Q_plsfState *st, /* i/o: state struct */
+ enum Mode mode, /* i : coder mode */
+ Word16 *lsp1, /* i : 1st LSP vector Q15 */
+ Word16 *lsp1_q, /* o : quantized 1st LSP vector Q15 */
+ Word16 *indice, /* o : quantization indices of 3 vectors Q0 */
+ Word16 *pred_init_i,/* o : init index for MA prediction in DTX mode */
+ Flag *pOverflow /* o : Flag set when overflow occurs */
+ );
+
+ OSCL_IMPORT_REF void Q_plsf_5(
+ Q_plsfState *st,
+ Word16 *lsp1, /* i : 1st LSP vector, Q15 */
+ Word16 *lsp2, /* i : 2nd LSP vector, Q15 */
+ Word16 *lsp1_q, /* o : quantized 1st LSP vector, Q15 */
+ Word16 *lsp2_q, /* o : quantized 2nd LSP vector, Q15 */
+ Word16 *indice, /* o : quantization indices of 5 matrices, Q0 */
+ Flag *pOverflow /* o : Flag set when overflow occurs */
+ );
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Q_PLSF_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_3_tbl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_3_tbl.h
new file mode 100644
index 0000000..8bf7047
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_3_tbl.h
@@ -0,0 +1,123 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: q_plsf_3_tbl.h
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; [Define module specific macros here]
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; [Include all pre-processor statements here. Include conditional
+ ; compile variables also.]
+ ----------------------------------------------------------------------------*/
+#define MR795_1_SIZE 512
+#define PAST_RQ_INIT_SIZE 8
+
+#define DICO1_SIZE 256
+#define DICO2_SIZE 512
+#define DICO3_SIZE 512
+
+#define MR515_3_SIZE 128
+
+ /*----------------------------------------------------------------------------
+ ; LOCAL FUNCTION DEFINITIONS
+ ; [List function prototypes here]
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; LOCAL VARIABLE DEFINITIONS
+ ; [Variable declaration - defined here and used outside this module]
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /* Codebooks of LSF prediction residual */
+ extern const Word16 mean_lsf_3[];
+
+ extern const Word16 pred_fac_3[];
+
+ extern const Word16 dico1_lsf_3[];
+ extern const Word16 dico2_lsf_3[];
+ extern const Word16 dico3_lsf_3[];
+
+ extern const Word16 mr515_3_lsf[];
+ extern const Word16 mr795_1_lsf[];
+
+ extern const Word16 past_rq_init[];
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_5_tbl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_5_tbl.h
new file mode 100644
index 0000000..e495c4a
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/q_plsf_5_tbl.h
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: q_plsf_5_tbl.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares tables defined in q_plsf_5_tbl.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef Q_PLSF_5_TBL_H
+#define Q_PLSF_5_TBL_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 mean_lsf_5[];
+ extern const Word16 dico1_lsf_5[];
+ extern const Word16 dico2_lsf_5[];
+ extern const Word16 dico3_lsf_5[];
+ extern const Word16 dico4_lsf_5[];
+ extern const Word16 dico5_lsf_5[];
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qgain475_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qgain475_tab.h
new file mode 100644
index 0000000..cfa5dee
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qgain475_tab.h
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: qgain475_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares tables defined in qgain475_tab.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef QGAIN475_TAB_H
+#define QGAIN475_TAB_H
+
+#define MR475_VQ_SIZE 256
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 table_gain_MR475[];
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain.h
new file mode 100644
index 0000000..951a2c4
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain.h
@@ -0,0 +1,126 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: qua_gain.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the file, qua_gain.c
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef qua_gain_h
+#define qua_gain_h "$Id $"
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "gc_pred.h"
+#include "mode.h"
+#include "get_const_tbls.h"
+
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+#define VQ_SIZE_HIGHRATES 128
+#define VQ_SIZE_LOWRATES 64
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+ Word16
+ Qua_gain( /* o : index of quantization. */
+ enum Mode mode, /* i : AMR mode */
+ Word16 exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
+ Word16 frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
+ Word16 frac_coeff[], /* i : energy coeff. (5), fraction part, Q15 */
+ Word16 exp_coeff[], /* i : energy coeff. (5), exponent part, Q0 */
+ /* (frac_coeff and exp_coeff computed in */
+ /* calc_filt_energies()) */
+ Word16 gp_limit, /* i : pitch gain limit */
+ Word16 *gain_pit, /* o : Pitch gain, Q14 */
+ Word16 *gain_cod, /* o : Code gain, Q1 */
+ Word16 *qua_ener_MR122, /* o : quantized energy error, Q10 */
+ /* (for MR122 MA predictor update) */
+ Word16 *qua_ener, /* o : quantized energy error, Q10 */
+ /* (for other MA predictor update) */
+ CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs */
+ Flag *pOverflow /* o : overflow indicator */
+ );
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* qua_gain_h */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain_tbl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain_tbl.h
new file mode 100644
index 0000000..b3d2c01
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/qua_gain_tbl.h
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: qua_gain_tbl.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares tables defined in qua_gain_tbl.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef QUA_GAIN_TBL_H
+#define QUA_GAIN_TBL_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 table_gain_highrates[];
+ extern const Word16 table_gain_lowrates[];
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reorder.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reorder.h
new file mode 100644
index 0000000..231bc9a
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reorder.h
@@ -0,0 +1,101 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: reorder.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the Reorder_lsf() function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef REORDER_H
+#define REORDER_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF void Reorder_lsf(
+ Word16 *lsf, /* (i/o) : vector of LSFs (range: 0<=val<=0.5) */
+ Word16 min_dist, /* (i) : minimum required distance */
+ Word16 n, /* (i) : LPC order */
+ Flag *pOverflow /* (i/o) : overflow Flag */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _REORDER_H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/residu.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/residu.h
new file mode 100644
index 0000000..2c6d430
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/residu.h
@@ -0,0 +1,83 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
+* R99 Version 3.2.0
+* REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+* File : residu.h
+* Purpose : Computes the LP residual.
+* Description : The LP residual is computed by filtering the input
+* : speech through the LP inverse filter A(z).
+*
+*
+********************************************************************************
+*/
+#ifndef residu_h
+#define residu_h "$Id $"
+
+/*
+********************************************************************************
+* INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*
+ ********************************************************************************
+ * DEFINITION OF DATA TYPES
+ ********************************************************************************
+ */
+
+ /*
+ ********************************************************************************
+ * DECLARATION OF PROTOTYPES
+ ********************************************************************************
+ */
+ OSCL_IMPORT_REF void Residu(
+ Word16 a[], /* (i) : prediction coefficients */
+ Word16 x[], /* (i) : speech signal */
+ Word16 y[], /* (o) : residual signal */
+ Word16 lg /* (i) : size of filtering */
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reverse_bits.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reverse_bits.h
new file mode 100644
index 0000000..5933e15
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/reverse_bits.h
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: reverse_bits.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the reverse_bits function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef REVERSE_BITS_H
+#define REVERSE_BITS_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "mode.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ void reverse_bits(enum Mode mode, unsigned char *pCompressedBlock);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/round.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/round.h
new file mode 100644
index 0000000..f4f8072
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/round.h
@@ -0,0 +1,98 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: round.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the pv_round function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef ROUND_H
+#define ROUND_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF Word16 pv_round(Word32 L_var1, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROUND_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/set_zero.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/set_zero.h
new file mode 100644
index 0000000..debd223
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/set_zero.h
@@ -0,0 +1,79 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
+* R99 Version 3.2.0
+* REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+* File : set_zero.h
+* Description : Set vector x[] to zero
+*
+*
+********************************************************************************
+*/
+#ifndef set_zero_h
+#define set_zero_h "$Id $"
+
+/*
+********************************************************************************
+* INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*
+ ********************************************************************************
+ * DEFINITION OF DATA TYPES
+ ********************************************************************************
+ */
+
+ /*
+ ********************************************************************************
+ * DECLARATION OF PROTOTYPES
+ ********************************************************************************
+ */
+ void Set_zero(
+ Word16 x[], /* (o) : vector to clear */
+ Word16 L /* (i) : length of vector */
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shl.h
new file mode 100644
index 0000000..ca09201
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shl.h
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: shl.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the shl function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef SHL_H
+#define SHL_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ Word16 shl(Word16 var1, Word16 var2, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SHL_H_ */
+
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr.h
new file mode 100644
index 0000000..b3149a0
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr.h
@@ -0,0 +1,99 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: shr.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the shr function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef SHR_H
+#define SHR_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF Word16 shr(Word16 var1, Word16 var2, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SHR_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr_r.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr_r.h
new file mode 100644
index 0000000..30ccf29
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/shr_r.h
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: shr_r.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the shr_r function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef SHR_R_H
+#define SHR_R_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF Word16 shr_r(Word16 var1, Word16 var2, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sqrt_l.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sqrt_l.h
new file mode 100644
index 0000000..368e9f9
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sqrt_l.h
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: sqrt_l.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the sqrt_l() function.
+
+------------------------------------------------------------------------------
+*/
+
+#ifndef SQRT_L_H
+#define SQRT_L_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 sqrt_l_tbl[];
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+ OSCL_IMPORT_REF Word32 sqrt_l_exp( /* o : output value, Q31 */
+ Word32 L_x, /* i : input value, Q31 */
+ Word16 *pExp, /* o : right shift to be applied to result, Q1 */
+ Flag *pOverflow /* i : pointer to overflow flag */
+ );
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SQRT_L__H_ */
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sub.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sub.h
new file mode 100644
index 0000000..b28d686
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/sub.h
@@ -0,0 +1,99 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: sub.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the sub function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef SUB_H
+#define SUB_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "basicop_malloc.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+ OSCL_IMPORT_REF Word16 sub(Word16 var1, Word16 var2, Flag *pOverflow);
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SUB_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/syn_filt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/syn_filt.h
new file mode 100644
index 0000000..4d8cd13
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/syn_filt.h
@@ -0,0 +1,83 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
+* R99 Version 3.2.0
+* REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+* File : syn_filt.h
+* Purpose : Perform synthesis filtering through 1/A(z).
+*
+*
+********************************************************************************
+*/
+#ifndef syn_filt_h
+#define syn_filt_h "$Id $"
+
+/*
+********************************************************************************
+* INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*
+ ********************************************************************************
+ * DEFINITION OF DATA TYPES
+ ********************************************************************************
+ */
+
+ /*
+ ********************************************************************************
+ * DECLARATION OF PROTOTYPES
+ ********************************************************************************
+ */
+ OSCL_IMPORT_REF void Syn_filt(
+ Word16 a[], /* (i) : a[m+1] prediction coefficients (m=10) */
+ Word16 x[], /* (i) : input signal */
+ Word16 y[], /* (o) : output signal */
+ Word16 lg, /* (i) : size of filtering */
+ Word16 mem[], /* (i/o): memory associated with this filtering. */
+ Word16 update /* (i) : 0=no update, 1=update of memory. */
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h
new file mode 100644
index 0000000..ee4d732
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h
@@ -0,0 +1,73 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
+* R99 Version 3.2.0
+* REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+* File : typedef.c
+* Purpose : Basic types.
+*
+********************************************************************************
+*/
+#ifndef typedef_h
+#define typedef_h "$Id $"
+
+#undef ORIGINAL_TYPEDEF_H /* CHANGE THIS TO #define to get the */
+/* "original" ETSI version of typedef.h */
+/* CHANGE TO #undef for PV version */
+
+#ifdef ORIGINAL_TYPEDEF_H
+/*
+ * this is the original code from the ETSI file typedef.h
+ */
+
+#if defined(__unix__) || defined(__unix)
+typedef signed char Word8;
+typedef short Word16;
+typedef int Word32;
+typedef int Flag;
+
+#else
+#error No System recognized
+#endif
+#else /* not original typedef.h */
+
+/*
+ * use (improved) type definition file typdefs.h
+ */
+#include "gsm_amr_typedefs.h"
+
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad.h
new file mode 100644
index 0000000..b9ee89f
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad.h
@@ -0,0 +1,76 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+**-------------------------------------------------------------------------**
+** **
+** GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 **
+** R99 Version 3.2.0 **
+** REL-4 Version 4.0.0 **
+** **
+**-------------------------------------------------------------------------**
+********************************************************************************
+*
+* File : vad.h
+* Purpose : Voice Activity Detection (VAD) for AMR
+*
+********************************************************************************
+*/
+#ifndef vad_h
+#define vad_h "$Id $"
+
+/*
+********************************************************************************
+* INCLUDE FILES
+********************************************************************************
+*/
+
+#include "vad1.h" /* for VAD option 1 */
+#include "vad2.h" /* for VAD option 2 */
+
+/*
+********************************************************************************
+* LOCAL VARIABLES AND TABLES
+********************************************************************************
+*/
+
+/*
+********************************************************************************
+* DEFINITION OF DATA TYPES
+********************************************************************************
+*/
+
+#ifndef VAD2
+#define vadState vadState1
+#else
+#define vadState vadState2
+#endif
+
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/weight_a.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/weight_a.h
new file mode 100644
index 0000000..cede607
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/weight_a.h
@@ -0,0 +1,81 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+********************************************************************************
+*
+* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
+* R99 Version 3.2.0
+* REL-4 Version 4.0.0
+*
+********************************************************************************
+*
+* File : weight_a.h
+* Purpose : Spectral expansion of LP coefficients. (order==10)
+* Description : a_exp[i] = a[i] * fac[i-1] ,i=1,10
+*
+*
+********************************************************************************
+*/
+#ifndef weight_a_h
+#define weight_a_h "$Id $"
+
+/*
+********************************************************************************
+* INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*
+ ********************************************************************************
+ * DEFINITION OF DATA TYPES
+ ********************************************************************************
+ */
+
+ /*
+ ********************************************************************************
+ * DECLARATION OF PROTOTYPES
+ ********************************************************************************
+ */
+ OSCL_IMPORT_REF void Weight_Ai(
+ Word16 a[], /* (i) : a[m+1] LPC coefficients (m=10) */
+ const Word16 fac[],/* (i) : Spectral expansion factors. */
+ Word16 a_exp[] /* (o) : Spectral expanded LPC coefficients */
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/window_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/window_tab.h
new file mode 100644
index 0000000..5928c54
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/window_tab.h
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: window_tab.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file declares a tables in window_tab.c used in lpc.c.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef WINDOW_TAB_H
+#define WINDOW_TAB_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+ extern const Word16 window_200_40[];
+ extern const Word16 window_160_80[];
+ extern const Word16 window_232_8[];
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/wmf_to_ets.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/wmf_to_ets.h
new file mode 100644
index 0000000..c005f52
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/wmf_to_ets.h
@@ -0,0 +1,108 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+ 3GPP TS 26.073
+ ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+ Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: wmf_to_ets.h
+
+------------------------------------------------------------------------------
+ INCLUDE DESCRIPTION
+
+ This file contains all the constant definitions and prototype definitions
+ needed by the wmf_to_ets function.
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef WMF_TO_ETS_H
+#define WMF_TO_ETS_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include "frame_type_3gpp.h"
+#include "typedef.h"
+#include "get_const_tbls.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*----------------------------------------------------------------------------
+ ; MACROS
+ ; Define module specific macros here
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; DEFINES
+ ; Include all pre-processor statements here.
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; EXTERNAL VARIABLES REFERENCES
+ ; Declare variables used in this module but defined elsewhere
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; SIMPLE TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; ENUMERATED TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------------------
+ ; STRUCTURES TYPEDEF'S
+ ----------------------------------------------------------------------------*/
+
+
+ /*----------------------------------------------------------------------------
+ ; GLOBAL FUNCTION DEFINITIONS
+ ; Function Prototype declaration
+ ----------------------------------------------------------------------------*/
+
+ void wmf_to_ets(enum Frame_Type_3GPP frame_type_3gpp,
+ UWord8 *wmf_input_ptr,
+ Word16 *ets_output_ptr,
+ CommonAmrTbls* common_amr_tbls);
+
+
+
+ /*----------------------------------------------------------------------------
+ ; END
+ ----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif